summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go80
1 files changed, 46 insertions, 34 deletions
diff --git a/java/java.go b/java/java.go
index 09df2ad43..0ba1f5a7a 100644
--- a/java/java.go
+++ b/java/java.go
@@ -463,6 +463,9 @@ type Module struct {
// expanded Jarjar_rules
expandJarjarRules android.Path
+ // list of additional targets for checkbuild
+ additionalCheckedModules android.Paths
+
// Extra files generated by the module type to be added as java resources.
extraResources android.Paths
@@ -498,7 +501,7 @@ type Dependency interface {
ImplementationJars() android.Paths
ResourceJars() android.Paths
ImplementationAndResourcesJars() android.Paths
- DexJar() android.Path
+ DexJarBuildPath() android.Path
AidlIncludeDirs() android.Paths
ExportedSdkLibs() []string
ExportedPlugins() (android.Paths, []string)
@@ -833,41 +836,46 @@ type linkTypeContext interface {
}
func (m *Module) getLinkType(name string) (ret linkType, stubs bool) {
- ver := m.sdkVersion()
- switch {
- case name == "core.current.stubs" || name == "core.platform.api.stubs" ||
- name == "stub-annotations" || name == "private-stub-annotations-jar" ||
- name == "core-lambda-stubs" || name == "core-generated-annotation-stubs":
+ switch name {
+ case "core.current.stubs", "core.platform.api.stubs", "stub-annotations",
+ "private-stub-annotations-jar", "core-lambda-stubs", "core-generated-annotation-stubs":
return javaCore, true
- case ver.kind == sdkCore:
- return javaCore, false
- case name == "android_system_stubs_current":
+ case "android_stubs_current":
+ return javaSdk, true
+ case "android_system_stubs_current":
return javaSystem, true
- case ver.kind == sdkSystem:
- return javaSystem, false
- case name == "android_test_stubs_current":
+ case "android_module_lib_stubs_current":
+ return javaModule, true
+ case "android_system_server_stubs_current":
+ return javaSystemServer, true
+ case "android_test_stubs_current":
return javaSystem, true
- case ver.kind == sdkTest:
- return javaPlatform, false
- case name == "android_stubs_current":
- return javaSdk, true
- case ver.kind == sdkPublic:
+ }
+
+ if stub, linkType := moduleStubLinkType(name); stub {
+ return linkType, true
+ }
+
+ ver := m.sdkVersion()
+ switch ver.kind {
+ case sdkCore:
+ return javaCore, false
+ case sdkSystem:
+ return javaSystem, false
+ case sdkPublic:
return javaSdk, false
- case name == "android_module_lib_stubs_current":
- return javaModule, true
- case ver.kind == sdkModule:
+ case sdkModule:
return javaModule, false
- case name == "android_system_server_stubs_current":
- return javaSystemServer, true
- case ver.kind == sdkSystemServer:
+ case sdkSystemServer:
return javaSystemServer, false
- case ver.kind == sdkPrivate || ver.kind == sdkNone || ver.kind == sdkCorePlatform:
+ case sdkPrivate, sdkNone, sdkCorePlatform, sdkTest:
return javaPlatform, false
- case !ver.valid():
+ }
+
+ if !ver.valid() {
panic(fmt.Errorf("sdk_version is invalid. got %q", ver.raw))
- default:
- return javaSdk, false
}
+ return javaSdk, false
}
func checkLinkType(ctx android.ModuleContext, from *Module, to linkTypeContext, tag dependencyTag) {
@@ -1518,10 +1526,10 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
// Check package restrictions if necessary.
if len(j.properties.Permitted_packages) > 0 {
- // Check packages and copy input to package-checked file.
- // Use the file copied after a successful package check as the output file for this
- // module so that any dependencies on this module will trigger the package check.
- outputFile = CheckJarPackages(ctx, outputFile, j.properties.Permitted_packages)
+ // Check packages and copy to package-checked file.
+ pkgckFile := android.PathForModuleOut(ctx, "package-check.stamp")
+ CheckJarPackages(ctx, pkgckFile, outputFile, j.properties.Permitted_packages)
+ j.additionalCheckedModules = append(j.additionalCheckedModules, pkgckFile)
if ctx.Failed() {
return
@@ -1736,7 +1744,7 @@ func (j *Module) ImplementationJars() android.Paths {
return android.Paths{j.implementationJarFile}
}
-func (j *Module) DexJar() android.Path {
+func (j *Module) DexJarBuildPath() android.Path {
return j.dexJarFile
}
@@ -2562,7 +2570,7 @@ func (j *Import) ImplementationAndResourcesJars() android.Paths {
return android.Paths{j.combinedClasspathFile}
}
-func (j *Import) DexJar() android.Path {
+func (j *Import) DexJarBuildPath() android.Path {
return nil
}
@@ -2688,6 +2696,10 @@ func (j *DexImport) Stem() string {
return proptools.StringDefault(j.properties.Stem, j.ModuleBase.Name())
}
+func (a *DexImport) JacocoReportClassesFile() android.Path {
+ return nil
+}
+
func (j *DexImport) IsInstallable() bool {
return true
}
@@ -2745,7 +2757,7 @@ func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.Stem()+".jar", dexOutputFile)
}
-func (j *DexImport) DexJar() android.Path {
+func (j *DexImport) DexJarBuildPath() android.Path {
return j.dexJarFile
}