Merge "Remove packagingSpecsDepSet from ModuleBase." into main
diff --git a/android/apex.go b/android/apex.go
index 028be57..79ee0a8 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -475,13 +475,6 @@
AvailableToAnyApex = "//apex_available:anyapex"
)
-var (
- AvailableToRecognziedWildcards = []string{
- AvailableToPlatform,
- AvailableToAnyApex,
- }
-)
-
// CheckAvailableForApex provides the default algorithm for checking the apex availability. When the
// availability is empty, it defaults to ["//apex_available:platform"] which means "available to the
// platform but not available to any APEX". When the list is not empty, `what` is matched against
diff --git a/android/build_prop.go b/android/build_prop.go
index 13d59f9..ede93ed 100644
--- a/android/build_prop.go
+++ b/android/build_prop.go
@@ -63,6 +63,8 @@
return ctx.Config().SystemExtPropFiles(ctx)
} else if partition == "product" {
return ctx.Config().ProductPropFiles(ctx)
+ } else if partition == "odm" {
+ return ctx.Config().OdmPropFiles(ctx)
}
return nil
}
diff --git a/android/config.go b/android/config.go
index 2f6ade7..bbb08dd 100644
--- a/android/config.go
+++ b/android/config.go
@@ -2057,6 +2057,10 @@
return PathsForSource(ctx, c.productVariables.ProductPropFiles)
}
+func (c *config) OdmPropFiles(ctx PathContext) Paths {
+ return PathsForSource(ctx, c.productVariables.OdmPropFiles)
+}
+
func (c *config) EnableUffdGc() string {
return String(c.productVariables.EnableUffdGc)
}
diff --git a/android/container.go b/android/container.go
index 10aff4d..43dccf6 100644
--- a/android/container.go
+++ b/android/container.go
@@ -93,6 +93,10 @@
// This module is implicitly added as a dependency for java modules even when the
// dependency specifies sdk_version.
"framework-res",
+
+ // jacocoagent is implicitly added as a dependency in coverage builds, and is not installed
+ // on the device.
+ "jacocoagent",
}
// Returns true when the dependency is globally allowlisted for inter-container dependency
diff --git a/android/module.go b/android/module.go
index 61ac4bc..4e46bdb 100644
--- a/android/module.go
+++ b/android/module.go
@@ -843,10 +843,6 @@
// Merged Aconfig files for all transitive deps.
aconfigFilePaths Paths
- // moduleInfoJSON can be filled out by GenerateAndroidBuildActions to write a JSON file that will
- // be included in the final module-info.json produced by Make.
- moduleInfoJSON *ModuleInfoJSON
-
// complianceMetadataInfo is for different module types to dump metadata.
// See android.ModuleContext interface.
complianceMetadataInfo *ComplianceMetadataInfo
@@ -1938,6 +1934,13 @@
if ctx.Failed() {
return
}
+
+ if x, ok := m.module.(IDEInfo); ok {
+ var result IdeInfo
+ x.IDEInfo(ctx, &result)
+ result.BaseModuleName = x.BaseModuleName()
+ SetProvider(ctx, IdeInfoProviderKey, result)
+ }
}
if incrementalEnabled && cacheKey != nil {
@@ -1982,7 +1985,7 @@
SetProvider(ctx, InstallFilesProvider, installFiles)
buildLicenseMetadata(ctx, ctx.licenseMetadataFile)
- if m.moduleInfoJSON != nil {
+ if ctx.moduleInfoJSON != nil {
var installed InstallPaths
installed = append(installed, ctx.katiInstalls.InstallPaths()...)
installed = append(installed, ctx.katiSymlinks.InstallPaths()...)
@@ -2002,28 +2005,28 @@
data = append(data, d.ToRelativeInstallPath())
}
- if m.moduleInfoJSON.Uninstallable {
+ if ctx.moduleInfoJSON.Uninstallable {
installedStrings = nil
- if len(m.moduleInfoJSON.CompatibilitySuites) == 1 && m.moduleInfoJSON.CompatibilitySuites[0] == "null-suite" {
- m.moduleInfoJSON.CompatibilitySuites = nil
- m.moduleInfoJSON.TestConfig = nil
- m.moduleInfoJSON.AutoTestConfig = nil
+ if len(ctx.moduleInfoJSON.CompatibilitySuites) == 1 && ctx.moduleInfoJSON.CompatibilitySuites[0] == "null-suite" {
+ ctx.moduleInfoJSON.CompatibilitySuites = nil
+ ctx.moduleInfoJSON.TestConfig = nil
+ ctx.moduleInfoJSON.AutoTestConfig = nil
data = nil
}
}
- m.moduleInfoJSON.core = CoreModuleInfoJSON{
- RegisterName: m.moduleInfoRegisterName(ctx, m.moduleInfoJSON.SubName),
+ ctx.moduleInfoJSON.core = CoreModuleInfoJSON{
+ RegisterName: m.moduleInfoRegisterName(ctx, ctx.moduleInfoJSON.SubName),
Path: []string{ctx.ModuleDir()},
Installed: installedStrings,
- ModuleName: m.BaseModuleName() + m.moduleInfoJSON.SubName,
+ ModuleName: m.BaseModuleName() + ctx.moduleInfoJSON.SubName,
SupportedVariants: []string{m.moduleInfoVariant(ctx)},
TargetDependencies: targetRequired,
HostDependencies: hostRequired,
Data: data,
Required: m.RequiredModuleNames(ctx),
}
- SetProvider(ctx, ModuleInfoJSONProvider, m.moduleInfoJSON)
+ SetProvider(ctx, ModuleInfoJSONProvider, ctx.moduleInfoJSON)
}
m.buildParams = ctx.buildParams
@@ -2722,7 +2725,7 @@
// Collect information for opening IDE project files in java/jdeps.go.
type IDEInfo interface {
- IDEInfo(ideInfo *IdeInfo)
+ IDEInfo(ctx BaseModuleContext, ideInfo *IdeInfo)
BaseModuleName() string
}
@@ -2734,7 +2737,9 @@
IDECustomizedModuleName() string
}
+// Collect information for opening IDE project files in java/jdeps.go.
type IdeInfo struct {
+ BaseModuleName string `json:"-"`
Deps []string `json:"dependencies,omitempty"`
Srcs []string `json:"srcs,omitempty"`
Aidl_include_dirs []string `json:"aidl_include_dirs,omitempty"`
@@ -2748,6 +2753,31 @@
Libs []string `json:"libs,omitempty"`
}
+// Merge merges two IdeInfos and produces a new one, leaving the origional unchanged
+func (i IdeInfo) Merge(other IdeInfo) IdeInfo {
+ return IdeInfo{
+ Deps: mergeStringLists(i.Deps, other.Deps),
+ Srcs: mergeStringLists(i.Srcs, other.Srcs),
+ Aidl_include_dirs: mergeStringLists(i.Aidl_include_dirs, other.Aidl_include_dirs),
+ Jarjar_rules: mergeStringLists(i.Jarjar_rules, other.Jarjar_rules),
+ Jars: mergeStringLists(i.Jars, other.Jars),
+ Classes: mergeStringLists(i.Classes, other.Classes),
+ Installed_paths: mergeStringLists(i.Installed_paths, other.Installed_paths),
+ SrcJars: mergeStringLists(i.SrcJars, other.SrcJars),
+ Paths: mergeStringLists(i.Paths, other.Paths),
+ Static_libs: mergeStringLists(i.Static_libs, other.Static_libs),
+ Libs: mergeStringLists(i.Libs, other.Libs),
+ }
+}
+
+// mergeStringLists appends the two string lists together and returns a new string list,
+// leaving the originals unchanged. Duplicate strings will be deduplicated.
+func mergeStringLists(a, b []string) []string {
+ return FirstUniqueStrings(Concat(a, b))
+}
+
+var IdeInfoProviderKey = blueprint.NewProvider[IdeInfo]()
+
func CheckBlueprintSyntax(ctx BaseModuleContext, filename string, contents string) []error {
bpctx := ctx.blueprintBaseModuleContext()
return blueprint.CheckBlueprintSyntax(bpctx.ModuleFactories(), filename, contents)
diff --git a/android/module_context.go b/android/module_context.go
index 6b64b1d..5322240 100644
--- a/android/module_context.go
+++ b/android/module_context.go
@@ -266,6 +266,10 @@
buildParams []BuildParams
ruleParams map[blueprint.Rule]blueprint.RuleParams
variables map[string]string
+
+ // moduleInfoJSON can be filled out by GenerateAndroidBuildActions to write a JSON file that will
+ // be included in the final module-info.json produced by Make.
+ moduleInfoJSON *ModuleInfoJSON
}
var _ ModuleContext = &moduleContext{}
@@ -729,11 +733,11 @@
}
func (m *moduleContext) ModuleInfoJSON() *ModuleInfoJSON {
- if moduleInfoJSON := m.module.base().moduleInfoJSON; moduleInfoJSON != nil {
+ if moduleInfoJSON := m.moduleInfoJSON; moduleInfoJSON != nil {
return moduleInfoJSON
}
moduleInfoJSON := &ModuleInfoJSON{}
- m.module.base().moduleInfoJSON = moduleInfoJSON
+ m.moduleInfoJSON = moduleInfoJSON
return moduleInfoJSON
}
diff --git a/android/neverallow.go b/android/neverallow.go
index 0f363e7..a68f5ea 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -287,7 +287,7 @@
continue
}
- if !n.appliesToProperties(properties) {
+ if !n.appliesToProperties(ctx, properties) {
continue
}
@@ -604,9 +604,9 @@
return (len(r.moduleTypes) == 0 || InList(moduleType, r.moduleTypes)) && !InList(moduleType, r.unlessModuleTypes)
}
-func (r *rule) appliesToProperties(properties []interface{}) bool {
- includeProps := hasAllProperties(properties, r.props)
- excludeProps := hasAnyProperty(properties, r.unlessProps)
+func (r *rule) appliesToProperties(ctx BottomUpMutatorContext, properties []interface{}) bool {
+ includeProps := hasAllProperties(ctx, properties, r.props)
+ excludeProps := hasAnyProperty(ctx, properties, r.unlessProps)
return includeProps && !excludeProps
}
@@ -644,25 +644,25 @@
return names
}
-func hasAnyProperty(properties []interface{}, props []ruleProperty) bool {
+func hasAnyProperty(ctx BottomUpMutatorContext, properties []interface{}, props []ruleProperty) bool {
for _, v := range props {
- if hasProperty(properties, v) {
+ if hasProperty(ctx, properties, v) {
return true
}
}
return false
}
-func hasAllProperties(properties []interface{}, props []ruleProperty) bool {
+func hasAllProperties(ctx BottomUpMutatorContext, properties []interface{}, props []ruleProperty) bool {
for _, v := range props {
- if !hasProperty(properties, v) {
+ if !hasProperty(ctx, properties, v) {
return false
}
}
return true
}
-func hasProperty(properties []interface{}, prop ruleProperty) bool {
+func hasProperty(ctx BottomUpMutatorContext, properties []interface{}, prop ruleProperty) bool {
for _, propertyStruct := range properties {
propertiesValue := reflect.ValueOf(propertyStruct).Elem()
for _, v := range prop.fields {
@@ -679,14 +679,14 @@
return prop.matcher.Test(value)
}
- if matchValue(propertiesValue, check) {
+ if matchValue(ctx, propertiesValue, check) {
return true
}
}
return false
}
-func matchValue(value reflect.Value, check func(string) bool) bool {
+func matchValue(ctx BottomUpMutatorContext, value reflect.Value, check func(string) bool) bool {
if !value.IsValid() {
return false
}
@@ -698,19 +698,26 @@
value = value.Elem()
}
- switch value.Kind() {
- case reflect.String:
- return check(value.String())
- case reflect.Bool:
- return check(strconv.FormatBool(value.Bool()))
- case reflect.Int:
- return check(strconv.FormatInt(value.Int(), 10))
- case reflect.Slice:
- slice, ok := value.Interface().([]string)
- if !ok {
- panic("Can only handle slice of string")
+ switch v := value.Interface().(type) {
+ case string:
+ return check(v)
+ case bool:
+ return check(strconv.FormatBool(v))
+ case int:
+ return check(strconv.FormatInt((int64)(v), 10))
+ case []string:
+ for _, v := range v {
+ if check(v) {
+ return true
+ }
}
- for _, v := range slice {
+ return false
+ case proptools.Configurable[string]:
+ return check(v.GetOrDefault(ctx, ""))
+ case proptools.Configurable[bool]:
+ return check(strconv.FormatBool(v.GetOrDefault(ctx, false)))
+ case proptools.Configurable[[]string]:
+ for _, v := range v.GetOrDefault(ctx, nil) {
if check(v) {
return true
}
diff --git a/android/variable.go b/android/variable.go
index 10205e3..14f1756 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -512,6 +512,7 @@
SystemPropFiles []string `json:",omitempty"`
SystemExtPropFiles []string `json:",omitempty"`
ProductPropFiles []string `json:",omitempty"`
+ OdmPropFiles []string `json:",omitempty"`
EnableUffdGc *string `json:",omitempty"`
}
diff --git a/apex/apex.go b/apex/apex.go
index 2feaaee..d5776b5 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2873,7 +2873,7 @@
}
// Collect information for opening IDE project files in java/jdeps.go.
-func (a *apexBundle) IDEInfo(dpInfo *android.IdeInfo) {
+func (a *apexBundle) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
dpInfo.Deps = append(dpInfo.Deps, a.properties.Java_libs...)
dpInfo.Deps = append(dpInfo.Deps, a.properties.Bootclasspath_fragments...)
dpInfo.Deps = append(dpInfo.Deps, a.properties.ResolvedSystemserverclasspathFragments...)
diff --git a/apex/dexpreopt_bootjars_test.go b/apex/dexpreopt_bootjars_test.go
index 95db37d..d8ee4ba 100644
--- a/apex/dexpreopt_bootjars_test.go
+++ b/apex/dexpreopt_bootjars_test.go
@@ -409,3 +409,106 @@
android.AssertStringListContains(t, tc.desc, inputs, tc.expectedProfile)
}
}
+
+// Check that dexpreopt works with Google mainline prebuilts even in workspaces where source is missing
+func TestDexpreoptWithMainlinePrebuiltNoSource(t *testing.T) {
+ bp := `
+ // Platform.
+
+ platform_bootclasspath {
+ name: "platform-bootclasspath",
+ fragments: [
+ {
+ apex: "com.android.art",
+ module: "art-bootclasspath-fragment",
+ },
+ ],
+ }
+
+ // Source AOSP ART apex
+ java_library {
+ name: "core-oj",
+ srcs: ["core-oj.java"],
+ installable: true,
+ apex_available: [
+ "com.android.art",
+ ],
+ }
+
+ bootclasspath_fragment {
+ name: "art-bootclasspath-fragment",
+ image_name: "art",
+ contents: ["core-oj"],
+ apex_available: [
+ "com.android.art",
+ ],
+ hidden_api: {
+ split_packages: ["*"],
+ },
+ }
+
+ apex_key {
+ name: "com.android.art.key",
+ public_key: "com.android.art.avbpubkey",
+ private_key: "com.android.art.pem",
+ }
+
+ apex {
+ name: "com.android.art",
+ key: "com.android.art.key",
+ bootclasspath_fragments: ["art-bootclasspath-fragment"],
+ updatable: false,
+ }
+
+
+ // Prebuilt Google ART APEX.
+
+ java_import {
+ name: "core-oj",
+ jars: ["core-oj.jar"],
+ apex_available: [
+ "com.android.art",
+ ],
+ }
+
+ prebuilt_bootclasspath_fragment {
+ name: "art-bootclasspath-fragment",
+ image_name: "art",
+ contents: ["core-oj"],
+ hidden_api: {
+ annotation_flags: "my-bootclasspath-fragment/annotation-flags.csv",
+ metadata: "my-bootclasspath-fragment/metadata.csv",
+ index: "my-bootclasspath-fragment/index.csv",
+ stub_flags: "my-bootclasspath-fragment/stub-flags.csv",
+ all_flags: "my-bootclasspath-fragment/all-flags.csv",
+ },
+ apex_available: [
+ "com.android.art",
+ ],
+ }
+
+ prebuilt_apex {
+ name: "com.google.android.art",
+ apex_name: "com.android.art",
+ src: "com.android.art-arm.apex",
+ exported_bootclasspath_fragments: ["art-bootclasspath-fragment"],
+ }
+
+ apex_contributions {
+ name: "art.prebuilt.contributions",
+ api_domain: "com.android.art",
+ contents: ["prebuilt_com.google.android.art"],
+ }
+ `
+ res := android.GroupFixturePreparers(
+ java.PrepareForTestWithDexpreopt,
+ java.PrepareForTestWithJavaSdkLibraryFiles,
+ java.FixtureConfigureBootJars("com.android.art:core-oj"),
+ PrepareForTestWithApexBuildComponents,
+ prepareForTestWithArtApex,
+ android.PrepareForTestWithBuildFlag("RELEASE_APEX_CONTRIBUTIONS_ART", "art.prebuilt.contributions"),
+ ).RunTestWithBp(t, bp)
+ if !java.CheckModuleHasDependency(t, res.TestContext, "dex_bootjars", "android_common", "prebuilt_com.google.android.art") {
+ t.Errorf("Expected dexpreopt to use prebuilt apex")
+ }
+}
diff --git a/cc/cc.go b/cc/cc.go
index 947dc1a..927935c 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -3042,7 +3042,7 @@
}
if dep.Target().Os != ctx.Os() {
- ctx.ModuleErrorf("OS mismatch between %q and %q", ctx.ModuleName(), depName)
+ ctx.ModuleErrorf("OS mismatch between %q (%s) and %q (%s)", ctx.ModuleName(), ctx.Os().Name, depName, dep.Target().Os.Name)
return
}
if dep.Target().Arch.ArchType != ctx.Arch().ArchType {
diff --git a/genrule/allowlists.go b/genrule/allowlists.go
index 7c71b77..4f1b320 100644
--- a/genrule/allowlists.go
+++ b/genrule/allowlists.go
@@ -17,7 +17,6 @@
var (
SandboxingDenyModuleList = []string{
// go/keep-sorted start
- "aidl_camera_build_version",
"com.google.pixel.camera.hal.manifest",
// go/keep-sorted end
}
diff --git a/genrule/genrule.go b/genrule/genrule.go
index b8b9968..39dd770 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -243,13 +243,27 @@
}
}
+var buildNumberAllowlistKey = android.NewOnceKey("genruleBuildNumberAllowlistKey")
+
// This allowlist should be kept to the bare minimum, it's
// intended for things that existed before the build number
// was tightly controlled. Prefer using libbuildversion
// via the use_version_lib property of cc modules.
-var genrule_build_number_allowlist = map[string]bool{
- "build/soong/tests:gen": true,
- "tools/tradefederation/core:tradefed_zip": true,
+// This is a function instead of a global map so that
+// soong plugins cannot add entries to the allowlist
+func isModuleInBuildNumberAllowlist(ctx android.ModuleContext) bool {
+ allowlist := ctx.Config().Once(buildNumberAllowlistKey, func() interface{} {
+ return map[string]bool{
+ // go/keep-sorted start
+ "build/soong/tests:gen": true,
+ "hardware/google/camera/common/hal/aidl_service:aidl_camera_build_version": true,
+ "tools/tradefederation/core:tradefed_zip": true,
+ // go/keep-sorted end
+ }
+ }).(map[string]bool)
+
+ _, ok := allowlist[ctx.ModuleDir()+":"+ctx.ModuleName()]
+ return ok
}
// generateCommonBuildActions contains build action generation logic
@@ -547,7 +561,7 @@
cmd.ImplicitTools(tools)
cmd.ImplicitPackagedTools(packagedTools)
if proptools.Bool(g.properties.Uses_order_only_build_number_file) {
- if _, ok := genrule_build_number_allowlist[ctx.ModuleDir()+":"+ctx.ModuleName()]; !ok {
+ if !isModuleInBuildNumberAllowlist(ctx) {
ctx.ModuleErrorf("Only allowlisted modules may use uses_order_only_build_number_file: true")
}
cmd.OrderOnly(ctx.Config().BuildNumberFile(ctx))
@@ -625,7 +639,7 @@
}
// Collect information for opening IDE project files in java/jdeps.go.
-func (g *Module) IDEInfo(dpInfo *android.IdeInfo) {
+func (g *Module) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
dpInfo.Srcs = append(dpInfo.Srcs, g.Srcs().Strings()...)
for _, src := range g.properties.ResolvedSrcs {
if strings.HasPrefix(src, ":") {
diff --git a/java/aar.go b/java/aar.go
index e6ad502..1bd372f 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -914,12 +914,12 @@
setOutputFiles(ctx, a.Library.Module)
}
-func (a *AndroidLibrary) IDEInfo(dpInfo *android.IdeInfo) {
- a.Library.IDEInfo(dpInfo)
- a.aapt.IDEInfo(dpInfo)
+func (a *AndroidLibrary) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
+ a.Library.IDEInfo(ctx, dpInfo)
+ a.aapt.IDEInfo(ctx, dpInfo)
}
-func (a *aapt) IDEInfo(dpInfo *android.IdeInfo) {
+func (a *aapt) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
if a.rJar != nil {
dpInfo.Jars = append(dpInfo.Jars, a.rJar.String())
}
@@ -1451,6 +1451,6 @@
return module
}
-func (a *AARImport) IDEInfo(dpInfo *android.IdeInfo) {
+func (a *AARImport) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
dpInfo.Jars = append(dpInfo.Jars, a.headerJarFile.String(), a.rJar.String())
}
diff --git a/java/app.go b/java/app.go
index 1ebf658..abd78b7 100644
--- a/java/app.go
+++ b/java/app.go
@@ -1243,9 +1243,9 @@
var _ cc.Coverage = (*AndroidApp)(nil)
-func (a *AndroidApp) IDEInfo(dpInfo *android.IdeInfo) {
- a.Library.IDEInfo(dpInfo)
- a.aapt.IDEInfo(dpInfo)
+func (a *AndroidApp) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
+ a.Library.IDEInfo(ctx, dpInfo)
+ a.aapt.IDEInfo(ctx, dpInfo)
}
func (a *AndroidApp) productCharacteristicsRROPackageName() string {
diff --git a/java/base.go b/java/base.go
index 9101457..4cd6021 100644
--- a/java/base.go
+++ b/java/base.go
@@ -2049,7 +2049,7 @@
}
// Collect information for opening IDE project files in java/jdeps.go.
-func (j *Module) IDEInfo(dpInfo *android.IdeInfo) {
+func (j *Module) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
// jarjar rules will repackage the sources. To prevent misleading results, IdeInfo should contain the
// repackaged jar instead of the input sources.
if j.expandJarjarRules != nil {
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index bce507a..bef3b58 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -836,7 +836,7 @@
}
// Collect information for opening IDE project files in java/jdeps.go.
-func (b *BootclasspathFragmentModule) IDEInfo(dpInfo *android.IdeInfo) {
+func (b *BootclasspathFragmentModule) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
dpInfo.Deps = append(dpInfo.Deps, b.properties.Contents...)
}
diff --git a/java/device_host_converter.go b/java/device_host_converter.go
index 63b69d0..7cc06fc 100644
--- a/java/device_host_converter.go
+++ b/java/device_host_converter.go
@@ -192,7 +192,7 @@
// implement the following interface for IDE completion.
var _ android.IDEInfo = (*DeviceHostConverter)(nil)
-func (d *DeviceHostConverter) IDEInfo(ideInfo *android.IdeInfo) {
+func (d *DeviceHostConverter) IDEInfo(ctx android.BaseModuleContext, ideInfo *android.IdeInfo) {
ideInfo.Deps = append(ideInfo.Deps, d.properties.Libs...)
ideInfo.Libs = append(ideInfo.Libs, d.properties.Libs...)
}
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index a81ab83..a2e4734 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -558,6 +558,10 @@
apexVariationOfSelected := append(ctx.Target().Variations(), blueprint.Variation{Mutator: "apex", Variation: apex})
if ctx.OtherModuleDependencyVariantExists(apexVariationOfSelected, selected) {
ctx.AddFarVariationDependencies(apexVariationOfSelected, dexpreoptBootJarDepTag, selected)
+ } else if ctx.OtherModuleDependencyVariantExists(apexVariationOfSelected, android.RemoveOptionalPrebuiltPrefix(selected)) {
+ // The prebuilt might have been renamed by prebuilt_rename mutator if the source module does not exist.
+ // Remove the prebuilt_ prefix.
+ ctx.AddFarVariationDependencies(apexVariationOfSelected, dexpreoptBootJarDepTag, android.RemoveOptionalPrebuiltPrefix(selected))
}
}
}
diff --git a/java/java.go b/java/java.go
index 46344c8..55c878e 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2404,15 +2404,15 @@
return al.SdkVersion(ctx).ApiLevel
}
-func (al *ApiLibrary) IDEInfo(i *android.IdeInfo) {
- i.Deps = append(i.Deps, al.ideDeps()...)
+func (al *ApiLibrary) IDEInfo(ctx android.BaseModuleContext, i *android.IdeInfo) {
+ i.Deps = append(i.Deps, al.ideDeps(ctx)...)
i.Libs = append(i.Libs, al.properties.Libs...)
i.Static_libs = append(i.Static_libs, al.properties.Static_libs...)
i.SrcJars = append(i.SrcJars, al.stubsSrcJar.String())
}
// deps of java_api_library for module_bp_java_deps.json
-func (al *ApiLibrary) ideDeps() []string {
+func (al *ApiLibrary) ideDeps(ctx android.BaseModuleContext) []string {
ret := []string{}
ret = append(ret, al.properties.Libs...)
ret = append(ret, al.properties.Static_libs...)
@@ -2933,7 +2933,7 @@
// Collect information for opening IDE project files in java/jdeps.go.
-func (j *Import) IDEInfo(dpInfo *android.IdeInfo) {
+func (j *Import) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
dpInfo.Jars = append(dpInfo.Jars, j.combinedHeaderFile.String())
}
diff --git a/java/jdeps.go b/java/jdeps.go
index e856b37..c2ce503 100644
--- a/java/jdeps.go
+++ b/java/jdeps.go
@@ -57,27 +57,19 @@
return
}
- ideInfoProvider, ok := module.(android.IDEInfo)
+ ideInfoProvider, ok := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
if !ok {
return
}
- name := ideInfoProvider.BaseModuleName()
+ name := ideInfoProvider.BaseModuleName
ideModuleNameProvider, ok := module.(android.IDECustomizedModuleName)
if ok {
name = ideModuleNameProvider.IDECustomizedModuleName()
}
dpInfo := moduleInfos[name]
- ideInfoProvider.IDEInfo(&dpInfo)
- dpInfo.Deps = android.FirstUniqueStrings(dpInfo.Deps)
- dpInfo.Srcs = android.FirstUniqueStrings(dpInfo.Srcs)
- dpInfo.Aidl_include_dirs = android.FirstUniqueStrings(dpInfo.Aidl_include_dirs)
- dpInfo.Jarjar_rules = android.FirstUniqueStrings(dpInfo.Jarjar_rules)
- dpInfo.Jars = android.FirstUniqueStrings(dpInfo.Jars)
- dpInfo.SrcJars = android.FirstUniqueStrings(dpInfo.SrcJars)
+ dpInfo = dpInfo.Merge(ideInfoProvider)
dpInfo.Paths = []string{ctx.ModuleDir(module)}
- dpInfo.Static_libs = android.FirstUniqueStrings(dpInfo.Static_libs)
- dpInfo.Libs = android.FirstUniqueStrings(dpInfo.Libs)
moduleInfos[name] = dpInfo
mkProvider, ok := module.(android.AndroidMkDataProvider)
diff --git a/java/jdeps_test.go b/java/jdeps_test.go
index ff54da9..d282f19 100644
--- a/java/jdeps_test.go
+++ b/java/jdeps_test.go
@@ -32,9 +32,7 @@
}
`)
module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
- dpInfo := &android.IdeInfo{}
-
- module.IDEInfo(dpInfo)
+ dpInfo, _ := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
for _, expected := range []string{"Foo", "Bar"} {
if !android.InList(expected, dpInfo.Deps) {
@@ -54,9 +52,7 @@
}
`)
module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
- dpInfo := &android.IdeInfo{}
-
- module.IDEInfo(dpInfo)
+ dpInfo, _ := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
for _, expected := range []string{"Foo", "Bar"} {
if !android.InList(expected, dpInfo.Deps) {
@@ -66,26 +62,36 @@
}
func TestCollectJavaLibraryPropertiesAddScrs(t *testing.T) {
- expected := []string{"Foo", "Bar"}
- module := LibraryFactory().(*Library)
- module.expandIDEInfoCompiledSrcs = append(module.expandIDEInfoCompiledSrcs, expected...)
- dpInfo := &android.IdeInfo{}
+ ctx, _ := testJava(t,
+ `
+ java_library {
+ name: "javalib",
+ srcs: ["Foo.java", "Bar.java"],
+ }
+ `)
+ module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
+ dpInfo, _ := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
- module.IDEInfo(dpInfo)
-
+ expected := []string{"Foo.java", "Bar.java"}
if !reflect.DeepEqual(dpInfo.Srcs, expected) {
t.Errorf("Library.IDEInfo() Srcs = %v, want %v", dpInfo.Srcs, expected)
}
}
func TestCollectJavaLibraryPropertiesAddAidlIncludeDirs(t *testing.T) {
+ ctx, _ := testJava(t,
+ `
+ java_library {
+ name: "javalib",
+ aidl: {
+ include_dirs: ["Foo", "Bar"],
+ },
+ }
+ `)
+ module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
+ dpInfo, _ := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
+
expected := []string{"Foo", "Bar"}
- module := LibraryFactory().(*Library)
- module.deviceProperties.Aidl.Include_dirs = append(module.deviceProperties.Aidl.Include_dirs, expected...)
- dpInfo := &android.IdeInfo{}
-
- module.IDEInfo(dpInfo)
-
if !reflect.DeepEqual(dpInfo.Aidl_include_dirs, expected) {
t.Errorf("Library.IDEInfo() Aidl_include_dirs = %v, want %v", dpInfo.Aidl_include_dirs, expected)
}
@@ -101,9 +107,8 @@
}
`)
module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
- dpInfo := &android.IdeInfo{}
+ dpInfo, _ := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
- module.IDEInfo(dpInfo)
android.AssertBoolEquals(t, "IdeInfo.Srcs of repackaged library should be empty", true, len(dpInfo.Srcs) == 0)
android.AssertStringEquals(t, "IdeInfo.Jar_rules of repackaged library should not be empty", "jarjar_rules.txt", dpInfo.Jarjar_rules[0])
if !android.SubstringInList(dpInfo.Jars, "soong/.intermediates/javalib/android_common/jarjar/turbine/javalib.jar") {
@@ -125,8 +130,7 @@
}
`)
module := ctx.ModuleForTests("javalib", "android_common").Module().(*Library)
- dpInfo := &android.IdeInfo{}
+ dpInfo, _ := android.OtherModuleProvider(ctx, module, android.IdeInfoProviderKey)
- module.IDEInfo(dpInfo)
android.AssertStringListContains(t, "IdeInfo.Deps should contain versioned sdk module", dpInfo.Deps, "sdk_public_29_android")
}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 2fe629f..25317c5 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -3599,8 +3599,8 @@
}
// TODO(b/358613520): This can be removed when modules are no longer allowed to depend on the top-level library.
-func (s *SdkLibrary) IDEInfo(dpInfo *android.IdeInfo) {
- s.Library.IDEInfo(dpInfo)
+func (s *SdkLibrary) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
+ s.Library.IDEInfo(ctx, dpInfo)
if s.implLibraryModule != nil {
dpInfo.Deps = append(dpInfo.Deps, s.implLibraryModule.Name())
} else {
diff --git a/java/system_modules.go b/java/system_modules.go
index 5b00079..f89bf9e 100644
--- a/java/system_modules.go
+++ b/java/system_modules.go
@@ -307,7 +307,7 @@
// implement the following interface for IDE completion.
var _ android.IDEInfo = (*SystemModules)(nil)
-func (s *SystemModules) IDEInfo(ideInfo *android.IdeInfo) {
+func (s *SystemModules) IDEInfo(ctx android.BaseModuleContext, ideInfo *android.IdeInfo) {
ideInfo.Deps = append(ideInfo.Deps, s.properties.Libs...)
ideInfo.Libs = append(ideInfo.Libs, s.properties.Libs...)
}
diff --git a/java/systemserver_classpath_fragment.go b/java/systemserver_classpath_fragment.go
index 3225a3a..924abd4 100644
--- a/java/systemserver_classpath_fragment.go
+++ b/java/systemserver_classpath_fragment.go
@@ -239,7 +239,7 @@
}
// Collect information for opening IDE project files in java/jdeps.go.
-func (s *SystemServerClasspathModule) IDEInfo(dpInfo *android.IdeInfo) {
+func (s *SystemServerClasspathModule) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
dpInfo.Deps = append(dpInfo.Deps, s.properties.Contents...)
dpInfo.Deps = append(dpInfo.Deps, s.properties.Standalone_contents...)
}
diff --git a/linkerconfig/linkerconfig.go b/linkerconfig/linkerconfig.go
index 533ec62..05b99fd 100644
--- a/linkerconfig/linkerconfig.go
+++ b/linkerconfig/linkerconfig.go
@@ -98,6 +98,7 @@
builder.Command().
BuiltTool("conv_linker_config").
Flag("proto").
+ Flag("--force").
FlagWithInput("-s ", input).
FlagWithOutput("-o ", interimOutput)