blob: eb5c63c7155fae27e876128f58579d8809d2a418 [file] [log] [blame]
Joe Onorato48bd6f52016-04-06 14:48:30 -07001# Print a list of the modules that could be built
yangbillfa5026c2022-02-08 16:59:21 +08002# Currently runtime_dependencies only include the runtime libs information for cc binaries.
Joe Onorato48bd6f52016-04-06 14:48:30 -07003
4MODULE_INFO_JSON := $(PRODUCT_OUT)/module-info.json
LaMont Jonesedc62e82023-06-02 21:56:24 +00005COMMA := ,
LaMont Jonesedc62e82023-06-02 21:56:24 +00006_NEWLINE := '\n'
Joe Onorato48bd6f52016-04-06 14:48:30 -07007
Colin Cross4ea5e852023-11-07 11:17:41 -08008define write-optional-json-list
9$(if $(strip $(2)),'$(COMMA)$(strip $(1)): [$(KATI_foreach_sep w,$(COMMA) ,$(2),"$(w)")]')
10endef
11
12define write-optional-json-bool
13$(if $(strip $(2)),'$(COMMA)$(strip $(1)): "$(strip $(2))"')
14endef
15
Joe Onorato48bd6f52016-04-06 14:48:30 -070016$(MODULE_INFO_JSON):
17 @echo Generating $@
18 $(hide) echo -ne '{\n ' > $@
LaMont Jones3a9ce1d2023-06-06 20:39:05 +000019 $(hide) echo -ne $(KATI_foreach_sep m,$(COMMA)$(_NEWLINE), $(sort $(ALL_MODULES)),\
20 '"$(m)": {' \
Colin Cross4ea5e852023-11-07 11:17:41 -080021 '"module_name": "$(ALL_MODULES.$(m).MODULE_NAME)"' \
22 $(call write-optional-json-list, "class", $(sort $(ALL_MODULES.$(m).CLASS))) \
23 $(call write-optional-json-list, "path", $(sort $(ALL_MODULES.$(m).PATH))) \
24 $(call write-optional-json-list, "tags", $(sort $(ALL_MODULES.$(m).TAGS))) \
25 $(call write-optional-json-list, "installed", $(sort $(ALL_MODULES.$(m).INSTALLED))) \
26 $(call write-optional-json-list, "compatibility_suites", $(sort $(ALL_MODULES.$(m).COMPATIBILITY_SUITES))) \
27 $(call write-optional-json-list, "auto_test_config", $(sort $(ALL_MODULES.$(m).auto_test_config))) \
28 $(call write-optional-json-list, "test_config", $(strip $(ALL_MODULES.$(m).TEST_CONFIG) $(ALL_MODULES.$(m).EXTRA_TEST_CONFIGS))) \
29 $(call write-optional-json-list, "dependencies", $(sort $(ALL_MODULES.$(m).ALL_DEPS))) \
30 $(call write-optional-json-list, "shared_libs", $(sort $(ALL_MODULES.$(m).SHARED_LIBS))) \
31 $(call write-optional-json-list, "static_libs", $(sort $(ALL_MODULES.$(m).STATIC_LIBS))) \
32 $(call write-optional-json-list, "system_shared_libs", $(sort $(ALL_MODULES.$(m).SYSTEM_SHARED_LIBS))) \
33 $(call write-optional-json-list, "srcs", $(sort $(ALL_MODULES.$(m).SRCS))) \
34 $(call write-optional-json-list, "srcjars", $(sort $(ALL_MODULES.$(m).SRCJARS))) \
35 $(call write-optional-json-list, "classes_jar", $(sort $(ALL_MODULES.$(m).CLASSES_JAR))) \
36 $(call write-optional-json-list, "test_mainline_modules", $(sort $(ALL_MODULES.$(m).TEST_MAINLINE_MODULES))) \
37 $(call write-optional-json-bool, $(ALL_MODULES.$(m).IS_UNIT_TEST)) \
38 $(call write-optional-json-list, "test_options_tags", $(sort $(ALL_MODULES.$(m).TEST_OPTIONS_TAGS))) \
39 $(call write-optional-json-list, "data", $(sort $(ALL_MODULES.$(m).TEST_DATA))) \
40 $(call write-optional-json-list, "runtime_dependencies", $(sort $(ALL_MODULES.$(m).LOCAL_RUNTIME_LIBRARIES))) \
41 $(call write-optional-json-list, "static_dependencies", $(sort $(ALL_MODULES.$(m).LOCAL_STATIC_LIBRARIES))) \
42 $(call write-optional-json-list, "data_dependencies", $(sort $(ALL_MODULES.$(m).TEST_DATA_BINS))) \
43 $(call write-optional-json-list, "supported_variants", $(sort $(ALL_MODULES.$(m).SUPPORTED_VARIANTS))) \
44 $(call write-optional-json-list, "host_dependencies", $(sort $(ALL_MODULES.$(m).HOST_REQUIRED_FROM_TARGET))) \
45 $(call write-optional-json-list, "target_dependencies", $(sort $(ALL_MODULES.$(m).TARGET_REQUIRED_FROM_HOST))) \
46 '}')'\n}\n' >> $@
Joe Onorato48bd6f52016-04-06 14:48:30 -070047
48
Bill Peckham16da01f2021-06-15 19:35:06 -070049droidcore-unbundled: $(MODULE_INFO_JSON)
Joe Onorato48bd6f52016-04-06 14:48:30 -070050
Simran Basi03f52532018-09-06 12:23:11 -070051$(call dist-for-goals, general-tests, $(MODULE_INFO_JSON))
Bill Peckham16da01f2021-06-15 19:35:06 -070052$(call dist-for-goals, droidcore-unbundled, $(MODULE_INFO_JSON))
Cole Faust5d825b72022-10-26 18:16:44 -070053
54# On every build, generate an all_modules.txt file to be used for autocompleting
55# the m command. After timing this using $(shell date +"%s.%3N"), it only adds
56# 0.01 seconds to the internal master build, and will only rerun on builds that
57# rerun kati.
58$(file >$(PRODUCT_OUT)/all_modules.txt,$(subst $(space),$(newline),$(ALL_MODULES)))