aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Badour <bbadour@google.com>2021-01-07 03:34:31 +0000
committerBob Badour <bbadour@google.com>2021-02-19 15:19:33 -0800
commit44dcaac28b080b90b19493f04ab992dc785a6177 (patch)
treeaf03786b152957d66284f12f2a04f9d501247b6b
parent02aea1327276bb3ba50ed4db0ce33d56a35d2c16 (diff)
downloadbuild-44dcaac28b080b90b19493f04ab992dc785a6177.tar.gz
Revert^2 "Add variables for notice deps, license kinds etc."
dcfb9c5ef551337f30ab26e78a6edcb2c9968284 Test: m nothing Bug: 180688789 Change-Id: I6a60f55ab0e7013061a695cb1b7c5ffde29577dd Merged-in: I6a60f55ab0e7013061a695cb1b7c5ffde29577dd
-rw-r--r--core/clear_vars.mk5
-rw-r--r--core/definitions.mk41
-rw-r--r--core/main.mk3
-rw-r--r--core/notice_files.mk86
4 files changed, 134 insertions, 1 deletions
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 55d1551c67..c5ce1b01a0 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -157,6 +157,10 @@ LOCAL_JNI_SHARED_LIBRARIES_ABI:=
LOCAL_CERTIFICATE_LINEAGE:=
LOCAL_LDFLAGS:=
LOCAL_LDLIBS:=
+LOCAL_LICENSE_CONDITIONS:=
+LOCAL_LICENSE_KINDS:=
+LOCAL_LICENSE_INSTALL_MAP:=
+LOCAL_LICENSE_PACKAGE_NAME:=
LOCAL_LOGTAGS_FILES:=
LOCAL_MANIFEST_FILE:=
LOCAL_MANIFEST_INSTRUMENTATION_FOR:=
@@ -168,6 +172,7 @@ LOCAL_MODULE_HOST_ARCH:=
LOCAL_MODULE_HOST_ARCH_WARN:=
LOCAL_MODULE_HOST_CROSS_ARCH:=
LOCAL_MODULE_HOST_OS:=
+LOCAL_MODULE_IS_CONTAINER:=
LOCAL_MODULE_OWNER:=
LOCAL_MODULE_PATH:=
LOCAL_MODULE_RELATIVE_PATH :=
diff --git a/core/definitions.mk b/core/definitions.mk
index 7dc3e99808..584c92efb4 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -531,6 +531,47 @@ $(_idf_val_)
endef
###########################################################
+## Sometimes a notice dependency will reference an unadorned
+## module name that only appears in ALL_MODULES adorned with
+## an ARCH suffix or a `host_cross_` prefix.
+##
+## After all of the modules are processed in base_rules.mk,
+## replace all such dependencies with every matching adorned
+## module name.
+###########################################################
+
+define fix-notice-deps
+$(strip \
+ $(eval _all_module_refs := \
+ $(sort \
+ $(foreach m,$(sort $(ALL_MODULES)), \
+ $(ALL_MODULES.$(m).NOTICE_DEPS) \
+ ) \
+ ) \
+ ) \
+ $(foreach m, $(_all_module_refs), \
+ $(eval _lookup.$(m) := \
+ $(sort \
+ $(if $(strip $(ALL_MODULES.$(m).PATH)), \
+ $(m), \
+ $(filter $(m)_32 $(m)_64 host_cross_$(m) host_cross_$(m)_32 host_cross_$(m)_64, $(ALL_MODULES)) \
+ ) \
+ ) \
+ ) \
+ ) \
+ $(foreach m, $(ALL_MODULES), \
+ $(eval ALL_MODULES.$(m).NOTICE_DEPS := \
+ $(sort \
+ $(foreach d,$(ALL_MODULES.$(m).NOTICE_DEPS), \
+ $(_lookup.$(d)) \
+ ) \
+ ) \
+ ) \
+ ) \
+)
+endef
+
+###########################################################
## Returns correct _idfPrefix from the list:
## { HOST, HOST_CROSS, AUX, TARGET }
###########################################################
diff --git a/core/main.mk b/core/main.mk
index 257ae29183..5a86c1ea1a 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1333,6 +1333,9 @@ modules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))
ALL_DEFAULT_INSTALLED_MODULES :=
+$(call fix-notice-deps)
+
+
# These are additional goals that we build, in order to make sure that there
# is as little code as possible in the tree that doesn't build.
modules_to_check := $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).CHECKED))
diff --git a/core/notice_files.mk b/core/notice_files.mk
index 22f8e41844..7051955a52 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -9,6 +9,32 @@ else
notice_file:=$(strip $(wildcard $(LOCAL_PATH)/NOTICE))
endif
+ifneq (,$(strip $(LOCAL_LICENSE_PACKAGE_NAME)))
+license_package_name:=$(strip $(LOCAL_LICENSE_PACKAGE_NAME))
+else ifdef my_register_name
+license_package_name:=$(my_register_name)
+else
+license_package_name:=$(strip $(LOCAL_MODULE))
+endif
+
+ifneq (,$(strip $(LOCAL_LICENSE_INSTALL_MAP)))
+install_map:=$(strip $(LOCAL_LICENSE_INSTALL_MAP))
+else
+install_map:=
+endif
+
+ifneq (,$(strip $(LOCAL_LICENSE_KINDS)))
+license_kinds:=$(strip $(LOCAL_LICENSE_KINDS))
+else
+license_kinds:=legacy_by_exception_only
+endif
+
+ifneq (,$(strip $(LOCAL_LICENSE_CONDITIONS)))
+license_conditions:=$(strip $(LOCAL_LICENSE_CONDITIONS))
+else
+license_conditions:=by_exception_only
+endif
+
ifeq ($(LOCAL_MODULE_CLASS),GYP)
# We ignore NOTICE files for modules of type GYP.
notice_file :=
@@ -40,10 +66,64 @@ endif
installed_notice_file :=
+is_container:=$(strip $(LOCAL_MODULE_IS_CONTAINER))
+ifeq (,$(is_container))
+ifneq (,$(strip $(filter %.zip %.tar %.tgz %.tar.gz %.apk %.img %.srcszip %.apex, $(LOCAL_BUILT_MODULE))))
+is_container:=true
+else
+is_container:=false
+endif
+else ifneq (,$(strip $(filter-out true false,$(is_container))))
+$(error Unrecognized value '$(is_container)' for LOCAL_MODULE_IS_CONTAINER)
+endif
+
+ifeq (true,$(is_container))
+# Include shared libraries' notices for "container" types, but not for binaries etc.
+notice_deps := \
+ $(sort \
+ $(LOCAL_REQUIRED_MODULES) \
+ $(LOCAL_STATIC_LIBRARIES) \
+ $(LOCAL_WHOLE_STATIC_LIBRARIES) \
+ $(LOCAL_SHARED_LIBRARIES) \
+ $(LOCAL_DYLIB_LIBRARIES) \
+ $(LOCAL_RLIB_LIBRARIES) \
+ $(LOCAL_PROC_MACRO_LIBRARIES) \
+ $(LOCAL_HEADER_LIBRARIES) \
+ $(LOCAL_STATIC_JAVA_LIBRARIES) \
+ $(LOCAL_JAVA_LIBRARIES) \
+ $(LOCAL_JNI_SHARED_LIBRARIES) \
+ )
+else
+notice_deps := \
+ $(sort \
+ $(LOCAL_REQUIRED_MODULES) \
+ $(LOCAL_STATIC_LIBRARIES) \
+ $(LOCAL_WHOLE_STATIC_LIBRARIES) \
+ $(LOCAL_RLIB_LIBRARIES) \
+ $(LOCAL_PROC_MACRO_LIBRARIES) \
+ $(LOCAL_HEADER_LIBRARIES) \
+ $(LOCAL_STATIC_JAVA_LIBRARIES) \
+ )
+endif
+ifeq ($(LOCAL_IS_HOST_MODULE),true)
+notice_deps := $(sort $(notice_deps) $(LOCAL_HOST_REQUIRED_MODULES))
+else
+notice_deps := $(sort $(notice_deps) $(LOCAL_TARGET_REQUIRED_MODULES))
+endif
+
+ifdef my_register_name
+ALL_MODULES.$(my_register_name).LICENSE_PACKAGE_NAME := $(strip $(license_package_name))
+ALL_MODULES.$(my_register_name).LICENSE_KINDS := $(sort $(ALL_MODULES.$(my_register_name).LICENSE_KINDS) $(license_kinds))
+ALL_MODULES.$(my_register_name).LICENSE_CONDITIONS := $(sort $(ALL_MODULES.$(my_register_name).LICENSE_CONDITIONS) $(license_conditions))
+ALL_MODULES.$(my_register_name).LICENSE_INSTALL_MAP := $(sort $(ALL_MODULES.$(my_register_name).LICENSE_INSTALL_MAP) $(install_map))
+ALL_MODULES.$(my_register_name).NOTICE_DEPS := $(sort $(ALL_MODULES.$(my_register_name).NOTICE_DEPS) $(notice_deps))
+ALL_MODULES.$(my_register_name).IS_CONTAINER := $(sort $(ALL_MODULES.$(my_register_name).IS_CONTAINER) $(is_container))
+endif
+
ifdef notice_file
ifdef my_register_name
-ALL_MODULES.$(my_register_name).NOTICES := $(ALL_MODULES.$(my_register_name).NOTICES) $(notice_file)
+ALL_MODULES.$(my_register_name).NOTICES := $(sort $(ALL_MODULES.$(my_register_name).NOTICES) $(notice_file))
endif
# This relies on the name of the directory in PRODUCT_OUT matching where
@@ -100,6 +180,10 @@ module_installed_filename := $(patsubst $(HOST_CROSS_OUT)/%,%,$(module_installed
installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/src/$(module_installed_filename).txt
+ifdef my_register_name
+ALL_MODULES.$(my_register_name).INSTALLED_NOTICE_FILE := $(installed_notice_file)
+endif
+
$(installed_notice_file): PRIVATE_INSTALLED_MODULE := $(module_installed_filename)
$(installed_notice_file): $(notice_file)