Add macros for declaring copied file licenses.
The PRODUCT_COPY_FILES is populated before definitions.mk mapping source files to installed files that get copied unchanged. Need to be able to declare license metadata for the copied files such that similarly named files in different projects can have different licenses. Need a macro to convert target names to their corresponding license metadata. Bug: 68860345 Bug: 151177513 Bug: 151953481 Bug: 213388645 Bug: 210912771 Test: m nothing Change-Id: Ic244b3525e72b6cd8c4c4305bf5ad430d6e24ccb
This commit is contained in:
@@ -576,6 +576,15 @@ define license-metadata-dir
|
||||
$(call generated-sources-dir-for,META,lic,)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
# License metadata targets corresponding to targets in $(1)
|
||||
###########################################################
|
||||
define corresponding-license-metadata
|
||||
$(strip $(eval _dir := $(call license-metadata-dir)) \
|
||||
$(foreach target, $(sort $(1)), $(_dir)/$(target).meta_lic) \
|
||||
)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## License metadata build rule for my_register_name $(1)
|
||||
###########################################################
|
||||
@@ -727,6 +736,22 @@ $(strip \
|
||||
)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Declare that non-module targets copied from project $(1) and
|
||||
## optionally ending in $(2) have the following license
|
||||
## metadata:
|
||||
##
|
||||
## $(3) -- license kinds e.g. SPDX-license-identifier-Apache-2.0
|
||||
## $(4) -- license conditions e.g. notice by_exception_only
|
||||
## $(5) -- license text filenames (notices)
|
||||
## $(6) -- package name
|
||||
###########################################################
|
||||
define declare-copy-files-license-metadata
|
||||
$(strip \
|
||||
$(foreach _pair,$(filter $(1)%$(2),$(PRODUCT_COPY_FILES)),$(eval $(call declare-license-metadata,$(PRODUCT_OUT)/$(call word-colon,2,$(_pair)),$(3),$(4),$(5),$(6),$(1)))) \
|
||||
)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Declare the license metadata for non-module container-type target $(1).
|
||||
##
|
||||
@@ -764,6 +789,18 @@ $(strip \
|
||||
)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Declare that non-module targets copied from project $(1) and
|
||||
## optionally ending in $(2) are non-copyrightable files.
|
||||
##
|
||||
## e.g. an information-only file merely listing other files.
|
||||
###########################################################
|
||||
define declare-0p-copy-files
|
||||
$(strip \
|
||||
$(foreach _pair,$(filter $(1)%$(2),$(PRODUCT_COPY_FILES)),$(eval $(call declare-0p-target,$(PRODUCT_OUT)/$(call word-colon,2,$(_pair))))) \
|
||||
)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Declare non-module target $(1) to have a first-party license
|
||||
## (Android Apache 2.0)
|
||||
@@ -774,6 +811,15 @@ define declare-1p-target
|
||||
$(call declare-license-metadata,$(1),SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,Android,$(2))
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Declare that non-module targets copied from project $(1) and
|
||||
## optionally ending in $(2) are first-party licensed
|
||||
## (Android Apache 2.0)
|
||||
###########################################################
|
||||
define declare-1p-copy-files
|
||||
$(foreach _pair,$(filter $(1)%$(2),$(PRODUCT_COPY_FILES)),$(call declare-1p-target,$(PRODUCT_OUT)/$(call word-colon,2,$(_pair)),$(1)))
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Declare non-module container-type target $(1) to have a
|
||||
## first-party license (Android Apache 2.0).
|
||||
|
Reference in New Issue
Block a user