Merge "Fix turbine classpath arguments"
diff --git a/android/neverallow.go b/android/neverallow.go
index aff706c..48efb4f 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -64,6 +64,8 @@
// The list of paths that cannot be referenced using include_dirs
paths := []string{
"art",
+ "art/libnativebridge",
+ "art/libnativeloader",
"libcore",
"libnativehelper",
"external/apache-harmony",
@@ -75,8 +77,6 @@
"external/okhttp",
"external/vixl",
"external/wycheproof",
- "system/core/libnativebridge",
- "system/core/libnativehelper",
}
// Create a composite matcher that will match if the value starts with any of the restricted
diff --git a/apex/apex.go b/apex/apex.go
index 4e6827f..b8581ed 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -634,6 +634,7 @@
testApex bool
vndkApex bool
+ artApex bool
primaryApexType bool
// intermediate path for apex_manifest.json
@@ -1241,6 +1242,19 @@
return false
})
+ // Specific to the ART apex: dexpreopt artifacts for libcore Java libraries.
+ // Build rules are generated by the dexpreopt singleton, and here we access build artifacts
+ // via the global boot image config.
+ if a.artApex {
+ for arch, files := range java.DexpreoptedArtApexJars(ctx) {
+ dirInApex := filepath.Join("javalib", arch.String())
+ for _, f := range files {
+ localModule := "javalib_" + arch.String() + "_" + filepath.Base(f.String())
+ filesInfo = append(filesInfo, apexFile{f, localModule, dirInApex, etc, nil, nil})
+ }
+ }
+ }
+
if a.private_key_file == nil {
ctx.PropertyErrorf("key", "private_key for %q could not be found", String(a.properties.Key))
return
@@ -1829,9 +1843,10 @@
return module
}
-func ApexBundleFactory(testApex bool) android.Module {
+func ApexBundleFactory(testApex bool, artApex bool) android.Module {
bundle := newApexBundle()
bundle.testApex = testApex
+ bundle.artApex = artApex
return bundle
}
diff --git a/cc/cc.go b/cc/cc.go
index 5dfc563..db7f0f6 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -877,7 +877,7 @@
func isBionic(name string) bool {
switch name {
- case "libc", "libm", "libdl", "linker":
+ case "libc", "libm", "libdl", "libdl_android", "linker":
return true
}
return false
diff --git a/java/config/config.go b/java/config/config.go
index f418ee7..1c55961 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -88,10 +88,10 @@
})
pctx.VariableFunc("JlinkVersion", func(ctx android.PackageVarContext) string {
switch ctx.Config().Getenv("EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN") {
- case "true":
- return "11"
- default:
+ case "false":
return "9"
+ default:
+ return "11"
}
})
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 74ef667..dbf6115 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -51,6 +51,7 @@
type bootImageConfig struct {
name string
+ stem string
modules []string
dexLocations []string
dexPaths android.WritablePaths
@@ -71,7 +72,7 @@
// In addition, each .art file has an associated .oat and .vdex file, and an
// unstripped .oat file
for i, m := range image.modules {
- name := image.name
+ name := image.stem
if i != 0 {
name += "-" + stemOf(m)
}
@@ -146,6 +147,14 @@
dexpreoptConfigForMake android.WritablePath
}
+// Accessor function for the apex package. Returns nil if dexpreopt is disabled.
+func DexpreoptedArtApexJars(ctx android.BuilderContext) map[android.ArchType]android.Paths {
+ if skipDexpreoptBootJars(ctx) {
+ return nil
+ }
+ return artBootImageConfig(ctx).imagesDeps
+}
+
// dexpreoptBoot singleton rules
func (d *dexpreoptBootJars) GenerateBuildActions(ctx android.SingletonContext) {
if skipDexpreoptBootJars(ctx) {
@@ -169,7 +178,10 @@
// Always create the default boot image first, to get a unique profile rule for all images.
d.defaultBootImage = buildBootImage(ctx, defaultBootImageConfig(ctx))
+ // Create boot image for the ART apex (build artifacts are accessed via the global boot image config).
+ buildBootImage(ctx, artBootImageConfig(ctx))
if global.GenerateApexImage {
+ // Create boot images for the JIT-zygote experiment.
d.otherImages = append(d.otherImages, buildBootImage(ctx, apexBootImageConfig(ctx)))
}
@@ -178,8 +190,6 @@
// buildBootImage takes a bootImageConfig, creates rules to build it, and returns a *bootImage.
func buildBootImage(ctx android.SingletonContext, config bootImageConfig) *bootImage {
- global := dexpreoptGlobalConfig(ctx)
-
image := newBootImage(ctx, config)
bootDexJars := make(android.Paths, len(image.modules))
@@ -223,12 +233,9 @@
bootFrameworkProfileRule(ctx, image, missingDeps)
var allFiles android.Paths
-
- if !global.DisablePreopt {
- for _, target := range image.targets {
- files := buildBootImageRuleForArch(ctx, image, target.Arch.ArchType, profile, missingDeps)
- allFiles = append(allFiles, files.Paths()...)
- }
+ for _, target := range image.targets {
+ files := buildBootImageRuleForArch(ctx, image, target.Arch.ArchType, profile, missingDeps)
+ allFiles = append(allFiles, files.Paths()...)
}
if image.zip != nil {
@@ -251,7 +258,7 @@
global := dexpreoptGlobalConfig(ctx)
symbolsDir := image.symbolsDir.Join(ctx, "system/framework", arch.String())
- symbolsFile := symbolsDir.Join(ctx, image.name+".oat")
+ symbolsFile := symbolsDir.Join(ctx, image.stem+".oat")
outputDir := image.dir.Join(ctx, "system/framework", arch.String())
outputPath := image.images[arch]
oatLocation := pathtools.ReplaceExtension(dexpreopt.PathToLocation(outputPath, arch), "oat")
@@ -381,8 +388,9 @@
if global.DisableGenerateProfile || ctx.Config().IsPdkBuild() || ctx.Config().UnbundledBuild() {
return nil
}
- return ctx.Config().Once(bootImageProfileRuleKey, func() interface{} {
+ profile := ctx.Config().Once(bootImageProfileRuleKey, func() interface{} {
tools := global.Tools
+ defaultProfile := "frameworks/base/config/boot-image-profile.txt"
rule := android.NewRuleBuilder()
rule.MissingDeps(missingDeps)
@@ -394,18 +402,13 @@
bootImageProfile = combinedBootImageProfile
} else if len(global.BootImageProfiles) == 1 {
bootImageProfile = global.BootImageProfiles[0]
+ } else if path := android.ExistentPathForSource(ctx, defaultProfile); path.Valid() {
+ bootImageProfile = path.Path()
} else {
- // If not set, use the default. Some branches like master-art-host don't have frameworks/base, so manually
- // handle the case that the default is missing. Those branches won't attempt to build the profile rule,
- // and if they do they'll get a missing deps error.
- defaultProfile := "frameworks/base/config/boot-image-profile.txt"
- path := android.ExistentPathForSource(ctx, defaultProfile)
- if path.Valid() {
- bootImageProfile = path.Path()
- } else {
- missingDeps = append(missingDeps, defaultProfile)
- bootImageProfile = android.PathForOutput(ctx, "missing")
- }
+ // No profile (not even a default one, which is the case on some branches
+ // like master-art-host that don't have frameworks/base).
+ // Return nil and continue without profile.
+ return nil
}
profile := image.dir.Join(ctx, "boot.prof")
@@ -425,7 +428,11 @@
image.profileInstalls = rule.Installs()
return profile
- }).(android.WritablePath)
+ })
+ if profile == nil {
+ return nil // wrap nil into a typed pointer with value nil
+ }
+ return profile.(android.WritablePath)
}
var bootImageProfileRuleKey = android.NewOnceKey("bootImageProfileRule")
diff --git a/java/dexpreopt_bootjars_test.go b/java/dexpreopt_bootjars_test.go
index 244bd52..a684ab2 100644
--- a/java/dexpreopt_bootjars_test.go
+++ b/java/dexpreopt_bootjars_test.go
@@ -62,7 +62,6 @@
bootArt := dexpreoptBootJars.Output("boot.art")
expectedInputs := []string{
- "dex_bootjars/boot.prof",
"dex_bootjars_input/foo.jar",
"dex_bootjars_input/bar.jar",
"dex_bootjars_input/baz.jar",
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index b3b1317..a6661b3 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -106,15 +106,20 @@
return moduleName
}
-func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name string,
- needZip bool) bootImageConfig {
+// Construct a variant of the global config for dexpreopted bootclasspath jars. The variants differ
+// in the list of input jars (libcore, framework, or both), in the naming scheme for the dexpreopt
+// files (ART recognizes "apex" names as special), and whether to include a zip archive.
+//
+// 'name' is a string unique for each profile (used in directory names and ninja rule names)
+// 'stem' is the basename of the image: the resulting filenames are <stem>[-<jar>].{art,oat,vdex}.
+func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name string, stem string,
+ needZip bool, artApexJarsOnly bool) bootImageConfig {
+
return ctx.Config().Once(key, func() interface{} {
global := dexpreoptGlobalConfig(ctx)
artModules := global.ArtApexJars
- nonFrameworkModules := concat(artModules, global.ProductUpdatableBootModules)
- frameworkModules := android.RemoveListFromList(global.BootJars, nonFrameworkModules)
- imageModules := concat(artModules, frameworkModules)
+ imageModules := artModules
var bootLocations []string
@@ -123,9 +128,15 @@
filepath.Join("/apex/com.android.art/javalib", stemOf(m)+".jar"))
}
- for _, m := range frameworkModules {
- bootLocations = append(bootLocations,
- filepath.Join("/system/framework", stemOf(m)+".jar"))
+ if !artApexJarsOnly {
+ nonFrameworkModules := concat(artModules, global.ProductUpdatableBootModules)
+ frameworkModules := android.RemoveListFromList(global.BootJars, nonFrameworkModules)
+ imageModules = concat(imageModules, frameworkModules)
+
+ for _, m := range frameworkModules {
+ bootLocations = append(bootLocations,
+ filepath.Join("/system/framework", stemOf(m)+".jar"))
+ }
}
// The path to bootclasspath dex files needs to be known at module GenerateAndroidBuildAction time, before
@@ -143,13 +154,14 @@
var zip android.WritablePath
if needZip {
- zip = dir.Join(ctx, name+".zip")
+ zip = dir.Join(ctx, stem+".zip")
}
targets := dexpreoptTargets(ctx)
imageConfig := bootImageConfig{
name: name,
+ stem: stem,
modules: imageModules,
dexLocations: bootLocations,
dexPaths: bootDexPaths,
@@ -163,7 +175,7 @@
for _, target := range targets {
imageDir := dir.Join(ctx, "system/framework", target.Arch.ArchType.String())
- imageConfig.images[target.Arch.ArchType] = imageDir.Join(ctx, name+".art")
+ imageConfig.images[target.Arch.ArchType] = imageDir.Join(ctx, stem+".art")
imagesDeps := make([]android.Path, 0, len(imageConfig.modules)*3)
for _, dep := range imageConfig.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex") {
@@ -176,15 +188,25 @@
}).(bootImageConfig)
}
+// Default config is the one that goes in the system image. It includes both libcore and framework.
var defaultBootImageConfigKey = android.NewOnceKey("defaultBootImageConfig")
-var apexBootImageConfigKey = android.NewOnceKey("apexBootImageConfig")
func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
- return getBootImageConfig(ctx, defaultBootImageConfigKey, "boot", true)
+ return getBootImageConfig(ctx, defaultBootImageConfigKey, "boot", "boot", true, false)
}
+// Apex config is used for the JIT-zygote experiment. It includes both libcore and framework, but AOT-compiles only libcore.
+var apexBootImageConfigKey = android.NewOnceKey("apexBootImageConfig")
+
func apexBootImageConfig(ctx android.PathContext) bootImageConfig {
- return getBootImageConfig(ctx, apexBootImageConfigKey, "apex", false)
+ return getBootImageConfig(ctx, apexBootImageConfigKey, "apex", "apex", false, false)
+}
+
+// ART config is the one used for the ART apex. It includes only libcore.
+var artBootImageConfigKey = android.NewOnceKey("artBootImageConfig")
+
+func artBootImageConfig(ctx android.PathContext) bootImageConfig {
+ return getBootImageConfig(ctx, artBootImageConfigKey, "art", "boot", false, true)
}
func defaultBootclasspath(ctx android.PathContext) []string {
diff --git a/sdk/sdk.go b/sdk/sdk.go
index 002fb5d..cb81a14 100644
--- a/sdk/sdk.go
+++ b/sdk/sdk.go
@@ -19,6 +19,7 @@
"strconv"
"github.com/google/blueprint"
+ "github.com/google/blueprint/proptools"
"android/soong/android"
// This package doesn't depend on the apex package, but import it to make its mutators to be
@@ -60,6 +61,13 @@
s.AddProperties(&s.properties)
android.InitAndroidMultiTargetsArchModule(s, android.HostAndDeviceSupported, android.MultilibCommon)
android.InitDefaultableModule(s)
+ android.AddLoadHook(s, func(ctx android.LoadHookContext) {
+ type props struct {
+ Compile_multilib *string
+ }
+ p := &props{Compile_multilib: proptools.StringPtr("both")}
+ ctx.AppendProperties(p)
+ })
return s
}
diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go
index 664bb7c..96129b8 100644
--- a/sdk/sdk_test.go
+++ b/sdk/sdk_test.go
@@ -377,6 +377,35 @@
`)
}
+func TestSdkIsCompileMultilibBoth(t *testing.T) {
+ ctx, _ := testSdk(t, `
+ sdk {
+ name: "mysdk",
+ native_shared_libs: ["sdkmember"],
+ }
+
+ cc_library_shared {
+ name: "sdkmember",
+ srcs: ["Test.cpp"],
+ system_shared_libs: [],
+ stl: "none",
+ }
+ `)
+
+ armOutput := ctx.ModuleForTests("sdkmember", "android_arm_armv7-a-neon_core_shared").Module().(*cc.Module).OutputFile()
+ arm64Output := ctx.ModuleForTests("sdkmember", "android_arm64_armv8-a_core_shared").Module().(*cc.Module).OutputFile()
+
+ var inputs []string
+ buildParams := ctx.ModuleForTests("mysdk", "android_common").Module().BuildParamsForTests()
+ for _, bp := range buildParams {
+ inputs = append(inputs, bp.Implicits.Strings()...)
+ }
+
+ // ensure that both 32/64 outputs are inputs of the sdk snapshot
+ ensureListContains(t, inputs, armOutput.String())
+ ensureListContains(t, inputs, arm64Output.String())
+}
+
var buildDir string
func setUp() {
diff --git a/ui/build/config.go b/ui/build/config.go
index 919b9ce..686ca3e 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -219,10 +219,10 @@
if override, ok := ret.environ.Get("OVERRIDE_ANDROID_JAVA_HOME"); ok {
return override
}
- if toolchain11, ok := ret.environ.Get("EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN"); ok && toolchain11 == "true" {
- return java11Home
+ if toolchain9, ok := ret.environ.Get("EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN"); ok && toolchain9 == "false" {
+ return java9Home
}
- return java9Home
+ return java11Home
}()
absJavaHome := absPath(ctx, javaHome)