Joe Onorato | 48bd6f5 | 2016-04-06 14:48:30 -0700 | [diff] [blame] | 1 | # Print a list of the modules that could be built |
yangbill | fa5026c | 2022-02-08 16:59:21 +0800 | [diff] [blame] | 2 | # Currently runtime_dependencies only include the runtime libs information for cc binaries. |
Joe Onorato | 48bd6f5 | 2016-04-06 14:48:30 -0700 | [diff] [blame] | 3 | |
| 4 | MODULE_INFO_JSON := $(PRODUCT_OUT)/module-info.json |
LaMont Jones | edc62e8 | 2023-06-02 21:56:24 +0000 | [diff] [blame] | 5 | COMMA := , |
LaMont Jones | edc62e8 | 2023-06-02 21:56:24 +0000 | [diff] [blame] | 6 | _NEWLINE := '\n' |
Joe Onorato | 48bd6f5 | 2016-04-06 14:48:30 -0700 | [diff] [blame] | 7 | |
Colin Cross | 4ea5e85 | 2023-11-07 11:17:41 -0800 | [diff] [blame] | 8 | define write-optional-json-list |
| 9 | $(if $(strip $(2)),'$(COMMA)$(strip $(1)): [$(KATI_foreach_sep w,$(COMMA) ,$(2),"$(w)")]') |
| 10 | endef |
| 11 | |
| 12 | define write-optional-json-bool |
| 13 | $(if $(strip $(2)),'$(COMMA)$(strip $(1)): "$(strip $(2))"') |
| 14 | endef |
| 15 | |
Colin Cross | 3b89c65 | 2023-11-06 13:54:39 -0800 | [diff] [blame] | 16 | SOONG_MODULE_INFO := $(SOONG_OUT_DIR)/module-info-$(TARGET_PRODUCT).json |
| 17 | |
| 18 | $(MODULE_INFO_JSON): PRIVATE_SOONG_MODULE_INFO := $(SOONG_MODULE_INFO) |
| 19 | $(MODULE_INFO_JSON): PRIVATE_MERGE_JSON_OBJECTS := $(HOST_OUT_EXECUTABLES)/merge_module_info_json |
| 20 | $(MODULE_INFO_JSON): $(HOST_OUT_EXECUTABLES)/merge_module_info_json |
| 21 | $(MODULE_INFO_JSON): $(SOONG_MODULE_INFO) |
Joe Onorato | 48bd6f5 | 2016-04-06 14:48:30 -0700 | [diff] [blame] | 22 | @echo Generating $@ |
Colin Cross | 3b89c65 | 2023-11-06 13:54:39 -0800 | [diff] [blame] | 23 | $(hide) echo -ne '{\n ' > $@.tmp |
| 24 | $(hide) echo -ne $(KATI_foreach_sep m,$(COMMA)$(_NEWLINE), $(sort $(ALL_MAKE_MODULE_INFO_JSON_MODULES)),\ |
LaMont Jones | 3a9ce1d | 2023-06-06 20:39:05 +0000 | [diff] [blame] | 25 | '"$(m)": {' \ |
Colin Cross | 4ea5e85 | 2023-11-07 11:17:41 -0800 | [diff] [blame] | 26 | '"module_name": "$(ALL_MODULES.$(m).MODULE_NAME)"' \ |
| 27 | $(call write-optional-json-list, "class", $(sort $(ALL_MODULES.$(m).CLASS))) \ |
| 28 | $(call write-optional-json-list, "path", $(sort $(ALL_MODULES.$(m).PATH))) \ |
| 29 | $(call write-optional-json-list, "tags", $(sort $(ALL_MODULES.$(m).TAGS))) \ |
| 30 | $(call write-optional-json-list, "installed", $(sort $(ALL_MODULES.$(m).INSTALLED))) \ |
| 31 | $(call write-optional-json-list, "compatibility_suites", $(sort $(ALL_MODULES.$(m).COMPATIBILITY_SUITES))) \ |
| 32 | $(call write-optional-json-list, "auto_test_config", $(sort $(ALL_MODULES.$(m).auto_test_config))) \ |
| 33 | $(call write-optional-json-list, "test_config", $(strip $(ALL_MODULES.$(m).TEST_CONFIG) $(ALL_MODULES.$(m).EXTRA_TEST_CONFIGS))) \ |
| 34 | $(call write-optional-json-list, "dependencies", $(sort $(ALL_MODULES.$(m).ALL_DEPS))) \ |
Hugo Drumond Jacob | faf9b01 | 2024-05-20 18:32:50 +0200 | [diff] [blame^] | 35 | $(call write-optional-json-list, "required", $(sort $(ALL_MODULES.$(m).REQUIRED_FROM_TARGET))) \ |
Colin Cross | 4ea5e85 | 2023-11-07 11:17:41 -0800 | [diff] [blame] | 36 | $(call write-optional-json-list, "shared_libs", $(sort $(ALL_MODULES.$(m).SHARED_LIBS))) \ |
| 37 | $(call write-optional-json-list, "static_libs", $(sort $(ALL_MODULES.$(m).STATIC_LIBS))) \ |
| 38 | $(call write-optional-json-list, "system_shared_libs", $(sort $(ALL_MODULES.$(m).SYSTEM_SHARED_LIBS))) \ |
| 39 | $(call write-optional-json-list, "srcs", $(sort $(ALL_MODULES.$(m).SRCS))) \ |
| 40 | $(call write-optional-json-list, "srcjars", $(sort $(ALL_MODULES.$(m).SRCJARS))) \ |
| 41 | $(call write-optional-json-list, "classes_jar", $(sort $(ALL_MODULES.$(m).CLASSES_JAR))) \ |
| 42 | $(call write-optional-json-list, "test_mainline_modules", $(sort $(ALL_MODULES.$(m).TEST_MAINLINE_MODULES))) \ |
yike | 9ec7a00 | 2024-04-04 23:30:38 +0000 | [diff] [blame] | 43 | $(call write-optional-json-bool, "is_unit_test", $(ALL_MODULES.$(m).IS_UNIT_TEST)) \ |
Colin Cross | 4ea5e85 | 2023-11-07 11:17:41 -0800 | [diff] [blame] | 44 | $(call write-optional-json-list, "test_options_tags", $(sort $(ALL_MODULES.$(m).TEST_OPTIONS_TAGS))) \ |
| 45 | $(call write-optional-json-list, "data", $(sort $(ALL_MODULES.$(m).TEST_DATA))) \ |
| 46 | $(call write-optional-json-list, "runtime_dependencies", $(sort $(ALL_MODULES.$(m).LOCAL_RUNTIME_LIBRARIES))) \ |
| 47 | $(call write-optional-json-list, "static_dependencies", $(sort $(ALL_MODULES.$(m).LOCAL_STATIC_LIBRARIES))) \ |
| 48 | $(call write-optional-json-list, "data_dependencies", $(sort $(ALL_MODULES.$(m).TEST_DATA_BINS))) \ |
| 49 | $(call write-optional-json-list, "supported_variants", $(sort $(ALL_MODULES.$(m).SUPPORTED_VARIANTS))) \ |
| 50 | $(call write-optional-json-list, "host_dependencies", $(sort $(ALL_MODULES.$(m).HOST_REQUIRED_FROM_TARGET))) \ |
| 51 | $(call write-optional-json-list, "target_dependencies", $(sort $(ALL_MODULES.$(m).TARGET_REQUIRED_FROM_HOST))) \ |
Colin Cross | 3b89c65 | 2023-11-06 13:54:39 -0800 | [diff] [blame] | 52 | '}')'\n}\n' >> $@.tmp |
| 53 | $(PRIVATE_MERGE_JSON_OBJECTS) -o $@ $(PRIVATE_SOONG_MODULE_INFO) $@.tmp |
| 54 | rm $@.tmp |
Joe Onorato | 48bd6f5 | 2016-04-06 14:48:30 -0700 | [diff] [blame] | 55 | |
| 56 | |
Bill Peckham | 16da01f | 2021-06-15 19:35:06 -0700 | [diff] [blame] | 57 | droidcore-unbundled: $(MODULE_INFO_JSON) |
Joe Onorato | 48bd6f5 | 2016-04-06 14:48:30 -0700 | [diff] [blame] | 58 | |
Simran Basi | 03f5253 | 2018-09-06 12:23:11 -0700 | [diff] [blame] | 59 | $(call dist-for-goals, general-tests, $(MODULE_INFO_JSON)) |
Bill Peckham | 16da01f | 2021-06-15 19:35:06 -0700 | [diff] [blame] | 60 | $(call dist-for-goals, droidcore-unbundled, $(MODULE_INFO_JSON)) |
Cole Faust | 5d825b7 | 2022-10-26 18:16:44 -0700 | [diff] [blame] | 61 | |
| 62 | # On every build, generate an all_modules.txt file to be used for autocompleting |
| 63 | # the m command. After timing this using $(shell date +"%s.%3N"), it only adds |
| 64 | # 0.01 seconds to the internal master build, and will only rerun on builds that |
| 65 | # rerun kati. |
| 66 | $(file >$(PRODUCT_OUT)/all_modules.txt,$(subst $(space),$(newline),$(ALL_MODULES))) |