Robustify the source zip creation

- Use $$(dir) in place of $(dir), as $(call)/$(eval) eats one of the
  dollars. Previously, ./tmp was used as the temp dir
- rm -rf before and after, in case cruft is left after a build error

Bug: 151360309
Test: inspect build against with `ninja -t commands`
Change-Id: Iec891df8d5bd52ef180c46099c1107e71e4cac83
This commit is contained in:
Anton Hansson
2023-10-09 15:22:49 +00:00
parent a2d41d454c
commit a781d69680

View File

@@ -80,9 +80,10 @@ bcp_srcjar := $(call intermediates-dir-for,ETC,platform-bootclasspath.srcjar)/pl
source_props := $(HOST_OUT)/development/sdk/source_source.properties
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)): $(3) $$(bcp_srcjar) $$(source_props)
@echo "Building SDK sources package"
unzip -qd $(dir $$@)/tmp $$(bcp_srcjar)
$$(SOONG_ZIP) -o $$@ -P src -e source.properties -f $$(source_props) -C $(dir $$@)/tmp -D $(dir $$@)/tmp
rm -r $(dir $$@)/tmp
rm -rf $$(dir $$@)/tmp
unzip -qd $$(dir $$@)/tmp $$(bcp_srcjar)
$$(SOONG_ZIP) -o $$@ -P src -e source.properties -f $$(source_props) -C $$(dir $$@)/tmp -D $$(dir $$@)/tmp
rm -rf $$(dir $$@)/tmp
$(call dist-for-goals-with-filenametag, sdk_repo, $(call sdk-repo-pkg-zip,$(2),$(3),$(4)))
$(1) += $(4) $(2) \
$(call sdk-repo-pkg-zip,$(2),$(3),$(4)):$(notdir $(call sdk-repo-pkg-zip,$(2),$(3),$(4)))