Merge "Add ar flags for CFI enabled components in Soong."
diff --git a/Android.bp b/Android.bp
index 4d06710..e394892 100644
--- a/Android.bp
+++ b/Android.bp
@@ -146,8 +146,6 @@
"cc/ndk_headers.go",
"cc/ndk_library.go",
"cc/ndk_sysroot.go",
-
- "cc/vndk_library.go",
],
testSrcs: [
"cc/cc_test.go",
diff --git a/android/config.go b/android/config.go
index 2413f52..bc76f34 100644
--- a/android/config.go
+++ b/android/config.go
@@ -497,7 +497,3 @@
}
return coverage
}
-
-func (c *deviceConfig) SameProcessHalDeps() []string {
- return append([]string(nil), c.config.ProductVariables.SameProcessHalDeps...)
-}
diff --git a/android/mutator.go b/android/mutator.go
index 3420280..940b0ff 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -14,7 +14,11 @@
package android
-import "github.com/google/blueprint"
+import (
+ "sync"
+
+ "github.com/google/blueprint"
+)
// Mutator phases:
// Pre-arch
@@ -23,36 +27,68 @@
// Deps
// PostDeps
-func registerMutators() {
- ctx := registerMutatorsContext{}
+var registerMutatorsOnce sync.Once
+var registeredMutators []*mutator
- register := func(funcs []RegisterMutatorFunc) {
- for _, f := range funcs {
- f(ctx)
+func registerMutatorsToContext(ctx *blueprint.Context, mutators []*mutator) {
+ for _, t := range mutators {
+ var handle blueprint.MutatorHandle
+ if t.bottomUpMutator != nil {
+ handle = ctx.RegisterBottomUpMutator(t.name, t.bottomUpMutator)
+ } else if t.topDownMutator != nil {
+ handle = ctx.RegisterTopDownMutator(t.name, t.topDownMutator)
+ }
+ if t.parallel {
+ handle.Parallel()
}
}
-
- ctx.TopDown("load_hooks", loadHookMutator).Parallel()
- ctx.BottomUp("prebuilts", prebuiltMutator).Parallel()
- ctx.BottomUp("defaults_deps", defaultsDepsMutator).Parallel()
- ctx.TopDown("defaults", defaultsMutator).Parallel()
-
- register(preArch)
-
- ctx.BottomUp("arch", archMutator).Parallel()
- ctx.TopDown("arch_hooks", archHookMutator).Parallel()
-
- register(preDeps)
-
- ctx.BottomUp("deps", depsMutator).Parallel()
-
- ctx.TopDown("prebuilt_select", PrebuiltSelectModuleMutator).Parallel()
- ctx.BottomUp("prebuilt_replace", PrebuiltReplaceMutator).Parallel()
-
- register(postDeps)
}
-type registerMutatorsContext struct{}
+func registerMutators(ctx *blueprint.Context) {
+
+ registerMutatorsOnce.Do(func() {
+ ctx := ®isterMutatorsContext{}
+
+ register := func(funcs []RegisterMutatorFunc) {
+ for _, f := range funcs {
+ f(ctx)
+ }
+ }
+
+ ctx.TopDown("load_hooks", loadHookMutator).Parallel()
+ ctx.BottomUp("prebuilts", prebuiltMutator).Parallel()
+ ctx.BottomUp("defaults_deps", defaultsDepsMutator).Parallel()
+ ctx.TopDown("defaults", defaultsMutator).Parallel()
+
+ register(preArch)
+
+ ctx.BottomUp("arch", archMutator).Parallel()
+ ctx.TopDown("arch_hooks", archHookMutator).Parallel()
+
+ register(preDeps)
+
+ ctx.BottomUp("deps", depsMutator).Parallel()
+
+ ctx.TopDown("prebuilt_select", PrebuiltSelectModuleMutator).Parallel()
+ ctx.BottomUp("prebuilt_replace", PrebuiltReplaceMutator).Parallel()
+
+ register(postDeps)
+
+ registeredMutators = ctx.mutators
+ })
+
+ registerMutatorsToContext(ctx, registeredMutators)
+}
+
+func RegisterTestMutators(ctx *blueprint.Context) {
+ mutators := registerMutatorsContext{}
+ mutators.BottomUp("deps", depsMutator).Parallel()
+ registerMutatorsToContext(ctx, mutators.mutators)
+}
+
+type registerMutatorsContext struct {
+ mutators []*mutator
+}
type RegisterMutatorsContext interface {
TopDown(name string, m AndroidTopDownMutator) MutatorHandle
@@ -99,7 +135,7 @@
androidBaseContextImpl
}
-func (registerMutatorsContext) BottomUp(name string, m AndroidBottomUpMutator) MutatorHandle {
+func (x *registerMutatorsContext) BottomUp(name string, m AndroidBottomUpMutator) MutatorHandle {
f := func(ctx blueprint.BottomUpMutatorContext) {
if a, ok := ctx.Module().(Module); ok {
actx := &androidBottomUpMutatorContext{
@@ -110,11 +146,11 @@
}
}
mutator := &mutator{name: name, bottomUpMutator: f}
- mutators = append(mutators, mutator)
+ x.mutators = append(x.mutators, mutator)
return mutator
}
-func (registerMutatorsContext) TopDown(name string, m AndroidTopDownMutator) MutatorHandle {
+func (x *registerMutatorsContext) TopDown(name string, m AndroidTopDownMutator) MutatorHandle {
f := func(ctx blueprint.TopDownMutatorContext) {
if a, ok := ctx.Module().(Module); ok {
actx := &androidTopDownMutatorContext{
@@ -125,7 +161,7 @@
}
}
mutator := &mutator{name: name, topDownMutator: f}
- mutators = append(mutators, mutator)
+ x.mutators = append(x.mutators, mutator)
return mutator
}
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 5f9b4b0..772df7a 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -19,7 +19,11 @@
// This file implements common functionality for handling modules that may exist as prebuilts,
// source, or both.
-var prebuiltDependencyTag blueprint.BaseDependencyTag
+type prebuiltDependencyTag struct {
+ blueprint.BaseDependencyTag
+}
+
+var prebuiltDepTag prebuiltDependencyTag
type Prebuilt struct {
Properties struct {
@@ -64,7 +68,7 @@
p := m.Prebuilt()
name := m.base().BaseModuleName()
if ctx.OtherModuleExists(name) {
- ctx.AddReverseDependency(ctx.Module(), prebuiltDependencyTag, name)
+ ctx.AddReverseDependency(ctx.Module(), prebuiltDepTag, name)
p.Properties.SourceExists = true
} else {
ctx.Rename(name)
@@ -72,12 +76,17 @@
}
}
-// PrebuiltSelectModuleMutator marks prebuilts that are overriding source modules, and disables
-// installing the source module.
+// PrebuiltSelectModuleMutator marks prebuilts that are used, either overriding source modules or
+// because the source module doesn't exist. It also disables installing overridden source modules.
func PrebuiltSelectModuleMutator(ctx TopDownMutatorContext) {
- if s, ok := ctx.Module().(Module); ok {
+ if m, ok := ctx.Module().(PrebuiltInterface); ok && m.Prebuilt() != nil {
+ p := m.Prebuilt()
+ if !p.Properties.SourceExists {
+ p.Properties.UsePrebuilt = p.usePrebuilt(ctx, nil)
+ }
+ } else if s, ok := ctx.Module().(Module); ok {
ctx.VisitDirectDeps(func(m blueprint.Module) {
- if ctx.OtherModuleDependencyTag(m) == prebuiltDependencyTag {
+ if ctx.OtherModuleDependencyTag(m) == prebuiltDepTag {
p := m.(PrebuiltInterface).Prebuilt()
if p.usePrebuilt(ctx, s) {
p.Properties.UsePrebuilt = true
@@ -117,5 +126,5 @@
return true
}
- return !source.Enabled()
+ return source == nil || !source.Enabled()
}
diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go
index 311f821..d09518b 100644
--- a/android/prebuilt_test.go
+++ b/android/prebuilt_test.go
@@ -144,20 +144,33 @@
t.Fatalf("failed to find module foo")
}
+ var dependsOnSourceModule, dependsOnPrebuiltModule bool
+ ctx.VisitDirectDeps(foo, func(m blueprint.Module) {
+ if _, ok := m.(*sourceModule); ok {
+ dependsOnSourceModule = true
+ }
+ if p, ok := m.(*prebuiltModule); ok {
+ dependsOnPrebuiltModule = true
+ if !p.Prebuilt().Properties.UsePrebuilt {
+ t.Errorf("dependency on prebuilt module not marked used")
+ }
+ }
+ })
+
if test.prebuilt {
- if !foo.(*sourceModule).dependsOnPrebuiltModule {
+ if !dependsOnPrebuiltModule {
t.Errorf("doesn't depend on prebuilt module")
}
- if foo.(*sourceModule).dependsOnSourceModule {
+ if dependsOnSourceModule {
t.Errorf("depends on source module")
}
} else {
- if foo.(*sourceModule).dependsOnPrebuiltModule {
+ if dependsOnPrebuiltModule {
t.Errorf("depends on prebuilt module")
}
- if !foo.(*sourceModule).dependsOnSourceModule {
+ if !dependsOnSourceModule {
t.Errorf("doens't depend on source module")
}
}
@@ -209,14 +222,6 @@
}
func (s *sourceModule) GenerateAndroidBuildActions(ctx ModuleContext) {
- ctx.VisitDirectDeps(func(m blueprint.Module) {
- if _, ok := m.(*sourceModule); ok {
- s.dependsOnSourceModule = true
- }
- if _, ok := m.(*prebuiltModule); ok {
- s.dependsOnPrebuiltModule = true
- }
- })
}
func findModule(ctx *blueprint.Context, name string) blueprint.Module {
diff --git a/android/register.go b/android/register.go
index d6b290d..9396664 100644
--- a/android/register.go
+++ b/android/register.go
@@ -15,8 +15,6 @@
package android
import (
- "sync"
-
"github.com/google/blueprint"
)
@@ -51,8 +49,6 @@
singletons = append(singletons, singleton{name, factory})
}
-var registerMutatorsOnce sync.Once
-
func NewContext() *blueprint.Context {
ctx := blueprint.NewContext()
@@ -64,19 +60,8 @@
ctx.RegisterSingletonType(t.name, t.factory)
}
- registerMutatorsOnce.Do(registerMutators)
+ registerMutators(ctx)
- for _, t := range mutators {
- var handle blueprint.MutatorHandle
- if t.bottomUpMutator != nil {
- handle = ctx.RegisterBottomUpMutator(t.name, t.bottomUpMutator)
- } else if t.topDownMutator != nil {
- handle = ctx.RegisterTopDownMutator(t.name, t.topDownMutator)
- }
- if t.parallel {
- handle.Parallel()
- }
- }
ctx.RegisterSingletonType("env", EnvSingleton)
return ctx
diff --git a/android/variable.go b/android/variable.go
index aefe1e3..c5b957b 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -135,8 +135,6 @@
ArtUseReadBarrier *bool `json:",omitempty"`
BtConfigIncludeDir *string `json:",omitempty"`
-
- SameProcessHalDeps []string `json:",omitempty"`
}
func boolPtr(v bool) *bool {
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go
index 8f0ebdf..8d46a78 100644
--- a/androidmk/cmd/androidmk/android.go
+++ b/androidmk/cmd/androidmk/android.go
@@ -12,88 +12,115 @@
clear_vars = "__android_mk_clear_vars"
)
-var standardProperties = map[string]struct {
- string
- bpparser.Type
-}{
- // String properties
- "LOCAL_MODULE": {"name", bpparser.StringType},
- "LOCAL_MODULE_CLASS": {"class", bpparser.StringType},
- "LOCAL_CXX_STL": {"stl", bpparser.StringType},
- "LOCAL_STRIP_MODULE": {"strip", bpparser.StringType},
- "LOCAL_MULTILIB": {"compile_multilib", bpparser.StringType},
- "LOCAL_ARM_MODE_HACK": {"instruction_set", bpparser.StringType},
- "LOCAL_SDK_VERSION": {"sdk_version", bpparser.StringType},
- "LOCAL_NDK_STL_VARIANT": {"stl", bpparser.StringType},
- "LOCAL_JAR_MANIFEST": {"manifest", bpparser.StringType},
- "LOCAL_JARJAR_RULES": {"jarjar_rules", bpparser.StringType},
- "LOCAL_CERTIFICATE": {"certificate", bpparser.StringType},
- "LOCAL_PACKAGE_NAME": {"name", bpparser.StringType},
- "LOCAL_MODULE_RELATIVE_PATH": {"relative_install_path", bpparser.StringType},
- "LOCAL_PROTOC_OPTIMIZE_TYPE": {"proto.type", bpparser.StringType},
-
- // List properties
- "LOCAL_SRC_FILES_EXCLUDE": {"exclude_srcs", bpparser.ListType},
- "LOCAL_SHARED_LIBRARIES": {"shared_libs", bpparser.ListType},
- "LOCAL_STATIC_LIBRARIES": {"static_libs", bpparser.ListType},
- "LOCAL_WHOLE_STATIC_LIBRARIES": {"whole_static_libs", bpparser.ListType},
- "LOCAL_SYSTEM_SHARED_LIBRARIES": {"system_shared_libs", bpparser.ListType},
- "LOCAL_HEADER_LIBRARIES": {"header_libs", bpparser.ListType},
- "LOCAL_ASFLAGS": {"asflags", bpparser.ListType},
- "LOCAL_CLANG_ASFLAGS": {"clang_asflags", bpparser.ListType},
- "LOCAL_CFLAGS": {"cflags", bpparser.ListType},
- "LOCAL_CONLYFLAGS": {"conlyflags", bpparser.ListType},
- "LOCAL_CPPFLAGS": {"cppflags", bpparser.ListType},
- "LOCAL_REQUIRED_MODULES": {"required", bpparser.ListType},
- "LOCAL_MODULE_TAGS": {"tags", bpparser.ListType},
- "LOCAL_LDLIBS": {"host_ldlibs", bpparser.ListType},
- "LOCAL_CLANG_CFLAGS": {"clang_cflags", bpparser.ListType},
- "LOCAL_YACCFLAGS": {"yaccflags", bpparser.ListType},
- "LOCAL_SANITIZE_RECOVER": {"sanitize.recover", bpparser.ListType},
- "LOCAL_LOGTAGS_FILES": {"logtags", bpparser.ListType},
- "LOCAL_EXPORT_SHARED_LIBRARY_HEADERS": {"export_shared_lib_headers", bpparser.ListType},
- "LOCAL_EXPORT_STATIC_LIBRARY_HEADERS": {"export_static_lib_headers", bpparser.ListType},
- "LOCAL_INIT_RC": {"init_rc", bpparser.ListType},
- "LOCAL_TIDY_FLAGS": {"tidy_flags", bpparser.ListType},
- // TODO: This is comma-seperated, not space-separated
- "LOCAL_TIDY_CHECKS": {"tidy_checks", bpparser.ListType},
-
- "LOCAL_JAVA_RESOURCE_DIRS": {"java_resource_dirs", bpparser.ListType},
- "LOCAL_JAVACFLAGS": {"javacflags", bpparser.ListType},
- "LOCAL_DX_FLAGS": {"dxflags", bpparser.ListType},
- "LOCAL_JAVA_LIBRARIES": {"java_libs", bpparser.ListType},
- "LOCAL_STATIC_JAVA_LIBRARIES": {"java_static_libs", bpparser.ListType},
- "LOCAL_AIDL_INCLUDES": {"aidl_includes", bpparser.ListType},
- "LOCAL_AAPT_FLAGS": {"aaptflags", bpparser.ListType},
- "LOCAL_PACKAGE_SPLITS": {"package_splits", bpparser.ListType},
-
- // Bool properties
- "LOCAL_IS_HOST_MODULE": {"host", bpparser.BoolType},
- "LOCAL_CLANG": {"clang", bpparser.BoolType},
- "LOCAL_FORCE_STATIC_EXECUTABLE": {"static_executable", bpparser.BoolType},
- "LOCAL_NATIVE_COVERAGE": {"native_coverage", bpparser.BoolType},
- "LOCAL_NO_CRT": {"nocrt", bpparser.BoolType},
- "LOCAL_ALLOW_UNDEFINED_SYMBOLS": {"allow_undefined_symbols", bpparser.BoolType},
- "LOCAL_RTTI_FLAG": {"rtti", bpparser.BoolType},
- "LOCAL_NO_STANDARD_LIBRARIES": {"no_standard_libraries", bpparser.BoolType},
- "LOCAL_PACK_MODULE_RELOCATIONS": {"pack_relocations", bpparser.BoolType},
- "LOCAL_TIDY": {"tidy", bpparser.BoolType},
- "LOCAL_USE_VNDK": {"use_vndk", bpparser.BoolType},
- "LOCAL_PROPRIETARY_MODULE": {"proprietary", bpparser.BoolType},
-
- "LOCAL_EXPORT_PACKAGE_RESOURCES": {"export_package_resources", bpparser.BoolType},
+type bpVariable struct {
+ name string
+ variableType bpparser.Type
}
-var rewriteProperties = map[string]struct {
- f func(file *bpFile, prefix string, value *mkparser.MakeString, append bool) error
-}{
- "LOCAL_C_INCLUDES": {localIncludeDirs},
- "LOCAL_EXPORT_C_INCLUDE_DIRS": {exportIncludeDirs},
- "LOCAL_MODULE_STEM": {stem},
- "LOCAL_MODULE_HOST_OS": {hostOs},
- "LOCAL_SRC_FILES": {srcFiles},
- "LOCAL_SANITIZE": {sanitize},
- "LOCAL_LDFLAGS": {ldflags},
+type variableAssignmentContext struct {
+ file *bpFile
+ prefix string
+ mkvalue *mkparser.MakeString
+ append bool
+}
+
+var rewriteProperties = map[string](func(variableAssignmentContext) error){
+ // custom functions
+ "LOCAL_C_INCLUDES": localIncludeDirs,
+ "LOCAL_EXPORT_C_INCLUDE_DIRS": exportIncludeDirs,
+ "LOCAL_LDFLAGS": ldflags,
+ "LOCAL_MODULE_STEM": stem,
+ "LOCAL_MODULE_HOST_OS": hostOs,
+ "LOCAL_SRC_FILES": srcFiles,
+ "LOCAL_SANITIZE": sanitize,
+
+ // composite functions
+ "LOCAL_MODULE_TAGS": includeVariableIf(bpVariable{"tags", bpparser.ListType}, not(valueDumpEquals("optional"))),
+
+ // skip functions
+ "LOCAL_ADDITIONAL_DEPENDENCIES": skip, // TODO: check for only .mk files?
+ "LOCAL_CPP_EXTENSION": skip,
+ "LOCAL_PATH": skip, // Nothing to do, except maybe avoid the "./" in paths?
+}
+
+// adds a group of properties all having the same type
+func addStandardProperties(propertyType bpparser.Type, properties map[string]string) {
+ for key, val := range properties {
+ rewriteProperties[key] = includeVariable(bpVariable{val, propertyType})
+ }
+}
+
+func init() {
+ addStandardProperties(bpparser.StringType,
+ map[string]string{
+ "LOCAL_MODULE": "name",
+ "LOCAL_MODULE_CLASS": "class",
+ "LOCAL_CXX_STL": "stl",
+ "LOCAL_STRIP_MODULE": "strip",
+ "LOCAL_MULTILIB": "compile_multilib",
+ "LOCAL_ARM_MODE_HACK": "instruction_set",
+ "LOCAL_SDK_VERSION": "sdk_version",
+ "LOCAL_NDK_STL_VARIANT": "stl",
+ "LOCAL_JAR_MANIFEST": "manifest",
+ "LOCAL_JARJAR_RULES": "jarjar_rules",
+ "LOCAL_CERTIFICATE": "certificate",
+ "LOCAL_PACKAGE_NAME": "name",
+ "LOCAL_MODULE_RELATIVE_PATH": "relative_install_path",
+ "LOCAL_PROTOC_OPTIMIZE_TYPE": "proto.type",
+ "LOCAL_HEADER_LIBRARIES": "header_libs",
+ })
+ addStandardProperties(bpparser.ListType,
+ map[string]string{
+ "LOCAL_SRC_FILES_EXCLUDE": "exclude_srcs",
+ "LOCAL_SHARED_LIBRARIES": "shared_libs",
+ "LOCAL_STATIC_LIBRARIES": "static_libs",
+ "LOCAL_WHOLE_STATIC_LIBRARIES": "whole_static_libs",
+ "LOCAL_SYSTEM_SHARED_LIBRARIES": "system_shared_libs",
+ "LOCAL_ASFLAGS": "asflags",
+ "LOCAL_CLANG_ASFLAGS": "clang_asflags",
+ "LOCAL_CFLAGS": "cflags",
+ "LOCAL_CONLYFLAGS": "conlyflags",
+ "LOCAL_CPPFLAGS": "cppflags",
+ "LOCAL_REQUIRED_MODULES": "required",
+ "LOCAL_LDLIBS": "host_ldlibs",
+ "LOCAL_CLANG_CFLAGS": "clang_cflags",
+ "LOCAL_YACCFLAGS": "yaccflags",
+ "LOCAL_SANITIZE_RECOVER": "sanitize.recover",
+ "LOCAL_LOGTAGS_FILES": "logtags",
+ "LOCAL_EXPORT_SHARED_LIBRARY_HEADERS": "export_shared_lib_headers",
+ "LOCAL_EXPORT_STATIC_LIBRARY_HEADERS": "export_static_lib_headers",
+ "LOCAL_INIT_RC": "init_rc",
+ "LOCAL_TIDY_FLAGS": "tidy_flags",
+ // TODO: This is comma-separated, not space-separated
+ "LOCAL_TIDY_CHECKS": "tidy_checks",
+
+ "LOCAL_JAVA_RESOURCE_DIRS": "java_resource_dirs",
+ "LOCAL_JAVACFLAGS": "javacflags",
+ "LOCAL_DX_FLAGS": "dxflags",
+ "LOCAL_JAVA_LIBRARIES": "java_libs",
+ "LOCAL_STATIC_JAVA_LIBRARIES": "java_static_libs",
+ "LOCAL_AIDL_INCLUDES": "aidl_includes",
+ "LOCAL_AAPT_FLAGS": "aaptflags",
+ "LOCAL_PACKAGE_SPLITS": "package_splits",
+ })
+ addStandardProperties(bpparser.BoolType,
+ map[string]string{
+ // Bool properties
+ "LOCAL_IS_HOST_MODULE": "host",
+ "LOCAL_CLANG": "clang",
+ "LOCAL_FORCE_STATIC_EXECUTABLE": "static_executable",
+ "LOCAL_NATIVE_COVERAGE": "native_coverage",
+ "LOCAL_NO_CRT": "nocrt",
+ "LOCAL_ALLOW_UNDEFINED_SYMBOLS": "allow_undefined_symbols",
+ "LOCAL_RTTI_FLAG": "rtti",
+ "LOCAL_NO_STANDARD_LIBRARIES": "no_standard_libraries",
+ "LOCAL_PACK_MODULE_RELOCATIONS": "pack_relocations",
+ "LOCAL_TIDY": "tidy",
+ "LOCAL_USE_VNDK": "use_vndk",
+ "LOCAL_PROPRIETARY_MODULE": "proprietary",
+
+ "LOCAL_EXPORT_PACKAGE_RESOURCES": "export_package_resources",
+ })
}
type listSplitFunc func(bpparser.Expression) (string, bpparser.Expression, error)
@@ -220,8 +247,8 @@
}
}
-func localIncludeDirs(file *bpFile, prefix string, value *mkparser.MakeString, appendVariable bool) error {
- val, err := makeVariableToBlueprint(file, value, bpparser.ListType)
+func localIncludeDirs(ctx variableAssignmentContext) error {
+ val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
if err != nil {
return err
}
@@ -232,14 +259,14 @@
}
if global, ok := lists["global"]; ok && !emptyList(global) {
- err = setVariable(file, appendVariable, prefix, "include_dirs", global, true)
+ err = setVariable(ctx.file, ctx.append, ctx.prefix, "include_dirs", global, true)
if err != nil {
return err
}
}
if local, ok := lists["local"]; ok && !emptyList(local) {
- err = setVariable(file, appendVariable, prefix, "local_include_dirs", local, true)
+ err = setVariable(ctx.file, ctx.append, ctx.prefix, "local_include_dirs", local, true)
if err != nil {
return err
}
@@ -248,8 +275,8 @@
return nil
}
-func exportIncludeDirs(file *bpFile, prefix string, value *mkparser.MakeString, appendVariable bool) error {
- val, err := makeVariableToBlueprint(file, value, bpparser.ListType)
+func exportIncludeDirs(ctx variableAssignmentContext) error {
+ val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
if err != nil {
return err
}
@@ -260,17 +287,17 @@
}
if local, ok := lists["local"]; ok && !emptyList(local) {
- err = setVariable(file, appendVariable, prefix, "export_include_dirs", local, true)
+ err = setVariable(ctx.file, ctx.append, ctx.prefix, "export_include_dirs", local, true)
if err != nil {
return err
}
- appendVariable = true
+ ctx.append = true
}
// Add any paths that could not be converted to local relative paths to export_include_dirs
// anyways, they will cause an error if they don't exist and can be fixed manually.
if global, ok := lists["global"]; ok && !emptyList(global) {
- err = setVariable(file, appendVariable, prefix, "export_include_dirs", global, true)
+ err = setVariable(ctx.file, ctx.append, ctx.prefix, "export_include_dirs", global, true)
if err != nil {
return err
}
@@ -279,8 +306,8 @@
return nil
}
-func stem(file *bpFile, prefix string, value *mkparser.MakeString, appendVariable bool) error {
- val, err := makeVariableToBlueprint(file, value, bpparser.StringType)
+func stem(ctx variableAssignmentContext) error {
+ val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.StringType)
if err != nil {
return err
}
@@ -293,11 +320,11 @@
}
}
- return setVariable(file, appendVariable, prefix, varName, val, true)
+ return setVariable(ctx.file, ctx.append, ctx.prefix, varName, val, true)
}
-func hostOs(file *bpFile, prefix string, value *mkparser.MakeString, appendVariable bool) error {
- val, err := makeVariableToBlueprint(file, value, bpparser.ListType)
+func hostOs(ctx variableAssignmentContext) error {
+ val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
if err != nil {
return err
}
@@ -320,15 +347,15 @@
}
if inList("windows") {
- err = setVariable(file, appendVariable, "target.windows", "enabled", trueValue, true)
+ err = setVariable(ctx.file, ctx.append, "target.windows", "enabled", trueValue, true)
}
if !inList("linux") && err == nil {
- err = setVariable(file, appendVariable, "target.linux", "enabled", falseValue, true)
+ err = setVariable(ctx.file, ctx.append, "target.linux", "enabled", falseValue, true)
}
if !inList("darwin") && err == nil {
- err = setVariable(file, appendVariable, "target.darwin", "enabled", falseValue, true)
+ err = setVariable(ctx.file, ctx.append, "target.darwin", "enabled", falseValue, true)
}
return err
@@ -353,8 +380,8 @@
}
-func srcFiles(file *bpFile, prefix string, value *mkparser.MakeString, appendVariable bool) error {
- val, err := makeVariableToBlueprint(file, value, bpparser.ListType)
+func srcFiles(ctx variableAssignmentContext) error {
+ val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
if err != nil {
return err
}
@@ -362,14 +389,14 @@
lists, err := splitBpList(val, splitSrcsLogtags)
if srcs, ok := lists["srcs"]; ok && !emptyList(srcs) {
- err = setVariable(file, appendVariable, prefix, "srcs", srcs, true)
+ err = setVariable(ctx.file, ctx.append, ctx.prefix, "srcs", srcs, true)
if err != nil {
return err
}
}
if logtags, ok := lists["logtags"]; ok && !emptyList(logtags) {
- err = setVariable(file, true, prefix, "logtags", logtags, true)
+ err = setVariable(ctx.file, true, ctx.prefix, "logtags", logtags, true)
if err != nil {
return err
}
@@ -378,8 +405,8 @@
return nil
}
-func sanitize(file *bpFile, prefix string, mkvalue *mkparser.MakeString, appendVariable bool) error {
- val, err := makeVariableToBlueprint(file, mkvalue, bpparser.ListType)
+func sanitize(ctx variableAssignmentContext) error {
+ val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
if err != nil {
return err
}
@@ -389,7 +416,7 @@
case *bpparser.Variable:
return "vars", value, nil
case *bpparser.Operator:
- file.errorf(mkvalue, "unknown sanitize expression")
+ ctx.file.errorf(ctx.mkvalue, "unknown sanitize expression")
return "unknown", value, nil
case *bpparser.String:
switch v.Value {
@@ -399,7 +426,7 @@
}
return v.Value, bpTrue, nil
default:
- file.errorf(mkvalue, "unknown sanitize argument: %s", v.Value)
+ ctx.file.errorf(ctx.mkvalue, "unknown sanitize argument: %s", v.Value)
return "unknown", value, nil
}
default:
@@ -417,13 +444,13 @@
switch k {
case "never", "address", "coverage", "integer", "thread", "undefined":
- err = setVariable(file, false, prefix, "sanitize."+k, lists[k].(*bpparser.List).Values[0], true)
+ err = setVariable(ctx.file, false, ctx.prefix, "sanitize."+k, lists[k].(*bpparser.List).Values[0], true)
case "unknown":
- // Nothing, we already added the error above
+ // Nothing, we already added the error above
case "vars":
fallthrough
default:
- err = setVariable(file, true, prefix, "sanitize", v, true)
+ err = setVariable(ctx.file, true, ctx.prefix, "sanitize", v, true)
}
if err != nil {
@@ -434,8 +461,8 @@
return err
}
-func ldflags(file *bpFile, prefix string, mkvalue *mkparser.MakeString, appendVariable bool) error {
- val, err := makeVariableToBlueprint(file, mkvalue, bpparser.ListType)
+func ldflags(ctx variableAssignmentContext) error {
+ val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
if err != nil {
return err
}
@@ -457,13 +484,13 @@
}
if v, ok := exp2.Args[1].(*bpparser.Variable); !ok || v.Name != "LOCAL_PATH" {
- file.errorf(mkvalue, "Unrecognized version-script")
+ ctx.file.errorf(ctx.mkvalue, "Unrecognized version-script")
return "ldflags", value, nil
}
s, ok := exp1.Args[1].(*bpparser.String)
if !ok {
- file.errorf(mkvalue, "Unrecognized version-script")
+ ctx.file.errorf(ctx.mkvalue, "Unrecognized version-script")
return "ldflags", value, nil
}
@@ -476,7 +503,7 @@
}
if ldflags, ok := lists["ldflags"]; ok && !emptyList(ldflags) {
- err = setVariable(file, appendVariable, prefix, "ldflags", ldflags, true)
+ err = setVariable(ctx.file, ctx.append, ctx.prefix, "ldflags", ldflags, true)
if err != nil {
return err
}
@@ -484,9 +511,9 @@
if version_script, ok := lists["version"]; ok && !emptyList(version_script) {
if len(version_script.(*bpparser.List).Values) > 1 {
- file.errorf(mkvalue, "multiple version scripts found?")
+ ctx.file.errorf(ctx.mkvalue, "multiple version scripts found?")
}
- err = setVariable(file, false, prefix, "version_script", version_script.(*bpparser.List).Values[0], true)
+ err = setVariable(ctx.file, false, ctx.prefix, "version_script", version_script.(*bpparser.List).Values[0], true)
if err != nil {
return err
}
@@ -495,8 +522,52 @@
return nil
}
-var deleteProperties = map[string]struct{}{
- "LOCAL_CPP_EXTENSION": struct{}{},
+// given a conditional, returns a function that will insert a variable assignment or not, based on the conditional
+func includeVariableIf(bpVar bpVariable, conditional func(ctx variableAssignmentContext) bool) func(ctx variableAssignmentContext) error {
+ return func(ctx variableAssignmentContext) error {
+ var err error
+ if conditional(ctx) {
+ err = includeVariableNow(bpVar, ctx)
+ }
+ return err
+ }
+}
+
+// given a variable, returns a function that will always insert a variable assignment
+func includeVariable(bpVar bpVariable) func(ctx variableAssignmentContext) error {
+ return includeVariableIf(bpVar, always)
+}
+
+func includeVariableNow(bpVar bpVariable, ctx variableAssignmentContext) error {
+ var val bpparser.Expression
+ var err error
+ val, err = makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpVar.variableType)
+ if err == nil {
+ err = setVariable(ctx.file, ctx.append, ctx.prefix, bpVar.name, val, true)
+ }
+ return err
+}
+
+// given a function that returns a bool, returns a function that returns the opposite
+func not(conditional func(ctx variableAssignmentContext) bool) func(ctx variableAssignmentContext) bool {
+ return func(ctx variableAssignmentContext) bool {
+ return !conditional(ctx)
+ }
+}
+
+// returns a function that tells whether mkvalue.Dump equals the given query string
+func valueDumpEquals(textToMatch string) func(ctx variableAssignmentContext) bool {
+ return func(ctx variableAssignmentContext) bool {
+ return (ctx.mkvalue.Dump() == textToMatch)
+ }
+}
+
+func always(ctx variableAssignmentContext) bool {
+ return true
+}
+
+func skip(ctx variableAssignmentContext) error {
+ return nil
}
// Shorter suffixes of other suffixes must be at the end of the list
diff --git a/androidmk/cmd/androidmk/androidmk.go b/androidmk/cmd/androidmk/androidmk.go
index 729e4f2..1d94b65 100644
--- a/androidmk/cmd/androidmk/androidmk.go
+++ b/androidmk/cmd/androidmk/androidmk.go
@@ -233,28 +233,16 @@
appendVariable := assignment.Type == "+="
var err error
- if prop, ok := standardProperties[name]; ok {
- var val bpparser.Expression
- val, err = makeVariableToBlueprint(file, assignment.Value, prop.Type)
- if err == nil {
- err = setVariable(file, appendVariable, prefix, prop.string, val, true)
- }
- } else if prop, ok := rewriteProperties[name]; ok {
- err = prop.f(file, prefix, assignment.Value, appendVariable)
- } else if _, ok := deleteProperties[name]; ok {
- return
+ if prop, ok := rewriteProperties[name]; ok {
+ err = prop(variableAssignmentContext{file, prefix, assignment.Value, appendVariable})
} else {
switch {
- case name == "LOCAL_PATH":
- // Nothing to do, except maybe avoid the "./" in paths?
case name == "LOCAL_ARM_MODE":
// This is a hack to get the LOCAL_ARM_MODE value inside
// of an arch: { arm: {} } block.
armModeAssign := assignment
armModeAssign.Name = mkparser.SimpleMakeString("LOCAL_ARM_MODE_HACK_arm", assignment.Name.Pos())
handleAssignment(file, armModeAssign, c)
- case name == "LOCAL_ADDITIONAL_DEPENDENCIES":
- // TODO: check for only .mk files?
case strings.HasPrefix(name, "LOCAL_"):
file.errorf(assignment, "unsupported assignment to %s", name)
return
diff --git a/androidmk/cmd/androidmk/androidmk_test.go b/androidmk/cmd/androidmk/androidmk_test.go
index 2f4daf7..0c44ea7 100644
--- a/androidmk/cmd/androidmk/androidmk_test.go
+++ b/androidmk/cmd/androidmk/androidmk_test.go
@@ -357,6 +357,34 @@
}
`,
},
+ {
+ desc: "Remove LOCAL_MODULE_TAGS optional",
+ in: `
+include $(CLEAR_VARS)
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_SHARED_LIBRARY)
+`,
+
+ expected: `
+cc_library_shared {
+
+}
+`,
+ },
+ {
+ desc: "Keep LOCAL_MODULE_TAGS non-optional",
+ in: `
+include $(CLEAR_VARS)
+LOCAL_MODULE_TAGS := debug
+include $(BUILD_SHARED_LIBRARY)
+`,
+
+ expected: `
+cc_library_shared {
+ tags: ["debug"],
+}
+`,
+ },
}
func reformatBlueprint(input string) string {
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 0cd6faf..f45fbbe 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -156,14 +156,6 @@
}
}
-func (vndkLibrary *vndkExtLibraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
- fmt.Fprintln(w, "LOCAL_EXTENDS_MODULE := ", vndkLibrary.properties.Extends)
- return nil
- })
- vndkLibrary.libraryDecorator.AndroidMk(ctx, ret)
-}
-
func (object *objectLinker) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ret.Custom = func(w io.Writer, name, prefix, moduleDir string) error {
out := ret.OutputFile.Path()
diff --git a/cc/cc.go b/cc/cc.go
index c5f1c35..4c69723 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -163,9 +163,6 @@
vndk() bool
selectedStl() string
baseModuleName() string
- isNdk() bool
- isVndk() bool
- isSameProcessHal() bool
}
type ModuleContext interface {
@@ -408,18 +405,6 @@
return ctx.mod.ModuleBase.BaseModuleName()
}
-func (ctx *moduleContextImpl) isNdk() bool {
- return inList(ctx.baseModuleName(), ndkPrebuiltSharedLibraries)
-}
-
-func (ctx *moduleContextImpl) isVndk() bool {
- return config.IsVndkLibrary(ctx.baseModuleName())
-}
-
-func (ctx *moduleContextImpl) isSameProcessHal() bool {
- return inList(ctx.baseModuleName(), ctx.ctx.DeviceConfig().SameProcessHalDeps())
-}
-
func newBaseModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module {
return &Module{
hod: hod,
diff --git a/cc/config/global.go b/cc/config/global.go
index 68de5d0..1ce1cce 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -176,11 +176,3 @@
func VndkLibraries() []string {
return []string{}
}
-
-func VndkIndirectLibraries() []string {
- return []string{}
-}
-
-func IsVndkLibrary(name string) bool {
- return inList(name, VndkLibraries()) || inList(name, VndkIndirectLibraries())
-}
diff --git a/cc/installer.go b/cc/installer.go
index de04ab6..64f87d9 100644
--- a/cc/installer.go
+++ b/cc/installer.go
@@ -47,7 +47,6 @@
dir string
dir64 string
- subDir string
relative string
location installLocation
@@ -61,14 +60,14 @@
}
func (installer *baseInstaller) installDir(ctx ModuleContext) android.OutputPath {
- dir := installer.dir
+ subDir := installer.dir
if ctx.toolchain().Is64Bit() && installer.dir64 != "" {
- dir = installer.dir64
+ subDir = installer.dir64
}
if !ctx.Host() && !ctx.Arch().Native {
- dir = filepath.Join(dir, ctx.Arch().ArchType.String())
+ subDir = filepath.Join(subDir, ctx.Arch().ArchType.String())
}
- return android.PathForModuleInstall(ctx, dir, installer.subDir, installer.Properties.Relative_install_path, installer.relative)
+ return android.PathForModuleInstall(ctx, subDir, installer.Properties.Relative_install_path, installer.relative)
}
func (installer *baseInstaller) install(ctx ModuleContext, file android.Path) {
diff --git a/cc/library.go b/cc/library.go
index 0ce84a1..0658fef 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -587,26 +587,6 @@
func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
if !ctx.static() {
- if ctx.Device() {
- if ctx.isNdk() {
- library.baseInstaller.subDir = "ndk"
- if ctx.Proprietary() {
- ctx.ModuleErrorf("NDK library must not be proprietary")
- }
- } else if ctx.isVndk() {
- library.baseInstaller.subDir = "vndk"
- if ctx.Proprietary() {
- ctx.ModuleErrorf("VNDK library must not be proprietary")
- }
- } else if ctx.isSameProcessHal() {
- library.baseInstaller.subDir = "sameprocess"
- if !ctx.Proprietary() {
- ctx.ModuleErrorf("SameProcess HAL library must be proprietary")
- }
- } else {
- // Do nothing for other types of lib
- }
- }
library.baseInstaller.install(ctx, file)
}
}
diff --git a/cc/makevars.go b/cc/makevars.go
index 3ab7955..200faff 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -58,7 +58,6 @@
ctx.Strict("BOARD_VNDK_VERSION", "")
}
ctx.Strict("VNDK_LIBRARIES", strings.Join(config.VndkLibraries(), " "))
- ctx.Strict("VNDK_INDIRECT_LIBRARIES", strings.Join(config.VndkIndirectLibraries(), " "))
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS", asanCflags)
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS", asanLdflags)
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index abe03b9..08ba145 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -21,7 +21,9 @@
)
func init() {
- android.RegisterModuleType("cc_prebuilt_shared_library", prebuiltSharedLibraryFactory)
+ android.RegisterModuleType("cc_prebuilt_library_shared", prebuiltSharedLibraryFactory)
+ android.RegisterModuleType("cc_prebuilt_library_static", prebuiltStaticLibraryFactory)
+ android.RegisterModuleType("cc_prebuilt_binary", prebuiltBinaryFactory)
}
type prebuiltLinkerInterface interface {
@@ -29,17 +31,21 @@
prebuilt() *android.Prebuilt
}
-type prebuiltLibraryLinker struct {
- *libraryDecorator
+type prebuiltLinker struct {
android.Prebuilt
}
-var _ prebuiltLinkerInterface = (*prebuiltLibraryLinker)(nil)
-
-func (p *prebuiltLibraryLinker) prebuilt() *android.Prebuilt {
+func (p *prebuiltLinker) prebuilt() *android.Prebuilt {
return &p.Prebuilt
}
+type prebuiltLibraryLinker struct {
+ *libraryDecorator
+ prebuiltLinker
+}
+
+var _ prebuiltLinkerInterface = (*prebuiltLibraryLinker)(nil)
+
func (p *prebuiltLibraryLinker) linkerProps() []interface{} {
props := p.libraryDecorator.linkerProps()
return append(props, &p.Prebuilt.Properties)
@@ -61,13 +67,61 @@
func prebuiltSharedLibraryFactory() (blueprint.Module, []interface{}) {
module, library := NewLibrary(android.HostAndDeviceSupported)
+ library.BuildOnlyShared()
module.compiler = nil
prebuilt := &prebuiltLibraryLinker{
libraryDecorator: library,
}
module.linker = prebuilt
- module.installer = prebuilt
+
+ return module.Init()
+}
+
+func prebuiltStaticLibraryFactory() (blueprint.Module, []interface{}) {
+ module, library := NewLibrary(android.HostAndDeviceSupported)
+ library.BuildOnlyStatic()
+ module.compiler = nil
+
+ prebuilt := &prebuiltLibraryLinker{
+ libraryDecorator: library,
+ }
+ module.linker = prebuilt
+
+ return module.Init()
+}
+
+type prebuiltBinaryLinker struct {
+ *binaryDecorator
+ prebuiltLinker
+}
+
+var _ prebuiltLinkerInterface = (*prebuiltBinaryLinker)(nil)
+
+func (p *prebuiltBinaryLinker) linkerProps() []interface{} {
+ props := p.binaryDecorator.linkerProps()
+ return append(props, &p.Prebuilt.Properties)
+}
+
+func (p *prebuiltBinaryLinker) link(ctx ModuleContext,
+ flags Flags, deps PathDeps, objs Objects) android.Path {
+ // TODO(ccross): verify shared library dependencies
+ if len(p.Prebuilt.Properties.Srcs) > 0 {
+ // TODO(ccross): .toc optimization, stripping, packing
+ return p.Prebuilt.Path(ctx)
+ }
+
+ return nil
+}
+
+func prebuiltBinaryFactory() (blueprint.Module, []interface{}) {
+ module, binary := NewBinary(android.HostAndDeviceSupported)
+ module.compiler = nil
+
+ prebuilt := &prebuiltBinaryLinker{
+ binaryDecorator: binary,
+ }
+ module.linker = prebuilt
return module.Init()
}
diff --git a/cc/test_data_test.go b/cc/test_data_test.go
index e3b1214..9b5a85a 100644
--- a/cc/test_data_test.go
+++ b/cc/test_data_test.go
@@ -22,6 +22,8 @@
"testing"
"android/soong/android"
+ "android/soong/genrule"
+
"github.com/google/blueprint"
)
@@ -121,13 +123,15 @@
for _, test := range testDataTests {
t.Run(test.name, func(t *testing.T) {
- ctx := android.NewContext()
+ ctx := blueprint.NewContext()
+ android.RegisterTestMutators(ctx)
ctx.MockFileSystem(map[string][]byte{
"Blueprints": []byte(`subdirs = ["dir"]`),
"dir/Blueprints": []byte(test.modules),
"dir/baz": nil,
"dir/bar/baz": nil,
})
+ ctx.RegisterModuleType("filegroup", genrule.FileGroupFactory)
ctx.RegisterModuleType("test", newTest)
_, errs := ctx.ParseBlueprintsFiles("Blueprints")
diff --git a/cc/vndk_library.go b/cc/vndk_library.go
deleted file mode 100644
index cca4f3f..0000000
--- a/cc/vndk_library.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2017 Google Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cc
-
-import (
- "github.com/google/blueprint"
-
- "android/soong/android"
- "android/soong/cc/config"
-)
-
-type vndkExtLibraryProperties struct {
- // Name of the VNDK library module that this VNDK-ext library is extending.
- // This library will have the same file name and soname as the original VNDK
- // library, but will be installed in /system/lib/vndk-ext rather
- // than /system/lib/vndk.
- Extends string
-}
-
-type vndkExtLibraryDecorator struct {
- *libraryDecorator
-
- properties vndkExtLibraryProperties
-}
-
-func init() {
- android.RegisterModuleType("vndk_ext_library", vndkExtLibraryFactory)
-}
-
-func (deco *vndkExtLibraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
- extends := deco.properties.Extends
- if extends != "" {
- if config.IsVndkLibrary(extends) {
- // TODO(jiyong): ensure that the module referenced by 'extends' exists. Don't know how...
- // Adding a dependency was not successful because it leads to circular dependency
- // in between this and the 'extends' module.
- // Ideally, this should be something like follows:
- // otherCtx = findModuleByName(deco.properties.Extends)
- // if otherCtx != nil && otherCtx.isVndk() {
- // deco.libaryDecorator.libName = otherCtx.getBaseName()
- // }
- deco.libraryDecorator.libName = extends
- } else {
- ctx.PropertyErrorf("extends", "%s should be a VNDK or VNDK-indirect library", extends)
- }
- } else {
- ctx.PropertyErrorf("extends", "missing. A VNDK-ext library must extend existing VNDK library")
- }
- return deco.libraryDecorator.linkerFlags(ctx, flags)
-}
-
-func (deco *vndkExtLibraryDecorator) install(ctx ModuleContext, file android.Path) {
- deco.libraryDecorator.baseInstaller.subDir = "vndk-ext"
- deco.libraryDecorator.baseInstaller.install(ctx, file)
-}
-
-func vndkExtLibraryFactory() (blueprint.Module, []interface{}) {
- module, library := NewLibrary(android.DeviceSupported)
- library.BuildOnlyShared()
-
- _, props := module.Init()
-
- deco := &vndkExtLibraryDecorator{
- libraryDecorator: library,
- }
-
- module.installer = deco
- module.linker = deco
-
- props = append(props, &deco.properties)
-
- return module, props
-}
diff --git a/genrule/filegroup.go b/genrule/filegroup.go
index c1d08a8..71c5439 100644
--- a/genrule/filegroup.go
+++ b/genrule/filegroup.go
@@ -21,7 +21,7 @@
)
func init() {
- android.RegisterModuleType("filegroup", fileGroupFactory)
+ android.RegisterModuleType("filegroup", FileGroupFactory)
}
type fileGroupProperties struct {
@@ -48,7 +48,7 @@
// filegroup modules contain a list of files, and can be used to export files across package
// boundaries. filegroups (and genrules) can be referenced from srcs properties of other modules
// using the syntax ":module".
-func fileGroupFactory() (blueprint.Module, []interface{}) {
+func FileGroupFactory() (blueprint.Module, []interface{}) {
module := &fileGroup{}
return android.InitAndroidModule(module, &module.properties)