diff --git a/java/sdk_library.go b/java/sdk_library.go index ecf2b1a03..94927291c 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -435,9 +435,6 @@ type sdkLibraryProperties struct { // a list of top-level directories containing Java stub files to merge show/hide annotations from. Merge_inclusion_annotations_dirs []string - // If set to true, the path of dist files is apistubs/core. Defaults to false. - Core_lib *bool - // If set to true then don't create dist rules. No_dist *bool @@ -458,7 +455,7 @@ type sdkLibraryProperties struct { Dist_stem *string // The subdirectory for the artifacts that are copied to the dist directory. If not specified - // then defaults to "android". Should be set to "android" for anything that should be published + // then defaults to "unknown". Should be set to "android" for anything that should be published // in the public Android SDK. Dist_group *string @@ -1203,11 +1200,7 @@ func (module *SdkLibrary) AndroidMkEntries() []android.AndroidMkEntries { // The dist path of the stub artifacts func (module *SdkLibrary) apiDistPath(apiScope *apiScope) string { - if Bool(module.sdkLibraryProperties.Core_lib) { - return path.Join("apistubs", "core", apiScope.name) - } else { - return path.Join("apistubs", module.distGroup(), apiScope.name) - } + return path.Join("apistubs", module.distGroup(), apiScope.name) } // Get the sdk version for use when compiling the stubs library. @@ -1233,15 +1226,7 @@ func (module *SdkLibrary) distStem() string { // distGroup returns the subdirectory of the dist path of the stub artifacts. func (module *SdkLibrary) distGroup() string { - if group := proptools.String(module.sdkLibraryProperties.Dist_group); group != "" { - return group - } - // TODO(b/186723288): Remove this once everything uses dist_group. - if owner := module.ModuleBase.Owner(); owner != "" { - return owner - } - // TODO(b/186723288): Make this "unknown". - return "android" + return proptools.StringDefault(module.sdkLibraryProperties.Dist_group, "unknown") } func (module *SdkLibrary) latestApiFilegroupName(apiScope *apiScope) string { diff --git a/java/sdk_library_test.go b/java/sdk_library_test.go index 0fe6e72ef..2520dde6e 100644 --- a/java/sdk_library_test.go +++ b/java/sdk_library_test.go @@ -844,40 +844,34 @@ func TestJavaSdkLibraryDist(t *testing.T) { PrepareForTestWithJavaBuildComponents, PrepareForTestWithJavaDefaultModules, PrepareForTestWithJavaSdkLibraryFiles, + FixtureWithLastReleaseApis( + "sdklib_no_group", + "sdklib_group_foo", + "sdklib_owner_foo", + "foo"), ).RunTestWithBp(t, ` java_sdk_library { - name: "sdklib_no_owner", - unsafe_ignore_missing_latest_api: true, + name: "sdklib_no_group", srcs: ["foo.java"], } java_sdk_library { name: "sdklib_group_foo", - unsafe_ignore_missing_latest_api: true, srcs: ["foo.java"], dist_group: "foo", } java_sdk_library { name: "sdklib_owner_foo", - unsafe_ignore_missing_latest_api: true, srcs: ["foo.java"], owner: "foo", } java_sdk_library { name: "sdklib_stem_foo", - unsafe_ignore_missing_latest_api: true, srcs: ["foo.java"], dist_stem: "foo", } - - java_sdk_library { - name: "sdklib_core_lib", - unsafe_ignore_missing_latest_api: true, - srcs: ["foo.java"], - core_lib: true, - } `) type testCase struct { @@ -887,9 +881,9 @@ func TestJavaSdkLibraryDist(t *testing.T) { } testCases := []testCase{ { - module: "sdklib_no_owner", - distDir: "apistubs/android/public", - distStem: "sdklib_no_owner.jar", + module: "sdklib_no_group", + distDir: "apistubs/unknown/public", + distStem: "sdklib_no_group.jar", }, { module: "sdklib_group_foo", @@ -897,20 +891,16 @@ func TestJavaSdkLibraryDist(t *testing.T) { distStem: "sdklib_group_foo.jar", }, { + // Owner doesn't affect distDir after b/186723288. module: "sdklib_owner_foo", - distDir: "apistubs/foo/public", + distDir: "apistubs/unknown/public", distStem: "sdklib_owner_foo.jar", }, { module: "sdklib_stem_foo", - distDir: "apistubs/android/public", + distDir: "apistubs/unknown/public", distStem: "foo.jar", }, - { - module: "sdklib_core_lib", - distDir: "apistubs/core/public", - distStem: "sdklib_core_lib.jar", - }, } for _, tt := range testCases {