summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go55
1 files changed, 33 insertions, 22 deletions
diff --git a/java/java.go b/java/java.go
index 17b963f6e..5b1dcd7cf 100644
--- a/java/java.go
+++ b/java/java.go
@@ -350,6 +350,22 @@ func (me *CompilerDeviceProperties) EffectiveOptimizeEnabled() bool {
return BoolDefault(me.Optimize.Enabled, me.Optimize.EnabledByDefault)
}
+// Functionality common to Module and Import
+type embeddableInModuleAndImport struct {
+}
+
+// Module/Import's DepIsInSameApex(...) delegates to this method.
+//
+// This cannot implement DepIsInSameApex(...) directly as that leads to ambiguity with
+// the one provided by ApexModuleBase.
+func (e *embeddableInModuleAndImport) depIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
+ // dependencies other than the static linkage are all considered crossing APEX boundary
+ if staticLibTag == ctx.OtherModuleDependencyTag(dep) {
+ return true
+ }
+ return false
+}
+
// Module contains the properties and members used by all java module types
type Module struct {
android.ModuleBase
@@ -357,6 +373,9 @@ type Module struct {
android.ApexModuleBase
android.SdkBase
+ // Functionality common to Module and Import.
+ embeddableInModuleAndImport
+
properties CompilerProperties
protoProperties android.ProtoProperties
deviceProperties CompilerDeviceProperties
@@ -624,13 +643,15 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
}
} else if sdkDep.useModule {
ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.bootclasspath...)
- ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules)
ctx.AddVariationDependencies(nil, java9LibTag, sdkDep.java9Classpath...)
if j.deviceProperties.EffectiveOptimizeEnabled() && sdkDep.hasStandardLibs() {
ctx.AddVariationDependencies(nil, proguardRaiseTag, config.DefaultBootclasspathLibraries...)
ctx.AddVariationDependencies(nil, proguardRaiseTag, config.DefaultLibraries...)
}
}
+ if sdkDep.systemModules != "" {
+ ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules)
+ }
if ctx.ModuleName() == "android_stubs_current" ||
ctx.ModuleName() == "android_system_stubs_current" ||
@@ -1033,19 +1054,10 @@ func addPlugins(deps *deps, pluginJars android.Paths, pluginClasses ...string) {
}
func getJavaVersion(ctx android.ModuleContext, javaVersion string, sdkContext sdkContext) javaVersion {
- sdk, err := sdkContext.sdkVersion().effectiveVersion(ctx)
- if err != nil {
- ctx.PropertyErrorf("sdk_version", "%s", err)
- }
if javaVersion != "" {
return normalizeJavaVersion(ctx, javaVersion)
- } else if ctx.Device() && sdk <= 23 {
- return JAVA_VERSION_7
- } else if ctx.Device() && sdk <= 29 {
- return JAVA_VERSION_8
- } else if ctx.Device() && ctx.Config().UnbundledBuildUsePrebuiltSdks() {
- // TODO(b/142896162): once we have prebuilt system modules we can use 1.9 for unbundled builds
- return JAVA_VERSION_8
+ } else if ctx.Device() {
+ return sdkContext.sdkVersion().defaultJavaLanguageVersion(ctx)
} else {
return JAVA_VERSION_9
}
@@ -1768,11 +1780,7 @@ func (j *Module) hasCode(ctx android.ModuleContext) bool {
}
func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
- // Dependencies other than the static linkage are all considered crossing APEX boundary
- if staticLibTag == ctx.OtherModuleDependencyTag(dep) {
- return true
- }
- return false
+ return j.depIsInSameApex(ctx, dep)
}
func (j *Module) Stem() string {
@@ -2032,6 +2040,10 @@ type testProperties struct {
// doesn't exist next to the Android.bp, this attribute doesn't need to be set to true
// explicitly.
Auto_gen_config *bool
+
+ // Add parameterized mainline modules to auto generated test config. The options will be
+ // handled by TradeFed to do downloading and installing the specified modules on the device.
+ Test_mainline_modules []string
}
type testHelperLibraryProperties struct {
@@ -2386,6 +2398,9 @@ type Import struct {
prebuilt android.Prebuilt
android.SdkBase
+ // Functionality common to Module and Import.
+ embeddableInModuleAndImport
+
properties ImportProperties
combinedClasspathFile android.Path
@@ -2520,11 +2535,7 @@ func (j *Import) SrcJarArgs() ([]string, android.Paths) {
}
func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
- // dependencies other than the static linkage are all considered crossing APEX boundary
- if staticLibTag == ctx.OtherModuleDependencyTag(dep) {
- return true
- }
- return false
+ return j.depIsInSameApex(ctx, dep)
}
// Add compile time check for interface implementation