From 7122205a5a098c5e5089e4213d3bf116a2459e60 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 24 May 2018 15:00:05 -0700 Subject: [PATCH 1/3] Fix typo. Properies -> Properties. Test: make checkbuild Bug: None Change-Id: I0b5e3dd44f507207f2de90e922dd7016cffce118 --- cc/ndk_headers.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cc/ndk_headers.go b/cc/ndk_headers.go index 9fabc97cb..866479dc0 100644 --- a/cc/ndk_headers.go +++ b/cc/ndk_headers.go @@ -45,7 +45,7 @@ func getCurrentIncludePath(ctx android.ModuleContext) android.OutputPath { return getNdkSysrootBase(ctx).Join(ctx, "usr/include") } -type headerProperies struct { +type headerProperties struct { // Base directory of the headers being installed. As an example: // // ndk_headers { @@ -72,7 +72,7 @@ type headerProperies struct { type headerModule struct { android.ModuleBase - properties headerProperies + properties headerProperties installPaths android.Paths licensePath android.ModuleSrcPath @@ -154,7 +154,7 @@ func ndkHeadersFactory() android.Module { return module } -type preprocessedHeaderProperies struct { +type preprocessedHeaderProperties struct { // Base directory of the headers being installed. As an example: // // preprocessed_ndk_headers { @@ -184,7 +184,7 @@ type preprocessedHeaderProperies struct { type preprocessedHeaderModule struct { android.ModuleBase - properties preprocessedHeaderProperies + properties preprocessedHeaderProperties installPaths android.Paths licensePath android.ModuleSrcPath From 19ff8b4662723d73c6dfc33d7585f66c25cd873d Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 24 May 2018 15:00:48 -0700 Subject: [PATCH 2/3] Add exclude_srcs property to ndk_headers modules. Test: make checkbuild Bug: None Change-Id: I2778c1140ab50abc0f7dee66da35ebacef77ea72 --- cc/ndk_headers.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cc/ndk_headers.go b/cc/ndk_headers.go index 866479dc0..663bd2af2 100644 --- a/cc/ndk_headers.go +++ b/cc/ndk_headers.go @@ -65,6 +65,9 @@ type headerProperties struct { // List of headers to install. Glob compatible. Common case is "include/**/*.h". Srcs []string + // Source paths that should be excluded from the srcs glob. + Exclude_srcs []string + // Path to the NOTICE file associated with the headers. License *string } @@ -128,7 +131,7 @@ func (m *headerModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { return } - srcFiles := ctx.ExpandSources(m.properties.Srcs, nil) + srcFiles := ctx.ExpandSources(m.properties.Srcs, m.properties.Exclude_srcs) for _, header := range srcFiles { installDir := getHeaderInstallDir(ctx, header, String(m.properties.From), String(m.properties.To)) From 97f9c963ad8434e78cb876004ff720ba6af9df3b Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 24 May 2018 15:02:16 -0700 Subject: [PATCH 3/3] Rename preprocessed_ndk_headers to versioned_ndk_headers. The current rule runs a specific preprocessor over the source files, and I'm adding support for generic preprocessed headers in a follow up patch. Test: make checkbuild Bug: None Change-Id: I1f3193cd595f151309e6321e1b41d8d16085379d --- cc/ndk_headers.go | 20 ++++++++++---------- cc/ndk_sysroot.go | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cc/ndk_headers.go b/cc/ndk_headers.go index 663bd2af2..0ee0f0556 100644 --- a/cc/ndk_headers.go +++ b/cc/ndk_headers.go @@ -26,7 +26,7 @@ import ( ) var ( - preprocessBionicHeaders = pctx.AndroidStaticRule("preprocessBionicHeaders", + versionBionicHeaders = pctx.AndroidStaticRule("versionBionicHeaders", blueprint.RuleParams{ // The `&& touch $out` isn't really necessary, but Blueprint won't // let us have only implicit outputs. @@ -157,10 +157,10 @@ func ndkHeadersFactory() android.Module { return module } -type preprocessedHeaderProperties struct { +type versionedHeaderProperties struct { // Base directory of the headers being installed. As an example: // - // preprocessed_ndk_headers { + // versioned_ndk_headers { // name: "foo", // from: "include", // to: "", @@ -184,19 +184,19 @@ type preprocessedHeaderProperties struct { // module does not have the srcs property, and operates on a full directory (the `from` property). // // Note that this is really only built to handle bionic/libc/include. -type preprocessedHeaderModule struct { +type versionedHeaderModule struct { android.ModuleBase - properties preprocessedHeaderProperties + properties versionedHeaderProperties installPaths android.Paths licensePath android.ModuleSrcPath } -func (m *preprocessedHeaderModule) DepsMutator(ctx android.BottomUpMutatorContext) { +func (m *versionedHeaderModule) DepsMutator(ctx android.BottomUpMutatorContext) { } -func (m *preprocessedHeaderModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { +func (m *versionedHeaderModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { if String(m.properties.License) == "" { ctx.PropertyErrorf("license", "field is required") } @@ -251,7 +251,7 @@ func processHeadersWithVersioner(ctx android.ModuleContext, srcDir, outDir andro timestampFile := android.PathForModuleOut(ctx, "versioner.timestamp") ctx.Build(pctx, android.BuildParams{ - Rule: preprocessBionicHeaders, + Rule: versionBionicHeaders, Description: "versioner preprocess " + srcDir.Rel(), Output: timestampFile, Implicits: append(srcFiles, depsGlob...), @@ -266,8 +266,8 @@ func processHeadersWithVersioner(ctx android.ModuleContext, srcDir, outDir andro return timestampFile } -func preprocessedNdkHeadersFactory() android.Module { - module := &preprocessedHeaderModule{} +func versionedNdkHeadersFactory() android.Module { + module := &versionedHeaderModule{} module.AddProperties(&module.properties) diff --git a/cc/ndk_sysroot.go b/cc/ndk_sysroot.go index c7ba5886d..1a467028e 100644 --- a/cc/ndk_sysroot.go +++ b/cc/ndk_sysroot.go @@ -59,7 +59,7 @@ import ( func init() { android.RegisterModuleType("ndk_headers", ndkHeadersFactory) android.RegisterModuleType("ndk_library", ndkLibraryFactory) - android.RegisterModuleType("preprocessed_ndk_headers", preprocessedNdkHeadersFactory) + android.RegisterModuleType("versioned_ndk_headers", versionedNdkHeadersFactory) android.RegisterSingletonType("ndk", NdkSingleton) pctx.Import("android/soong/common") @@ -107,7 +107,7 @@ func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) { licensePaths = append(licensePaths, m.licensePath) } - if m, ok := module.(*preprocessedHeaderModule); ok { + if m, ok := module.(*versionedHeaderModule); ok { installPaths = append(installPaths, m.installPaths...) licensePaths = append(licensePaths, m.licensePath) }