Merge "apex: apex_available with prefix" into main
diff --git a/android/all_teams.go b/android/all_teams.go
index e3c2e70..01be396 100644
--- a/android/all_teams.go
+++ b/android/all_teams.go
@@ -1,6 +1,7 @@
package android
import (
+ "path"
"path/filepath"
"android/soong/android/team_proto"
@@ -153,6 +154,11 @@
} else {
teamProperties, found = t.lookupDefaultTeam(m.bpFile)
}
+ // Deal with one blueprint file including another by looking up the default
+ // in the main Android.bp rather than one listed with "build = [My.bp]"
+ if !found {
+ teamProperties, found = t.lookupDefaultTeam(path.Join(path.Dir(m.bpFile), "Android.bp"))
+ }
trendy_team_id := ""
if found {
diff --git a/android/all_teams_test.go b/android/all_teams_test.go
index 96ed92f..fa8c048 100644
--- a/android/all_teams_test.go
+++ b/android/all_teams_test.go
@@ -264,6 +264,84 @@
AssertDeepEquals(t, "compare maps", expectedTeams, actualTeams)
}
+func TestPackageLookupForIncludedBlueprintFiles(t *testing.T) {
+ t.Parallel()
+ rootBp := `
+ package { default_team: "team_top"}
+ team {
+ name: "team_top",
+ trendy_team_id: "trendy://team_top",
+ }
+ build = ["include.bp"]
+ `
+ includeBp := `
+ fake {
+ name: "IncludedModule",
+ } `
+
+ ctx := GroupFixturePreparers(
+ prepareForTestWithTeamAndFakes,
+ PrepareForTestWithPackageModule,
+ FixtureRegisterWithContext(func(ctx RegistrationContext) {
+ ctx.RegisterParallelSingletonType("all_teams", AllTeamsFactory)
+ }),
+ FixtureAddTextFile("Android.bp", rootBp),
+ FixtureAddTextFile("include.bp", includeBp),
+ ).RunTest(t)
+
+ var teams *team_proto.AllTeams
+ teams = getTeamProtoOutput(t, ctx)
+
+ // map of module name -> trendy team name.
+ actualTeams := make(map[string]*string)
+ for _, teamProto := range teams.Teams {
+ actualTeams[teamProto.GetTargetName()] = teamProto.TrendyTeamId
+ }
+ expectedTeams := map[string]*string{
+ "IncludedModule": proto.String("trendy://team_top"),
+ }
+ AssertDeepEquals(t, "compare maps", expectedTeams, actualTeams)
+}
+
+func TestPackageLookupForIncludedBlueprintFilesWithPackageInChildBlueprint(t *testing.T) {
+ t.Parallel()
+ rootBp := `
+ team {
+ name: "team_top",
+ trendy_team_id: "trendy://team_top",
+ }
+ build = ["include.bp"]
+ `
+ includeBp := `
+ package { default_team: "team_top"}
+ fake {
+ name: "IncludedModule",
+ } `
+
+ ctx := GroupFixturePreparers(
+ prepareForTestWithTeamAndFakes,
+ PrepareForTestWithPackageModule,
+ FixtureRegisterWithContext(func(ctx RegistrationContext) {
+ ctx.RegisterParallelSingletonType("all_teams", AllTeamsFactory)
+ }),
+ FixtureAddTextFile("Android.bp", rootBp),
+ FixtureAddTextFile("include.bp", includeBp),
+ ).RunTest(t)
+
+ var teams *team_proto.AllTeams
+ teams = getTeamProtoOutput(t, ctx)
+
+ // map of module name -> trendy team name.
+ actualTeams := make(map[string]*string)
+ for _, teamProto := range teams.Teams {
+ actualTeams[teamProto.GetTargetName()] = teamProto.TrendyTeamId
+ }
+ expectedTeams := map[string]*string{
+ "IncludedModule": proto.String("trendy://team_top"),
+ }
+ AssertDeepEquals(t, "compare maps", expectedTeams, actualTeams)
+}
+
type fakeForTests struct {
ModuleBase
diff --git a/android/sdk.go b/android/sdk.go
index 4bcbe2e..d3f04a4 100644
--- a/android/sdk.go
+++ b/android/sdk.go
@@ -813,6 +813,7 @@
// SdkMemberContext provides access to information common to a specific member.
type SdkMemberContext interface {
+ ConfigAndErrorContext
// SdkModuleContext returns the module context of the sdk common os variant which is creating the
// snapshot.
diff --git a/android/variable_test.go b/android/variable_test.go
index 928bca6..73dc052 100644
--- a/android/variable_test.go
+++ b/android/variable_test.go
@@ -199,9 +199,7 @@
ctx.RegisterModuleType("module3", testProductVariableModuleFactoryFactory(&struct {
Foo []string
}{}))
- ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
- ctx.BottomUp("variable", VariableMutator).Parallel()
- })
+ registerVariableBuildComponents(ctx)
}),
FixtureWithRootAndroidBp(bp),
).RunTest(t)
@@ -210,14 +208,14 @@
var testProductVariableDefaultsProperties = struct {
Product_variables struct {
Eng struct {
- Foo []string
+ Foo []string `android:"arch_variant"`
Bar []string
- }
- }
+ } `android:"arch_variant"`
+ } `android:"arch_variant"`
}{}
type productVariablesDefaultsTestProperties struct {
- Foo []string
+ Foo []string `android:"arch_variant"`
}
type productVariablesDefaultsTestProperties2 struct {
@@ -242,7 +240,7 @@
module := &productVariablesDefaultsTestModule{}
module.AddProperties(&module.properties)
module.variableProperties = testProductVariableDefaultsProperties
- InitAndroidModule(module)
+ InitAndroidArchModule(module, DeviceSupported, MultilibBoth)
InitDefaultableModule(module)
return module
}
@@ -324,3 +322,46 @@
})
}
}
+
+// Test a defaults module that supports more product variable properties than the target module.
+func TestProductVariablesArch(t *testing.T) {
+ bp := `
+ test {
+ name: "foo",
+ arch: {
+ arm: {
+ product_variables: {
+ eng: {
+ foo: ["arm"],
+ },
+ },
+ },
+ arm64: {
+ product_variables: {
+ eng: {
+ foo: ["arm64"],
+ },
+ },
+ },
+ },
+ foo: ["module"],
+ }
+ `
+
+ result := GroupFixturePreparers(
+ FixtureModifyProductVariables(func(variables FixtureProductVariables) {
+ variables.Eng = boolPtr(true)
+ }),
+ PrepareForTestWithArchMutator,
+ PrepareForTestWithVariables,
+ FixtureRegisterWithContext(func(ctx RegistrationContext) {
+ ctx.RegisterModuleType("test", productVariablesDefaultsTestModuleFactory)
+ }),
+ FixtureWithRootAndroidBp(bp),
+ ).RunTest(t)
+
+ foo := result.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*productVariablesDefaultsTestModule)
+
+ want := []string{"module", "arm64"}
+ AssertDeepEquals(t, "foo", want, foo.properties.Foo)
+}
diff --git a/cc/binary_sdk_member.go b/cc/binary_sdk_member.go
index 71e0cd8..8a7ea88 100644
--- a/cc/binary_sdk_member.go
+++ b/cc/binary_sdk_member.go
@@ -132,7 +132,7 @@
if ccModule.linker != nil {
specifiedDeps := specifiedDeps{}
- specifiedDeps = ccModule.linker.linkerSpecifiedDeps(specifiedDeps)
+ specifiedDeps = ccModule.linker.linkerSpecifiedDeps(ctx, ccModule, specifiedDeps)
p.SharedLibs = specifiedDeps.sharedLibs
p.SystemSharedLibs = specifiedDeps.systemSharedLibs
diff --git a/cc/cc.go b/cc/cc.go
index b3cac62..947dc1a 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -613,7 +613,7 @@
coverageOutputFilePath() android.OptionalPath
// Get the deps that have been explicitly specified in the properties.
- linkerSpecifiedDeps(specifiedDeps specifiedDeps) specifiedDeps
+ linkerSpecifiedDeps(ctx android.ConfigAndErrorContext, module *Module, specifiedDeps specifiedDeps) specifiedDeps
moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *android.ModuleInfoJSON)
}
diff --git a/cc/cmake_module_cc.txt b/cc/cmake_module_cc.txt
index 0dc45ae..0f6e62f 100644
--- a/cc/cmake_module_cc.txt
+++ b/cc/cmake_module_cc.txt
@@ -2,10 +2,10 @@
<<$includeDirs := getIncludeDirs .Ctx .M>>
<<$cflags := getCflagsProperty .Ctx .M>>
<<$deps := mapLibraries .Ctx .M (concat5
-(getLinkerProperties .M).Whole_static_libs
-(getLinkerProperties .M).Static_libs
-(getLinkerProperties .M).Shared_libs
-(getLinkerProperties .M).Header_libs
+(getWholeStaticLibsProperty .Ctx .M)
+(getStaticLibsProperty .Ctx .M)
+(getSharedLibsProperty .Ctx .M)
+(getHeaderLibsProperty .Ctx .M)
(getExtraLibs .M)
) .Pprop.LibraryMapping>>
<<$moduleType := getModuleType .M>>
diff --git a/cc/cmake_snapshot.go b/cc/cmake_snapshot.go
index 600ac47..61fa46d 100644
--- a/cc/cmake_snapshot.go
+++ b/cc/cmake_snapshot.go
@@ -204,12 +204,28 @@
return m.compiler.baseCompilerProps()
},
"getCflagsProperty": func(ctx android.ModuleContext, m *Module) []string {
- cflags := m.compiler.baseCompilerProps().Cflags
- return cflags.GetOrDefault(ctx, nil)
+ prop := m.compiler.baseCompilerProps().Cflags
+ return prop.GetOrDefault(ctx, nil)
},
"getLinkerProperties": func(m *Module) BaseLinkerProperties {
return m.linker.baseLinkerProps()
},
+ "getWholeStaticLibsProperty": func(ctx android.ModuleContext, m *Module) []string {
+ prop := m.linker.baseLinkerProps().Whole_static_libs
+ return prop.GetOrDefault(ctx, nil)
+ },
+ "getStaticLibsProperty": func(ctx android.ModuleContext, m *Module) []string {
+ prop := m.linker.baseLinkerProps().Static_libs
+ return prop.GetOrDefault(ctx, nil)
+ },
+ "getSharedLibsProperty": func(ctx android.ModuleContext, m *Module) []string {
+ prop := m.linker.baseLinkerProps().Shared_libs
+ return prop.GetOrDefault(ctx, nil)
+ },
+ "getHeaderLibsProperty": func(ctx android.ModuleContext, m *Module) []string {
+ prop := m.linker.baseLinkerProps().Header_libs
+ return prop.GetOrDefault(ctx, nil)
+ },
"getExtraLibs": getExtraLibs,
"getIncludeDirs": getIncludeDirs,
"mapLibraries": func(ctx android.ModuleContext, m *Module, libs []string, mapping map[string]LibraryMappingProperty) []string {
diff --git a/cc/compiler.go b/cc/compiler.go
index 0e0b9a7..396ec88 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -798,13 +798,13 @@
Local_include_dirs []string `android:"arch_variant,variant_prepend"`
// list of static libraries that provide headers for this binding.
- Static_libs []string `android:"arch_variant,variant_prepend"`
+ Static_libs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// list of shared libraries that provide headers for this binding.
- Shared_libs []string `android:"arch_variant"`
+ Shared_libs proptools.Configurable[[]string] `android:"arch_variant"`
// List of libraries which export include paths required for this module
- Header_libs []string `android:"arch_variant,variant_prepend"`
+ Header_libs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// list of clang flags required to correctly interpret the headers.
Cflags proptools.Configurable[[]string] `android:"arch_variant"`
diff --git a/cc/library.go b/cc/library.go
index de0070a..6017848 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -152,11 +152,11 @@
Cflags proptools.Configurable[[]string] `android:"arch_variant"`
- Enabled *bool `android:"arch_variant"`
- Whole_static_libs []string `android:"arch_variant"`
- Static_libs []string `android:"arch_variant"`
- Shared_libs []string `android:"arch_variant"`
- System_shared_libs []string `android:"arch_variant"`
+ Enabled *bool `android:"arch_variant"`
+ Whole_static_libs proptools.Configurable[[]string] `android:"arch_variant"`
+ Static_libs proptools.Configurable[[]string] `android:"arch_variant"`
+ Shared_libs proptools.Configurable[[]string] `android:"arch_variant"`
+ System_shared_libs []string `android:"arch_variant"`
Export_shared_lib_headers []string `android:"arch_variant"`
Export_static_lib_headers []string `android:"arch_variant"`
@@ -837,9 +837,9 @@
if library.static() {
deps.WholeStaticLibs = append(deps.WholeStaticLibs,
- library.StaticProperties.Static.Whole_static_libs...)
- deps.StaticLibs = append(deps.StaticLibs, library.StaticProperties.Static.Static_libs...)
- deps.SharedLibs = append(deps.SharedLibs, library.StaticProperties.Static.Shared_libs...)
+ library.StaticProperties.Static.Whole_static_libs.GetOrDefault(ctx, nil)...)
+ deps.StaticLibs = append(deps.StaticLibs, library.StaticProperties.Static.Static_libs.GetOrDefault(ctx, nil)...)
+ deps.SharedLibs = append(deps.SharedLibs, library.StaticProperties.Static.Shared_libs.GetOrDefault(ctx, nil)...)
deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, library.StaticProperties.Static.Export_shared_lib_headers...)
deps.ReexportStaticLibHeaders = append(deps.ReexportStaticLibHeaders, library.StaticProperties.Static.Export_static_lib_headers...)
@@ -852,9 +852,9 @@
if library.baseLinker.Properties.crtPadSegment() {
deps.CrtEnd = append(deps.CrtEnd, ctx.toolchain().CrtPadSegmentSharedLibrary()...)
}
- deps.WholeStaticLibs = append(deps.WholeStaticLibs, library.SharedProperties.Shared.Whole_static_libs...)
- deps.StaticLibs = append(deps.StaticLibs, library.SharedProperties.Shared.Static_libs...)
- deps.SharedLibs = append(deps.SharedLibs, library.SharedProperties.Shared.Shared_libs...)
+ deps.WholeStaticLibs = append(deps.WholeStaticLibs, library.SharedProperties.Shared.Whole_static_libs.GetOrDefault(ctx, nil)...)
+ deps.StaticLibs = append(deps.StaticLibs, library.SharedProperties.Shared.Static_libs.GetOrDefault(ctx, nil)...)
+ deps.SharedLibs = append(deps.SharedLibs, library.SharedProperties.Shared.Shared_libs.GetOrDefault(ctx, nil)...)
deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, library.SharedProperties.Shared.Export_shared_lib_headers...)
deps.ReexportStaticLibHeaders = append(deps.ReexportStaticLibHeaders, library.SharedProperties.Shared.Export_static_lib_headers...)
@@ -900,8 +900,8 @@
return deps
}
-func (library *libraryDecorator) linkerSpecifiedDeps(specifiedDeps specifiedDeps) specifiedDeps {
- specifiedDeps = library.baseLinker.linkerSpecifiedDeps(specifiedDeps)
+func (library *libraryDecorator) linkerSpecifiedDeps(ctx android.ConfigAndErrorContext, module *Module, specifiedDeps specifiedDeps) specifiedDeps {
+ specifiedDeps = library.baseLinker.linkerSpecifiedDeps(ctx, module, specifiedDeps)
var properties StaticOrSharedProperties
if library.static() {
properties = library.StaticProperties.Static
@@ -909,7 +909,8 @@
properties = library.SharedProperties.Shared
}
- specifiedDeps.sharedLibs = append(specifiedDeps.sharedLibs, properties.Shared_libs...)
+ eval := module.ConfigurableEvaluator(ctx)
+ specifiedDeps.sharedLibs = append(specifiedDeps.sharedLibs, properties.Shared_libs.GetOrDefault(eval, nil)...)
// Must distinguish nil and [] in system_shared_libs - ensure that [] in
// either input list doesn't come out as nil.
@@ -2079,12 +2080,12 @@
// include directories.
if len(sharedCompiler.StaticProperties.Static.Cflags.GetOrDefault(ctx, nil)) == 0 &&
len(sharedCompiler.SharedProperties.Shared.Cflags.GetOrDefault(ctx, nil)) == 0 &&
- len(sharedCompiler.StaticProperties.Static.Whole_static_libs) == 0 &&
- len(sharedCompiler.SharedProperties.Shared.Whole_static_libs) == 0 &&
- len(sharedCompiler.StaticProperties.Static.Static_libs) == 0 &&
- len(sharedCompiler.SharedProperties.Shared.Static_libs) == 0 &&
- len(sharedCompiler.StaticProperties.Static.Shared_libs) == 0 &&
- len(sharedCompiler.SharedProperties.Shared.Shared_libs) == 0 &&
+ len(sharedCompiler.StaticProperties.Static.Whole_static_libs.GetOrDefault(ctx, nil)) == 0 &&
+ len(sharedCompiler.SharedProperties.Shared.Whole_static_libs.GetOrDefault(ctx, nil)) == 0 &&
+ len(sharedCompiler.StaticProperties.Static.Static_libs.GetOrDefault(ctx, nil)) == 0 &&
+ len(sharedCompiler.SharedProperties.Shared.Static_libs.GetOrDefault(ctx, nil)) == 0 &&
+ len(sharedCompiler.StaticProperties.Static.Shared_libs.GetOrDefault(ctx, nil)) == 0 &&
+ len(sharedCompiler.SharedProperties.Shared.Shared_libs.GetOrDefault(ctx, nil)) == 0 &&
// Compare System_shared_libs properties with nil because empty lists are
// semantically significant for them.
sharedCompiler.StaticProperties.Static.System_shared_libs == nil &&
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index e8a9827..053c460 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -543,7 +543,7 @@
p.ExportedFlags = exportedInfo.Flags
if ccModule.linker != nil {
specifiedDeps := specifiedDeps{}
- specifiedDeps = ccModule.linker.linkerSpecifiedDeps(specifiedDeps)
+ specifiedDeps = ccModule.linker.linkerSpecifiedDeps(ctx, ccModule, specifiedDeps)
if lib := ccModule.library; lib != nil {
if !lib.hasStubsVariants() {
diff --git a/cc/linker.go b/cc/linker.go
index d2974c2..0056817 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -37,16 +37,16 @@
// in their entirety. For static library modules, all of the .o files from the intermediate
// directory of the dependency will be linked into this modules .a file. For a shared library,
// the dependency's .a file will be linked into this module using -Wl,--whole-archive.
- Whole_static_libs []string `android:"arch_variant,variant_prepend"`
+ Whole_static_libs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// list of modules that should be statically linked into this module.
- Static_libs []string `android:"arch_variant,variant_prepend"`
+ Static_libs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// list of modules that should be dynamically linked into this module.
- Shared_libs []string `android:"arch_variant"`
+ Shared_libs proptools.Configurable[[]string] `android:"arch_variant"`
// list of modules that should only provide headers for this module.
- Header_libs []string `android:"arch_variant,variant_prepend"`
+ Header_libs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// list of module-specific flags that will be used for all link steps
Ldflags []string `android:"arch_variant"`
@@ -296,10 +296,10 @@
}
func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
- deps.WholeStaticLibs = append(deps.WholeStaticLibs, linker.Properties.Whole_static_libs...)
- deps.HeaderLibs = append(deps.HeaderLibs, linker.Properties.Header_libs...)
- deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Static_libs...)
- deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Shared_libs...)
+ deps.WholeStaticLibs = append(deps.WholeStaticLibs, linker.Properties.Whole_static_libs.GetOrDefault(ctx, nil)...)
+ deps.HeaderLibs = append(deps.HeaderLibs, linker.Properties.Header_libs.GetOrDefault(ctx, nil)...)
+ deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Static_libs.GetOrDefault(ctx, nil)...)
+ deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Shared_libs.GetOrDefault(ctx, nil)...)
deps.RuntimeLibs = append(deps.RuntimeLibs, linker.Properties.Runtime_libs...)
deps.ReexportHeaderLibHeaders = append(deps.ReexportHeaderLibHeaders, linker.Properties.Export_header_lib_headers...)
@@ -645,8 +645,9 @@
panic(fmt.Errorf("baseLinker doesn't know how to link"))
}
-func (linker *baseLinker) linkerSpecifiedDeps(specifiedDeps specifiedDeps) specifiedDeps {
- specifiedDeps.sharedLibs = append(specifiedDeps.sharedLibs, linker.Properties.Shared_libs...)
+func (linker *baseLinker) linkerSpecifiedDeps(ctx android.ConfigAndErrorContext, module *Module, specifiedDeps specifiedDeps) specifiedDeps {
+ eval := module.ConfigurableEvaluator(ctx)
+ specifiedDeps.sharedLibs = append(specifiedDeps.sharedLibs, linker.Properties.Shared_libs.GetOrDefault(eval, nil)...)
// Must distinguish nil and [] in system_shared_libs - ensure that [] in
// either input list doesn't come out as nil.
diff --git a/cc/object.go b/cc/object.go
index 8b23295..a4f4c84 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -19,6 +19,8 @@
"strings"
"android/soong/android"
+
+ "github.com/google/blueprint/proptools"
)
//
@@ -50,13 +52,13 @@
type ObjectLinkerProperties struct {
// list of static library modules that should only provide headers for this module.
- Static_libs []string `android:"arch_variant,variant_prepend"`
+ Static_libs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// list of shared library modules should only provide headers for this module.
- Shared_libs []string `android:"arch_variant,variant_prepend"`
+ Shared_libs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// list of modules that should only provide headers for this module.
- Header_libs []string `android:"arch_variant,variant_prepend"`
+ Header_libs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// list of default libraries that will provide headers for this module. If unset, generally
// defaults to libc, libm, and libdl. Set to [] to prevent using headers from the defaults.
@@ -116,9 +118,9 @@
func (*objectLinker) linkerInit(ctx BaseModuleContext) {}
func (object *objectLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
- deps.HeaderLibs = append(deps.HeaderLibs, object.Properties.Header_libs...)
- deps.SharedLibs = append(deps.SharedLibs, object.Properties.Shared_libs...)
- deps.StaticLibs = append(deps.StaticLibs, object.Properties.Static_libs...)
+ deps.HeaderLibs = append(deps.HeaderLibs, object.Properties.Header_libs.GetOrDefault(ctx, nil)...)
+ deps.SharedLibs = append(deps.SharedLibs, object.Properties.Shared_libs.GetOrDefault(ctx, nil)...)
+ deps.StaticLibs = append(deps.StaticLibs, object.Properties.Static_libs.GetOrDefault(ctx, nil)...)
deps.ObjFiles = append(deps.ObjFiles, object.Properties.Objs...)
deps.SystemSharedLibs = object.Properties.System_shared_libs
@@ -201,8 +203,9 @@
return outputFile
}
-func (object *objectLinker) linkerSpecifiedDeps(specifiedDeps specifiedDeps) specifiedDeps {
- specifiedDeps.sharedLibs = append(specifiedDeps.sharedLibs, object.Properties.Shared_libs...)
+func (object *objectLinker) linkerSpecifiedDeps(ctx android.ConfigAndErrorContext, module *Module, specifiedDeps specifiedDeps) specifiedDeps {
+ eval := module.ConfigurableEvaluator(ctx)
+ specifiedDeps.sharedLibs = append(specifiedDeps.sharedLibs, object.Properties.Shared_libs.GetOrDefault(eval, nil)...)
// Must distinguish nil and [] in system_shared_libs - ensure that [] in
// either input list doesn't come out as nil.
diff --git a/mk2rbc/mk2rbc.go b/mk2rbc/mk2rbc.go
index 78ab771..2e408b7 100644
--- a/mk2rbc/mk2rbc.go
+++ b/mk2rbc/mk2rbc.go
@@ -72,6 +72,7 @@
"add_soong_config_namespace": &simpleCallParser{name: baseName + ".soong_config_namespace", returnType: starlarkTypeVoid, addGlobals: true},
"add_soong_config_var_value": &simpleCallParser{name: baseName + ".soong_config_set", returnType: starlarkTypeVoid, addGlobals: true},
soongConfigAssign: &simpleCallParser{name: baseName + ".soong_config_set", returnType: starlarkTypeVoid, addGlobals: true},
+ "soong_config_set_bool": &simpleCallParser{name: baseName + ".soong_config_set_bool", returnType: starlarkTypeVoid, addGlobals: true},
soongConfigAppend: &simpleCallParser{name: baseName + ".soong_config_append", returnType: starlarkTypeVoid, addGlobals: true},
"soong_config_get": &simpleCallParser{name: baseName + ".soong_config_get", returnType: starlarkTypeString, addGlobals: true},
"add-to-product-copy-files-if-exists": &simpleCallParser{name: baseName + ".copy_if_exists", returnType: starlarkTypeList},
diff --git a/mk2rbc/mk2rbc_test.go b/mk2rbc/mk2rbc_test.go
index 0c4d213..c295c40 100644
--- a/mk2rbc/mk2rbc_test.go
+++ b/mk2rbc/mk2rbc_test.go
@@ -853,6 +853,7 @@
$(call add_soong_config_namespace,snsconfig)
$(call add_soong_config_var_value,snsconfig,imagetype,odm_image)
$(call soong_config_set, snsconfig, foo, foo_value)
+$(call soong_config_set_bool, snsconfig, bar, true)
$(call soong_config_append, snsconfig, bar, bar_value)
PRODUCT_COPY_FILES := $(call copy-files,$(wildcard foo*.mk),etc)
PRODUCT_COPY_FILES := $(call product-copy-files-by-pattern,from/%,to/%,a b c)
@@ -880,6 +881,7 @@
rblf.soong_config_namespace(g, "snsconfig")
rblf.soong_config_set(g, "snsconfig", "imagetype", "odm_image")
rblf.soong_config_set(g, "snsconfig", "foo", "foo_value")
+ rblf.soong_config_set_bool(g, "snsconfig", "bar", "true")
rblf.soong_config_append(g, "snsconfig", "bar", "bar_value")
cfg["PRODUCT_COPY_FILES"] = rblf.copy_files(rblf.expand_wildcard("foo*.mk"), "etc")
cfg["PRODUCT_COPY_FILES"] = rblf.product_copy_files_by_pattern("from/%", "to/%", "a b c")
diff --git a/rust/bindgen.go b/rust/bindgen.go
index a81024a..31aa137 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -393,8 +393,8 @@
deps.StaticLibs = append(deps.StaticLibs, String(b.Properties.Static_inline_library))
}
- deps.SharedLibs = append(deps.SharedLibs, b.ClangProperties.Shared_libs...)
- deps.StaticLibs = append(deps.StaticLibs, b.ClangProperties.Static_libs...)
- deps.HeaderLibs = append(deps.HeaderLibs, b.ClangProperties.Header_libs...)
+ deps.SharedLibs = append(deps.SharedLibs, b.ClangProperties.Shared_libs.GetOrDefault(ctx, nil)...)
+ deps.StaticLibs = append(deps.StaticLibs, b.ClangProperties.Static_libs.GetOrDefault(ctx, nil)...)
+ deps.HeaderLibs = append(deps.HeaderLibs, b.ClangProperties.Header_libs.GetOrDefault(ctx, nil)...)
return deps
}
diff --git a/sdk/update.go b/sdk/update.go
index 198c8d4..a4b1967 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -1989,6 +1989,14 @@
return m.builder.targetBuildRelease.EarlierThan(buildReleaseT)
}
+func (m *memberContext) Config() android.Config {
+ return m.sdkMemberContext.Config()
+}
+
+func (m *memberContext) OtherModulePropertyErrorf(module android.Module, property string, fmt string, args ...interface{}) {
+ m.sdkMemberContext.OtherModulePropertyErrorf(module, property, fmt, args)
+}
+
var _ android.SdkMemberContext = (*memberContext)(nil)
func (s *sdk) createMemberSnapshot(ctx *memberContext, member *sdkMember, bpModule *bpModule) {
diff --git a/ui/build/config.go b/ui/build/config.go
index b8fcb6b..dfe0dfe 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -1041,7 +1041,7 @@
func (c *configImpl) UsedEnvFile(tag string) string {
if v, ok := c.environ.Get("TARGET_PRODUCT"); ok {
- return shared.JoinPath(c.SoongOutDir(), usedEnvFile+"."+v+"."+tag)
+ return shared.JoinPath(c.SoongOutDir(), usedEnvFile+"."+v+c.CoverageSuffix()+"."+tag)
}
return shared.JoinPath(c.SoongOutDir(), usedEnvFile+"."+tag)
}
@@ -1149,6 +1149,13 @@
return "", fmt.Errorf("TARGET_PRODUCT is not defined")
}
+func (c *configImpl) CoverageSuffix() string {
+ if v := c.environ.IsEnvTrue("EMMA_INSTRUMENT"); v {
+ return ".coverage"
+ }
+ return ""
+}
+
func (c *configImpl) TargetDevice() string {
return c.targetDevice
}
@@ -1520,7 +1527,7 @@
if err != nil {
return filepath.Join(c.SoongOutDir(), "soong.variables")
} else {
- return filepath.Join(c.SoongOutDir(), "soong."+targetProduct+".variables")
+ return filepath.Join(c.SoongOutDir(), "soong."+targetProduct+c.CoverageSuffix()+".variables")
}
}
@@ -1529,7 +1536,7 @@
if err != nil {
return filepath.Join(c.SoongOutDir(), "soong.extra.variables")
} else {
- return filepath.Join(c.SoongOutDir(), "soong."+targetProduct+".extra.variables")
+ return filepath.Join(c.SoongOutDir(), "soong."+targetProduct+c.CoverageSuffix()+".extra.variables")
}
}
@@ -1538,7 +1545,7 @@
if err != nil {
return filepath.Join(c.SoongOutDir(), "build.ninja")
} else {
- return filepath.Join(c.SoongOutDir(), "build."+targetProduct+".ninja")
+ return filepath.Join(c.SoongOutDir(), "build."+targetProduct+c.CoverageSuffix()+".ninja")
}
}
@@ -1550,11 +1557,11 @@
}
func (c *configImpl) SoongAndroidMk() string {
- return filepath.Join(c.SoongOutDir(), "Android-"+c.TargetProduct()+".mk")
+ return filepath.Join(c.SoongOutDir(), "Android-"+c.TargetProduct()+c.CoverageSuffix()+".mk")
}
func (c *configImpl) SoongMakeVarsMk() string {
- return filepath.Join(c.SoongOutDir(), "make_vars-"+c.TargetProduct()+".mk")
+ return filepath.Join(c.SoongOutDir(), "make_vars-"+c.TargetProduct()+c.CoverageSuffix()+".mk")
}
func (c *configImpl) SoongBuildMetrics() string {
diff --git a/ui/build/kati.go b/ui/build/kati.go
index a0efd2c..5743ff7 100644
--- a/ui/build/kati.go
+++ b/ui/build/kati.go
@@ -41,7 +41,7 @@
// arguments.
func genKatiSuffix(ctx Context, config Config) {
// Construct the base suffix.
- katiSuffix := "-" + config.TargetProduct()
+ katiSuffix := "-" + config.TargetProduct() + config.CoverageSuffix()
// Append kati arguments to the suffix.
if args := config.KatiArgs(); len(args) > 0 {