diff options
author | 2024-12-16 14:44:16 -0800 | |
---|---|---|
committer | 2025-01-06 15:22:15 -0800 | |
commit | 11590358b5f570d231c78e739a1b059ed6bbe572 (patch) | |
tree | 744010d9b4959fedd72dfddd10cc1c602c064d88 /tools/missing_soong_module_info.py | |
parent | 928fa2298030d47ea30c29586e7bba913c9eb23d (diff) |
Add metadata to module info about whether the module came from soong or make
And a tool to print out the soong modules with their module info still
coming from make, because we need to eliminate those.
Test: build/make/tools/missing_soong_module_info.py
Bug: 384569435
Change-Id: I093148451a0353fb82da9503b6c0c722ebc06336
Diffstat (limited to 'tools/missing_soong_module_info.py')
-rwxr-xr-x | tools/missing_soong_module_info.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tools/missing_soong_module_info.py b/tools/missing_soong_module_info.py new file mode 100755 index 0000000000..6fa7f2bccb --- /dev/null +++ b/tools/missing_soong_module_info.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the 'License'); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an 'AS IS' BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +import os +import sys + +def main(): + try: + product_out = os.environ["ANDROID_PRODUCT_OUT"] + except KeyError: + sys.stderr.write("Can't get ANDROID_PRODUCT_OUT. Run lunch first.\n") + sys.exit(1) + + filename = os.path.join(product_out, "module-info.json") + try: + with open(filename) as f: + modules = json.load(f) + except FileNotFoundError: + sys.stderr.write(f"File not found: {filename}\n") + sys.exit(1) + except json.JSONDecodeError: + sys.stderr.write(f"Invalid json: {filename}\n") + return None + + classes = {} + + for name, info in modules.items(): + make = info.get("make") + make_gen = info.get("make_generated_module_info") + if not make and make_gen: + classes.setdefault(frozenset(info.get("class")), []).append(name) + + for cl, names in classes.items(): + print(" ".join(cl)) + for name in names: + print(" ", name) + +if __name__ == "__main__": + main() |