Add test to show issues with widest stub dex jars
The widest stub dex jars should include the widest stub dex jars
provided by each module. So, if module A has public, system and test
and module B has only public then the widest stub dex jars should
include module A's test and module B's public stub dex jars. Instead,
they just include module A's test.
That behaviour is needed so that when the "hiddenapi list" tool is run
against a module C that it is passed stub dex jars from both module A
and module B so that any references to the types provided by those APIs
can be resolved.
A follow up change will fix this issue.
Bug: 179354495
Test: m nothing
Merged-In: Ibd31964e8d2a33fa92fbd0b800c9fe054ee359c7
Change-Id: Ibd31964e8d2a33fa92fbd0b800c9fe054ee359c7
(cherry picked from commit d2b1e0ca92
)
This commit is contained in:
@@ -258,4 +258,8 @@ func TestBootclasspathFragment_StubLibs(t *testing.T) {
|
|||||||
// Check that SdkCorePlatform uses public stubs from the mycoreplatform library.
|
// Check that SdkCorePlatform uses public stubs from the mycoreplatform library.
|
||||||
corePlatformStubsJar := "out/soong/.intermediates/mycoreplatform.stubs/android_common/dex/mycoreplatform.stubs.jar"
|
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])
|
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())
|
||||||
}
|
}
|
||||||
|
@@ -305,10 +305,10 @@ func buildRuleToGenerateHiddenAPIStubFlagsFile(ctx android.BuilderContext, name,
|
|||||||
tempPath := tempPathForRestat(ctx, outputPath)
|
tempPath := tempPathForRestat(ctx, outputPath)
|
||||||
|
|
||||||
// Find the widest API stubs provided by the fragments on which this depends, if any.
|
// 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.
|
// 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().
|
command := rule.Command().
|
||||||
Tool(ctx.Config().HostToolPath(ctx, "hiddenapi")).
|
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.
|
// 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-- {
|
for i := len(hiddenAPIScopes) - 1; i >= 0; i-- {
|
||||||
apiScope := hiddenAPIScopes[i]
|
apiScope := hiddenAPIScopes[i]
|
||||||
stubsForAPIScope := s[apiScope]
|
stubsForAPIScope := s[apiScope]
|
||||||
|
Reference in New Issue
Block a user