Merge changes Ia693c4a5,I8e5620d2 into main am: c14be38f1a am: 4e373a7904

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

Change-Id: Ic901c1d2deef5f61e661cd07aa620b8ffdaf39df
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jihoon Kang
2024-08-28 21:52:18 +00:00
committed by Automerger Merge Worker
18 changed files with 229 additions and 19 deletions

View File

@@ -590,6 +590,13 @@ func (j *Module) InstallInProduct() bool {
return j.ProductSpecific()
}
var _ android.StubsAvailableModule = (*Module)(nil)
// To safisfy the StubsAvailableModule interface
func (j *Module) IsStubsModule() bool {
return proptools.Bool(j.properties.Is_stubs_module)
}
func (j *Module) CheckStableSdkVersion(ctx android.BaseModuleContext) error {
sdkVersion := j.SdkVersion(ctx)
if sdkVersion.Stable() {

View File

@@ -38,6 +38,7 @@ java_defaults {
visibility: ["//visibility:public"],
sdk_version: "none",
system_modules: "none",
is_stubs_module: true,
}
java_library {
@@ -289,6 +290,7 @@ java_defaults {
sdk_version: "none",
system_modules: "none",
patch_module: "java.base",
is_stubs_module: true,
}
// Same as legacy.core.platform.api.stubs, but android annotations are
@@ -307,6 +309,7 @@ java_library {
"legacy.core.platform.api.stubs",
],
patch_module: "java.base",
is_stubs_module: true,
}
java_library {
@@ -339,6 +342,7 @@ java_library {
"stable.core.platform.api.stubs",
],
patch_module: "java.base",
is_stubs_module: true,
}
// Used when compiling higher-level code against *.core.platform.api.stubs.

View File

@@ -54,6 +54,7 @@ func TestDexpreoptEnabled(t *testing.T) {
name: "foo",
installable: true,
srcs: ["a.java"],
sdk_version: "current",
}`,
enabled: true,
},
@@ -98,6 +99,7 @@ func TestDexpreoptEnabled(t *testing.T) {
java_library {
name: "foo",
installable: true,
sdk_version: "current",
}`,
enabled: false,
},
@@ -107,6 +109,7 @@ func TestDexpreoptEnabled(t *testing.T) {
java_library {
name: "foo",
srcs: ["a.java"],
sdk_version: "current",
}`,
enabled: false,
},
@@ -144,6 +147,7 @@ func TestDexpreoptEnabled(t *testing.T) {
name: "foo",
srcs: ["a.java"],
compile_dex: true,
sdk_version: "current",
}`,
enabled: false,
},
@@ -164,6 +168,7 @@ func TestDexpreoptEnabled(t *testing.T) {
installable: true,
srcs: ["a.java"],
apex_available: ["com.android.apex1"],
sdk_version: "current",
}`,
apexVariant: true,
enabled: false,
@@ -176,6 +181,7 @@ func TestDexpreoptEnabled(t *testing.T) {
installable: true,
srcs: ["a.java"],
apex_available: ["com.android.apex1"],
sdk_version: "current",
}`,
moduleName: "service-foo",
apexVariant: true,
@@ -189,6 +195,7 @@ func TestDexpreoptEnabled(t *testing.T) {
installable: true,
srcs: ["a.java"],
apex_available: ["com.android.apex1"],
sdk_version: "current",
}`,
moduleName: "prebuilt_service-foo",
apexVariant: true,
@@ -202,6 +209,7 @@ func TestDexpreoptEnabled(t *testing.T) {
installable: true,
srcs: ["a.java"],
apex_available: ["com.android.apex1"],
sdk_version: "current",
}`,
moduleName: "service-foo",
apexVariant: false,
@@ -311,6 +319,7 @@ func TestDexpreoptBuiltInstalledForApex(t *testing.T) {
installable: true,
srcs: ["a.java"],
apex_available: ["com.android.apex1"],
sdk_version: "current",
}`)
ctx := result.TestContext
module := ctx.ModuleForTests("service-foo", "android_common_apex1000")
@@ -342,6 +351,7 @@ func TestDexpreoptBuiltInstalledForApex(t *testing.T) {
name: "foo",
installable: true,
srcs: ["a.java"],
sdk_version: "current",
}`)
ctx = result.TestContext
module = ctx.ModuleForTests("foo", "android_common")
@@ -398,6 +408,7 @@ func TestAndroidMkEntriesForApex(t *testing.T) {
installable: true,
srcs: ["a.java"],
apex_available: ["com.android.apex1"],
sdk_version: "current",
}`)
ctx := result.TestContext
module := ctx.ModuleForTests("service-foo", "android_common_apex1000")
@@ -429,6 +440,7 @@ func TestAndroidMkEntriesForApex(t *testing.T) {
name: "foo",
installable: true,
srcs: ["a.java"],
sdk_version: "current",
}`)
ctx = result.TestContext
module = ctx.ModuleForTests("foo", "android_common")
@@ -454,6 +466,7 @@ func TestGenerateProfileEvenIfDexpreoptIsDisabled(t *testing.T) {
profile: "art-profile",
},
srcs: ["a.java"],
sdk_version: "current",
}`)
ctx := result.TestContext

View File

@@ -2099,6 +2099,7 @@ func (module *SdkLibrary) topLevelStubsLibraryProps(mctx android.DefaultableHook
props.Dist.Dir = proptools.StringPtr(module.apiDistPath(apiScope))
props.Dist.Tag = proptools.StringPtr(".jar")
}
props.Is_stubs_module = proptools.BoolPtr(true)
return props
}

View File

@@ -184,6 +184,10 @@ var PrepareForTestWithJacocoInstrumentation = android.GroupFixturePreparers(
host_supported: true,
srcs: ["Test.java"],
sdk_version: "current",
apex_available: [
"//apex_available:anyapex",
"//apex_available:platform",
],
}
`)),
)
@@ -408,7 +412,6 @@ func gatherRequiredDepsForTest() string {
"core.current.stubs",
"legacy.core.platform.api.stubs",
"stable.core.platform.api.stubs",
"android_stubs_current_exportable",
"android_system_stubs_current_exportable",
"android_test_stubs_current_exportable",
@@ -416,13 +419,11 @@ func gatherRequiredDepsForTest() string {
"android_system_server_stubs_current_exportable",
"core.current.stubs.exportable",
"legacy.core.platform.api.stubs.exportable",
"kotlin-stdlib",
"kotlin-stdlib-jdk7",
"kotlin-stdlib-jdk8",
"kotlin-annotations",
"stub-annotations",
"aconfig-annotations-lib",
"aconfig_storage_reader_java",
"unsupportedappusage",
@@ -436,6 +437,7 @@ func gatherRequiredDepsForTest() string {
sdk_version: "none",
system_modules: "stable-core-platform-api-stubs-system-modules",
compile_dex: true,
is_stubs_module: true,
}
`, extra)
}