diff --git a/cc/ndk_headers.go b/cc/ndk_headers.go index 9fabc97cb..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. @@ -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 { @@ -65,6 +65,9 @@ type headerProperies 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 } @@ -72,7 +75,7 @@ type headerProperies struct { type headerModule struct { android.ModuleBase - properties headerProperies + properties headerProperties installPaths android.Paths licensePath android.ModuleSrcPath @@ -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)) @@ -154,10 +157,10 @@ func ndkHeadersFactory() android.Module { return module } -type preprocessedHeaderProperies 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: "", @@ -181,19 +184,19 @@ type preprocessedHeaderProperies 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 preprocessedHeaderProperies + 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") } @@ -248,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...), @@ -263,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) }