summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/aapt2.go16
-rw-r--r--java/aar.go34
-rw-r--r--java/androidmk.go8
-rw-r--r--java/app_test.go156
-rw-r--r--java/builder.go23
-rw-r--r--java/device_host_converter_test.go2
-rw-r--r--java/dexpreopt.go7
-rw-r--r--java/dexpreopt_bootjars.go61
-rw-r--r--java/dexpreopt_config.go48
-rw-r--r--java/droiddoc.go13
-rw-r--r--java/java.go16
-rw-r--r--java/sdk.go13
-rw-r--r--java/sdk_test.go10
-rw-r--r--java/system_modules.go27
14 files changed, 142 insertions, 292 deletions
diff --git a/java/aapt2.go b/java/aapt2.go
index a8151608f..ad746f7b8 100644
--- a/java/aapt2.go
+++ b/java/aapt2.go
@@ -60,7 +60,9 @@ var aapt2CompileRule = pctx.AndroidStaticRule("aapt2Compile",
},
"outDir", "cFlags")
-func aapt2Compile(ctx android.ModuleContext, dir android.Path, paths android.Paths) android.WritablePaths {
+func aapt2Compile(ctx android.ModuleContext, dir android.Path, paths android.Paths,
+ flags []string) android.WritablePaths {
+
shards := shardPaths(paths, AAPT2_SHARD_SIZE)
ret := make(android.WritablePaths, 0, len(paths))
@@ -81,9 +83,7 @@ func aapt2Compile(ctx android.ModuleContext, dir android.Path, paths android.Pat
Outputs: outPaths,
Args: map[string]string{
"outDir": android.PathForModuleOut(ctx, "aapt2", dir.String()).String(),
- // Always set --pseudo-localize, it will be stripped out later for release
- // builds that don't want it.
- "cFlags": "--pseudo-localize",
+ "cFlags": strings.Join(flags, " "),
},
})
}
@@ -104,7 +104,9 @@ var aapt2CompileZipRule = pctx.AndroidStaticRule("aapt2CompileZip",
},
}, "cFlags", "resZipDir", "zipSyncFlags")
-func aapt2CompileZip(ctx android.ModuleContext, flata android.WritablePath, zip android.Path, zipPrefix string) {
+func aapt2CompileZip(ctx android.ModuleContext, flata android.WritablePath, zip android.Path, zipPrefix string,
+ flags []string) {
+
if zipPrefix != "" {
zipPrefix = "--zip-prefix " + zipPrefix
}
@@ -114,9 +116,7 @@ func aapt2CompileZip(ctx android.ModuleContext, flata android.WritablePath, zip
Input: zip,
Output: flata,
Args: map[string]string{
- // Always set --pseudo-localize, it will be stripped out later for release
- // builds that don't want it.
- "cFlags": "--pseudo-localize",
+ "cFlags": strings.Join(flags, " "),
"resZipDir": android.PathForModuleOut(ctx, "aapt2", "reszip", flata.Base()).String(),
"zipSyncFlags": zipPrefix,
},
diff --git a/java/aar.go b/java/aar.go
index 47f6e5f6a..460fbfa63 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -111,8 +111,9 @@ func (a *aapt) ExportedManifests() android.Paths {
return a.transitiveManifestPaths
}
-func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext, manifestPath android.Path) (flags []string,
- deps android.Paths, resDirs, overlayDirs []globbedResourceDir, rroDirs []rroDir, resZips android.Paths) {
+func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext,
+ manifestPath android.Path) (compileFlags, linkFlags []string, linkDeps android.Paths,
+ resDirs, overlayDirs []globbedResourceDir, rroDirs []rroDir, resZips android.Paths) {
hasVersionCode := false
hasVersionName := false
@@ -124,8 +125,6 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext, mani
}
}
- var linkFlags []string
-
// Flags specified in Android.bp
linkFlags = append(linkFlags, a.aaptProperties.Aaptflags...)
@@ -136,8 +135,6 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext, mani
resourceDirs := android.PathsWithOptionalDefaultForModuleSrc(ctx, a.aaptProperties.Resource_dirs, "res")
resourceZips := android.PathsForModuleSrc(ctx, a.aaptProperties.Resource_zips)
- var linkDeps android.Paths
-
// Glob directories into lists of paths
for _, dir := range resourceDirs {
resDirs = append(resDirs, globbedResourceDir{
@@ -185,7 +182,13 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext, mani
linkFlags = append(linkFlags, "--version-name ", versionName)
}
- return linkFlags, linkDeps, resDirs, overlayDirs, rroDirs, resourceZips
+ linkFlags, compileFlags = android.FilterList(linkFlags, []string{"--legacy"})
+
+ // Always set --pseudo-localize, it will be stripped out later for release
+ // builds that don't want it.
+ compileFlags = append(compileFlags, "--pseudo-localize")
+
+ return compileFlags, linkFlags, linkDeps, resDirs, overlayDirs, rroDirs, resourceZips
}
func (a *aapt) deps(ctx android.BottomUpMutatorContext, sdkDep sdkDep) {
@@ -220,7 +223,7 @@ func (a *aapt) buildActions(ctx android.ModuleContext, sdkContext sdkContext, ex
a.mergedManifestFile = manifestPath
}
- linkFlags, linkDeps, resDirs, overlayDirs, rroDirs, resZips := a.aapt2Flags(ctx, sdkContext, manifestPath)
+ compileFlags, linkFlags, linkDeps, resDirs, overlayDirs, rroDirs, resZips := a.aapt2Flags(ctx, sdkContext, manifestPath)
rroDirs = append(rroDirs, staticRRODirs...)
linkFlags = append(linkFlags, libFlags...)
@@ -239,12 +242,12 @@ func (a *aapt) buildActions(ctx android.ModuleContext, sdkContext sdkContext, ex
var compiledResDirs []android.Paths
for _, dir := range resDirs {
- compiledResDirs = append(compiledResDirs, aapt2Compile(ctx, dir.dir, dir.files).Paths())
+ compiledResDirs = append(compiledResDirs, aapt2Compile(ctx, dir.dir, dir.files, compileFlags).Paths())
}
for i, zip := range resZips {
flata := android.PathForModuleOut(ctx, fmt.Sprintf("reszip.%d.flata", i))
- aapt2CompileZip(ctx, flata, zip, "")
+ aapt2CompileZip(ctx, flata, zip, "", compileFlags)
compiledResDirs = append(compiledResDirs, android.Paths{flata})
}
@@ -273,7 +276,7 @@ func (a *aapt) buildActions(ctx android.ModuleContext, sdkContext sdkContext, ex
}
for _, dir := range overlayDirs {
- compiledOverlay = append(compiledOverlay, aapt2Compile(ctx, dir.dir, dir.files).Paths()...)
+ compiledOverlay = append(compiledOverlay, aapt2Compile(ctx, dir.dir, dir.files, compileFlags).Paths()...)
}
var splitPackages android.WritablePaths
@@ -513,10 +516,6 @@ func (a *AARImport) targetSdkVersion() string {
return a.sdkVersion()
}
-func (a *AARImport) noFrameworkLibs() bool {
- return false
-}
-
var _ AndroidLibraryDependency = (*AARImport)(nil)
func (a *AARImport) ExportPackage() android.Path {
@@ -598,9 +597,12 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
},
})
+ // Always set --pseudo-localize, it will be stripped out later for release
+ // builds that don't want it.
+ compileFlags := []string{"--pseudo-localize"}
compiledResDir := android.PathForModuleOut(ctx, "flat-res")
flata := compiledResDir.Join(ctx, "gen_res.flata")
- aapt2CompileZip(ctx, flata, aar, "res")
+ aapt2CompileZip(ctx, flata, aar, "res", compileFlags)
a.exportPackage = android.PathForModuleOut(ctx, "package-res.apk")
srcJar := android.PathForModuleGen(ctx, "R.jar")
diff --git a/java/androidmk.go b/java/androidmk.go
index 5491b3eba..39c2d1342 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -97,14 +97,6 @@ func (library *Library) AndroidMk() android.AndroidMkData {
if library.proguardDictionary != nil {
fmt.Fprintln(w, "LOCAL_SOONG_PROGUARD_DICT :=", library.proguardDictionary.String())
}
-
- // Temporary hack: export sources used to compile framework.jar to Make
- // to be used for droiddoc
- // TODO(ccross): remove this once droiddoc is in soong
- if (library.Name() == "framework") || (library.Name() == "framework-annotation-proc") {
- fmt.Fprintln(w, "SOONG_FRAMEWORK_SRCS :=", strings.Join(library.compiledJavaSrcs.Strings(), " "))
- fmt.Fprintln(w, "SOONG_FRAMEWORK_SRCJARS :=", strings.Join(library.compiledSrcJars.Strings(), " "))
- }
},
},
Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
diff --git a/java/app_test.go b/java/app_test.go
index 27802cd21..459f3770b 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -546,79 +546,6 @@ func TestAppSdkVersion(t *testing.T) {
}
}
-func TestJNIABI_no_framework_libs_true(t *testing.T) {
- ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
- cc_library {
- name: "libjni",
- system_shared_libs: [],
- stl: "none",
- }
-
- android_test {
- name: "test",
- no_framework_libs: true,
- jni_libs: ["libjni"],
- }
-
- android_test {
- name: "test_first",
- no_framework_libs: true,
- compile_multilib: "first",
- jni_libs: ["libjni"],
- }
-
- android_test {
- name: "test_both",
- no_framework_libs: true,
- compile_multilib: "both",
- jni_libs: ["libjni"],
- }
-
- android_test {
- name: "test_32",
- no_framework_libs: true,
- compile_multilib: "32",
- jni_libs: ["libjni"],
- }
-
- android_test {
- name: "test_64",
- no_framework_libs: true,
- compile_multilib: "64",
- jni_libs: ["libjni"],
- }
- `)
-
- testCases := []struct {
- name string
- abis []string
- }{
- {"test", []string{"arm64-v8a"}},
- {"test_first", []string{"arm64-v8a"}},
- {"test_both", []string{"arm64-v8a", "armeabi-v7a"}},
- {"test_32", []string{"armeabi-v7a"}},
- {"test_64", []string{"arm64-v8a"}},
- }
-
- for _, test := range testCases {
- t.Run(test.name, func(t *testing.T) {
- app := ctx.ModuleForTests(test.name, "android_common")
- jniLibZip := app.Output("jnilibs.zip")
- var abis []string
- args := strings.Fields(jniLibZip.Args["jarArgs"])
- for i := 0; i < len(args); i++ {
- if args[i] == "-P" {
- abis = append(abis, filepath.Base(args[i+1]))
- i++
- }
- }
- if !reflect.DeepEqual(abis, test.abis) {
- t.Errorf("want abis %v, got %v", test.abis, abis)
- }
- })
- }
-}
-
func TestJNIABI(t *testing.T) {
ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
cc_library {
@@ -692,89 +619,6 @@ func TestJNIABI(t *testing.T) {
}
}
-func TestJNIPackaging_no_framework_libs_true(t *testing.T) {
- ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
- cc_library {
- name: "libjni",
- system_shared_libs: [],
- stl: "none",
- }
-
- android_app {
- name: "app",
- jni_libs: ["libjni"],
- }
-
- android_app {
- name: "app_noembed",
- jni_libs: ["libjni"],
- use_embedded_native_libs: false,
- }
-
- android_app {
- name: "app_embed",
- jni_libs: ["libjni"],
- use_embedded_native_libs: true,
- }
-
- android_test {
- name: "test",
- no_framework_libs: true,
- jni_libs: ["libjni"],
- }
-
- android_test {
- name: "test_noembed",
- no_framework_libs: true,
- jni_libs: ["libjni"],
- use_embedded_native_libs: false,
- }
-
- android_test_helper_app {
- name: "test_helper",
- no_framework_libs: true,
- jni_libs: ["libjni"],
- }
-
- android_test_helper_app {
- name: "test_helper_noembed",
- no_framework_libs: true,
- jni_libs: ["libjni"],
- use_embedded_native_libs: false,
- }
- `)
-
- testCases := []struct {
- name string
- packaged bool
- compressed bool
- }{
- {"app", false, false},
- {"app_noembed", false, false},
- {"app_embed", true, false},
- {"test", true, false},
- {"test_noembed", true, true},
- {"test_helper", true, false},
- {"test_helper_noembed", true, true},
- }
-
- for _, test := range testCases {
- t.Run(test.name, func(t *testing.T) {
- app := ctx.ModuleForTests(test.name, "android_common")
- jniLibZip := app.MaybeOutput("jnilibs.zip")
- if g, w := (jniLibZip.Rule != nil), test.packaged; g != w {
- t.Errorf("expected jni packaged %v, got %v", w, g)
- }
-
- if jniLibZip.Rule != nil {
- if g, w := !strings.Contains(jniLibZip.Args["jarArgs"], "-L 0"), test.compressed; g != w {
- t.Errorf("expected jni compressed %v, got %v", w, g)
- }
- }
- })
- }
-}
-
func TestJNIPackaging(t *testing.T) {
ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
cc_library {
diff --git a/java/builder.go b/java/builder.go
index e1a912b2f..a48e8b1a2 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -148,15 +148,16 @@ func init() {
}
type javaBuilderFlags struct {
- javacFlags string
- bootClasspath classpath
- classpath classpath
- processorPath classpath
- processor string
- systemModules classpath
- aidlFlags string
- aidlDeps android.Paths
- javaVersion string
+ javacFlags string
+ bootClasspath classpath
+ classpath classpath
+ processorPath classpath
+ processor string
+ systemModules classpath
+ systemModulesDeps android.Paths
+ aidlFlags string
+ aidlDeps android.Paths
+ javaVersion string
errorProneExtraJavacFlags string
errorProneProcessorPath classpath
@@ -248,7 +249,7 @@ func transformJavaToClasses(ctx android.ModuleContext, outputFile android.Writab
var bootClasspath string
if flags.javaVersion == "1.9" {
- deps = append(deps, flags.systemModules...)
+ deps = append(deps, flags.systemModulesDeps...)
bootClasspath = flags.systemModules.FormJavaSystemModulesPath("--system=", ctx.Device())
} else {
deps = append(deps, flags.bootClasspath...)
@@ -430,7 +431,7 @@ func (x *classpath) FormJavaSystemModulesPath(optName string, forceEmpty bool) s
if len(*x) > 1 {
panic("more than one system module")
} else if len(*x) == 1 {
- return optName + strings.TrimSuffix((*x)[0].String(), "lib/modules")
+ return optName + (*x)[0].String()
} else if forceEmpty {
return optName + "none"
} else {
diff --git a/java/device_host_converter_test.go b/java/device_host_converter_test.go
index 146bf6f40..9b9d0d899 100644
--- a/java/device_host_converter_test.go
+++ b/java/device_host_converter_test.go
@@ -126,7 +126,7 @@ func TestHostForDevice(t *testing.T) {
java_library {
name: "device_module",
- no_framework_libs: true,
+ sdk_version: "core_platform",
srcs: ["b.java"],
java_resources: ["java-res/b/b"],
static_libs: ["host_for_device_module"],
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 23d2aa6e3..ed12fe6d2 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -132,8 +132,10 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
}
var images android.Paths
+ var imagesDeps []android.Paths
for _, arch := range archs {
images = append(images, bootImage.images[arch])
+ imagesDeps = append(imagesDeps, bootImage.imagesDeps[arch])
}
dexLocation := android.InstallPathToOnDevicePath(ctx, d.installPath)
@@ -173,8 +175,9 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
UsesLibraries: d.usesLibs,
LibraryPaths: d.libraryPaths,
- Archs: archs,
- DexPreoptImages: images,
+ Archs: archs,
+ DexPreoptImages: images,
+ DexPreoptImagesDeps: imagesDeps,
// We use the dex paths and dex locations of the default boot image, as it
// contains the full dexpreopt boot classpath. Other images may just contain a subset of
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 2a1a901b7..eb735c162 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -58,9 +58,32 @@ type bootImageConfig struct {
symbolsDir android.OutputPath
targets []android.Target
images map[android.ArchType]android.OutputPath
+ imagesDeps map[android.ArchType]android.Paths
zip android.WritablePath
}
+func (image bootImageConfig) moduleFiles(ctx android.PathContext, dir android.OutputPath, exts ...string) []android.OutputPath {
+ ret := make([]android.OutputPath, 0, len(image.modules)*len(exts))
+
+ // dex preopt on the bootclasspath produces multiple files. The first dex file
+ // is converted into to 'name'.art (to match the legacy assumption that 'name'.art
+ // exists), and the rest are converted to 'name'-<jar>.art.
+ // 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
+ if i != 0 {
+ name += "-" + m
+ }
+
+ for _, ext := range exts {
+ ret = append(ret, dir.Join(ctx, name+ext))
+ }
+ }
+
+ return ret
+}
+
type bootImage struct {
bootImageConfig
@@ -302,49 +325,38 @@ func buildBootImageRuleForArch(ctx android.SingletonContext, image *bootImage,
installDir := filepath.Join("/system/framework", arch.String())
vdexInstallDir := filepath.Join("/system/framework")
- var extraFiles android.WritablePaths
var vdexInstalls android.RuleBuilderInstalls
var unstrippedInstalls android.RuleBuilderInstalls
var zipFiles android.WritablePaths
- // dex preopt on the bootclasspath produces multiple files. The first dex file
- // is converted into to 'name'.art (to match the legacy assumption that 'name'.art
- // exists), and the rest are converted to 'name'-<jar>.art.
- // 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
- if i != 0 {
- name += "-" + m
- }
-
- art := outputDir.Join(ctx, name+".art")
- oat := outputDir.Join(ctx, name+".oat")
- vdex := outputDir.Join(ctx, name+".vdex")
- unstrippedOat := symbolsDir.Join(ctx, name+".oat")
-
- extraFiles = append(extraFiles, art, oat, vdex, unstrippedOat)
+ for _, artOrOat := range image.moduleFiles(ctx, outputDir, ".art", ".oat") {
+ cmd.ImplicitOutput(artOrOat)
+ zipFiles = append(zipFiles, artOrOat)
- zipFiles = append(zipFiles, art, oat, vdex)
+ // Install the .oat and .art files
+ rule.Install(artOrOat, filepath.Join(installDir, artOrOat.Base()))
+ }
- // Install the .oat and .art files.
- rule.Install(art, filepath.Join(installDir, art.Base()))
- rule.Install(oat, filepath.Join(installDir, oat.Base()))
+ for _, vdex := range image.moduleFiles(ctx, outputDir, ".vdex") {
+ cmd.ImplicitOutput(vdex)
+ zipFiles = append(zipFiles, vdex)
// The vdex files are identical between architectures, install them to a shared location. The Make rules will
// only use the install rules for one architecture, and will create symlinks into the architecture-specific
// directories.
vdexInstalls = append(vdexInstalls,
android.RuleBuilderInstall{vdex, filepath.Join(vdexInstallDir, vdex.Base())})
+ }
+
+ for _, unstrippedOat := range image.moduleFiles(ctx, symbolsDir, ".oat") {
+ cmd.ImplicitOutput(unstrippedOat)
// Install the unstripped oat files. The Make rules will put these in $(TARGET_OUT_UNSTRIPPED)
unstrippedInstalls = append(unstrippedInstalls,
android.RuleBuilderInstall{unstrippedOat, filepath.Join(installDir, unstrippedOat.Base())})
}
- cmd.ImplicitOutputs(extraFiles)
-
rule.Build(pctx, ctx, image.name+"JarsDexpreopt_"+arch.String(), "dexpreopt "+image.name+" jars "+arch.String())
// save output and installed files for makevars
@@ -496,6 +508,7 @@ func (d *dexpreoptBootJars) MakeVars(ctx android.MakeVarsContext) {
for _, arch := range arches {
ctx.Strict("DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_"+current.name+"_"+arch.String(), current.vdexInstalls[arch].String())
ctx.Strict("DEXPREOPT_IMAGE_"+current.name+"_"+arch.String(), current.images[arch].String())
+ ctx.Strict("DEXPREOPT_IMAGE_DEPS_"+current.name+"_"+arch.String(), strings.Join(current.imagesDeps[arch].Strings(), " "))
ctx.Strict("DEXPREOPT_IMAGE_BUILT_INSTALLED_"+current.name+"_"+arch.String(), current.installs[arch].String())
ctx.Strict("DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_"+current.name+"_"+arch.String(), current.unstrippedInstalls[arch].String())
if current.zip != nil {
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index d903f456a..c396d3ea0 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -137,27 +137,35 @@ func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
dir := android.PathForOutput(ctx, ctx.Config().DeviceName(), "dex_bootjars")
symbolsDir := android.PathForOutput(ctx, ctx.Config().DeviceName(), "dex_bootjars_unstripped")
- images := make(map[android.ArchType]android.OutputPath)
zip := dir.Join(ctx, "boot.zip")
targets := dexpreoptTargets(ctx)
- for _, target := range targets {
- images[target.Arch.ArchType] = dir.Join(ctx,
- "system/framework", target.Arch.ArchType.String()).Join(ctx, "boot.art")
- }
-
- return bootImageConfig{
+ imageConfig := bootImageConfig{
name: "boot",
modules: nonUpdatableBootModules,
dexLocations: nonUpdatableBootLocations,
dexPaths: nonUpdatableBootDexPaths,
dir: dir,
symbolsDir: symbolsDir,
- images: images,
+ images: make(map[android.ArchType]android.OutputPath),
+ imagesDeps: make(map[android.ArchType]android.Paths),
targets: targets,
zip: zip,
}
+
+ for _, target := range targets {
+ imageDir := dir.Join(ctx, "system/framework", target.Arch.ArchType.String())
+ imageConfig.images[target.Arch.ArchType] = imageDir.Join(ctx, "boot.art")
+
+ imagesDeps := make([]android.Path, 0, len(imageConfig.modules)*3)
+ for _, dep := range imageConfig.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex") {
+ imagesDeps = append(imagesDeps, dep)
+ }
+ imageConfig.imagesDeps[target.Arch.ArchType] = imagesDeps
+ }
+
+ return imageConfig
}).(bootImageConfig)
}
@@ -196,16 +204,10 @@ func apexBootImageConfig(ctx android.PathContext) bootImageConfig {
dir := android.PathForOutput(ctx, ctx.Config().DeviceName(), "dex_apexjars")
symbolsDir := android.PathForOutput(ctx, ctx.Config().DeviceName(), "dex_apexjars_unstripped")
- images := make(map[android.ArchType]android.OutputPath)
targets := dexpreoptTargets(ctx)
- for _, target := range targets {
- images[target.Arch.ArchType] = dir.Join(ctx,
- "system/framework", target.Arch.ArchType.String(), "apex.art")
- }
-
- return bootImageConfig{
+ imageConfig := bootImageConfig{
name: "apex",
modules: imageModules,
dexLocations: bootLocations,
@@ -213,8 +215,22 @@ func apexBootImageConfig(ctx android.PathContext) bootImageConfig {
dir: dir,
symbolsDir: symbolsDir,
targets: targets,
- images: images,
+ images: make(map[android.ArchType]android.OutputPath),
+ imagesDeps: make(map[android.ArchType]android.Paths),
}
+
+ for _, target := range targets {
+ imageDir := dir.Join(ctx, "system/framework", target.Arch.ArchType.String())
+ imageConfig.images[target.Arch.ArchType] = imageDir.Join(ctx, "apex.art")
+
+ imagesDeps := make([]android.Path, 0, len(imageConfig.modules)*3)
+ for _, dep := range imageConfig.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex") {
+ imagesDeps = append(imagesDeps, dep)
+ }
+ imageConfig.imagesDeps[target.Arch.ArchType] = imagesDeps
+ }
+
+ return imageConfig
}).(bootImageConfig)
}
diff --git a/java/droiddoc.go b/java/droiddoc.go
index a8cf1c034..734b411a8 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -171,9 +171,6 @@ type JavadocProperties struct {
// list of java libraries that will be in the classpath.
Libs []string `android:"arch_variant"`
- // don't build against the framework libraries (ext, and framework for device targets)
- No_framework_libs *bool
-
// the java library (in classpath) for documentation that provides java srcs and srcjars.
Srcs_lib *string
@@ -534,10 +531,6 @@ func (j *Javadoc) targetSdkVersion() string {
return j.sdkVersion()
}
-func (j *Javadoc) noFrameworkLibs() bool {
- return Bool(j.properties.No_framework_libs)
-}
-
func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) {
if ctx.Device() {
sdkDep := decodeSdkDep(ctx, sdkContext(j))
@@ -692,10 +685,11 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
panic("Found two system module dependencies")
}
sm := module.(*SystemModules)
- if sm.outputFile == nil {
+ if sm.outputDir == nil && len(sm.outputDeps) == 0 {
panic("Missing directory for system module dependency")
}
- deps.systemModules = sm.outputFile
+ deps.systemModules = sm.outputDir
+ deps.systemModulesDeps = sm.outputDeps
}
})
// do not pass exclude_srcs directly when expanding srcFiles since exclude_srcs
@@ -776,6 +770,7 @@ func (j *Javadoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if deps.systemModules != nil {
systemModules = append(systemModules, deps.systemModules)
}
+ implicits = append(implicits, deps.systemModulesDeps...)
bootClasspathArgs = systemModules.FormJavaSystemModulesPath("--system ", ctx.Device())
bootClasspathArgs = bootClasspathArgs + " --patch-module java.base=."
}
diff --git a/java/java.go b/java/java.go
index 4b3845161..bf80cedee 100644
--- a/java/java.go
+++ b/java/java.go
@@ -82,9 +82,6 @@ type CompilerProperties struct {
// list of files that should be excluded from java_resources and java_resource_dirs
Exclude_java_resources []string `android:"path,arch_variant"`
- // don't build against the framework libraries (ext, and framework for device targets)
- No_framework_libs *bool
-
// list of module-specific flags that will be used for javac compiles
Javacflags []string `android:"arch_variant"`
@@ -482,10 +479,6 @@ func (j *Module) targetSdkVersion() string {
return j.sdkVersion()
}
-func (j *Module) noFrameworkLibs() bool {
- return Bool(j.properties.No_framework_libs)
-}
-
func (j *Module) deps(ctx android.BottomUpMutatorContext) {
if ctx.Device() {
sdkDep := decodeSdkDep(ctx, sdkContext(j))
@@ -506,7 +499,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
}
} else if j.deviceProperties.System_modules == nil {
ctx.PropertyErrorf("sdk_version",
- `system_modules is required to be set when sdk_version is "none", did you mean no_framework_libs?`)
+ `system_modules is required to be set when sdk_version is "none", did you mean "core_platform"`)
} else if *j.deviceProperties.System_modules != "none" {
ctx.AddVariationDependencies(nil, systemModulesTag, *j.deviceProperties.System_modules)
}
@@ -628,6 +621,7 @@ type deps struct {
srcs android.Paths
srcJars android.Paths
systemModules android.Path
+ systemModulesDeps android.Paths
aidlPreprocess android.OptionalPath
kotlinStdlib android.Paths
kotlinAnnotations android.Paths
@@ -835,10 +829,11 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
panic("Found two system module dependencies")
}
sm := module.(*SystemModules)
- if sm.outputFile == nil {
+ if sm.outputDir == nil || len(sm.outputDeps) == 0 {
panic("Missing directory for system module dependency")
}
- deps.systemModules = sm.outputFile
+ deps.systemModules = sm.outputDir
+ deps.systemModulesDeps = sm.outputDeps
}
}
})
@@ -968,6 +963,7 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
// systemModules
if deps.systemModules != nil {
flags.systemModules = append(flags.systemModules, deps.systemModules)
+ flags.systemModulesDeps = append(flags.systemModulesDeps, deps.systemModulesDeps...)
}
// aidl flags.
diff --git a/java/sdk.go b/java/sdk.go
index 6ffe399fb..1682a1003 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -44,9 +44,6 @@ type sdkContext interface {
minSdkVersion() string
// targetSdkVersion returns the target_sdk_version property of the current module, or sdkVersion() if it is not set.
targetSdkVersion() string
-
- // Temporarily provide access to the no_frameworks_libs property (where present).
- noFrameworkLibs() bool
}
func sdkVersionOrDefault(ctx android.BaseModuleContext, v string) string {
@@ -84,6 +81,7 @@ func sdkVersionToNumberAsString(ctx android.BaseModuleContext, v string) (string
func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
v := sdkContext.sdkVersion()
+
// For PDK builds, use the latest SDK version instead of "current"
if ctx.Config().IsPdkBuild() && (v == "" || v == "current") {
sdkVersions := ctx.Config().Get(sdkVersionsKey).([]int)
@@ -141,9 +139,6 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
useFiles: true,
jars: android.Paths{jarPath.Path(), lambdaStubsPath},
aidl: android.OptionalPathForPath(aidlPath.Path()),
-
- // Pass value straight through for now to match previous behavior.
- noFrameworksLibs: sdkContext.noFrameworkLibs(),
}
}
@@ -154,9 +149,6 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
systemModules: m + "_system_modules",
frameworkResModule: r,
aidl: android.OptionalPathForPath(aidl),
-
- // Pass value straight through for now to match previous behavior.
- noFrameworksLibs: sdkContext.noFrameworkLibs(),
}
if m == "core.current.stubs" {
@@ -192,9 +184,6 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
return sdkDep{
useDefaultLibs: true,
frameworkResModule: "framework-res",
-
- // Pass value straight through for now to match previous behavior.
- noFrameworksLibs: sdkContext.noFrameworkLibs(),
}
case "none":
return sdkDep{
diff --git a/java/sdk_test.go b/java/sdk_test.go
index 915333ec9..f82a4fba9 100644
--- a/java/sdk_test.go
+++ b/java/sdk_test.go
@@ -47,14 +47,6 @@ func TestClasspath(t *testing.T) {
aidl: "-Iframework/aidl",
},
{
- name: "no_framework_libs:true",
- properties: `no_framework_libs:true`,
- bootclasspath: config.DefaultBootclasspathLibraries,
- system: config.DefaultSystemModules,
- classpath: []string{},
- aidl: "",
- },
- {
name: `sdk_version:"core_platform"`,
properties: `sdk_version:"core_platform"`,
bootclasspath: config.DefaultBootclasspathLibraries,
@@ -254,7 +246,7 @@ func TestClasspath(t *testing.T) {
if testcase.system == "none" {
system = "--system=none"
} else if testcase.system != "" {
- system = "--system=" + filepath.Join(buildDir, ".intermediates", testcase.system, "android_common", "system") + "/"
+ system = "--system=" + filepath.Join(buildDir, ".intermediates", testcase.system, "android_common", "system")
}
checkClasspath := func(t *testing.T, ctx *android.TestContext) {
diff --git a/java/system_modules.go b/java/system_modules.go
index 5a86f3c82..c616249d5 100644
--- a/java/system_modules.go
+++ b/java/system_modules.go
@@ -61,7 +61,7 @@ var (
"moduleName", "classpath", "outDir", "workDir")
)
-func TransformJarsToSystemModules(ctx android.ModuleContext, moduleName string, jars android.Paths) android.WritablePath {
+func TransformJarsToSystemModules(ctx android.ModuleContext, moduleName string, jars android.Paths) (android.Path, android.Paths) {
outDir := android.PathForModuleOut(ctx, "system")
workDir := android.PathForModuleOut(ctx, "modules")
outputFile := android.PathForModuleOut(ctx, "system/lib/modules")
@@ -84,7 +84,7 @@ func TransformJarsToSystemModules(ctx android.ModuleContext, moduleName string,
},
})
- return outputFile
+ return outDir, outputs.Paths()
}
func SystemModulesFactory() android.Module {
@@ -101,7 +101,8 @@ type SystemModules struct {
properties SystemModulesProperties
- outputFile android.Path
+ outputDir android.Path
+ outputDeps android.Paths
}
type SystemModulesProperties struct {
@@ -117,7 +118,7 @@ func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleConte
jars = append(jars, dep.HeaderJars()...)
})
- system.outputFile = TransformJarsToSystemModules(ctx, "java.base", jars)
+ system.outputDir, system.outputDeps = TransformJarsToSystemModules(ctx, "java.base", jars)
}
func (system *SystemModules) DepsMutator(ctx android.BottomUpMutatorContext) {
@@ -127,16 +128,22 @@ func (system *SystemModules) DepsMutator(ctx android.BottomUpMutatorContext) {
func (system *SystemModules) AndroidMk() android.AndroidMkData {
return android.AndroidMkData{
Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
+ fmt.Fprintln(w)
+
makevar := "SOONG_SYSTEM_MODULES_" + name
+ fmt.Fprintln(w, makevar, ":=$=", system.outputDir.String())
+ fmt.Fprintln(w)
+
+ makevar = "SOONG_SYSTEM_MODULES_LIBS_" + name
+ fmt.Fprintln(w, makevar, ":=$=", strings.Join(system.properties.Libs, " "))
fmt.Fprintln(w)
- fmt.Fprintln(w, makevar, ":=", system.outputFile.String())
- fmt.Fprintln(w, ".KATI_READONLY", ":=", makevar)
+
+ makevar = "SOONG_SYSTEM_MODULES_DEPS_" + name
+ fmt.Fprintln(w, makevar, ":=$=", strings.Join(system.outputDeps.Strings(), " "))
+ fmt.Fprintln(w)
+
fmt.Fprintln(w, name+":", "$("+makevar+")")
fmt.Fprintln(w, ".PHONY:", name)
- fmt.Fprintln(w)
- makevar = "SOONG_SYSTEM_MODULES_LIBS_" + name
- fmt.Fprintln(w, makevar, ":=", strings.Join(system.properties.Libs, " "))
- fmt.Fprintln(w, ".KATI_READONLY :=", makevar)
},
}
}