Don't add apex_set deps in nondeterministic order
Test: unit tests
Change-Id: I97a9708cb6e5a4f3aef55697b6127f61e4d17720
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index cae507e..31cecf1 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -316,31 +316,29 @@
}
}
-func (p *prebuiltCommon) getExportedDependencies() map[string]exportedDependencyTag {
- dependencies := make(map[string]exportedDependencyTag)
-
- for _, dep := range p.prebuiltCommonProperties.Exported_java_libs {
- 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
+func (p *prebuiltCommon) hasExportedDeps() bool {
+ return len(p.prebuiltCommonProperties.Exported_java_libs) > 0 ||
+ len(p.prebuiltCommonProperties.Exported_bootclasspath_fragments) > 0 ||
+ len(p.prebuiltCommonProperties.Exported_systemserverclasspath_fragments) > 0
}
// prebuiltApexContentsDeps adds dependencies onto the prebuilt apex module's contents.
func (p *prebuiltCommon) prebuiltApexContentsDeps(ctx android.BottomUpMutatorContext) {
module := ctx.Module()
- for dep, tag := range p.getExportedDependencies() {
+ for _, dep := range p.prebuiltCommonProperties.Exported_java_libs {
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 @@
// the listed modules need access to files from within the prebuilt .apex file.
func (p *prebuiltCommon) createDeapexerModuleIfNeeded(ctx android.TopDownMutatorContext, deapexerName string, apexFileSource string) {
// Only create the deapexer module if it is needed.
- if len(p.getExportedDependencies()) == 0 {
+ if !p.hasExportedDeps() {
return
}