summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
author Dan Willemsen <dwillemsen@google.com> 2021-09-22 20:13:33 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2021-09-22 20:13:33 +0000
commitb13daf2ba7135f25f81fb3b51b147c63ccda143d (patch)
treed5b4e6a57bae84b35e7b107fa2d010339c8dfe37 /java
parentfac6fd09273fa92310a9350c9237de0b473311c1 (diff)
parent8e6b37119a7861ee034bff8336b12a1df00e047b (diff)
Merge "Add java_binary_host support for Windows"
Diffstat (limited to 'java')
-rw-r--r--java/java.go27
1 files changed, 24 insertions, 3 deletions
diff --git a/java/java.go b/java/java.go
index 2ca4ac8f0..4a4486658 100644
--- a/java/java.go
+++ b/java/java.go
@@ -533,6 +533,10 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.installFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
j.Stem()+".jar", j.outputFile, extraInstallDeps...)
}
+
+ if ctx.Windows() {
+ j.HideFromMake()
+ }
}
func (j *Library) DepsMutator(ctx android.BottomUpMutatorContext) {
@@ -1030,14 +1034,14 @@ func InitTestHost(th *TestHost, installable *bool, testSuites []string, autoGenC
type binaryProperties struct {
// installable script to execute the resulting jar
- Wrapper *string `android:"path"`
+ Wrapper *string `android:"path,arch_variant"`
// Name of the class containing main to be inserted into the manifest as Main-Class.
Main_class *string
// Names of modules containing JNI libraries that should be installed alongside the host
// variant of the binary.
- Jni_libs []string
+ Jni_libs []string `android:"arch_variant"`
}
type Binary struct {
@@ -1075,14 +1079,27 @@ func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if j.binaryProperties.Wrapper != nil {
j.wrapperFile = android.PathForModuleSrc(ctx, *j.binaryProperties.Wrapper)
} else {
+ if ctx.Windows() {
+ ctx.PropertyErrorf("wrapper", "wrapper is required for Windows")
+ }
+
j.wrapperFile = android.PathForSource(ctx, "build/soong/scripts/jar-wrapper.sh")
}
+ ext := ""
+ if ctx.Windows() {
+ ext = ".bat"
+ }
+
// The host installation rules make the installed wrapper depend on all the dependencies
// of the wrapper variant, which will include the common variant's jar file and any JNI
// libraries. This is verified by TestBinary.
j.binaryFile = ctx.InstallExecutable(android.PathForModuleInstall(ctx, "bin"),
- ctx.ModuleName(), j.wrapperFile)
+ ctx.ModuleName()+ext, j.wrapperFile)
+ }
+
+ if ctx.Windows() {
+ j.HideFromMake()
}
}
@@ -1283,6 +1300,10 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.hideApexVariantFromMake = true
}
+ if ctx.Windows() {
+ j.HideFromMake()
+ }
+
jars := android.PathsForModuleSrc(ctx, j.properties.Jars)
jarName := j.Stem() + ".jar"