Add stub_libs properties to bootclasspath_fragment snapshot

Bug: 177892522
Test: m nothing
Change-Id: I7644122c4abed8e8bc2cc7b58f408bee3bdc91f6
This commit is contained in:
Paul Duffin
2021-04-25 13:40:15 +01:00
parent 1093158faf
commit 895c7140a9
3 changed files with 165 additions and 8 deletions

View File

@@ -165,15 +165,25 @@ sdk_snapshot {
func TestSnapshotWithBootClasspathFragment_Contents(t *testing.T) {
result := android.GroupFixturePreparers(
prepareForSdkTestWithJava,
java.PrepareForTestWithJavaDefaultModules,
java.PrepareForTestWithJavaSdkLibraryFiles,
java.FixtureWithLastReleaseApis("mysdklibrary", "mycoreplatform"),
android.FixtureWithRootAndroidBp(`
sdk {
name: "mysdk",
bootclasspath_fragments: ["mybootclasspathfragment"],
java_sdk_libs: ["mysdklibrary", "mycoreplatform"],
}
bootclasspath_fragment {
name: "mybootclasspathfragment",
contents: ["mybootlib"],
api: {
stub_libs: ["mysdklibrary"],
},
core_platform_api: {
stub_libs: ["mycoreplatform"],
},
}
java_library {
@@ -183,6 +193,20 @@ func TestSnapshotWithBootClasspathFragment_Contents(t *testing.T) {
sdk_version: "none",
compile_dex: true,
}
java_sdk_library {
name: "mysdklibrary",
srcs: ["Test.java"],
compile_dex: true,
public: {enabled: true},
}
java_sdk_library {
name: "mycoreplatform",
srcs: ["Test.java"],
compile_dex: true,
public: {enabled: true},
}
`),
).RunTest(t)
@@ -196,6 +220,12 @@ prebuilt_bootclasspath_fragment {
visibility: ["//visibility:public"],
apex_available: ["//apex_available:platform"],
contents: ["mybootlib"],
api: {
stub_libs: ["mysdklibrary"],
},
core_platform_api: {
stub_libs: ["mycoreplatform"],
},
}
java_import {
@@ -205,6 +235,38 @@ java_import {
apex_available: ["//apex_available:platform"],
jars: ["java/mybootlib.jar"],
}
java_sdk_library_import {
name: "mysdklibrary",
prefer: false,
visibility: ["//visibility:public"],
apex_available: ["//apex_available:platform"],
shared_library: true,
compile_dex: true,
public: {
jars: ["sdk_library/public/mysdklibrary-stubs.jar"],
stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"],
current_api: "sdk_library/public/mysdklibrary.txt",
removed_api: "sdk_library/public/mysdklibrary-removed.txt",
sdk_version: "current",
},
}
java_sdk_library_import {
name: "mycoreplatform",
prefer: false,
visibility: ["//visibility:public"],
apex_available: ["//apex_available:platform"],
shared_library: true,
compile_dex: true,
public: {
jars: ["sdk_library/public/mycoreplatform-stubs.jar"],
stub_srcs: ["sdk_library/public/mycoreplatform_stub_sources"],
current_api: "sdk_library/public/mycoreplatform.txt",
removed_api: "sdk_library/public/mycoreplatform-removed.txt",
sdk_version: "current",
},
}
`),
checkVersionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
@@ -215,6 +277,12 @@ prebuilt_bootclasspath_fragment {
visibility: ["//visibility:public"],
apex_available: ["//apex_available:platform"],
contents: ["mysdk_mybootlib@current"],
api: {
stub_libs: ["mysdk_mysdklibrary@current"],
},
core_platform_api: {
stub_libs: ["mysdk_mycoreplatform@current"],
},
}
java_import {
@@ -225,15 +293,57 @@ java_import {
jars: ["java/mybootlib.jar"],
}
java_sdk_library_import {
name: "mysdk_mysdklibrary@current",
sdk_member_name: "mysdklibrary",
visibility: ["//visibility:public"],
apex_available: ["//apex_available:platform"],
shared_library: true,
compile_dex: true,
public: {
jars: ["sdk_library/public/mysdklibrary-stubs.jar"],
stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"],
current_api: "sdk_library/public/mysdklibrary.txt",
removed_api: "sdk_library/public/mysdklibrary-removed.txt",
sdk_version: "current",
},
}
java_sdk_library_import {
name: "mysdk_mycoreplatform@current",
sdk_member_name: "mycoreplatform",
visibility: ["//visibility:public"],
apex_available: ["//apex_available:platform"],
shared_library: true,
compile_dex: true,
public: {
jars: ["sdk_library/public/mycoreplatform-stubs.jar"],
stub_srcs: ["sdk_library/public/mycoreplatform_stub_sources"],
current_api: "sdk_library/public/mycoreplatform.txt",
removed_api: "sdk_library/public/mycoreplatform-removed.txt",
sdk_version: "current",
},
}
sdk_snapshot {
name: "mysdk@current",
visibility: ["//visibility:public"],
bootclasspath_fragments: ["mysdk_mybootclasspathfragment@current"],
java_boot_libs: ["mysdk_mybootlib@current"],
java_sdk_libs: [
"mysdk_mysdklibrary@current",
"mysdk_mycoreplatform@current",
],
}
`),
checkAllCopyRules(`
.intermediates/mybootlib/android_common/javac/mybootlib.jar -> java/mybootlib.jar
.intermediates/mysdklibrary.stubs/android_common/javac/mysdklibrary.stubs.jar -> sdk_library/public/mysdklibrary-stubs.jar
.intermediates/mysdklibrary.stubs.source/android_common/metalava/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
.intermediates/mysdklibrary.stubs.source/android_common/metalava/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
.intermediates/mycoreplatform.stubs/android_common/javac/mycoreplatform.stubs.jar -> sdk_library/public/mycoreplatform-stubs.jar
.intermediates/mycoreplatform.stubs.source/android_common/metalava/mycoreplatform.stubs.source_api.txt -> sdk_library/public/mycoreplatform.txt
.intermediates/mycoreplatform.stubs.source/android_common/metalava/mycoreplatform.stubs.source_removed.txt -> sdk_library/public/mycoreplatform-removed.txt
`))
}