Merge "Disable boot jars package check if no boot jars have been configured"
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 41097ca..dae31b9 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -701,12 +701,6 @@
return c.namingScheme.stubsSourceModuleName(apiScope, c.moduleBase.BaseModuleName())
}
-// Name of the droidstubs module that generates/checks the API. Only used if it
-// requires different arts to the stubs source generating module.
-func (c *commonToSdkLibraryAndImport) apiModuleName(apiScope *apiScope) string {
- return c.namingScheme.apiModuleName(apiScope, c.moduleBase.BaseModuleName())
-}
-
// The component names for different outputs of the java_sdk_library.
//
// They are similar to the names used for the child modules it creates
@@ -1732,8 +1726,6 @@
stubsLibraryModuleName(scope *apiScope, baseName string) string
stubsSourceModuleName(scope *apiScope, baseName string) string
-
- apiModuleName(scope *apiScope, baseName string) string
}
type defaultNamingScheme struct {
@@ -1747,10 +1739,6 @@
return scope.stubsSourceModuleName(baseName)
}
-func (s *defaultNamingScheme) apiModuleName(scope *apiScope, baseName string) string {
- return scope.apiModuleName(baseName)
-}
-
var _ sdkLibraryComponentNamingScheme = (*defaultNamingScheme)(nil)
func moduleStubLinkType(name string) (stub bool, ret sdkLinkType) {
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index 6f769a3..ad2bd75 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -663,16 +663,28 @@
}
func TestSnapshotWithJavaSystemModules(t *testing.T) {
- result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
+ result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_header_libs: ["exported-system-module"],
+ java_sdk_libs: ["myjavalib"],
java_system_modules: ["my-system-modules"],
}
+ java_sdk_library {
+ name: "myjavalib",
+ apex_available: ["//apex_available:anyapex"],
+ srcs: ["Test.java"],
+ sdk_version: "current",
+ shared_library: false,
+ public: {
+ enabled: true,
+ },
+ }
+
java_system_modules {
name: "my-system-modules",
- libs: ["system-module", "exported-system-module"],
+ libs: ["system-module", "exported-system-module", "myjavalib.stubs"],
}
java_library {
@@ -710,6 +722,29 @@
jars: ["java/system-module.jar"],
}
+java_import {
+ name: "mysdk_myjavalib.stubs",
+ prefer: false,
+ visibility: ["//visibility:private"],
+ apex_available: ["//apex_available:platform"],
+ jars: ["java/myjavalib.stubs.jar"],
+}
+
+java_sdk_library_import {
+ name: "myjavalib",
+ prefer: false,
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:anyapex"],
+ shared_library: false,
+ public: {
+ jars: ["sdk_library/public/myjavalib-stubs.jar"],
+ stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
+ current_api: "sdk_library/public/myjavalib.txt",
+ removed_api: "sdk_library/public/myjavalib-removed.txt",
+ sdk_version: "current",
+ },
+}
+
java_system_modules_import {
name: "my-system-modules",
prefer: false,
@@ -717,6 +752,7 @@
libs: [
"mysdk_system-module",
"exported-system-module",
+ "mysdk_myjavalib.stubs",
],
}
`),
@@ -739,6 +775,29 @@
jars: ["java/system-module.jar"],
}
+java_import {
+ name: "mysdk_myjavalib.stubs@current",
+ sdk_member_name: "myjavalib.stubs",
+ visibility: ["//visibility:private"],
+ apex_available: ["//apex_available:platform"],
+ jars: ["java/myjavalib.stubs.jar"],
+}
+
+java_sdk_library_import {
+ name: "mysdk_myjavalib@current",
+ sdk_member_name: "myjavalib",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:anyapex"],
+ shared_library: false,
+ public: {
+ jars: ["sdk_library/public/myjavalib-stubs.jar"],
+ stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
+ current_api: "sdk_library/public/myjavalib.txt",
+ removed_api: "sdk_library/public/myjavalib-removed.txt",
+ sdk_version: "current",
+ },
+}
+
java_system_modules_import {
name: "mysdk_my-system-modules@current",
sdk_member_name: "my-system-modules",
@@ -746,6 +805,7 @@
libs: [
"mysdk_system-module@current",
"mysdk_exported-system-module@current",
+ "mysdk_myjavalib.stubs@current",
],
}
@@ -753,12 +813,17 @@
name: "mysdk@current",
visibility: ["//visibility:public"],
java_header_libs: ["mysdk_exported-system-module@current"],
+ java_sdk_libs: ["mysdk_myjavalib@current"],
java_system_modules: ["mysdk_my-system-modules@current"],
}
`),
checkAllCopyRules(`
.intermediates/exported-system-module/android_common/turbine-combined/exported-system-module.jar -> java/exported-system-module.jar
.intermediates/system-module/android_common/turbine-combined/system-module.jar -> java/system-module.jar
+.intermediates/myjavalib.stubs/android_common/turbine-combined/myjavalib.stubs.jar -> java/myjavalib.stubs.jar
+.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
`),
)
}
@@ -1085,7 +1150,14 @@
checkMergeZips(
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip",
- ".intermediates/mysdk/common_os/tmp/sdk_library/test/myjavalib_stub_sources.zip"),
+ ".intermediates/mysdk/common_os/tmp/sdk_library/test/myjavalib_stub_sources.zip",
+ ),
+ snapshotTestChecker(checkSnapshotWithoutSource, func(t *testing.T, result *android.TestResult) {
+ // Show that the existing behavior is incorrect as the suffix for the child modules is added
+ // to the version not before it.
+ result.Module("mysdk_myjavalib@current.stubs", "android_common")
+ result.Module("mysdk_myjavalib@current.stubs.source", "android_common")
+ }),
)
}