Merge "Add test to show issues with widest stub dex jars" am: f6d3b2aef8

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1748466

Change-Id: Ie1acf5281abfd5bf31e06d68fa1d79ae8f878d65
This commit is contained in:
Paul Duffin 2021-06-28 11:17:00 +00:00 committed by Automerger Merge Worker
commit dc2947c21f
2 changed files with 8 additions and 4 deletions

View file

@ -258,4 +258,8 @@ func TestBootclasspathFragment_StubLibs(t *testing.T) {
// Check that SdkCorePlatform uses public stubs from the mycoreplatform library.
corePlatformStubsJar := "out/soong/.intermediates/mycoreplatform.stubs/android_common/dex/mycoreplatform.stubs.jar"
android.AssertPathsRelativeToTopEquals(t, "core platform dex stubs jar", []string{corePlatformStubsJar}, info.TransitiveStubDexJarsByScope[CorePlatformHiddenAPIScope])
// Check the widest stubs. This should list the widest stub dex jar provided by each module.
// TODO(b/179354495): Fix this.
android.AssertPathsRelativeToTopEquals(t, "widest dex stubs jar", []string{corePlatformStubsJar}, info.TransitiveStubDexJarsByScope.StubDexJarsForWidestAPIScope())
}

View file

@ -305,10 +305,10 @@ func buildRuleToGenerateHiddenAPIStubFlagsFile(ctx android.BuilderContext, name,
tempPath := tempPathForRestat(ctx, outputPath)
// Find the widest API stubs provided by the fragments on which this depends, if any.
dependencyStubDexJars := input.DependencyStubDexJarsByScope.stubDexJarsForWidestAPIScope()
dependencyStubDexJars := input.DependencyStubDexJarsByScope.StubDexJarsForWidestAPIScope()
// Add widest API stubs from the additional dependencies of this, if any.
dependencyStubDexJars = append(dependencyStubDexJars, input.AdditionalStubDexJarsByScope.stubDexJarsForWidestAPIScope()...)
dependencyStubDexJars = append(dependencyStubDexJars, input.AdditionalStubDexJarsByScope.StubDexJarsForWidestAPIScope()...)
command := rule.Command().
Tool(ctx.Config().HostToolPath(ctx, "hiddenapi")).
@ -579,9 +579,9 @@ func (s StubDexJarsByScope) dedupAndSort() {
}
}
// stubDexJarsForWidestAPIScope returns the stub dex jars for the widest API scope provided by this
// StubDexJarsForWidestAPIScope returns the stub dex jars for the widest API scope provided by this
// map. The relative width of APIs is determined by their order in hiddenAPIScopes.
func (s StubDexJarsByScope) stubDexJarsForWidestAPIScope() android.Paths {
func (s StubDexJarsByScope) StubDexJarsForWidestAPIScope() android.Paths {
for i := len(hiddenAPIScopes) - 1; i >= 0; i-- {
apiScope := hiddenAPIScopes[i]
stubsForAPIScope := s[apiScope]