aboutsummaryrefslogtreecommitdiffstats
path: root/cc/ndk_headers.go
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2016-10-20 01:36:11 -0700
committerDan Albert <danalbert@google.com>2016-10-20 13:30:07 -0700
commitc6345fb7ec656e18933f654197c2a6972270fead (patch)
treebdf9f40d9b9fb6cd911fc2795a2acf7b721dc709 /cc/ndk_headers.go
parent7b872837c6d13dc5828978d18d55f4956c046a61 (diff)
downloadbuild_soong-c6345fb7ec656e18933f654197c2a6972270fead.tar.gz
build_soong-c6345fb7ec656e18933f654197c2a6972270fead.tar.bz2
build_soong-c6345fb7ec656e18933f654197c2a6972270fead.zip
Add a "license" property to ndk_headers.
This field points to the license file for the headers being shipped. Test: make ndk && less $SOONG_OUT/ndk/NOTICE Bug: None Change-Id: I386f4e6f6d9776f422ffc09b8dab69e1911b08a4
Diffstat (limited to 'cc/ndk_headers.go')
-rw-r--r--cc/ndk_headers.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/cc/ndk_headers.go b/cc/ndk_headers.go
index ece83bb9..9cc34170 100644
--- a/cc/ndk_headers.go
+++ b/cc/ndk_headers.go
@@ -46,6 +46,9 @@ type headerProperies struct {
// List of headers to install. Glob compatible. Common case is "include/**/*.h".
Srcs []string
+
+ // Path to the NOTICE file associated with the headers.
+ License string
}
type headerModule struct {
@@ -54,12 +57,19 @@ type headerModule struct {
properties headerProperies
installPaths []string
+ licensePath android.ModuleSrcPath
}
func (m *headerModule) DepsMutator(ctx android.BottomUpMutatorContext) {
}
func (m *headerModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ if m.properties.License == "" {
+ ctx.PropertyErrorf("license", "field is required")
+ }
+
+ m.licensePath = android.PathForModuleSrc(ctx, m.properties.License)
+
srcFiles := ctx.ExpandSources(m.properties.Srcs, nil)
for _, header := range srcFiles {
// Output path is the sysroot base + "usr/include" + to directory + directory component
@@ -100,6 +110,10 @@ func (m *headerModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
func ndkHeadersFactory() (blueprint.Module, []interface{}) {
module := &headerModule{}
- return android.InitAndroidArchModule(module, android.HostSupported, android.MultilibFirst,
- &module.properties)
+ // Host module rather than device module because device module install steps
+ // do not get run when embedded in make. We're not any of the existing
+ // module types that can be exposed via the Android.mk exporter, so just use
+ // a host module.
+ return android.InitAndroidArchModule(module, android.HostSupportedNoCross,
+ android.MultilibFirst, &module.properties)
}