diff options
Diffstat (limited to 'java/java.go')
| -rw-r--r-- | java/java.go | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/java/java.go b/java/java.go index 3332482c3..c5414f4fa 100644 --- a/java/java.go +++ b/java/java.go @@ -362,6 +362,11 @@ type dependencyTag struct { name string } +type jniDependencyTag struct { + blueprint.BaseDependencyTag + target android.Target +} + var ( staticLibTag = dependencyTag{name: "staticlib"} libTag = dependencyTag{name: "javalib"} @@ -372,6 +377,7 @@ var ( frameworkApkTag = dependencyTag{name: "framework-apk"} kotlinStdlibTag = dependencyTag{name: "kotlin-stdlib"} proguardRaiseTag = dependencyTag{name: "proguard-raise"} + certificateTag = dependencyTag{name: "certificate"} ) type sdkDep struct { @@ -386,6 +392,12 @@ type sdkDep struct { aidl android.Path } +type jniLib struct { + name string + path android.Path + target android.Target +} + func (j *Module) shouldInstrument(ctx android.BaseContext) bool { return j.properties.Instrument && ctx.Config().IsEnvTrue("EMMA_INSTRUMENT") } @@ -594,6 +606,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) { ctx.AddFarVariationDependencies([]blueprint.Variation{ {Mutator: "arch", Variation: ctx.Config().BuildOsCommonVariant}, }, annoTag, j.properties.Annotation_processors...) + android.ExtractSourcesDeps(ctx, j.properties.Srcs) android.ExtractSourcesDeps(ctx, j.properties.Exclude_srcs) android.ExtractSourcesDeps(ctx, j.properties.Java_resources) @@ -784,6 +797,15 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { otherName := ctx.OtherModuleName(module) tag := ctx.OtherModuleDependencyTag(module) + if _, ok := tag.(*jniDependencyTag); ok { + // Handled by AndroidApp.collectAppDeps + return + } + if tag == certificateTag { + // Handled by AndroidApp.collectAppDeps + return + } + if to, ok := module.(*Library); ok { switch tag { case bootClasspathTag, libTag, staticLibTag: @@ -889,7 +911,7 @@ func getJavaVersion(ctx android.ModuleContext, javaVersion string, sdkContext sd ret = javaVersion } else if ctx.Device() && sdk <= 23 { ret = "1.7" - } else if ctx.Device() && sdk <= 26 || !ctx.Config().TargetOpenJDK9() { + } else if ctx.Device() && sdk <= 28 || !ctx.Config().TargetOpenJDK9() { ret = "1.8" } else if ctx.Device() && sdkContext.sdkVersion() != "" && sdk == android.FutureApiLevel { // TODO(ccross): once we generate stubs we should be able to use 1.9 for sdk_version: "current" @@ -1446,6 +1468,10 @@ type testProperties struct { // installed with the module. Test_config *string `android:"arch_variant"` + // the name of the test configuration template (for example "AndroidTestTemplate.xml") that + // should be installed with the module. + Test_config_template *string `android:"arch_variant"` + // list of files or filegroup modules that provide data that should be installed alongside // the test Data []string @@ -1461,7 +1487,7 @@ type Test struct { } func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) { - j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config) + j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template) j.data = ctx.ExpandSources(j.testProperties.Data, nil) j.Library.GenerateAndroidBuildActions(ctx) @@ -1470,6 +1496,7 @@ func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (j *Test) DepsMutator(ctx android.BottomUpMutatorContext) { j.deps(ctx) android.ExtractSourceDeps(ctx, j.testProperties.Test_config) + android.ExtractSourceDeps(ctx, j.testProperties.Test_config_template) android.ExtractSourcesDeps(ctx, j.testProperties.Data) } @@ -1485,7 +1512,6 @@ func TestFactory() android.Module { module.Module.properties.Installable = proptools.BoolPtr(true) InitJavaModule(module, android.HostAndDeviceSupported) - android.InitDefaultableModule(module) return module } @@ -1500,7 +1526,6 @@ func TestHostFactory() android.Module { module.Module.properties.Installable = proptools.BoolPtr(true) InitJavaModule(module, android.HostSupported) - android.InitDefaultableModule(module) return module } @@ -1616,6 +1641,7 @@ type ImportProperties struct { type Import struct { android.ModuleBase + android.DefaultableModuleBase prebuilt android.Prebuilt properties ImportProperties @@ -1744,7 +1770,7 @@ func ImportFactory() android.Module { module.AddProperties(&module.properties) android.InitPrebuiltModule(module, &module.properties.Jars) - android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon) + InitJavaModule(module, android.HostAndDeviceSupported) return module } @@ -1754,7 +1780,7 @@ func ImportFactoryHost() android.Module { module.AddProperties(&module.properties) android.InitPrebuiltModule(module, &module.properties.Jars) - android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) + InitJavaModule(module, android.HostSupported) return module } @@ -1784,6 +1810,13 @@ func DefaultsFactory(props ...interface{}) android.Module { &CompilerProperties{}, &CompilerDeviceProperties{}, &android.ProtoProperties{}, + &aaptProperties{}, + &androidLibraryProperties{}, + &appProperties{}, + &appTestProperties{}, + &ImportProperties{}, + &AARImportProperties{}, + &sdkLibraryProperties{}, ) android.InitDefaultsModule(module) |