Snap for 12391343 from 47ace291a7
to 24Q4-release
Change-Id: I0486e8443fad8ef52cab50ce86d88d860f728d03
This commit is contained in:
11
Android.bp
11
Android.bp
@@ -1,5 +1,8 @@
|
|||||||
package {
|
package {
|
||||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||||
|
default_visibility: [
|
||||||
|
"//build/soong:__subpackages__",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
subdirs = [
|
subdirs = [
|
||||||
@@ -23,6 +26,8 @@ bootstrap_go_package {
|
|||||||
srcs: [
|
srcs: [
|
||||||
"doc.go",
|
"doc.go",
|
||||||
],
|
],
|
||||||
|
// Used by plugins, though probably shouldn't be.
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -40,6 +45,7 @@ cc_defaults {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
defaults_visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -51,6 +57,7 @@ kernel_headers {
|
|||||||
vendor: true,
|
vendor: true,
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
min_sdk_version: "apex_inherit",
|
min_sdk_version: "apex_inherit",
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_genrule {
|
cc_genrule {
|
||||||
@@ -75,6 +82,7 @@ cc_genrule {
|
|||||||
cmd: "$(location) -s $(out) $(in)",
|
cmd: "$(location) -s $(out) $(in)",
|
||||||
srcs: [":linker"],
|
srcs: [":linker"],
|
||||||
out: ["linker.s"],
|
out: ["linker.s"],
|
||||||
|
visibility: ["//bionic/libc"],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_genrule {
|
cc_genrule {
|
||||||
@@ -99,11 +107,13 @@ cc_genrule {
|
|||||||
cmd: "$(location) -T $(out) $(in)",
|
cmd: "$(location) -T $(out) $(in)",
|
||||||
srcs: [":linker"],
|
srcs: [":linker"],
|
||||||
out: ["linker.script"],
|
out: ["linker.script"],
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instantiate the dex_bootjars singleton module.
|
// Instantiate the dex_bootjars singleton module.
|
||||||
dex_bootjars {
|
dex_bootjars {
|
||||||
name: "dex_bootjars",
|
name: "dex_bootjars",
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pseudo-test that's run on checkbuilds to ensure that get_clang_version can
|
// Pseudo-test that's run on checkbuilds to ensure that get_clang_version can
|
||||||
@@ -123,6 +133,7 @@ dexpreopt_systemserver_check {
|
|||||||
// container for apex_contributions selected using build flags
|
// container for apex_contributions selected using build flags
|
||||||
all_apex_contributions {
|
all_apex_contributions {
|
||||||
name: "all_apex_contributions",
|
name: "all_apex_contributions",
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
|
||||||
product_config {
|
product_config {
|
||||||
|
@@ -29,4 +29,5 @@ bootstrap_go_package {
|
|||||||
"aidl_library_test.go",
|
"aidl_library_test.go",
|
||||||
],
|
],
|
||||||
pluginFor: ["soong_build"],
|
pluginFor: ["soong_build"],
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -155,4 +155,6 @@ bootstrap_go_package {
|
|||||||
"vintf_fragment_test.go",
|
"vintf_fragment_test.go",
|
||||||
"visibility_test.go",
|
"visibility_test.go",
|
||||||
],
|
],
|
||||||
|
// Used by plugins
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -18,5 +18,6 @@ import "encoding/gob"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
gob.Register(ModuleOutPath{})
|
gob.Register(ModuleOutPath{})
|
||||||
|
gob.Register(PhonyPath{})
|
||||||
gob.Register(unstableInfo{})
|
gob.Register(unstableInfo{})
|
||||||
}
|
}
|
||||||
|
@@ -40,4 +40,8 @@ python_library_host {
|
|||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
canonical_path_from_root: false,
|
||||||
},
|
},
|
||||||
|
visibility: [
|
||||||
|
"//build/soong:__subpackages__",
|
||||||
|
"//tools/asuite/team_build_scripts",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
@@ -42,4 +42,6 @@ bootstrap_go_package {
|
|||||||
"systemserver_classpath_fragment_test.go",
|
"systemserver_classpath_fragment_test.go",
|
||||||
],
|
],
|
||||||
pluginFor: ["soong_build"],
|
pluginFor: ["soong_build"],
|
||||||
|
// Used by plugins
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -4885,236 +4885,6 @@ type moduleErrorfTestCtx struct {
|
|||||||
func (ctx moduleErrorfTestCtx) ModuleErrorf(format string, args ...interface{}) {
|
func (ctx moduleErrorfTestCtx) ModuleErrorf(format string, args ...interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// These tests verify that the prebuilt_apex/deapexer to java_import wiring allows for the
|
|
||||||
// propagation of paths to dex implementation jars from the former to the latter.
|
|
||||||
func TestPrebuiltExportDexImplementationJars(t *testing.T) {
|
|
||||||
transform := android.NullFixturePreparer
|
|
||||||
|
|
||||||
checkDexJarBuildPath := func(t *testing.T, ctx *android.TestContext, name string) {
|
|
||||||
t.Helper()
|
|
||||||
// Make sure the import has been given the correct path to the dex jar.
|
|
||||||
p := ctx.ModuleForTests(name, "android_common_myapex").Module().(java.UsesLibraryDependency)
|
|
||||||
dexJarBuildPath := p.DexJarBuildPath(moduleErrorfTestCtx{}).PathOrNil()
|
|
||||||
stem := android.RemoveOptionalPrebuiltPrefix(name)
|
|
||||||
android.AssertStringEquals(t, "DexJarBuildPath should be apex-related path.",
|
|
||||||
".intermediates/prebuilt_myapex.deapexer/android_common/deapexer/javalib/"+stem+".jar",
|
|
||||||
android.NormalizePathForTesting(dexJarBuildPath))
|
|
||||||
}
|
|
||||||
|
|
||||||
checkDexJarInstallPath := func(t *testing.T, ctx *android.TestContext, name string) {
|
|
||||||
t.Helper()
|
|
||||||
// Make sure the import has been given the correct path to the dex jar.
|
|
||||||
p := ctx.ModuleForTests(name, "android_common_myapex").Module().(java.UsesLibraryDependency)
|
|
||||||
dexJarBuildPath := p.DexJarInstallPath()
|
|
||||||
stem := android.RemoveOptionalPrebuiltPrefix(name)
|
|
||||||
android.AssertStringEquals(t, "DexJarInstallPath should be apex-related path.",
|
|
||||||
"target/product/test_device/apex/myapex/javalib/"+stem+".jar",
|
|
||||||
android.NormalizePathForTesting(dexJarBuildPath))
|
|
||||||
}
|
|
||||||
|
|
||||||
ensureNoSourceVariant := func(t *testing.T, ctx *android.TestContext, name string) {
|
|
||||||
t.Helper()
|
|
||||||
// Make sure that an apex variant is not created for the source module.
|
|
||||||
android.AssertArrayString(t, "Check if there is no source variant",
|
|
||||||
[]string{"android_common"},
|
|
||||||
ctx.ModuleVariantsForTests(name))
|
|
||||||
}
|
|
||||||
|
|
||||||
t.Run("prebuilt only", func(t *testing.T) {
|
|
||||||
bp := `
|
|
||||||
prebuilt_apex {
|
|
||||||
name: "myapex",
|
|
||||||
arch: {
|
|
||||||
arm64: {
|
|
||||||
src: "myapex-arm64.apex",
|
|
||||||
},
|
|
||||||
arm: {
|
|
||||||
src: "myapex-arm.apex",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
exported_java_libs: ["libfoo", "libbar"],
|
|
||||||
}
|
|
||||||
|
|
||||||
java_import {
|
|
||||||
name: "libfoo",
|
|
||||||
jars: ["libfoo.jar"],
|
|
||||||
sdk_version: "core_current",
|
|
||||||
}
|
|
||||||
|
|
||||||
java_sdk_library_import {
|
|
||||||
name: "libbar",
|
|
||||||
public: {
|
|
||||||
jars: ["libbar.jar"],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
// Make sure that dexpreopt can access dex implementation files from the prebuilt.
|
|
||||||
ctx := testDexpreoptWithApexes(t, bp, "", transform)
|
|
||||||
|
|
||||||
deapexerName := deapexerModuleName("prebuilt_myapex")
|
|
||||||
android.AssertStringEquals(t, "APEX module name from deapexer name", "prebuilt_myapex", apexModuleName(deapexerName))
|
|
||||||
|
|
||||||
// Make sure that the deapexer has the correct input APEX.
|
|
||||||
deapexer := ctx.ModuleForTests(deapexerName, "android_common")
|
|
||||||
rule := deapexer.Rule("deapexer")
|
|
||||||
if expected, actual := []string{"myapex-arm64.apex"}, android.NormalizePathsForTesting(rule.Implicits); !reflect.DeepEqual(expected, actual) {
|
|
||||||
t.Errorf("expected: %q, found: %q", expected, actual)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure that the prebuilt_apex has the correct input APEX.
|
|
||||||
prebuiltApex := ctx.ModuleForTests("myapex", "android_common_myapex")
|
|
||||||
rule = prebuiltApex.Rule("android/soong/android.Cp")
|
|
||||||
if expected, actual := "myapex-arm64.apex", android.NormalizePathForTesting(rule.Input); !reflect.DeepEqual(expected, actual) {
|
|
||||||
t.Errorf("expected: %q, found: %q", expected, actual)
|
|
||||||
}
|
|
||||||
|
|
||||||
checkDexJarBuildPath(t, ctx, "libfoo")
|
|
||||||
checkDexJarInstallPath(t, ctx, "libfoo")
|
|
||||||
|
|
||||||
checkDexJarBuildPath(t, ctx, "libbar")
|
|
||||||
checkDexJarInstallPath(t, ctx, "libbar")
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("prebuilt with source preferred", func(t *testing.T) {
|
|
||||||
|
|
||||||
bp := `
|
|
||||||
apex {
|
|
||||||
name: "myapex",
|
|
||||||
key: "myapex.key",
|
|
||||||
updatable: false,
|
|
||||||
java_libs: [
|
|
||||||
"libfoo",
|
|
||||||
"libbar",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
apex_key {
|
|
||||||
name: "myapex.key",
|
|
||||||
public_key: "testkey.avbpubkey",
|
|
||||||
private_key: "testkey.pem",
|
|
||||||
}
|
|
||||||
|
|
||||||
prebuilt_apex {
|
|
||||||
name: "myapex",
|
|
||||||
arch: {
|
|
||||||
arm64: {
|
|
||||||
src: "myapex-arm64.apex",
|
|
||||||
},
|
|
||||||
arm: {
|
|
||||||
src: "myapex-arm.apex",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
exported_java_libs: ["libfoo", "libbar"],
|
|
||||||
}
|
|
||||||
|
|
||||||
java_import {
|
|
||||||
name: "libfoo",
|
|
||||||
jars: ["libfoo.jar"],
|
|
||||||
apex_available: [
|
|
||||||
"myapex",
|
|
||||||
],
|
|
||||||
compile_dex: true,
|
|
||||||
sdk_version: "core_current",
|
|
||||||
}
|
|
||||||
|
|
||||||
java_library {
|
|
||||||
name: "libfoo",
|
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
|
||||||
apex_available: [
|
|
||||||
"myapex",
|
|
||||||
],
|
|
||||||
compile_dex: true,
|
|
||||||
sdk_version: "core_current",
|
|
||||||
}
|
|
||||||
|
|
||||||
java_sdk_library_import {
|
|
||||||
name: "libbar",
|
|
||||||
public: {
|
|
||||||
jars: ["libbar.jar"],
|
|
||||||
},
|
|
||||||
apex_available: [
|
|
||||||
"myapex",
|
|
||||||
],
|
|
||||||
compile_dex: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
java_sdk_library {
|
|
||||||
name: "libbar",
|
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
|
||||||
unsafe_ignore_missing_latest_api: true,
|
|
||||||
apex_available: [
|
|
||||||
"myapex",
|
|
||||||
],
|
|
||||||
compile_dex: true,
|
|
||||||
sdk_version: "core_current",
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
// Make sure that dexpreopt can access dex implementation files from the prebuilt.
|
|
||||||
ctx := testDexpreoptWithApexes(t, bp, "", transform)
|
|
||||||
|
|
||||||
checkDexJarBuildPath(t, ctx, "prebuilt_libfoo")
|
|
||||||
checkDexJarInstallPath(t, ctx, "prebuilt_libfoo")
|
|
||||||
|
|
||||||
checkDexJarBuildPath(t, ctx, "prebuilt_libbar")
|
|
||||||
checkDexJarInstallPath(t, ctx, "prebuilt_libbar")
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("prebuilt preferred with source", func(t *testing.T) {
|
|
||||||
bp := `
|
|
||||||
prebuilt_apex {
|
|
||||||
name: "myapex",
|
|
||||||
arch: {
|
|
||||||
arm64: {
|
|
||||||
src: "myapex-arm64.apex",
|
|
||||||
},
|
|
||||||
arm: {
|
|
||||||
src: "myapex-arm.apex",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
exported_java_libs: ["libfoo", "libbar"],
|
|
||||||
}
|
|
||||||
|
|
||||||
java_import {
|
|
||||||
name: "libfoo",
|
|
||||||
prefer: true,
|
|
||||||
jars: ["libfoo.jar"],
|
|
||||||
}
|
|
||||||
|
|
||||||
java_library {
|
|
||||||
name: "libfoo",
|
|
||||||
sdk_version: "core_current",
|
|
||||||
}
|
|
||||||
|
|
||||||
java_sdk_library_import {
|
|
||||||
name: "libbar",
|
|
||||||
prefer: true,
|
|
||||||
public: {
|
|
||||||
jars: ["libbar.jar"],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
java_sdk_library {
|
|
||||||
name: "libbar",
|
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
|
||||||
unsafe_ignore_missing_latest_api: true,
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
// Make sure that dexpreopt can access dex implementation files from the prebuilt.
|
|
||||||
ctx := testDexpreoptWithApexes(t, bp, "", transform)
|
|
||||||
|
|
||||||
checkDexJarBuildPath(t, ctx, "prebuilt_libfoo")
|
|
||||||
checkDexJarInstallPath(t, ctx, "prebuilt_libfoo")
|
|
||||||
ensureNoSourceVariant(t, ctx, "libfoo")
|
|
||||||
|
|
||||||
checkDexJarBuildPath(t, ctx, "prebuilt_libbar")
|
|
||||||
checkDexJarInstallPath(t, ctx, "prebuilt_libbar")
|
|
||||||
ensureNoSourceVariant(t, ctx, "libbar")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
||||||
preparer := android.GroupFixturePreparers(
|
preparer := android.GroupFixturePreparers(
|
||||||
java.FixtureConfigureApexBootJars("myapex:libfoo", "myapex:libbar"),
|
java.FixtureConfigureApexBootJars("myapex:libfoo", "myapex:libbar"),
|
||||||
@@ -5243,18 +5013,10 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
apex_set {
|
apex_set {
|
||||||
name: "myapex",
|
name: "myapex",
|
||||||
set: "myapex.apks",
|
set: "myapex.apks",
|
||||||
exported_java_libs: ["myjavalib"],
|
|
||||||
exported_bootclasspath_fragments: ["my-bootclasspath-fragment"],
|
exported_bootclasspath_fragments: ["my-bootclasspath-fragment"],
|
||||||
exported_systemserverclasspath_fragments: ["my-systemserverclasspath-fragment"],
|
exported_systemserverclasspath_fragments: ["my-systemserverclasspath-fragment"],
|
||||||
}
|
}
|
||||||
|
|
||||||
java_import {
|
|
||||||
name: "myjavalib",
|
|
||||||
jars: ["myjavalib.jar"],
|
|
||||||
apex_available: ["myapex"],
|
|
||||||
permitted_packages: ["javalib"],
|
|
||||||
}
|
|
||||||
|
|
||||||
prebuilt_bootclasspath_fragment {
|
prebuilt_bootclasspath_fragment {
|
||||||
name: "my-bootclasspath-fragment",
|
name: "my-bootclasspath-fragment",
|
||||||
contents: ["libfoo", "libbar"],
|
contents: ["libfoo", "libbar"],
|
||||||
@@ -9617,42 +9379,6 @@ func TestAndroidMk_DexpreoptBuiltInstalledForApex(t *testing.T) {
|
|||||||
ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := foo.myapex foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.odex foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.vdex\n")
|
ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := foo.myapex foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.odex foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.vdex\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAndroidMk_DexpreoptBuiltInstalledForApex_Prebuilt(t *testing.T) {
|
|
||||||
ctx := testApex(t, `
|
|
||||||
prebuilt_apex {
|
|
||||||
name: "myapex",
|
|
||||||
arch: {
|
|
||||||
arm64: {
|
|
||||||
src: "myapex-arm64.apex",
|
|
||||||
},
|
|
||||||
arm: {
|
|
||||||
src: "myapex-arm.apex",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
exported_java_libs: ["foo"],
|
|
||||||
}
|
|
||||||
|
|
||||||
java_import {
|
|
||||||
name: "foo",
|
|
||||||
jars: ["foo.jar"],
|
|
||||||
apex_available: ["myapex"],
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
dexpreopt.FixtureSetApexSystemServerJars("myapex:foo"),
|
|
||||||
)
|
|
||||||
|
|
||||||
prebuilt := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*Prebuilt)
|
|
||||||
entriesList := android.AndroidMkEntriesForTest(t, ctx, prebuilt)
|
|
||||||
mainModuleEntries := entriesList[0]
|
|
||||||
android.AssertArrayString(t,
|
|
||||||
"LOCAL_REQUIRED_MODULES",
|
|
||||||
mainModuleEntries.EntryMap["LOCAL_REQUIRED_MODULES"],
|
|
||||||
[]string{
|
|
||||||
"foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.odex",
|
|
||||||
"foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.vdex",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestAndroidMk_RequiredModules(t *testing.T) {
|
func TestAndroidMk_RequiredModules(t *testing.T) {
|
||||||
ctx := testApex(t, `
|
ctx := testApex(t, `
|
||||||
apex {
|
apex {
|
||||||
@@ -11929,3 +11655,110 @@ func TestPrebuiltStubNoinstall(t *testing.T) {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSdkLibraryTransitiveClassLoaderContext(t *testing.T) {
|
||||||
|
// This test case tests that listing the impl lib instead of the top level java_sdk_library
|
||||||
|
// in libs of android_app and java_library does not lead to class loader context device/host
|
||||||
|
// path mismatch errors.
|
||||||
|
android.GroupFixturePreparers(
|
||||||
|
prepareForApexTest,
|
||||||
|
android.PrepareForIntegrationTestWithAndroid,
|
||||||
|
PrepareForTestWithApexBuildComponents,
|
||||||
|
android.FixtureModifyEnv(func(env map[string]string) {
|
||||||
|
env["DISABLE_CONTAINER_CHECK"] = "true"
|
||||||
|
}),
|
||||||
|
withFiles(filesForSdkLibrary),
|
||||||
|
android.FixtureMergeMockFs(android.MockFS{
|
||||||
|
"system/sepolicy/apex/com.android.foo30-file_contexts": nil,
|
||||||
|
}),
|
||||||
|
).RunTestWithBp(t, `
|
||||||
|
apex {
|
||||||
|
name: "com.android.foo30",
|
||||||
|
key: "myapex.key",
|
||||||
|
updatable: true,
|
||||||
|
bootclasspath_fragments: [
|
||||||
|
"foo-bootclasspath-fragment",
|
||||||
|
],
|
||||||
|
java_libs: [
|
||||||
|
"bar",
|
||||||
|
],
|
||||||
|
apps: [
|
||||||
|
"bar-app",
|
||||||
|
],
|
||||||
|
min_sdk_version: "30",
|
||||||
|
}
|
||||||
|
apex_key {
|
||||||
|
name: "myapex.key",
|
||||||
|
public_key: "testkey.avbpubkey",
|
||||||
|
private_key: "testkey.pem",
|
||||||
|
}
|
||||||
|
bootclasspath_fragment {
|
||||||
|
name: "foo-bootclasspath-fragment",
|
||||||
|
contents: [
|
||||||
|
"framework-foo",
|
||||||
|
],
|
||||||
|
apex_available: [
|
||||||
|
"com.android.foo30",
|
||||||
|
],
|
||||||
|
hidden_api: {
|
||||||
|
split_packages: ["*"]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
java_sdk_library {
|
||||||
|
name: "framework-foo",
|
||||||
|
srcs: [
|
||||||
|
"A.java"
|
||||||
|
],
|
||||||
|
unsafe_ignore_missing_latest_api: true,
|
||||||
|
apex_available: [
|
||||||
|
"com.android.foo30",
|
||||||
|
],
|
||||||
|
compile_dex: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
|
shared_library: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
java_library {
|
||||||
|
name: "bar",
|
||||||
|
srcs: [
|
||||||
|
"A.java"
|
||||||
|
],
|
||||||
|
libs: [
|
||||||
|
"framework-foo.impl",
|
||||||
|
],
|
||||||
|
apex_available: [
|
||||||
|
"com.android.foo30",
|
||||||
|
],
|
||||||
|
sdk_version: "core_current",
|
||||||
|
}
|
||||||
|
|
||||||
|
java_library {
|
||||||
|
name: "baz",
|
||||||
|
srcs: [
|
||||||
|
"A.java"
|
||||||
|
],
|
||||||
|
libs: [
|
||||||
|
"bar",
|
||||||
|
],
|
||||||
|
sdk_version: "core_current",
|
||||||
|
}
|
||||||
|
|
||||||
|
android_app {
|
||||||
|
name: "bar-app",
|
||||||
|
srcs: [
|
||||||
|
"A.java"
|
||||||
|
],
|
||||||
|
libs: [
|
||||||
|
"baz",
|
||||||
|
"framework-foo.impl",
|
||||||
|
],
|
||||||
|
apex_available: [
|
||||||
|
"com.android.foo30",
|
||||||
|
],
|
||||||
|
sdk_version: "core_current",
|
||||||
|
min_sdk_version: "30",
|
||||||
|
manifest: "AndroidManifest.xml",
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
@@ -107,11 +107,6 @@ type PrebuiltCommonProperties struct {
|
|||||||
// from PRODUCT_PACKAGES.
|
// from PRODUCT_PACKAGES.
|
||||||
Overrides []string
|
Overrides []string
|
||||||
|
|
||||||
// List of java libraries that are embedded inside this prebuilt APEX bundle and for which this
|
|
||||||
// APEX bundle will create an APEX variant and provide dex implementation jars for use by
|
|
||||||
// dexpreopt and boot jars package check.
|
|
||||||
Exported_java_libs []string
|
|
||||||
|
|
||||||
// List of bootclasspath fragments inside this prebuilt APEX bundle and for which this APEX
|
// List of bootclasspath fragments inside this prebuilt APEX bundle and for which this APEX
|
||||||
// bundle will create an APEX variant.
|
// bundle will create an APEX variant.
|
||||||
Exported_bootclasspath_fragments []string
|
Exported_bootclasspath_fragments []string
|
||||||
@@ -283,8 +278,7 @@ func prebuiltApexModuleCreatorMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *prebuiltCommon) hasExportedDeps() bool {
|
func (p *prebuiltCommon) hasExportedDeps() bool {
|
||||||
return len(p.prebuiltCommonProperties.Exported_java_libs) > 0 ||
|
return len(p.prebuiltCommonProperties.Exported_bootclasspath_fragments) > 0 ||
|
||||||
len(p.prebuiltCommonProperties.Exported_bootclasspath_fragments) > 0 ||
|
|
||||||
len(p.prebuiltCommonProperties.Exported_systemserverclasspath_fragments) > 0
|
len(p.prebuiltCommonProperties.Exported_systemserverclasspath_fragments) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,11 +286,6 @@ func (p *prebuiltCommon) hasExportedDeps() bool {
|
|||||||
func (p *prebuiltCommon) prebuiltApexContentsDeps(ctx android.BottomUpMutatorContext) {
|
func (p *prebuiltCommon) prebuiltApexContentsDeps(ctx android.BottomUpMutatorContext) {
|
||||||
module := ctx.Module()
|
module := ctx.Module()
|
||||||
|
|
||||||
for _, dep := range p.prebuiltCommonProperties.Exported_java_libs {
|
|
||||||
prebuiltDep := android.PrebuiltNameFromSource(dep)
|
|
||||||
ctx.AddDependency(module, exportedJavaLibTag, prebuiltDep)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, dep := range p.prebuiltCommonProperties.Exported_bootclasspath_fragments {
|
for _, dep := range p.prebuiltCommonProperties.Exported_bootclasspath_fragments {
|
||||||
prebuiltDep := android.PrebuiltNameFromSource(dep)
|
prebuiltDep := android.PrebuiltNameFromSource(dep)
|
||||||
ctx.AddDependency(module, exportedBootclasspathFragmentTag, prebuiltDep)
|
ctx.AddDependency(module, exportedBootclasspathFragmentTag, prebuiltDep)
|
||||||
@@ -559,7 +548,7 @@ func createApexSelectorModule(ctx android.BottomUpMutatorContext, name string, a
|
|||||||
// createDeapexerModuleIfNeeded will create a deapexer module if it is needed.
|
// createDeapexerModuleIfNeeded will create a deapexer module if it is needed.
|
||||||
//
|
//
|
||||||
// A deapexer module is only needed when the prebuilt apex specifies one or more modules in either
|
// A deapexer module is only needed when the prebuilt apex specifies one or more modules in either
|
||||||
// the `exported_java_libs` or `exported_bootclasspath_fragments` properties as that indicates that
|
// the `exported_bootclasspath_fragments` properties as that indicates that
|
||||||
// the listed modules need access to files from within the prebuilt .apex file.
|
// the listed modules need access to files from within the prebuilt .apex file.
|
||||||
func (p *prebuiltCommon) createDeapexerModuleIfNeeded(ctx android.BottomUpMutatorContext, deapexerName string, apexFileSource string) {
|
func (p *prebuiltCommon) createDeapexerModuleIfNeeded(ctx android.BottomUpMutatorContext, deapexerName string, apexFileSource string) {
|
||||||
// Only create the deapexer module if it is needed.
|
// Only create the deapexer module if it is needed.
|
||||||
@@ -666,7 +655,6 @@ func (t exportedDependencyTag) RequiresFilesFromPrebuiltApex() {}
|
|||||||
var _ android.RequiresFilesFromPrebuiltApexTag = exportedDependencyTag{}
|
var _ android.RequiresFilesFromPrebuiltApexTag = exportedDependencyTag{}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
exportedJavaLibTag = exportedDependencyTag{name: "exported_java_libs"}
|
|
||||||
exportedBootclasspathFragmentTag = exportedDependencyTag{name: "exported_bootclasspath_fragments"}
|
exportedBootclasspathFragmentTag = exportedDependencyTag{name: "exported_bootclasspath_fragments"}
|
||||||
exportedSystemserverclasspathFragmentTag = exportedDependencyTag{name: "exported_systemserverclasspath_fragments"}
|
exportedSystemserverclasspathFragmentTag = exportedDependencyTag{name: "exported_systemserverclasspath_fragments"}
|
||||||
)
|
)
|
||||||
@@ -677,7 +665,7 @@ var _ prebuiltApexModuleCreator = (*Prebuilt)(nil)
|
|||||||
// build.
|
// build.
|
||||||
//
|
//
|
||||||
// If this needs to make files from within a `.apex` file available for use by other Soong modules,
|
// If this needs to make files from within a `.apex` file available for use by other Soong modules,
|
||||||
// e.g. make dex implementation jars available for java_import modules listed in exported_java_libs,
|
// e.g. make dex implementation jars available for `contents` listed in exported_bootclasspath_fragments,
|
||||||
// it does so as follows:
|
// it does so as follows:
|
||||||
//
|
//
|
||||||
// 1. It creates a `deapexer` module that actually extracts the files from the `.apex` file and
|
// 1. It creates a `deapexer` module that actually extracts the files from the `.apex` file and
|
||||||
|
@@ -116,4 +116,6 @@ bootstrap_go_package {
|
|||||||
"cmake_module_cc.txt",
|
"cmake_module_cc.txt",
|
||||||
],
|
],
|
||||||
pluginFor: ["soong_build"],
|
pluginFor: ["soong_build"],
|
||||||
|
// Used by plugins
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -35,4 +35,8 @@ bootstrap_go_package {
|
|||||||
testSrcs: [
|
testSrcs: [
|
||||||
"tidy_test.go",
|
"tidy_test.go",
|
||||||
],
|
],
|
||||||
|
visibility: [
|
||||||
|
"//build/soong:__subpackages__",
|
||||||
|
"//prebuilts/clang/host/linux-x86/soong",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
@@ -20,4 +20,5 @@ cc_library_static {
|
|||||||
"//apex_available:anyapex",
|
"//apex_available:anyapex",
|
||||||
],
|
],
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ func (n *ndkAbiDumpSingleton) GenerateBuildActions(ctx android.SingletonContext)
|
|||||||
|
|
||||||
if m, ok := module.(*Module); ok {
|
if m, ok := module.(*Module); ok {
|
||||||
if installer, ok := m.installer.(*stubDecorator); ok {
|
if installer, ok := m.installer.(*stubDecorator); ok {
|
||||||
if canDumpAbi(ctx.Config(), ctx.ModuleDir(module)) {
|
if installer.hasAbiDump {
|
||||||
depPaths = append(depPaths, installer.abiDumpPath)
|
depPaths = append(depPaths, installer.abiDumpPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -125,6 +125,7 @@ type stubDecorator struct {
|
|||||||
parsedCoverageXmlPath android.ModuleOutPath
|
parsedCoverageXmlPath android.ModuleOutPath
|
||||||
installPath android.Path
|
installPath android.Path
|
||||||
abiDumpPath android.OutputPath
|
abiDumpPath android.OutputPath
|
||||||
|
hasAbiDump bool
|
||||||
abiDiffPaths android.Paths
|
abiDiffPaths android.Paths
|
||||||
|
|
||||||
apiLevel android.ApiLevel
|
apiLevel android.ApiLevel
|
||||||
@@ -330,11 +331,11 @@ func (this *stubDecorator) findPrebuiltAbiDump(ctx ModuleContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Feature flag.
|
// Feature flag.
|
||||||
func canDumpAbi(config android.Config, moduleDir string) bool {
|
func (this *stubDecorator) canDumpAbi(ctx ModuleContext) bool {
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(moduleDir, "bionic/") {
|
if strings.HasPrefix(ctx.ModuleDir(), "bionic/") {
|
||||||
// Bionic has enough uncommon implementation details like ifuncs and asm
|
// Bionic has enough uncommon implementation details like ifuncs and asm
|
||||||
// code that the ABI tracking here has a ton of false positives. That's
|
// code that the ABI tracking here has a ton of false positives. That's
|
||||||
// causing pretty extreme friction for development there, so disabling
|
// causing pretty extreme friction for development there, so disabling
|
||||||
@@ -343,8 +344,14 @@ func canDumpAbi(config android.Config, moduleDir string) bool {
|
|||||||
// http://b/358653811
|
// http://b/358653811
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if this.apiLevel.IsCurrent() {
|
||||||
|
// "current" (AKA 10000) is not tracked.
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// http://b/156513478
|
// http://b/156513478
|
||||||
return config.ReleaseNdkAbiMonitored()
|
return ctx.Config().ReleaseNdkAbiMonitored()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Feature flag to disable diffing against prebuilts.
|
// Feature flag to disable diffing against prebuilts.
|
||||||
@@ -357,6 +364,7 @@ func (this *stubDecorator) dumpAbi(ctx ModuleContext, symbolList android.Path) {
|
|||||||
this.abiDumpPath = getNdkAbiDumpInstallBase(ctx).Join(ctx,
|
this.abiDumpPath = getNdkAbiDumpInstallBase(ctx).Join(ctx,
|
||||||
this.apiLevel.String(), ctx.Arch().ArchType.String(),
|
this.apiLevel.String(), ctx.Arch().ArchType.String(),
|
||||||
this.libraryName(ctx), "abi.stg")
|
this.libraryName(ctx), "abi.stg")
|
||||||
|
this.hasAbiDump = true
|
||||||
headersList := getNdkABIHeadersFile(ctx)
|
headersList := getNdkABIHeadersFile(ctx)
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: stg,
|
Rule: stg,
|
||||||
@@ -478,7 +486,7 @@ func (c *stubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) O
|
|||||||
nativeAbiResult := parseNativeAbiDefinition(ctx, symbolFile, c.apiLevel, "")
|
nativeAbiResult := parseNativeAbiDefinition(ctx, symbolFile, c.apiLevel, "")
|
||||||
objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc)
|
objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc)
|
||||||
c.versionScriptPath = nativeAbiResult.versionScript
|
c.versionScriptPath = nativeAbiResult.versionScript
|
||||||
if canDumpAbi(ctx.Config(), ctx.ModuleDir()) {
|
if c.canDumpAbi(ctx) {
|
||||||
c.dumpAbi(ctx, nativeAbiResult.symbolList)
|
c.dumpAbi(ctx, nativeAbiResult.symbolList)
|
||||||
if canDiffAbi(ctx.Config()) {
|
if canDiffAbi(ctx.Config()) {
|
||||||
c.diffAbi(ctx)
|
c.diffAbi(ctx)
|
||||||
|
@@ -10,4 +10,8 @@ python_library_host {
|
|||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
canonical_path_from_root: false,
|
||||||
},
|
},
|
||||||
|
visibility: [
|
||||||
|
"//build/soong:__subpackages__",
|
||||||
|
"//tools/mainline:__subpackages__",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
@@ -212,7 +212,14 @@ func writeDepFile(outputFile string, eventHandler *metrics.EventHandler, ninjaDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if there are changes to the environment file, product variable file and
|
// Check if there are changes to the environment file, product variable file and
|
||||||
// soong_build binary, in which case no incremental will be performed.
|
// soong_build binary, in which case no incremental will be performed. For env
|
||||||
|
// variables we check the used env file, which will be removed in soong ui if
|
||||||
|
// there is any changes to the env variables used last time, in which case the
|
||||||
|
// check below will fail and a full build will be attempted. If any new env
|
||||||
|
// variables are added in the new run, soong ui won't be able to detect it, the
|
||||||
|
// used env file check below will pass. But unless there is a soong build code
|
||||||
|
// change, in which case the soong build binary check will fail, otherwise the
|
||||||
|
// new env variables shouldn't have any affect.
|
||||||
func incrementalValid(config android.Config, configCacheFile string) (*ConfigCache, bool) {
|
func incrementalValid(config android.Config, configCacheFile string) (*ConfigCache, bool) {
|
||||||
var newConfigCache ConfigCache
|
var newConfigCache ConfigCache
|
||||||
data, err := os.ReadFile(shared.JoinPath(topDir, usedEnvFile))
|
data, err := os.ReadFile(shared.JoinPath(topDir, usedEnvFile))
|
||||||
|
@@ -30,4 +30,5 @@ bootstrap_go_package {
|
|||||||
srcs: [
|
srcs: [
|
||||||
"symbols_map_proto/symbols_map.pb.go",
|
"symbols_map_proto/symbols_map.pb.go",
|
||||||
],
|
],
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -27,4 +27,6 @@ blueprint_go_binary {
|
|||||||
"zip2zip.go",
|
"zip2zip.go",
|
||||||
],
|
],
|
||||||
testSrcs: ["zip2zip_test.go"],
|
testSrcs: ["zip2zip_test.go"],
|
||||||
|
// Used by genrules
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -24,4 +24,8 @@ bootstrap_go_package {
|
|||||||
"golang-protobuf-reflect-protoreflect",
|
"golang-protobuf-reflect-protoreflect",
|
||||||
"golang-protobuf-runtime-protoimpl",
|
"golang-protobuf-runtime-protoimpl",
|
||||||
],
|
],
|
||||||
|
visibility: [
|
||||||
|
"//build/make/tools/compliance:__subpackages__",
|
||||||
|
"//build/soong:__subpackages__",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
@@ -24,4 +24,5 @@ bootstrap_go_package {
|
|||||||
"golang-protobuf-reflect-protoreflect",
|
"golang-protobuf-reflect-protoreflect",
|
||||||
"golang-protobuf-runtime-protoimpl",
|
"golang-protobuf-runtime-protoimpl",
|
||||||
],
|
],
|
||||||
|
visibility: ["//build/make/tools/compliance:__subpackages__"],
|
||||||
}
|
}
|
||||||
|
@@ -20,4 +20,6 @@ bootstrap_go_package {
|
|||||||
"install_symlink_test.go",
|
"install_symlink_test.go",
|
||||||
],
|
],
|
||||||
pluginFor: ["soong_build"],
|
pluginFor: ["soong_build"],
|
||||||
|
// Used by plugins
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -22,4 +22,6 @@ bootstrap_go_package {
|
|||||||
"genrule_test.go",
|
"genrule_test.go",
|
||||||
],
|
],
|
||||||
pluginFor: ["soong_build"],
|
pluginFor: ["soong_build"],
|
||||||
|
// Used by plugins
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -120,4 +120,5 @@ bootstrap_go_package {
|
|||||||
"test_spec_test.go",
|
"test_spec_test.go",
|
||||||
],
|
],
|
||||||
pluginFor: ["soong_build"],
|
pluginFor: ["soong_build"],
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -1790,14 +1790,14 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||||||
classesJar: outputFile,
|
classesJar: outputFile,
|
||||||
jarName: jarName,
|
jarName: jarName,
|
||||||
}
|
}
|
||||||
if j.GetProfileGuided() && j.optimizeOrObfuscateEnabled() && !j.EnableProfileRewriting() {
|
if j.GetProfileGuided(ctx) && j.optimizeOrObfuscateEnabled() && !j.EnableProfileRewriting(ctx) {
|
||||||
ctx.PropertyErrorf("enable_profile_rewriting",
|
ctx.PropertyErrorf("enable_profile_rewriting",
|
||||||
"Enable_profile_rewriting must be true when profile_guided dexpreopt and R8 optimization/obfuscation is turned on. The attached profile should be sourced from an unoptimized/unobfuscated APK.",
|
"Enable_profile_rewriting must be true when profile_guided dexpreopt and R8 optimization/obfuscation is turned on. The attached profile should be sourced from an unoptimized/unobfuscated APK.",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if j.EnableProfileRewriting() {
|
if j.EnableProfileRewriting(ctx) {
|
||||||
profile := j.GetProfile()
|
profile := j.GetProfile(ctx)
|
||||||
if profile == "" || !j.GetProfileGuided() {
|
if profile == "" || !j.GetProfileGuided(ctx) {
|
||||||
ctx.PropertyErrorf("enable_profile_rewriting", "Profile and Profile_guided must be set when enable_profile_rewriting is true")
|
ctx.PropertyErrorf("enable_profile_rewriting", "Profile and Profile_guided must be set when enable_profile_rewriting is true")
|
||||||
}
|
}
|
||||||
params.artProfileInput = &profile
|
params.artProfileInput = &profile
|
||||||
|
@@ -17,4 +17,8 @@ bootstrap_go_package {
|
|||||||
"kotlin.go",
|
"kotlin.go",
|
||||||
"makevars.go",
|
"makevars.go",
|
||||||
],
|
],
|
||||||
|
visibility: [
|
||||||
|
"//build/soong:__subpackages__",
|
||||||
|
"//external/error_prone/soong",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
@@ -147,25 +147,25 @@ type dexpreopter struct {
|
|||||||
type DexpreoptProperties struct {
|
type DexpreoptProperties struct {
|
||||||
Dex_preopt struct {
|
Dex_preopt struct {
|
||||||
// If false, prevent dexpreopting. Defaults to true.
|
// If false, prevent dexpreopting. Defaults to true.
|
||||||
Enabled *bool
|
Enabled proptools.Configurable[bool] `android:"replace_instead_of_append"`
|
||||||
|
|
||||||
// If true, generate an app image (.art file) for this module.
|
// If true, generate an app image (.art file) for this module.
|
||||||
App_image *bool
|
App_image proptools.Configurable[bool] `android:"replace_instead_of_append"`
|
||||||
|
|
||||||
// If true, use a checked-in profile to guide optimization. Defaults to false unless
|
// If true, use a checked-in profile to guide optimization. Defaults to false unless
|
||||||
// a matching profile is set or a profile is found in PRODUCT_DEX_PREOPT_PROFILE_DIR
|
// a matching profile is set or a profile is found in PRODUCT_DEX_PREOPT_PROFILE_DIR
|
||||||
// that matches the name of this module, in which case it is defaulted to true.
|
// that matches the name of this module, in which case it is defaulted to true.
|
||||||
Profile_guided *bool
|
Profile_guided proptools.Configurable[bool] `android:"replace_instead_of_append"`
|
||||||
|
|
||||||
// If set, provides the path to profile relative to the Android.bp file. If not set,
|
// If set, provides the path to profile relative to the Android.bp file. If not set,
|
||||||
// defaults to searching for a file that matches the name of this module in the default
|
// defaults to searching for a file that matches the name of this module in the default
|
||||||
// profile location set by PRODUCT_DEX_PREOPT_PROFILE_DIR, or empty if not found.
|
// profile location set by PRODUCT_DEX_PREOPT_PROFILE_DIR, or empty if not found.
|
||||||
Profile *string `android:"path"`
|
Profile proptools.Configurable[string] `android:"path,replace_instead_of_append"`
|
||||||
|
|
||||||
// If set to true, r8/d8 will use `profile` as input to generate a new profile that matches
|
// If set to true, r8/d8 will use `profile` as input to generate a new profile that matches
|
||||||
// the optimized dex.
|
// the optimized dex.
|
||||||
// The new profile will be subsequently used as the profile to dexpreopt the dex file.
|
// The new profile will be subsequently used as the profile to dexpreopt the dex file.
|
||||||
Enable_profile_rewriting *bool
|
Enable_profile_rewriting proptools.Configurable[bool] `android:"replace_instead_of_append"`
|
||||||
}
|
}
|
||||||
|
|
||||||
Dex_preopt_result struct {
|
Dex_preopt_result struct {
|
||||||
@@ -244,7 +244,7 @@ func (d *dexpreopter) dexpreoptDisabled(ctx android.BaseModuleContext, libName s
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if !BoolDefault(d.dexpreoptProperties.Dex_preopt.Enabled, true) {
|
if !d.dexpreoptProperties.Dex_preopt.Enabled.GetOrDefault(ctx, true) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,12 +433,12 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, libName string, dexJa
|
|||||||
|
|
||||||
if d.inputProfilePathOnHost != nil {
|
if d.inputProfilePathOnHost != nil {
|
||||||
profileClassListing = android.OptionalPathForPath(d.inputProfilePathOnHost)
|
profileClassListing = android.OptionalPathForPath(d.inputProfilePathOnHost)
|
||||||
} else if BoolDefault(d.dexpreoptProperties.Dex_preopt.Profile_guided, true) && !forPrebuiltApex(ctx) {
|
} else if d.dexpreoptProperties.Dex_preopt.Profile_guided.GetOrDefault(ctx, true) && !forPrebuiltApex(ctx) {
|
||||||
// If enable_profile_rewriting is set, use the rewritten profile instead of the checked-in profile
|
// If enable_profile_rewriting is set, use the rewritten profile instead of the checked-in profile
|
||||||
if d.EnableProfileRewriting() {
|
if d.EnableProfileRewriting(ctx) {
|
||||||
profileClassListing = android.OptionalPathForPath(d.GetRewrittenProfile())
|
profileClassListing = android.OptionalPathForPath(d.GetRewrittenProfile())
|
||||||
profileIsTextListing = true
|
profileIsTextListing = true
|
||||||
} else if profile := d.GetProfile(); profile != "" {
|
} else if profile := d.GetProfile(ctx); profile != "" {
|
||||||
// If dex_preopt.profile_guided is not set, default it based on the existence of the
|
// If dex_preopt.profile_guided is not set, default it based on the existence of the
|
||||||
// dexprepot.profile option or the profile class listing.
|
// dexprepot.profile option or the profile class listing.
|
||||||
profileClassListing = android.OptionalPathForPath(
|
profileClassListing = android.OptionalPathForPath(
|
||||||
@@ -458,6 +458,8 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, libName string, dexJa
|
|||||||
// Use the dexJar to create a unique scope for each
|
// Use the dexJar to create a unique scope for each
|
||||||
dexJarStem := strings.TrimSuffix(dexJarFile.Base(), dexJarFile.Ext())
|
dexJarStem := strings.TrimSuffix(dexJarFile.Base(), dexJarFile.Ext())
|
||||||
|
|
||||||
|
appImage := d.dexpreoptProperties.Dex_preopt.App_image.Get(ctx)
|
||||||
|
|
||||||
// Full dexpreopt config, used to create dexpreopt build rules.
|
// Full dexpreopt config, used to create dexpreopt build rules.
|
||||||
dexpreoptConfig := &dexpreopt.ModuleConfig{
|
dexpreoptConfig := &dexpreopt.ModuleConfig{
|
||||||
Name: libName,
|
Name: libName,
|
||||||
@@ -486,8 +488,8 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, libName string, dexJa
|
|||||||
PreoptBootClassPathDexFiles: dexFiles.Paths(),
|
PreoptBootClassPathDexFiles: dexFiles.Paths(),
|
||||||
PreoptBootClassPathDexLocations: dexLocations,
|
PreoptBootClassPathDexLocations: dexLocations,
|
||||||
|
|
||||||
NoCreateAppImage: !BoolDefault(d.dexpreoptProperties.Dex_preopt.App_image, true),
|
NoCreateAppImage: !appImage.GetOrDefault(true),
|
||||||
ForceCreateAppImage: BoolDefault(d.dexpreoptProperties.Dex_preopt.App_image, false),
|
ForceCreateAppImage: appImage.GetOrDefault(false),
|
||||||
|
|
||||||
PresignedPrebuilt: d.isPresignedPrebuilt,
|
PresignedPrebuilt: d.isPresignedPrebuilt,
|
||||||
}
|
}
|
||||||
@@ -657,16 +659,16 @@ func (d *dexpreopter) disableDexpreopt() {
|
|||||||
d.shouldDisableDexpreopt = true
|
d.shouldDisableDexpreopt = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *dexpreopter) EnableProfileRewriting() bool {
|
func (d *dexpreopter) EnableProfileRewriting(ctx android.BaseModuleContext) bool {
|
||||||
return proptools.Bool(d.dexpreoptProperties.Dex_preopt.Enable_profile_rewriting)
|
return d.dexpreoptProperties.Dex_preopt.Enable_profile_rewriting.GetOrDefault(ctx, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *dexpreopter) GetProfile() string {
|
func (d *dexpreopter) GetProfile(ctx android.BaseModuleContext) string {
|
||||||
return proptools.String(d.dexpreoptProperties.Dex_preopt.Profile)
|
return d.dexpreoptProperties.Dex_preopt.Profile.GetOrDefault(ctx, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *dexpreopter) GetProfileGuided() bool {
|
func (d *dexpreopter) GetProfileGuided(ctx android.BaseModuleContext) bool {
|
||||||
return proptools.Bool(d.dexpreoptProperties.Dex_preopt.Profile_guided)
|
return d.dexpreoptProperties.Dex_preopt.Profile_guided.GetOrDefault(ctx, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *dexpreopter) GetRewrittenProfile() android.Path {
|
func (d *dexpreopter) GetRewrittenProfile() android.Path {
|
||||||
|
@@ -15,4 +15,5 @@
|
|||||||
filegroup {
|
filegroup {
|
||||||
name: "metalava-config-files",
|
name: "metalava-config-files",
|
||||||
srcs: ["*-config.xml"],
|
srcs: ["*-config.xml"],
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,7 @@ cc_library_static {
|
|||||||
"//apex_available:platform",
|
"//apex_available:platform",
|
||||||
"//apex_available:anyapex",
|
"//apex_available:anyapex",
|
||||||
],
|
],
|
||||||
|
visibility: ["//system/linkerconfig"],
|
||||||
}
|
}
|
||||||
|
|
||||||
python_library_host {
|
python_library_host {
|
||||||
|
@@ -13,4 +13,5 @@ bootstrap_go_package {
|
|||||||
"phony.go",
|
"phony.go",
|
||||||
],
|
],
|
||||||
pluginFor: ["soong_build"],
|
pluginFor: ["soong_build"],
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -13,4 +13,8 @@ bootstrap_go_package {
|
|||||||
testSrcs: [
|
testSrcs: [
|
||||||
"response_test.go",
|
"response_test.go",
|
||||||
],
|
],
|
||||||
|
visibility: [
|
||||||
|
"//build/make/tools/compliance",
|
||||||
|
"//build/soong:__subpackages__",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
@@ -61,4 +61,5 @@ bootstrap_go_package {
|
|||||||
"test_test.go",
|
"test_test.go",
|
||||||
],
|
],
|
||||||
pluginFor: ["soong_build"],
|
pluginFor: ["soong_build"],
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -24,4 +24,8 @@ bootstrap_go_package {
|
|||||||
"x86_64_device.go",
|
"x86_64_device.go",
|
||||||
"arm64_linux_host.go",
|
"arm64_linux_host.go",
|
||||||
],
|
],
|
||||||
|
visibility: [
|
||||||
|
"//build/soong:__subpackages__",
|
||||||
|
"//prebuilts/rust/soong",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
@@ -21,4 +21,6 @@ bootstrap_go_package {
|
|||||||
"sysprop_test.go",
|
"sysprop_test.go",
|
||||||
],
|
],
|
||||||
pluginFor: ["soong_build"],
|
pluginFor: ["soong_build"],
|
||||||
|
// Used by plugins
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
@@ -20,10 +20,14 @@ bootstrap_go_package {
|
|||||||
name: "soong-testing-code_metadata_internal_proto",
|
name: "soong-testing-code_metadata_internal_proto",
|
||||||
pkgPath: "android/soong/testing/code_metadata_internal_proto",
|
pkgPath: "android/soong/testing/code_metadata_internal_proto",
|
||||||
deps: [
|
deps: [
|
||||||
"golang-protobuf-reflect-protoreflect",
|
"golang-protobuf-reflect-protoreflect",
|
||||||
"golang-protobuf-runtime-protoimpl",
|
"golang-protobuf-runtime-protoimpl",
|
||||||
],
|
],
|
||||||
srcs: [
|
srcs: [
|
||||||
"code_metadata_internal.pb.go",
|
"code_metadata_internal.pb.go",
|
||||||
],
|
],
|
||||||
|
visibility: [
|
||||||
|
"//build/make/tools/metadata",
|
||||||
|
"//build/soong:__subpackages__",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@ bootstrap_go_package {
|
|||||||
srcs: [
|
srcs: [
|
||||||
"code_metadata.pb.go",
|
"code_metadata.pb.go",
|
||||||
],
|
],
|
||||||
|
visibility: ["//build/make/tools/metadata"],
|
||||||
}
|
}
|
||||||
|
|
||||||
python_library_host {
|
python_library_host {
|
||||||
@@ -40,4 +41,5 @@ python_library_host {
|
|||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
canonical_path_from_root: false,
|
||||||
},
|
},
|
||||||
|
visibility: ["//tools/asuite/team_build_scripts"],
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,11 @@ bootstrap_go_package {
|
|||||||
srcs: [
|
srcs: [
|
||||||
"test_spec.pb.go",
|
"test_spec.pb.go",
|
||||||
],
|
],
|
||||||
|
visibility: [
|
||||||
|
"//build/make/tools/metadata",
|
||||||
|
"//build/soong:__subpackages__",
|
||||||
|
"//vendor:__subpackages__",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
python_library_host {
|
python_library_host {
|
||||||
@@ -40,4 +45,5 @@ python_library_host {
|
|||||||
proto: {
|
proto: {
|
||||||
canonical_path_from_root: false,
|
canonical_path_from_root: false,
|
||||||
},
|
},
|
||||||
|
visibility: ["//tools/asuite/team_build_scripts"],
|
||||||
}
|
}
|
||||||
|
110
tests/build_action_caching_test.sh
Executable file
110
tests/build_action_caching_test.sh
Executable file
@@ -0,0 +1,110 @@
|
|||||||
|
#!/bin/bash -u
|
||||||
|
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
# Test that the mk and ninja files generated by Soong don't change if some
|
||||||
|
# incremental modules are restored from cache.
|
||||||
|
|
||||||
|
OUTPUT_DIR="$(mktemp -d tmp.XXXXXX)"
|
||||||
|
echo ${OUTPUT_DIR}
|
||||||
|
|
||||||
|
function cleanup {
|
||||||
|
rm -rf "${OUTPUT_DIR}"
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
function run_soong_build {
|
||||||
|
USE_RBE=false TARGET_PRODUCT=aosp_arm TARGET_RELEASE=trunk_staging TARGET_BUILD_VARIANT=userdebug build/soong/soong_ui.bash --make-mode --incremental-build-actions nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
function run_soong_clean {
|
||||||
|
build/soong/soong_ui.bash --make-mode clean
|
||||||
|
}
|
||||||
|
|
||||||
|
function assert_files_equal {
|
||||||
|
if [ $# -ne 2 ]; then
|
||||||
|
echo "Usage: assert_files_equal file1 file2"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! cmp -s "$1" "$2"; then
|
||||||
|
echo "Files are different: $1 $2"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function compare_mtimes() {
|
||||||
|
if [ $# -ne 2 ]; then
|
||||||
|
echo "Usage: compare_mtimes file1 file2"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
file1_mtime=$(stat -c '%Y' $1)
|
||||||
|
file2_mtime=$(stat -c '%Y' $2)
|
||||||
|
|
||||||
|
if [ "$file1_mtime" -eq "$file2_mtime" ]; then
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_build_action_restoring() {
|
||||||
|
run_soong_clean
|
||||||
|
cat > ${OUTPUT_DIR}/Android.bp <<'EOF'
|
||||||
|
python_binary_host {
|
||||||
|
name: "my_little_binary_host",
|
||||||
|
srcs: ["my_little_binary_host.py"],
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
touch ${OUTPUT_DIR}/my_little_binary_host.py
|
||||||
|
run_soong_build
|
||||||
|
mkdir -p "${OUTPUT_DIR}/before"
|
||||||
|
cp -pr out/soong/build_aosp_arm_ninja_incremental out/soong/*.mk out/soong/build.aosp_arm.*.ninja ${OUTPUT_DIR}/before
|
||||||
|
# add a comment to the bp file, this should force a new analysis but no module
|
||||||
|
# should be really impacted, so all the incremental modules should be skipped.
|
||||||
|
cat >> ${OUTPUT_DIR}/Android.bp <<'EOF'
|
||||||
|
// new comments
|
||||||
|
EOF
|
||||||
|
run_soong_build
|
||||||
|
mkdir -p "${OUTPUT_DIR}/after"
|
||||||
|
cp -pr out/soong/build_aosp_arm_ninja_incremental out/soong/*.mk out/soong/build.aosp_arm.*.ninja ${OUTPUT_DIR}/after
|
||||||
|
|
||||||
|
compare_files
|
||||||
|
}
|
||||||
|
|
||||||
|
function compare_files() {
|
||||||
|
for file_before in ${OUTPUT_DIR}/before/*.ninja; do
|
||||||
|
file_after="${OUTPUT_DIR}/after/$(basename "$file_before")"
|
||||||
|
assert_files_equal $file_before $file_after
|
||||||
|
compare_mtimes $file_before $file_after
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Files have identical mtime: $file_before $file_after"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for file_before in ${OUTPUT_DIR}/before/*.mk; do
|
||||||
|
file_after="${OUTPUT_DIR}/after/$(basename "$file_before")"
|
||||||
|
assert_files_equal $file_before $file_after
|
||||||
|
compare_mtimes $file_before $file_after
|
||||||
|
# mk files shouldn't be regenerated
|
||||||
|
if [ $? -ne 1 ]; then
|
||||||
|
echo "Files have different mtimes: $file_before $file_after"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for file_before in ${OUTPUT_DIR}/before/build_aosp_arm_ninja_incremental/*.ninja; do
|
||||||
|
file_after="${OUTPUT_DIR}/after/build_aosp_arm_ninja_incremental/$(basename "$file_before")"
|
||||||
|
assert_files_equal $file_before $file_after
|
||||||
|
compare_mtimes $file_before $file_after
|
||||||
|
# ninja files of skipped modules shouldn't be regenerated
|
||||||
|
if [ $? -ne 1 ]; then
|
||||||
|
echo "Files have different mtimes: $file_before $file_after"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
test_build_action_restoring
|
@@ -24,4 +24,6 @@ blueprint_go_binary {
|
|||||||
srcs: [
|
srcs: [
|
||||||
"main.go",
|
"main.go",
|
||||||
],
|
],
|
||||||
|
// Used by genrules
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user