diff options
author | Colin Cross | 2018-11-16 23:26:33 -0600 |
---|---|---|
committer | Colin Cross | 2018-12-17 15:46:17 -0600 |
commit | 6db5b0ea9aae3fffc4b90ed1cd40e50ee8b06765 (patch) | |
tree | c214ed33ce40fc0e838e7d71ea476a4978192db8 /common | |
parent | ab847928157cddb7e469b15f5a8310f535173805 (diff) | |
download | platform-build-6db5b0ea9aae3fffc4b90ed1cd40e50ee8b06765.tar.gz platform-build-6db5b0ea9aae3fffc4b90ed1cd40e50ee8b06765.tar.xz platform-build-6db5b0ea9aae3fffc4b90ed1cd40e50ee8b06765.zip |
Move dexpreopting to Soong
Move the dexpreopting logic into Soong. Make modules will be
dexpreopted by executing the Soong logic in the standalone
dexpreopt_gen binary, which will generate scripts that will
perform dexpreopting for each module. Export global configuration
as JSON to $OUT/dexpreopt.config, which will be used by
dexpreopt_gen and Soong, and per-module JSON configuration that
will be used by dexpreopt_gen.
This relands I59b20c931ee3e5a8d35eb30da4148691c5095502,
I39d580999947ee54cfefe875b57a028be5333bd7,
Ie7daa94e107d53eff075ca58dbe721bd9d7fc8c2 and
Ica006a007d112c232311435aaac0c0e476232b67, with a minor
update to match the changes made to dexpreopt_gen arguments
and a fix to correctly keep dexpreopt disabled on mac builds.
Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
only expected changes to dexpreopt outputs on system_other
(.vdex files for privileged Soong modules no longer incorrectly
contain .dex contents).
Change-Id: I25163e91886cea6941afa25cdb529ed053278dcb
Diffstat (limited to 'common')
-rw-r--r-- | common/json.mk | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/common/json.mk b/common/json.mk new file mode 100644 index 000000000..ba8ffa73e --- /dev/null +++ b/common/json.mk | |||
@@ -0,0 +1,35 @@ | |||
1 | 4space :=$= $(space)$(space)$(space)$(space) | ||
2 | invert_bool =$= $(if $(strip $(1)),,true) | ||
3 | |||
4 | # Converts a list to a JSON list. | ||
5 | # $1: List separator. | ||
6 | # $2: List. | ||
7 | _json_list =$= [$(if $(2),"$(subst $(1),"$(comma)",$(2))")] | ||
8 | |||
9 | # Converts a space-separated list to a JSON list. | ||
10 | json_list =$= $(call _json_list,$(space),$(1)) | ||
11 | |||
12 | # Converts a comma-separated list to a JSON list. | ||
13 | csv_to_json_list =$= $(call _json_list,$(comma),$(1)) | ||
14 | |||
15 | # Adds or removes 4 spaces from _json_indent | ||
16 | json_increase_indent =$= $(eval _json_indent := $$(_json_indent)$$(4space)) | ||
17 | json_decrease_indent =$= $(eval _json_indent := $$(subst _,$$(space),$$(patsubst %____,%,$$(subst $$(space),_,$$(_json_indent))))) | ||
18 | |||
19 | # 1: Key name | ||
20 | # 2: Value | ||
21 | add_json_val =$= $(eval _json_contents := $$(_json_contents)$$(_json_indent)"$$(strip $$(1))": $$(strip $$(2))$$(comma)$$(newline)) | ||
22 | add_json_str =$= $(call add_json_val,$(1),"$(strip $(2))") | ||
23 | add_json_list =$= $(call add_json_val,$(1),$(call json_list,$(patsubst %,%,$(2)))) | ||
24 | add_json_csv =$= $(call add_json_val,$(1),$(call csv_to_json_list,$(strip $(2)))) | ||
25 | add_json_bool =$= $(call add_json_val,$(1),$(if $(strip $(2)),true,false)) | ||
26 | add_json_map =$= $(eval _json_contents := $$(_json_contents)$$(_json_indent)"$$(strip $$(1))": {$$(newline))$(json_increase_indent) | ||
27 | end_json_map =$= $(json_decrease_indent)$(eval _json_contents := $$(_json_contents)$$(if $$(filter %$$(comma),$$(lastword $$(_json_contents))),__SV_END)$$(_json_indent)},$$(newline)) | ||
28 | |||
29 | # Clears _json_contents to start a new json file | ||
30 | json_start =$= $(eval _json_contents := {$$(newline))$(eval _json_indent := $$(4space)) | ||
31 | |||
32 | # Adds the trailing close brace to _json_contents, and removes any trailing commas if necessary | ||
33 | json_end =$= $(eval _json_contents := $$(subst $$(comma)$$(newline)__SV_END,$$(newline),$$(_json_contents)__SV_END}$$(newline))) | ||
34 | |||
35 | json_contents =$= $(_json_contents) | ||