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

Commit acd61f92 authored by Colin Cross's avatar Colin Cross
Browse files

Don't store notice files for Soong modules

Soong modules have already generated their license metadata file, the
stored notice file list is not used.

Bug: 309006256
Test: no change to out/build-cf_x86_64_phone.ninja
Change-Id: I69ab4e3023db7ed42363e4a8eedbd737f237e509
parent 8faa4a58
Loading
Loading
Loading
Loading
+28 −27
Original line number Diff line number Diff line
@@ -2,6 +2,25 @@
## Track NOTICE files
###########################################################

module_license_metadata := $(call local-meta-intermediates-dir)/$(my_register_name).meta_lic

$(foreach target,$(ALL_MODULES.$(my_register_name).BUILT) $(ALL_MODULES.$(my_register_name).INSTALLED) $(foreach bi,$(LOCAL_SOONG_BUILT_INSTALLED),$(call word-colon,1,$(bi))),\
  $(eval ALL_TARGETS.$(target).META_LIC := $(module_license_metadata)))

$(foreach f,$(my_test_data) $(my_test_config),\
  $(if $(strip $(ALL_TARGETS.$(call word-colon,1,$(f)).META_LIC)), \
    $(call declare-copy-target-license-metadata,$(call word-colon,2,$(f)),$(call word-colon,1,$(f))), \
    $(eval ALL_TARGETS.$(call word-colon,2,$(f)).META_LIC := $(module_license_metadata))))

ALL_MODULES.$(my_register_name).META_LIC := $(strip $(ALL_MODULES.$(my_register_name).META_LIC) $(module_license_metadata))

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-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.

  ifneq ($(LOCAL_NOTICE_FILE),)
    notice_file:=$(strip $(LOCAL_NOTICE_FILE))
  else
@@ -26,25 +45,6 @@ ifdef LOCAL_NO_NOTICE_FILE
    notice_file :=
  endif

module_license_metadata := $(call local-meta-intermediates-dir)/$(my_register_name).meta_lic

$(foreach target,$(ALL_MODULES.$(my_register_name).BUILT) $(ALL_MODULES.$(my_register_name).INSTALLED) $(foreach bi,$(LOCAL_SOONG_BUILT_INSTALLED),$(call word-colon,1,$(bi))),\
  $(eval ALL_TARGETS.$(target).META_LIC := $(module_license_metadata)))

$(foreach f,$(my_test_data) $(my_test_config),\
  $(if $(strip $(ALL_TARGETS.$(call word-colon,1,$(f)).META_LIC)), \
    $(call declare-copy-target-license-metadata,$(call word-colon,2,$(f)),$(call word-colon,1,$(f))), \
    $(eval ALL_TARGETS.$(call word-colon,2,$(f)).META_LIC := $(module_license_metadata))))

ALL_MODULES.$(my_register_name).META_LIC := $(strip $(ALL_MODULES.$(my_register_name).META_LIC) $(module_license_metadata))

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-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.

  ifneq (,$(strip $(LOCAL_LICENSE_PACKAGE_NAME)))
    license_package_name:=$(strip $(LOCAL_LICENSE_PACKAGE_NAME))
  else
@@ -136,8 +136,9 @@ else
  ALL_MODULES.$(my_register_name).NOTICE_DEPS := $(ALL_MODULES.$(my_register_name).NOTICE_DEPS) $(notice_deps)
  ALL_MODULES.$(my_register_name).IS_CONTAINER := $(strip $(filter-out false,$(ALL_MODULES.$(my_register_name).IS_CONTAINER) $(is_container)))
  ALL_MODULES.$(my_register_name).PATH := $(strip $(ALL_MODULES.$(my_register_name).PATH) $(local_path))
endif

  ifdef notice_file
    ALL_MODULES.$(my_register_name).NOTICES := $(ALL_MODULES.$(my_register_name).NOTICES) $(notice_file)
  endif  # notice_file
endif