Merge "Convert javacflags -> javacopts for java_binary_host" am: 88a1b9da85 am: a3b597cacb

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1940313

Change-Id: I22c6275a26226d9038c9f068167ea7f8b9a55518
This commit is contained in:
Sam Delmerico 2022-01-10 22:16:48 +00:00 committed by Automerger Merge Worker
commit e73c046d05
2 changed files with 9 additions and 1 deletions

View file

@ -41,7 +41,7 @@ var fs = map[string]string{
func TestJavaBinaryHost(t *testing.T) { func TestJavaBinaryHost(t *testing.T) {
runJavaBinaryHostTestCase(t, bp2buildTestCase{ runJavaBinaryHostTestCase(t, bp2buildTestCase{
description: "java_binary_host with srcs, exclude_srcs, jni_libs and manifest.", description: "java_binary_host with srcs, exclude_srcs, jni_libs, javacflags, and manifest.",
filesystem: fs, filesystem: fs,
blueprint: `java_binary_host { blueprint: `java_binary_host {
name: "java-binary-host-1", name: "java-binary-host-1",
@ -49,6 +49,7 @@ func TestJavaBinaryHost(t *testing.T) {
exclude_srcs: ["b.java"], exclude_srcs: ["b.java"],
manifest: "test.mf", manifest: "test.mf",
jni_libs: ["jni-lib-1"], jni_libs: ["jni-lib-1"],
javacflags: ["-Xdoclint:all/protected"],
bazel_module: { bp2build_available: true }, bazel_module: { bp2build_available: true },
}`, }`,
expectedBazelTargets: []string{ expectedBazelTargets: []string{
@ -57,6 +58,7 @@ func TestJavaBinaryHost(t *testing.T) {
"main_class": `"com.android.test.MainClass"`, "main_class": `"com.android.test.MainClass"`,
"deps": `["//other:jni-lib-1"]`, "deps": `["//other:jni-lib-1"]`,
"jvm_flags": `["-Djava.library.path=$${RUNPATH}other"]`, "jvm_flags": `["-Djava.library.path=$${RUNPATH}other"]`,
"javacopts": `["-Xdoclint:all/protected"]`,
}), }),
}, },
}) })

View file

@ -24,6 +24,7 @@ import (
"strings" "strings"
"android/soong/bazel" "android/soong/bazel"
"github.com/google/blueprint" "github.com/google/blueprint"
"github.com/google/blueprint/proptools" "github.com/google/blueprint/proptools"
@ -2000,6 +2001,7 @@ type javaBinaryHostAttributes struct {
Deps bazel.LabelListAttribute Deps bazel.LabelListAttribute
Main_class string Main_class string
Jvm_flags bazel.StringListAttribute Jvm_flags bazel.StringListAttribute
Javacopts bazel.StringListAttribute
} }
// JavaBinaryHostBp2Build is for java_binary_host bp2build. // JavaBinaryHostBp2Build is for java_binary_host bp2build.
@ -2021,6 +2023,10 @@ func javaBinaryHostBp2Build(ctx android.TopDownMutatorContext, m *Binary) {
Main_class: mainClass, Main_class: mainClass,
} }
if m.properties.Javacflags != nil {
attrs.Javacopts = bazel.MakeStringListAttribute(m.properties.Javacflags)
}
// Attribute deps // Attribute deps
deps := []string{} deps := []string{}
if m.properties.Static_libs != nil { if m.properties.Static_libs != nil {