Merge "Don't add apex_set deps in nondeterministic order" am: e5eb5786e2
am: 74447fa446
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2550970 Change-Id: Iefd399de8789c654a687ef0eb30660619e7149c3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -5281,7 +5281,16 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
apex_set {
|
apex_set {
|
||||||
name: "myapex",
|
name: "myapex",
|
||||||
set: "myapex.apks",
|
set: "myapex.apks",
|
||||||
|
exported_java_libs: ["myjavalib"],
|
||||||
exported_bootclasspath_fragments: ["my-bootclasspath-fragment"],
|
exported_bootclasspath_fragments: ["my-bootclasspath-fragment"],
|
||||||
|
exported_systemserverclasspath_fragments: ["my-systemserverclasspath-fragment"],
|
||||||
|
}
|
||||||
|
|
||||||
|
java_import {
|
||||||
|
name: "myjavalib",
|
||||||
|
jars: ["myjavalib.jar"],
|
||||||
|
apex_available: ["myapex"],
|
||||||
|
permitted_packages: ["javalib"],
|
||||||
}
|
}
|
||||||
|
|
||||||
prebuilt_bootclasspath_fragment {
|
prebuilt_bootclasspath_fragment {
|
||||||
@@ -5298,6 +5307,12 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prebuilt_systemserverclasspath_fragment {
|
||||||
|
name: "my-systemserverclasspath-fragment",
|
||||||
|
contents: ["libbaz"],
|
||||||
|
apex_available: ["myapex"],
|
||||||
|
}
|
||||||
|
|
||||||
java_import {
|
java_import {
|
||||||
name: "libfoo",
|
name: "libfoo",
|
||||||
jars: ["libfoo.jar"],
|
jars: ["libfoo.jar"],
|
||||||
@@ -5314,6 +5329,16 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
shared_library: false,
|
shared_library: false,
|
||||||
permitted_packages: ["bar"],
|
permitted_packages: ["bar"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java_sdk_library_import {
|
||||||
|
name: "libbaz",
|
||||||
|
public: {
|
||||||
|
jars: ["libbaz.jar"],
|
||||||
|
},
|
||||||
|
apex_available: ["myapex"],
|
||||||
|
shared_library: false,
|
||||||
|
permitted_packages: ["baz"],
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
ctx := testDexpreoptWithApexes(t, bp, "", preparer, fragment)
|
ctx := testDexpreoptWithApexes(t, bp, "", preparer, fragment)
|
||||||
@@ -5326,6 +5351,24 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
my-bootclasspath-fragment/index.csv
|
my-bootclasspath-fragment/index.csv
|
||||||
out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
|
out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
myApex := ctx.ModuleForTests("myapex", "android_common_myapex").Module()
|
||||||
|
|
||||||
|
overrideNames := []string{
|
||||||
|
"",
|
||||||
|
"myjavalib.myapex",
|
||||||
|
"libfoo.myapex",
|
||||||
|
"libbar.myapex",
|
||||||
|
"libbaz.myapex",
|
||||||
|
}
|
||||||
|
mkEntries := android.AndroidMkEntriesForTest(t, ctx, myApex)
|
||||||
|
for i, e := range mkEntries {
|
||||||
|
g := e.OverrideName
|
||||||
|
if w := overrideNames[i]; w != g {
|
||||||
|
t.Errorf("Expected override name %q, got %q", w, g)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("prebuilt with source library preferred", func(t *testing.T) {
|
t.Run("prebuilt with source library preferred", func(t *testing.T) {
|
||||||
|
@@ -316,31 +316,29 @@ func prebuiltApexModuleCreatorMutator(ctx android.TopDownMutatorContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *prebuiltCommon) getExportedDependencies() map[string]exportedDependencyTag {
|
func (p *prebuiltCommon) hasExportedDeps() bool {
|
||||||
dependencies := make(map[string]exportedDependencyTag)
|
return len(p.prebuiltCommonProperties.Exported_java_libs) > 0 ||
|
||||||
|
len(p.prebuiltCommonProperties.Exported_bootclasspath_fragments) > 0 ||
|
||||||
for _, dep := range p.prebuiltCommonProperties.Exported_java_libs {
|
len(p.prebuiltCommonProperties.Exported_systemserverclasspath_fragments) > 0
|
||||||
dependencies[dep] = exportedJavaLibTag
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, dep := range p.prebuiltCommonProperties.Exported_bootclasspath_fragments {
|
|
||||||
dependencies[dep] = exportedBootclasspathFragmentTag
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, dep := range p.prebuiltCommonProperties.Exported_systemserverclasspath_fragments {
|
|
||||||
dependencies[dep] = exportedSystemserverclasspathFragmentTag
|
|
||||||
}
|
|
||||||
|
|
||||||
return dependencies
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// prebuiltApexContentsDeps adds dependencies onto the prebuilt apex module's contents.
|
// prebuiltApexContentsDeps adds dependencies onto the prebuilt apex module's contents.
|
||||||
func (p *prebuiltCommon) prebuiltApexContentsDeps(ctx android.BottomUpMutatorContext) {
|
func (p *prebuiltCommon) prebuiltApexContentsDeps(ctx android.BottomUpMutatorContext) {
|
||||||
module := ctx.Module()
|
module := ctx.Module()
|
||||||
|
|
||||||
for dep, tag := range p.getExportedDependencies() {
|
for _, dep := range p.prebuiltCommonProperties.Exported_java_libs {
|
||||||
prebuiltDep := android.PrebuiltNameFromSource(dep)
|
prebuiltDep := android.PrebuiltNameFromSource(dep)
|
||||||
ctx.AddDependency(module, tag, prebuiltDep)
|
ctx.AddDependency(module, exportedJavaLibTag, prebuiltDep)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, dep := range p.prebuiltCommonProperties.Exported_bootclasspath_fragments {
|
||||||
|
prebuiltDep := android.PrebuiltNameFromSource(dep)
|
||||||
|
ctx.AddDependency(module, exportedBootclasspathFragmentTag, prebuiltDep)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, dep := range p.prebuiltCommonProperties.Exported_systemserverclasspath_fragments {
|
||||||
|
prebuiltDep := android.PrebuiltNameFromSource(dep)
|
||||||
|
ctx.AddDependency(module, exportedSystemserverclasspathFragmentTag, prebuiltDep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,7 +606,7 @@ func createApexSelectorModule(ctx android.TopDownMutatorContext, name string, ap
|
|||||||
// the listed modules need access to files from within the prebuilt .apex file.
|
// the listed modules need access to files from within the prebuilt .apex file.
|
||||||
func (p *prebuiltCommon) createDeapexerModuleIfNeeded(ctx android.TopDownMutatorContext, deapexerName string, apexFileSource string) {
|
func (p *prebuiltCommon) createDeapexerModuleIfNeeded(ctx android.TopDownMutatorContext, deapexerName string, apexFileSource string) {
|
||||||
// Only create the deapexer module if it is needed.
|
// Only create the deapexer module if it is needed.
|
||||||
if len(p.getExportedDependencies()) == 0 {
|
if !p.hasExportedDeps() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user