diff options
Diffstat (limited to 'java')
| -rw-r--r-- | java/aar.go | 4 | ||||
| -rwxr-xr-x | java/app.go | 24 | ||||
| -rw-r--r-- | java/device_host_converter.go | 4 | ||||
| -rw-r--r-- | java/dexpreopt.go | 4 | ||||
| -rw-r--r-- | java/dexpreopt_bootjars.go | 20 | ||||
| -rw-r--r-- | java/dexpreopt_bootjars_test.go | 2 | ||||
| -rw-r--r-- | java/java.go | 15 |
7 files changed, 42 insertions, 31 deletions
diff --git a/java/aar.go b/java/aar.go index 7413c8082..28e388aaf 100644 --- a/java/aar.go +++ b/java/aar.go @@ -734,6 +734,10 @@ func (a *AARImport) DexJarBuildPath() android.Path { return nil } +func (a *AARImport) DexJarInstallPath() android.Path { + return nil +} + func (a *AARImport) AidlIncludeDirs() android.Paths { return nil } diff --git a/java/app.go b/java/app.go index 24dde79f4..7a109be56 100755 --- a/java/app.go +++ b/java/app.go @@ -973,10 +973,6 @@ func AndroidAppFactory() android.Module { &module.overridableAppProperties, &module.usesLibrary.usesLibraryProperties) - module.Prefer32(func(ctx android.BaseModuleContext, base *android.ModuleBase, class android.OsClass) bool { - return class == android.Device && ctx.Config().DevicePrefer32BitApps() - }) - android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon) android.InitDefaultableModule(module) android.InitOverridableModule(module, &module.appProperties.Overrides) @@ -1887,16 +1883,22 @@ func (u *usesLibrary) usesLibraryPaths(ctx android.ModuleContext) dexpreopt.Libr ctx.VisitDirectDepsWithTag(usesLibTag, func(m android.Module) { dep := ctx.OtherModuleName(m) if lib, ok := m.(Dependency); ok { - if dexJar := lib.DexJarBuildPath(); dexJar != nil { - usesLibPaths[dep] = &dexpreopt.LibraryPath{ - dexJar, - // TODO(b/132357300): propagate actual install paths here. - filepath.Join("/system/framework", dep+".jar"), - } - } else { + buildPath := lib.DexJarBuildPath() + if buildPath == nil { ctx.ModuleErrorf("module %q in uses_libs or optional_uses_libs must"+ " produce a dex jar, does it have installable: true?", dep) + return } + + var devicePath string + installPath := lib.DexJarInstallPath() + if installPath == nil { + devicePath = filepath.Join("/system/framework", dep+".jar") + } else { + devicePath = android.InstallPathToOnDevicePath(ctx, installPath.(android.InstallPath)) + } + + usesLibPaths[dep] = &dexpreopt.LibraryPath{buildPath, devicePath} } else if ctx.Config().AllowMissingDependencies() { ctx.AddMissingDependencies([]string{dep}) } else { diff --git a/java/device_host_converter.go b/java/device_host_converter.go index 1ffb13f94..877fd8ac2 100644 --- a/java/device_host_converter.go +++ b/java/device_host_converter.go @@ -154,6 +154,10 @@ func (d *DeviceHostConverter) DexJarBuildPath() android.Path { return nil } +func (d *DeviceHostConverter) DexJarInstallPath() android.Path { + return nil +} + func (d *DeviceHostConverter) AidlIncludeDirs() android.Paths { return nil } diff --git a/java/dexpreopt.go b/java/dexpreopt.go index 2911fd9b9..c33415ef6 100644 --- a/java/dexpreopt.go +++ b/java/dexpreopt.go @@ -77,10 +77,6 @@ func (d *dexpreopter) dexpreoptDisabled(ctx android.BaseModuleContext) bool { return true } - if ctx.Config().UnbundledBuild() { - return true - } - if d.isTest { return true } diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index 9d9383814..41205598e 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -179,15 +179,7 @@ func RegisterDexpreoptBootJarsComponents(ctx android.RegistrationContext) { } func skipDexpreoptBootJars(ctx android.PathContext) bool { - if dexpreopt.GetGlobalConfig(ctx).DisablePreopt { - return true - } - - if ctx.Config().UnbundledBuild() { - return true - } - - return false + return dexpreopt.GetGlobalConfig(ctx).DisablePreopt } type dexpreoptBootJars struct { @@ -340,10 +332,12 @@ func buildBootImage(ctx android.SingletonContext, image *bootImageConfig) *bootI bootFrameworkProfileRule(ctx, image, missingDeps) updatableBcpPackagesRule(ctx, image, missingDeps) - var allFiles android.Paths + var zipFiles android.Paths for _, variant := range image.variants { files := buildBootImageVariant(ctx, variant, profile, missingDeps) - allFiles = append(allFiles, files.Paths()...) + if variant.target.Os == android.Android { + zipFiles = append(zipFiles, files.Paths()...) + } } if image.zip != nil { @@ -351,8 +345,8 @@ func buildBootImage(ctx android.SingletonContext, image *bootImageConfig) *bootI rule.Command(). BuiltTool(ctx, "soong_zip"). FlagWithOutput("-o ", image.zip). - FlagWithArg("-C ", image.dir.String()). - FlagWithInputList("-f ", allFiles, " -f ") + FlagWithArg("-C ", image.dir.Join(ctx, android.Android.String()).String()). + FlagWithInputList("-f ", zipFiles, " -f ") rule.Build(pctx, ctx, "zip_"+image.name, "zip "+image.name+" image") } diff --git a/java/dexpreopt_bootjars_test.go b/java/dexpreopt_bootjars_test.go index e9704dc2a..9670c7f4b 100644 --- a/java/dexpreopt_bootjars_test.go +++ b/java/dexpreopt_bootjars_test.go @@ -118,7 +118,7 @@ func TestDexpreoptBootZip(t *testing.T) { ctx := android.PathContextForTesting(testConfig(nil, "", nil)) expectedInputs := []string{} - for _, target := range dexpreoptTargets(ctx) { + for _, target := range ctx.Config().Targets[android.Android] { for _, ext := range []string{".art", ".oat", ".vdex"} { for _, jar := range []string{"foo", "bar", "baz"} { expectedInputs = append(expectedInputs, diff --git a/java/java.go b/java/java.go index 9a352dbe0..1cdfbf187 100644 --- a/java/java.go +++ b/java/java.go @@ -502,6 +502,7 @@ type Dependency interface { ResourceJars() android.Paths ImplementationAndResourcesJars() android.Paths DexJarBuildPath() android.Path + DexJarInstallPath() android.Path AidlIncludeDirs() android.Paths ExportedSdkLibs() []string ExportedPlugins() (android.Paths, []string) @@ -1749,6 +1750,10 @@ func (j *Module) DexJarBuildPath() android.Path { return j.dexJarFile } +func (j *Module) DexJarInstallPath() android.Path { + return j.installFile +} + func (j *Module) ResourceJars() android.Paths { if j.resourceJar == nil { return nil @@ -2575,6 +2580,10 @@ func (j *Import) DexJarBuildPath() android.Path { return nil } +func (j *Import) DexJarInstallPath() android.Path { + return nil +} + func (j *Import) AidlIncludeDirs() android.Paths { return j.exportAidlIncludeDirs } @@ -2754,8 +2763,10 @@ func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.maybeStrippedDexJarFile = dexOutputFile - ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"), - j.Stem()+".jar", dexOutputFile) + if j.IsForPlatform() { + ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"), + j.Stem()+".jar", dexOutputFile) + } } func (j *DexImport) DexJarBuildPath() android.Path { |