Merge changes from topic "preprocessed_ndk_headers" am: 5ae3652d99
am: 7435738d53
Change-Id: Iac614f6376163d527709ed57a37a4f3111a5dfe3
This commit is contained in:
commit
e6ab4f9657
|
@ -26,7 +26,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
preprocessBionicHeaders = pctx.AndroidStaticRule("preprocessBionicHeaders",
|
versionBionicHeaders = pctx.AndroidStaticRule("versionBionicHeaders",
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
// The `&& touch $out` isn't really necessary, but Blueprint won't
|
// The `&& touch $out` isn't really necessary, but Blueprint won't
|
||||||
// let us have only implicit outputs.
|
// let us have only implicit outputs.
|
||||||
|
@ -45,7 +45,7 @@ func getCurrentIncludePath(ctx android.ModuleContext) android.OutputPath {
|
||||||
return getNdkSysrootBase(ctx).Join(ctx, "usr/include")
|
return getNdkSysrootBase(ctx).Join(ctx, "usr/include")
|
||||||
}
|
}
|
||||||
|
|
||||||
type headerProperies struct {
|
type headerProperties struct {
|
||||||
// Base directory of the headers being installed. As an example:
|
// Base directory of the headers being installed. As an example:
|
||||||
//
|
//
|
||||||
// ndk_headers {
|
// ndk_headers {
|
||||||
|
@ -65,6 +65,9 @@ type headerProperies struct {
|
||||||
// List of headers to install. Glob compatible. Common case is "include/**/*.h".
|
// List of headers to install. Glob compatible. Common case is "include/**/*.h".
|
||||||
Srcs []string
|
Srcs []string
|
||||||
|
|
||||||
|
// Source paths that should be excluded from the srcs glob.
|
||||||
|
Exclude_srcs []string
|
||||||
|
|
||||||
// Path to the NOTICE file associated with the headers.
|
// Path to the NOTICE file associated with the headers.
|
||||||
License *string
|
License *string
|
||||||
}
|
}
|
||||||
|
@ -72,7 +75,7 @@ type headerProperies struct {
|
||||||
type headerModule struct {
|
type headerModule struct {
|
||||||
android.ModuleBase
|
android.ModuleBase
|
||||||
|
|
||||||
properties headerProperies
|
properties headerProperties
|
||||||
|
|
||||||
installPaths android.Paths
|
installPaths android.Paths
|
||||||
licensePath android.ModuleSrcPath
|
licensePath android.ModuleSrcPath
|
||||||
|
@ -128,7 +131,7 @@ func (m *headerModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
srcFiles := ctx.ExpandSources(m.properties.Srcs, nil)
|
srcFiles := ctx.ExpandSources(m.properties.Srcs, m.properties.Exclude_srcs)
|
||||||
for _, header := range srcFiles {
|
for _, header := range srcFiles {
|
||||||
installDir := getHeaderInstallDir(ctx, header, String(m.properties.From),
|
installDir := getHeaderInstallDir(ctx, header, String(m.properties.From),
|
||||||
String(m.properties.To))
|
String(m.properties.To))
|
||||||
|
@ -154,10 +157,10 @@ func ndkHeadersFactory() android.Module {
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
type preprocessedHeaderProperies struct {
|
type versionedHeaderProperties struct {
|
||||||
// Base directory of the headers being installed. As an example:
|
// Base directory of the headers being installed. As an example:
|
||||||
//
|
//
|
||||||
// preprocessed_ndk_headers {
|
// versioned_ndk_headers {
|
||||||
// name: "foo",
|
// name: "foo",
|
||||||
// from: "include",
|
// from: "include",
|
||||||
// to: "",
|
// to: "",
|
||||||
|
@ -181,19 +184,19 @@ type preprocessedHeaderProperies struct {
|
||||||
// module does not have the srcs property, and operates on a full directory (the `from` property).
|
// 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.
|
// Note that this is really only built to handle bionic/libc/include.
|
||||||
type preprocessedHeaderModule struct {
|
type versionedHeaderModule struct {
|
||||||
android.ModuleBase
|
android.ModuleBase
|
||||||
|
|
||||||
properties preprocessedHeaderProperies
|
properties versionedHeaderProperties
|
||||||
|
|
||||||
installPaths android.Paths
|
installPaths android.Paths
|
||||||
licensePath android.ModuleSrcPath
|
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) == "" {
|
if String(m.properties.License) == "" {
|
||||||
ctx.PropertyErrorf("license", "field is required")
|
ctx.PropertyErrorf("license", "field is required")
|
||||||
}
|
}
|
||||||
|
@ -248,7 +251,7 @@ func processHeadersWithVersioner(ctx android.ModuleContext, srcDir, outDir andro
|
||||||
|
|
||||||
timestampFile := android.PathForModuleOut(ctx, "versioner.timestamp")
|
timestampFile := android.PathForModuleOut(ctx, "versioner.timestamp")
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: preprocessBionicHeaders,
|
Rule: versionBionicHeaders,
|
||||||
Description: "versioner preprocess " + srcDir.Rel(),
|
Description: "versioner preprocess " + srcDir.Rel(),
|
||||||
Output: timestampFile,
|
Output: timestampFile,
|
||||||
Implicits: append(srcFiles, depsGlob...),
|
Implicits: append(srcFiles, depsGlob...),
|
||||||
|
@ -263,8 +266,8 @@ func processHeadersWithVersioner(ctx android.ModuleContext, srcDir, outDir andro
|
||||||
return timestampFile
|
return timestampFile
|
||||||
}
|
}
|
||||||
|
|
||||||
func preprocessedNdkHeadersFactory() android.Module {
|
func versionedNdkHeadersFactory() android.Module {
|
||||||
module := &preprocessedHeaderModule{}
|
module := &versionedHeaderModule{}
|
||||||
|
|
||||||
module.AddProperties(&module.properties)
|
module.AddProperties(&module.properties)
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ import (
|
||||||
func init() {
|
func init() {
|
||||||
android.RegisterModuleType("ndk_headers", ndkHeadersFactory)
|
android.RegisterModuleType("ndk_headers", ndkHeadersFactory)
|
||||||
android.RegisterModuleType("ndk_library", ndkLibraryFactory)
|
android.RegisterModuleType("ndk_library", ndkLibraryFactory)
|
||||||
android.RegisterModuleType("preprocessed_ndk_headers", preprocessedNdkHeadersFactory)
|
android.RegisterModuleType("versioned_ndk_headers", versionedNdkHeadersFactory)
|
||||||
android.RegisterSingletonType("ndk", NdkSingleton)
|
android.RegisterSingletonType("ndk", NdkSingleton)
|
||||||
|
|
||||||
pctx.Import("android/soong/common")
|
pctx.Import("android/soong/common")
|
||||||
|
@ -107,7 +107,7 @@ func (n *ndkSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||||
licensePaths = append(licensePaths, m.licensePath)
|
licensePaths = append(licensePaths, m.licensePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if m, ok := module.(*preprocessedHeaderModule); ok {
|
if m, ok := module.(*versionedHeaderModule); ok {
|
||||||
installPaths = append(installPaths, m.installPaths...)
|
installPaths = append(installPaths, m.installPaths...)
|
||||||
licensePaths = append(licensePaths, m.licensePath)
|
licensePaths = append(licensePaths, m.licensePath)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue