Revert^2 "Remove compilation actions from java sdk library"

This change modifies the build actions of java_sdk_library module type
so that it does not perform any compilation actions (i.e. does not
create the top level java_sdk_library jar file). Instead, it delegates
the build actions the top level jar file was performing to the
dynamically created ".impl"-suffixed java library module. The build
actions that are delegated to the impl library module include hiddenapi
processing, dexing, and dexpreopt.

This change relands https://r.android.com/3035972. Implementation
changes from the original change:
- "all_apex_contributions" is added as a dependecy to the implementation
  library modules where the parent sdk_library module has a prebuilt
  equivalent. This allows the source apex variant to be hidden from make
  when the prebuilt is active.

Test: patch in internal main, lunch barbet-ap2a-userdebug && m nothing
Test: m nothing --no-skip-soong-tests
Bug: 332785297
Change-Id: I017938e5567aef82e428e7ceb557d9c9090e0257
This commit is contained in:
Jihoon Kang
2024-04-05 00:36:44 +00:00
parent 248cc0072c
commit a3a05460b4
17 changed files with 177 additions and 79 deletions

View File

@@ -1095,7 +1095,7 @@ func testSnapshotWithBootClasspathFragment_MinSdkVersion(t *testing.T, targetBui
bcpf := result.ModuleForTests("mybootclasspathfragment", "android_common")
rule := bcpf.Output("out/soong/.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi" + suffix + "/stub-flags.csv")
android.AssertPathsRelativeToTopEquals(t, "stub flags inputs", expectedStubFlagsInputs, rule.Implicits)
android.AssertPathsRelativeToTopEquals(t, "stub flags inputs", android.SortedUniqueStrings(expectedStubFlagsInputs), android.SortedUniquePaths(rule.Implicits))
CheckSnapshot(t, result, "mysdk", "",
checkAndroidBpContents(expectedSdkSnapshot),
@@ -1153,7 +1153,7 @@ java_sdk_library_import {
// of the snapshot.
expectedStubFlagsInputs := []string{
"out/soong/.intermediates/mysdklibrary.stubs.exportable/android_common/dex/mysdklibrary.stubs.exportable.jar",
"out/soong/.intermediates/mysdklibrary/android_common/aligned/mysdklibrary.jar",
"out/soong/.intermediates/mysdklibrary.impl/android_common/aligned/mysdklibrary.jar",
}
testSnapshotWithBootClasspathFragment_MinSdkVersion(t, "S",
@@ -1234,9 +1234,9 @@ java_sdk_library_import {
// they are both part of the snapshot.
expectedStubFlagsInputs := []string{
"out/soong/.intermediates/mynewsdklibrary.stubs.exportable/android_common/dex/mynewsdklibrary.stubs.exportable.jar",
"out/soong/.intermediates/mynewsdklibrary/android_common/aligned/mynewsdklibrary.jar",
"out/soong/.intermediates/mynewsdklibrary.impl/android_common/aligned/mynewsdklibrary.jar",
"out/soong/.intermediates/mysdklibrary.stubs.exportable/android_common/dex/mysdklibrary.stubs.exportable.jar",
"out/soong/.intermediates/mysdklibrary/android_common/aligned/mysdklibrary.jar",
"out/soong/.intermediates/mysdklibrary.impl/android_common/aligned/mysdklibrary.jar",
}
testSnapshotWithBootClasspathFragment_MinSdkVersion(t, "Tiramisu",