1980dd0eb8
This makes it easier to cross-compile KWin since it is no longer necessary to have all the KWin dependencies on the host machine. This could be partially addressed by moving the strip-effects-metadata.cpp into a separate folder than can be built as a top-level project, thereby reducing the dependencies to just QtCore. However, it still means we have to build a native binary. Since all this script is doing is removing some JSON keys, we could also use a python script and avoid the need to compile a build-time helper program.
28 lines
1.1 KiB
Python
Executable file
28 lines
1.1 KiB
Python
Executable file
#!/usr/bin/env python3
|
|
# SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
# SPDX-FileCopyrightText: 2022 Alex Richardson <arichardson.kde@gmail.com>
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
#
|
|
# This little helper strips unnecessary information from builtin effect metadata files to
|
|
# reduce the size of kwin executables and json parsing runtime overhead.
|
|
|
|
import argparse
|
|
import json
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(prog="kwin-strip-effect-metadata")
|
|
parser.add_argument("--source", help="input file", required=True)
|
|
parser.add_argument("--output", help="output file", required=True)
|
|
args = parser.parse_args()
|
|
stripped_json = dict(KPlugin=dict())
|
|
with open(args.source, "r") as src:
|
|
original_json = json.load(src)
|
|
stripped_json["KPlugin"]["Id"] = original_json["KPlugin"]["Id"]
|
|
stripped_json["KPlugin"]["EnabledByDefault"] = original_json["KPlugin"]["EnabledByDefault"]
|
|
|
|
with open(args.output, "w") as dst:
|
|
json.dump(stripped_json, dst)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|