summaryrefslogtreecommitdiff
path: root/java/device_host_converter.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2019-04-23 22:04:46 -0700
committer Colin Cross <ccross@android.com> 2019-04-24 05:17:22 +0000
commit28c3eb6829f6516ff3bb94d8c59ecd0b8ff16f17 (patch)
tree629c4d632b060590803cd0d1014e3f7be7a4d1a2 /java/device_host_converter.go
parent159a5852513040c3e23503214ca931a1d5643199 (diff)
Export java_host_for_device and java_device_for_host modules to Make
Robolectric needs to reference some modules declared with java_host_for_device and java_device_for_host from Make for now. Bug: 122331577 Test: m checkbuild Change-Id: I09b3848edb120f2c3ee16b449b937b650f59811b
Diffstat (limited to 'java/device_host_converter.go')
-rw-r--r--java/device_host_converter.go44
1 files changed, 43 insertions, 1 deletions
diff --git a/java/device_host_converter.go b/java/device_host_converter.go
index 9f40a6c0d..9c883e50a 100644
--- a/java/device_host_converter.go
+++ b/java/device_host_converter.go
@@ -15,9 +15,12 @@
package java
import (
- "android/soong/android"
+ "fmt"
+ "io"
"github.com/google/blueprint"
+
+ "android/soong/android"
)
type DeviceHostConverter struct {
@@ -30,6 +33,9 @@ type DeviceHostConverter struct {
implementationJars android.Paths
implementationAndResourceJars android.Paths
resourceJars android.Paths
+
+ combinedHeaderJar android.Path
+ combinedImplementationJar android.Path
}
type DeviceHostConverterProperties struct {
@@ -98,6 +104,27 @@ func (d *DeviceHostConverter) GenerateAndroidBuildActions(ctx android.ModuleCont
ctx.PropertyErrorf("libs", "module %q cannot be used as a dependency", ctx.OtherModuleName(m))
}
})
+
+ jarName := ctx.ModuleName() + ".jar"
+
+ if len(d.implementationAndResourceJars) > 1 {
+ outputFile := android.PathForModuleOut(ctx, "combined", jarName)
+ TransformJarsToJar(ctx, outputFile, "combine", d.implementationAndResourceJars,
+ android.OptionalPath{}, false, nil, nil)
+ d.combinedImplementationJar = outputFile
+ } else {
+ d.combinedImplementationJar = d.implementationAndResourceJars[0]
+ }
+
+ if len(d.headerJars) > 1 {
+ outputFile := android.PathForModuleOut(ctx, "turbine-combined", jarName)
+ TransformJarsToJar(ctx, outputFile, "turbine combine", d.headerJars,
+ android.OptionalPath{}, false, nil, nil)
+ d.combinedHeaderJar = outputFile
+ } else {
+ d.combinedHeaderJar = d.headerJars[0]
+ }
+
}
var _ Dependency = (*DeviceHostConverter)(nil)
@@ -129,3 +156,18 @@ func (d *DeviceHostConverter) AidlIncludeDirs() android.Paths {
func (d *DeviceHostConverter) ExportedSdkLibs() []string {
return nil
}
+
+func (d *DeviceHostConverter) AndroidMk() android.AndroidMkData {
+ return android.AndroidMkData{
+ Class: "JAVA_LIBRARIES",
+ OutputFile: android.OptionalPathForPath(d.combinedImplementationJar),
+ Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
+ Extra: []android.AndroidMkExtraFunc{
+ func(w io.Writer, outputFile android.Path) {
+ fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
+ fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", d.combinedHeaderJar.String())
+ fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", d.combinedImplementationJar.String())
+ },
+ },
+ }
+}