diff options
Diffstat (limited to 'java/java.go')
| -rw-r--r-- | java/java.go | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/java/java.go b/java/java.go index 4b3845161..f3e10bebd 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"` @@ -426,6 +423,18 @@ var ( usesLibTag = dependencyTag{name: "uses-library"} ) +func defaultSdkVersion(ctx checkVendorModuleContext) string { + if ctx.SocSpecific() || ctx.DeviceSpecific() { + return "system_current" + } + return "" +} + +type checkVendorModuleContext interface { + SocSpecific() bool + DeviceSpecific() bool +} + type sdkDep struct { useModule, useFiles, useDefaultLibs, invalidVersion bool @@ -465,7 +474,7 @@ func (j *Module) shouldInstrumentStatic(ctx android.BaseModuleContext) bool { } func (j *Module) sdkVersion() string { - return String(j.deviceProperties.Sdk_version) + return proptools.StringDefault(j.deviceProperties.Sdk_version, defaultSdkVersion(j)) } func (j *Module) minSdkVersion() string { @@ -482,10 +491,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 +511,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) } @@ -627,7 +632,7 @@ type deps struct { aidlIncludeDirs android.Paths srcs android.Paths srcJars android.Paths - systemModules android.Path + systemModules *systemModules aidlPreprocess android.OptionalPath kotlinStdlib android.Paths kotlinAnnotations android.Paths @@ -835,10 +840,10 @@ 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 = &systemModules{sm.outputDir, sm.outputDeps} } } }) @@ -966,9 +971,7 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB } // systemModules - if deps.systemModules != nil { - flags.systemModules = append(flags.systemModules, deps.systemModules) - } + flags.systemModules = deps.systemModules // aidl flags. flags.aidlFlags, flags.aidlDeps = j.aidlFlags(ctx, deps.aidlPreprocess, deps.aidlIncludeDirs) @@ -1314,11 +1317,9 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) { return } - if !ctx.Config().UnbundledBuild() { - // Hidden API CSV generation and dex encoding - dexOutputFile = j.hiddenAPI.hiddenAPI(ctx, dexOutputFile, j.implementationJarFile, - j.deviceProperties.UncompressDex) - } + // Hidden API CSV generation and dex encoding + dexOutputFile = j.hiddenAPI.hiddenAPI(ctx, dexOutputFile, j.implementationJarFile, + j.deviceProperties.UncompressDex) // merge dex jar with resources if necessary if j.resourceJar != nil { @@ -1866,7 +1867,7 @@ type Import struct { } func (j *Import) sdkVersion() string { - return String(j.properties.Sdk_version) + return proptools.StringDefault(j.properties.Sdk_version, defaultSdkVersion(j)) } func (j *Import) minSdkVersion() string { @@ -2034,7 +2035,7 @@ func ImportFactoryHost() android.Module { // dex_import module type DexImportProperties struct { - Jars []string + Jars []string `android:"path"` } type DexImport struct { @@ -2062,10 +2063,6 @@ func (j *DexImport) Name() string { return j.prebuilt.Name(j.ModuleBase.Name()) } -func (j *DexImport) DepsMutator(ctx android.BottomUpMutatorContext) { - android.ExtractSourcesDeps(ctx, j.properties.Jars) -} - func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { if len(j.properties.Jars) != 1 { ctx.PropertyErrorf("jars", "exactly one jar must be provided") @@ -2086,14 +2083,14 @@ func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { // use zip2zip to uncompress classes*.dex files rule.Command(). - Tool(ctx.Config().HostToolPath(ctx, "zip2zip")). + BuiltTool(ctx, "zip2zip"). FlagWithInput("-i ", inputJar). FlagWithOutput("-o ", temporary). FlagWithArg("-0 ", "'classes*.dex'") // use zipalign to align uncompressed classes*.dex files rule.Command(). - Tool(ctx.Config().HostToolPath(ctx, "zipalign")). + BuiltTool(ctx, "zipalign"). Flag("-f"). Text("4"). Input(temporary). |