Use the profiles in the APEX to dexpreopt system server jars.
After this change, if "profile_guided: true" is set, profile-guided compilation will be enabled for the jar and the ".prof" file next to the jar in the APEX ("javalib/<name>.jar.prof") will be used as the profile when dexpreopting for the prebuilt APEX. Bug: 241823638 Test: m nothing Test: - 1. (on internal master) Patch aosp/2426453. 2. Build the APEX bundle and the module SDK of com.android.wifi 3. (on tm-dev) Patch this CL and aosp/2141972. 4. Copy the APEX bundle and the module SDK built on step 2 to the source tree 5. Disable hiddenapi check 6. lunch cf_x86_64_phone-userdebug && m MODULE_BUILD_FROM_SOURCE=false com.google.android.wifi 7. cat out/soong/.intermediates/prebuilts/module_sdk/Wifi/current/prebuilt_service-wifi/android_common_com.android.wifi/dexpreopt/oat/x86_64/javalib.invocation 8. See the profile being used. Change-Id: I55a5a295e9c5d6f0564afb139c5fb7da91ab8cae
This commit is contained in:
@@ -222,7 +222,7 @@ func TestPrebuiltSystemserverclasspathFragmentContents(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForTestWithSystemserverclasspathFragment,
|
||||
prepareForTestWithMyapex,
|
||||
dexpreopt.FixtureSetApexSystemServerJars("myapex:foo"),
|
||||
dexpreopt.FixtureSetApexSystemServerJars("myapex:foo", "myapex:bar"),
|
||||
).RunTestWithBp(t, `
|
||||
prebuilt_apex {
|
||||
name: "myapex",
|
||||
@@ -245,11 +245,23 @@ func TestPrebuiltSystemserverclasspathFragmentContents(t *testing.T) {
|
||||
],
|
||||
}
|
||||
|
||||
java_import {
|
||||
name: "bar",
|
||||
jars: ["bar.jar"],
|
||||
dex_preopt: {
|
||||
profile_guided: true,
|
||||
},
|
||||
apex_available: [
|
||||
"myapex",
|
||||
],
|
||||
}
|
||||
|
||||
prebuilt_systemserverclasspath_fragment {
|
||||
name: "mysystemserverclasspathfragment",
|
||||
prefer: true,
|
||||
contents: [
|
||||
"foo",
|
||||
"bar",
|
||||
],
|
||||
apex_available: [
|
||||
"myapex",
|
||||
@@ -257,15 +269,27 @@ func TestPrebuiltSystemserverclasspathFragmentContents(t *testing.T) {
|
||||
}
|
||||
`)
|
||||
|
||||
java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex", []string{
|
||||
ctx := result.TestContext
|
||||
|
||||
java.CheckModuleDependencies(t, ctx, "myapex", "android_common_myapex", []string{
|
||||
`myapex.apex.selector`,
|
||||
`prebuilt_mysystemserverclasspathfragment`,
|
||||
})
|
||||
|
||||
java.CheckModuleDependencies(t, result.TestContext, "mysystemserverclasspathfragment", "android_common_myapex", []string{
|
||||
java.CheckModuleDependencies(t, ctx, "mysystemserverclasspathfragment", "android_common_myapex", []string{
|
||||
`myapex.deapexer`,
|
||||
`prebuilt_bar`,
|
||||
`prebuilt_foo`,
|
||||
})
|
||||
|
||||
ensureExactDeapexedContents(t, ctx, "myapex", "android_common", []string{
|
||||
"javalib/foo.jar",
|
||||
"javalib/bar.jar",
|
||||
"javalib/bar.jar.prof",
|
||||
})
|
||||
|
||||
assertProfileGuided(t, ctx, "foo", "android_common_myapex", false)
|
||||
assertProfileGuided(t, ctx, "bar", "android_common_myapex", true)
|
||||
}
|
||||
|
||||
func TestSystemserverclasspathFragmentStandaloneContents(t *testing.T) {
|
||||
@@ -354,7 +378,7 @@ func TestPrebuiltStandaloneSystemserverclasspathFragmentContents(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForTestWithSystemserverclasspathFragment,
|
||||
prepareForTestWithMyapex,
|
||||
dexpreopt.FixtureSetApexStandaloneSystemServerJars("myapex:foo"),
|
||||
dexpreopt.FixtureSetApexStandaloneSystemServerJars("myapex:foo", "myapex:bar"),
|
||||
).RunTestWithBp(t, `
|
||||
prebuilt_apex {
|
||||
name: "myapex",
|
||||
@@ -377,11 +401,23 @@ func TestPrebuiltStandaloneSystemserverclasspathFragmentContents(t *testing.T) {
|
||||
],
|
||||
}
|
||||
|
||||
java_import {
|
||||
name: "bar",
|
||||
jars: ["bar.jar"],
|
||||
dex_preopt: {
|
||||
profile_guided: true,
|
||||
},
|
||||
apex_available: [
|
||||
"myapex",
|
||||
],
|
||||
}
|
||||
|
||||
prebuilt_systemserverclasspath_fragment {
|
||||
name: "mysystemserverclasspathfragment",
|
||||
prefer: true,
|
||||
standalone_contents: [
|
||||
"foo",
|
||||
"bar",
|
||||
],
|
||||
apex_available: [
|
||||
"myapex",
|
||||
@@ -389,10 +425,22 @@ func TestPrebuiltStandaloneSystemserverclasspathFragmentContents(t *testing.T) {
|
||||
}
|
||||
`)
|
||||
|
||||
java.CheckModuleDependencies(t, result.TestContext, "mysystemserverclasspathfragment", "android_common_myapex", []string{
|
||||
ctx := result.TestContext
|
||||
|
||||
java.CheckModuleDependencies(t, ctx, "mysystemserverclasspathfragment", "android_common_myapex", []string{
|
||||
`myapex.deapexer`,
|
||||
`prebuilt_bar`,
|
||||
`prebuilt_foo`,
|
||||
})
|
||||
|
||||
ensureExactDeapexedContents(t, ctx, "myapex", "android_common", []string{
|
||||
"javalib/foo.jar",
|
||||
"javalib/bar.jar",
|
||||
"javalib/bar.jar.prof",
|
||||
})
|
||||
|
||||
assertProfileGuided(t, ctx, "foo", "android_common_myapex", false)
|
||||
assertProfileGuided(t, ctx, "bar", "android_common_myapex", true)
|
||||
}
|
||||
|
||||
func assertProfileGuided(t *testing.T, ctx *android.TestContext, moduleName string, variant string, expected bool) {
|
||||
|
Reference in New Issue
Block a user