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

Commit 04fbe296 authored by Bob Badour's avatar Bob Badour
Browse files

Append built and installed when copying metadata.

Soong doesn't always have the built and installed available.

Bug: 239638693

Test: m droid dist

Change-Id: Id18201da488e3b16d60957c9a298a52345595c5b
parent 193de78d
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -2976,6 +2976,19 @@ $(2): $(1)
	$$(copy-file-to-target)
endef

# Define a rule to copy a license metadata file. For use via $(eval).
# $(1): source license metadata file
# $(2): destination license metadata file
# $(3): built targets
# $(4): installed targets
define copy-one-license-metadata-file
$(2): PRIVATE_BUILT=$(3)
$(2): PRIVATE_INSTALLED=$(4)
$(2): $(1)
	@echo "Copy: $$@"
	$$(call copy-license-metadata-file-to-target,$$(PRIVATE_BUILT),$$(PRIVATE_INSTALLED))
endef

define copy-and-uncompress-dexs
$(2): $(1) $(ZIPALIGN) $(ZIP2ZIP)
	@echo "Uncompress dexs in: $$@"
@@ -3163,6 +3176,17 @@ $(hide) rm -f $@
$(hide) cp "$<" "$@"
endef

# Same as copy-file-to-target, but assume file is a licenes metadata file,
# and append built from $(1) and installed from $(2).
define copy-license-metadata-file-to-target
@mkdir -p $(dir $@)
$(hide) rm -f $@
$(hide) cp "$<" "$@" $(strip \
  $(foreach b,$(1), && (grep -F 'built: "'"$(b)"'"' "$@" >/dev/null || echo 'built: "'"$(b)"'"' >>"$@")) \
  $(foreach i,$(2), && (grep -F 'installed: "'"$(i)"'"' "$@" >/dev/null || echo 'installed: "'"$(i)"'"' >>"$@")) \
)
endef

# The same as copy-file-to-target, but use the local
# cp command instead of acp.
define copy-file-to-target-with-cp
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ ifdef my_register_name

  ifdef LOCAL_SOONG_LICENSE_METADATA
    # Soong modules have already produced a license metadata file, copy it to where Make expects it.
    $(eval $(call copy-one-file, $(LOCAL_SOONG_LICENSE_METADATA), $(module_license_metadata)))
    $(eval $(call copy-one-license-metadata-file, $(LOCAL_SOONG_LICENSE_METADATA), $(module_license_metadata),$(ALL_MODULES.$(my_register_name).BUILT),$(ALL_MODUES.$(my_register_name).INSTALLED)))
  else
    # Make modules don't have enough information to produce a license metadata rule until after fix-notice-deps
    # has been called, store the necessary information until later.