Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cad39b3e authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add metadata to module info about whether the module came from soong or...

Merge "Add metadata to module info about whether the module came from soong or make" into main am: 0a223d47

Original change: https://android-review.googlesource.com/c/platform/build/+/3417229



Change-Id: I2a60e108fd43a4b228d1937575f15623b92bc1d2
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a8cd4cc9 0a223d47
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ $(MODULE_INFO_JSON): $(SOONG_MODULE_INFO)
			$(call write-optional-json-list, "host_dependencies", $(sort $(ALL_MODULES.$(m).HOST_REQUIRED_FROM_TARGET))) \
			$(call write-optional-json-list, "target_dependencies", $(sort $(ALL_MODULES.$(m).TARGET_REQUIRED_FROM_HOST))) \
			$(call write-optional-json-bool, "test_module_config_base", $(ALL_MODULES.$(m).TEST_MODULE_CONFIG_BASE)) \
			$(call write-optional-json-bool, "make", $(if $(ALL_MODULES.$(m).IS_SOONG_MODULE),,true)) \
			$(call write-optional-json-bool, "make_generated_module_info", true) \
		'}')'\n}\n' >> $@.tmp
	$(PRIVATE_MERGE_JSON_OBJECTS) -o $@ $(PRIVATE_SOONG_MODULE_INFO) $@.tmp
	rm $@.tmp
+53 −0
Original line number Diff line number Diff line
#!/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()