Output dex_preopt to SDK snapshot.
This is needed to determine whether we need to deapex the profile or
not.
Bug: 241823638
Test: m nothing
Test: -
1. Patch ag/20582608 PS2.
2. TARGET_BUILD_APPS=com.android.wifi packages/modules/common/build/mainline_modules_sdks.sh
3. See the `dex_preopt` property being written.
Change-Id: I05177388c24be1ab315247ea85e7e3a8600cebd3
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index 2ade146..3a2ecc0 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -33,7 +33,8 @@
// Files needs by most of the tests.
android.MockFS{
- "Test.java": nil,
+ "Test.java": nil,
+ "art-profile": nil,
}.AddToFixture(),
)
diff --git a/sdk/systemserverclasspath_fragment_sdk_test.go b/sdk/systemserverclasspath_fragment_sdk_test.go
index 2a17cdc..66c44c8 100644
--- a/sdk/systemserverclasspath_fragment_sdk_test.go
+++ b/sdk/systemserverclasspath_fragment_sdk_test.go
@@ -62,6 +62,9 @@
min_sdk_version: "2",
compile_dex: true,
permitted_packages: ["mylib"],
+ dex_preopt: {
+ profile: "art-profile",
+ },
}
java_sdk_library {
@@ -71,6 +74,9 @@
shared_library: false,
public: {enabled: true},
min_sdk_version: "2",
+ dex_preopt: {
+ profile: "art-profile",
+ },
}
`),
).RunTest(t)
@@ -105,6 +111,9 @@
visibility: ["//visibility:public"],
apex_available: ["myapex"],
shared_library: false,
+ dex_preopt: {
+ profile_guided: true,
+ },
public: {
jars: ["sdk_library/public/mysdklibrary-stubs.jar"],
stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"],
@@ -122,6 +131,9 @@
jars: ["java_systemserver_libs/snapshot/jars/are/invalid/mylib.jar"],
min_sdk_version: "2",
permitted_packages: ["mylib"],
+ dex_preopt: {
+ profile_guided: true,
+ },
}
prebuilt_systemserverclasspath_fragment {
@@ -199,6 +211,54 @@
`)
})
+ t.Run("target-u", func(t *testing.T) {
+ testSnapshotWithSystemServerClasspathFragment(t, commonSdk, "UpsideDownCake", `
+// This is auto-generated. DO NOT EDIT.
+
+java_sdk_library_import {
+ name: "mysdklibrary",
+ prefer: false,
+ visibility: ["//visibility:public"],
+ apex_available: ["myapex"],
+ shared_library: false,
+ dex_preopt: {
+ profile_guided: 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_import {
+ name: "mylib",
+ prefer: false,
+ visibility: ["//visibility:public"],
+ apex_available: ["myapex"],
+ jars: ["java_systemserver_libs/snapshot/jars/are/invalid/mylib.jar"],
+ min_sdk_version: "2",
+ permitted_packages: ["mylib"],
+ dex_preopt: {
+ profile_guided: true,
+ },
+}
+
+prebuilt_systemserverclasspath_fragment {
+ name: "mysystemserverclasspathfragment",
+ prefer: false,
+ visibility: ["//visibility:public"],
+ apex_available: ["myapex"],
+ contents: [
+ "mylib",
+ "mysdklibrary",
+ ],
+}
+`)
+ })
+
t.Run("added-directly", func(t *testing.T) {
testSnapshotWithSystemServerClasspathFragment(t, commonSdk, `latest`, expectedLatestSnapshot)
})