diff options
Diffstat (limited to 'java/java.go')
| -rw-r--r-- | java/java.go | 63 |
1 files changed, 56 insertions, 7 deletions
diff --git a/java/java.go b/java/java.go index 46ef98be9..bd476bc26 100644 --- a/java/java.go +++ b/java/java.go @@ -556,7 +556,20 @@ func (j *Module) XrefJavaFiles() android.Paths { } func InitJavaModule(module android.DefaultableModule, hod android.HostOrDeviceSupported) { - android.InitAndroidArchModule(module, hod, android.MultilibCommon) + initJavaModule(module, hod, false) +} + +func InitJavaModuleMultiTargets(module android.DefaultableModule, hod android.HostOrDeviceSupported) { + initJavaModule(module, hod, true) +} + +func initJavaModule(module android.DefaultableModule, hod android.HostOrDeviceSupported, multiTargets bool) { + multilib := android.MultilibCommon + if multiTargets { + android.InitAndroidMultiTargetsArchModule(module, hod, multilib) + } else { + android.InitAndroidArchModule(module, hod, multilib) + } android.InitDefaultableModule(module) } @@ -575,6 +588,7 @@ func IsJniDepTag(depTag blueprint.DependencyTag) bool { } var ( + dataNativeBinsTag = dependencyTag{name: "dataNativeBins"} staticLibTag = dependencyTag{name: "staticlib"} libTag = dependencyTag{name: "javalib"} java9LibTag = dependencyTag{name: "java9lib"} @@ -635,10 +649,11 @@ func (s sdkDep) hasFrameworkLibs() bool { } type jniLib struct { - name string - path android.Path - target android.Target - coverageFile android.OptionalPath + name string + path android.Path + target android.Target + coverageFile android.OptionalPath + unstrippedFile android.Path } func (j *Module) shouldInstrument(ctx android.BaseModuleContext) bool { @@ -1706,6 +1721,9 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) { j.linter.compileSdkVersion = lintSDKVersionString(j.sdkVersion()) j.linter.javaLanguageLevel = flags.javaVersion.String() j.linter.kotlinLanguageLevel = "1.3" + if j.ApexName() != "" && ctx.Config().UnbundledBuildApps() { + j.linter.buildModuleReportZip = true + } j.linter.lint(ctx) } @@ -2189,6 +2207,11 @@ type testProperties struct { Test_mainline_modules []string } +type hostTestProperties struct { + // list of native binary modules that should be installed alongside the test + Data_native_bins []string `android:"arch_variant"` +} + type testHelperLibraryProperties struct { // list of compatibility suites (for example "cts", "vts") that the module should be // installed into. @@ -2214,6 +2237,12 @@ type Test struct { data android.Paths } +type TestHost struct { + Test + + testHostProperties hostTestProperties +} + type TestHelperLibrary struct { Library @@ -2228,11 +2257,26 @@ type JavaTestImport struct { testConfig android.Path } +func (j *TestHost) DepsMutator(ctx android.BottomUpMutatorContext) { + if len(j.testHostProperties.Data_native_bins) > 0 { + for _, target := range ctx.MultiTargets() { + ctx.AddVariationDependencies(target.Variations(), dataNativeBinsTag, j.testHostProperties.Data_native_bins...) + } + } + + j.deps(ctx) +} + func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template, j.testProperties.Test_suites, j.testProperties.Auto_gen_config) + j.data = android.PathsForModuleSrc(ctx, j.testProperties.Data) + ctx.VisitDirectDepsWithTag(dataNativeBinsTag, func(dep android.Module) { + j.data = append(j.data, android.OutputFileForModule(ctx, dep, "")) + }) + j.Library.GenerateAndroidBuildActions(ctx) } @@ -2373,14 +2417,15 @@ func JavaTestImportFactory() android.Module { // A java_test_host has a single variant that produces a `.jar` file containing `.class` files that were // compiled against the host bootclasspath. func TestHostFactory() android.Module { - module := &Test{} + module := &TestHost{} module.addHostProperties() module.AddProperties(&module.testProperties) + module.AddProperties(&module.testHostProperties) module.Module.properties.Installable = proptools.BoolPtr(true) - InitJavaModule(module, android.HostSupported) + InitJavaModuleMultiTargets(module, android.HostSupported) return module } @@ -2788,6 +2833,10 @@ func (a *DexImport) JacocoReportClassesFile() android.Path { return nil } +func (a *DexImport) LintDepSets() LintDepSets { + return LintDepSets{} +} + func (j *DexImport) IsInstallable() bool { return true } |