Merge changes Ia7e7fb61,Iede67e2c am: 92ca32e6b9

am: aa40abedb6

Change-Id: Idb59e3b230e5458f243d6467b21d68e10834b303
This commit is contained in:
Dan Willemsen
2016-06-08 04:51:14 +00:00
committed by android-build-merger
2 changed files with 85 additions and 40 deletions

View File

@@ -49,6 +49,8 @@ var standardProperties = map[string]struct {
"LOCAL_YACCFLAGS": {"yaccflags", bpparser.List}, "LOCAL_YACCFLAGS": {"yaccflags", bpparser.List},
"LOCAL_SANITIZE_RECOVER": {"sanitize.recover", bpparser.List}, "LOCAL_SANITIZE_RECOVER": {"sanitize.recover", bpparser.List},
"LOCAL_LOGTAGS_FILES": {"logtags", bpparser.List}, "LOCAL_LOGTAGS_FILES": {"logtags", bpparser.List},
"LOCAL_EXPORT_SHARED_LIBRARY_HEADERS": {"export_shared_lib_headers", bpparser.List},
"LOCAL_EXPORT_STATIC_LIBRARY_HEADERS": {"export_static_lib_headers", bpparser.List},
"LOCAL_JAVA_RESOURCE_DIRS": {"java_resource_dirs", bpparser.List}, "LOCAL_JAVA_RESOURCE_DIRS": {"java_resource_dirs", bpparser.List},
"LOCAL_JAVACFLAGS": {"javacflags", bpparser.List}, "LOCAL_JAVACFLAGS": {"javacflags", bpparser.List},
@@ -62,7 +64,7 @@ var standardProperties = map[string]struct {
// Bool properties // Bool properties
"LOCAL_IS_HOST_MODULE": {"host", bpparser.Bool}, "LOCAL_IS_HOST_MODULE": {"host", bpparser.Bool},
"LOCAL_CLANG": {"clang", bpparser.Bool}, "LOCAL_CLANG": {"clang", bpparser.Bool},
"LOCAL_FORCE_STATIC_EXECUTABLE": {"static", bpparser.Bool}, "LOCAL_FORCE_STATIC_EXECUTABLE": {"static_executable", bpparser.Bool},
"LOCAL_NATIVE_COVERAGE": {"native_coverage", bpparser.Bool}, "LOCAL_NATIVE_COVERAGE": {"native_coverage", bpparser.Bool},
"LOCAL_NO_CRT": {"nocrt", bpparser.Bool}, "LOCAL_NO_CRT": {"nocrt", bpparser.Bool},
"LOCAL_ALLOW_UNDEFINED_SYMBOLS": {"allow_undefined_symbols", bpparser.Bool}, "LOCAL_ALLOW_UNDEFINED_SYMBOLS": {"allow_undefined_symbols", bpparser.Bool},

View File

@@ -182,6 +182,8 @@ type Deps struct {
SharedLibs, LateSharedLibs []string SharedLibs, LateSharedLibs []string
StaticLibs, LateStaticLibs, WholeStaticLibs []string StaticLibs, LateStaticLibs, WholeStaticLibs []string
ReexportSharedLibHeaders, ReexportStaticLibHeaders []string
ObjFiles []string ObjFiles []string
GeneratedSources []string GeneratedSources []string
@@ -327,6 +329,14 @@ type BaseLinkerProperties struct {
// -l arguments to pass to linker for host-provided shared libraries // -l arguments to pass to linker for host-provided shared libraries
Host_ldlibs []string `android:"arch_variant"` Host_ldlibs []string `android:"arch_variant"`
// list of shared libraries to re-export include directories from. Entries must be
// present in shared_libs.
Export_shared_lib_headers []string `android:"arch_variant"`
// list of static libraries to re-export include directories from. Entries must be
// present in static_libs.
Export_static_lib_headers []string `android:"arch_variant"`
} }
type LibraryCompilerProperties struct { type LibraryCompilerProperties struct {
@@ -493,14 +503,18 @@ type dependencyTag struct {
blueprint.BaseDependencyTag blueprint.BaseDependencyTag
name string name string
library bool library bool
reexportFlags bool
} }
var ( var (
sharedDepTag = dependencyTag{name: "shared", library: true} sharedDepTag = dependencyTag{name: "shared", library: true}
sharedExportDepTag = dependencyTag{name: "shared", library: true, reexportFlags: true}
lateSharedDepTag = dependencyTag{name: "late shared", library: true} lateSharedDepTag = dependencyTag{name: "late shared", library: true}
staticDepTag = dependencyTag{name: "static", library: true} staticDepTag = dependencyTag{name: "static", library: true}
staticExportDepTag = dependencyTag{name: "static", library: true, reexportFlags: true}
lateStaticDepTag = dependencyTag{name: "late static", library: true} lateStaticDepTag = dependencyTag{name: "late static", library: true}
wholeStaticDepTag = dependencyTag{name: "whole static", library: true} wholeStaticDepTag = dependencyTag{name: "whole static", library: true, reexportFlags: true}
genSourceDepTag = dependencyTag{name: "gen source"} genSourceDepTag = dependencyTag{name: "gen source"}
genHeaderDepTag = dependencyTag{name: "gen header"} genHeaderDepTag = dependencyTag{name: "gen header"}
objDepTag = dependencyTag{name: "obj"} objDepTag = dependencyTag{name: "obj"}
@@ -783,6 +797,18 @@ func (c *Module) deps(ctx BaseModuleContext) Deps {
deps.SharedLibs = lastUniqueElements(deps.SharedLibs) deps.SharedLibs = lastUniqueElements(deps.SharedLibs)
deps.LateSharedLibs = lastUniqueElements(deps.LateSharedLibs) deps.LateSharedLibs = lastUniqueElements(deps.LateSharedLibs)
for _, lib := range deps.ReexportSharedLibHeaders {
if !inList(lib, deps.SharedLibs) {
ctx.PropertyErrorf("export_shared_lib_headers", "Shared library not in shared_libs: '%s'", lib)
}
}
for _, lib := range deps.ReexportStaticLibHeaders {
if !inList(lib, deps.StaticLibs) {
ctx.PropertyErrorf("export_static_lib_headers", "Static library not in static_libs: '%s'", lib)
}
}
return deps return deps
} }
@@ -808,14 +834,26 @@ func (c *Module) depsMutator(actx android.BottomUpMutatorContext) {
actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, wholeStaticDepTag, actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, wholeStaticDepTag,
deps.WholeStaticLibs...) deps.WholeStaticLibs...)
actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, staticDepTag, for _, lib := range deps.StaticLibs {
depTag := staticDepTag
if inList(lib, deps.ReexportStaticLibHeaders) {
depTag = staticExportDepTag
}
actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, depTag,
deps.StaticLibs...) deps.StaticLibs...)
}
actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, lateStaticDepTag, actx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}}, lateStaticDepTag,
deps.LateStaticLibs...) deps.LateStaticLibs...)
actx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, sharedDepTag, for _, lib := range deps.SharedLibs {
depTag := sharedDepTag
if inList(lib, deps.ReexportSharedLibHeaders) {
depTag = sharedExportDepTag
}
actx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, depTag,
deps.SharedLibs...) deps.SharedLibs...)
}
actx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, lateSharedDepTag, actx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, lateSharedDepTag,
deps.LateSharedLibs...) deps.LateSharedLibs...)
@@ -925,28 +963,30 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
return return
} }
var cflags []string if t, ok := tag.(dependencyTag); ok && t.library {
if t, _ := tag.(dependencyTag); t.library {
if i, ok := c.linker.(exportedFlagsProducer); ok { if i, ok := c.linker.(exportedFlagsProducer); ok {
cflags = i.exportedFlags() cflags := i.exportedFlags()
depPaths.Cflags = append(depPaths.Cflags, cflags...) depPaths.Cflags = append(depPaths.Cflags, cflags...)
if t.reexportFlags {
depPaths.ReexportedCflags = append(depPaths.ReexportedCflags, cflags...)
}
} }
} }
var depPtr *android.Paths var depPtr *android.Paths
switch tag { switch tag {
case sharedDepTag: case sharedDepTag, sharedExportDepTag:
depPtr = &depPaths.SharedLibs depPtr = &depPaths.SharedLibs
case lateSharedDepTag: case lateSharedDepTag:
depPtr = &depPaths.LateSharedLibs depPtr = &depPaths.LateSharedLibs
case staticDepTag: case staticDepTag, staticExportDepTag:
depPtr = &depPaths.StaticLibs depPtr = &depPaths.StaticLibs
case lateStaticDepTag: case lateStaticDepTag:
depPtr = &depPaths.LateStaticLibs depPtr = &depPaths.LateStaticLibs
case wholeStaticDepTag: case wholeStaticDepTag:
depPtr = &depPaths.WholeStaticLibs depPtr = &depPaths.WholeStaticLibs
depPaths.ReexportedCflags = append(depPaths.ReexportedCflags, cflags...)
staticLib, _ := c.linker.(*libraryLinker) staticLib, _ := c.linker.(*libraryLinker)
if staticLib == nil || !staticLib.static() { if staticLib == nil || !staticLib.static() {
ctx.ModuleErrorf("module %q not a static library", ctx.OtherModuleName(m)) ctx.ModuleErrorf("module %q not a static library", ctx.OtherModuleName(m))
@@ -969,7 +1009,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
case crtEndDepTag: case crtEndDepTag:
depPaths.CrtEnd = c.outputFile depPaths.CrtEnd = c.outputFile
default: default:
panic(fmt.Errorf("unknown dependency tag: %s", ctx.OtherModuleDependencyTag(m))) panic(fmt.Errorf("unknown dependency tag: %s", tag))
} }
if depPtr != nil { if depPtr != nil {
@@ -1223,6 +1263,9 @@ func (linker *baseLinker) deps(ctx BaseModuleContext, deps Deps) Deps {
deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Static_libs...) deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Static_libs...)
deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Shared_libs...) deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Shared_libs...)
deps.ReexportStaticLibHeaders = append(deps.ReexportStaticLibHeaders, linker.Properties.Export_static_lib_headers...)
deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, linker.Properties.Export_shared_lib_headers...)
if ctx.ModuleName() != "libcompiler_rt-extras" { if ctx.ModuleName() != "libcompiler_rt-extras" {
deps.StaticLibs = append(deps.StaticLibs, "libcompiler_rt-extras") deps.StaticLibs = append(deps.StaticLibs, "libcompiler_rt-extras")
} }