Merge "java_test macro needs srcs and deps to create .jar for tradefed_test_suite" into main am: 8348ce92f5
am: 1c29688852
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2660942 Change-Id: I6dc51ffab3ef187cff433975096fa55088c273d8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1492,8 +1492,6 @@ var (
|
|||||||
"ICU4CTestRunner",
|
"ICU4CTestRunner",
|
||||||
"DeviceLongPollingStubTest",
|
"DeviceLongPollingStubTest",
|
||||||
|
|
||||||
"HelloWorldHostTest", // TODO(b/280452825): Convert HelloWorldHostTest to b test
|
|
||||||
|
|
||||||
"libprotobuf-full-test", // TODO(b/246997908): cannot convert proto_libraries which implicitly include other srcs in the same directory
|
"libprotobuf-full-test", // TODO(b/246997908): cannot convert proto_libraries which implicitly include other srcs in the same directory
|
||||||
"libprotobuf-lite-test", // TODO(b/246997908): cannot convert proto_libraries which implicitly include other srcs in the same directory
|
"libprotobuf-lite-test", // TODO(b/246997908): cannot convert proto_libraries which implicitly include other srcs in the same directory
|
||||||
|
|
||||||
|
@@ -71,6 +71,11 @@ java_library {
|
|||||||
}),
|
}),
|
||||||
MakeBazelTarget("java_test", "java_test_host-1", AttrNameToString{
|
MakeBazelTarget("java_test", "java_test_host-1", AttrNameToString{
|
||||||
"runtime_deps": `[":java_test_host-1_lib"]`,
|
"runtime_deps": `[":java_test_host-1_lib"]`,
|
||||||
|
"deps": `[
|
||||||
|
":lib_a-neverlink",
|
||||||
|
":static_libs_a",
|
||||||
|
]`,
|
||||||
|
"srcs": `["a.java"]`,
|
||||||
"target_compatible_with": `select({
|
"target_compatible_with": `select({
|
||||||
"//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
|
"//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
@@ -128,6 +133,10 @@ java_test_host {
|
|||||||
`,
|
`,
|
||||||
ExpectedBazelTargets: []string{
|
ExpectedBazelTargets: []string{
|
||||||
MakeBazelTarget("java_test", "java_test_host-1", AttrNameToString{
|
MakeBazelTarget("java_test", "java_test_host-1", AttrNameToString{
|
||||||
|
"srcs": `[
|
||||||
|
"a.java",
|
||||||
|
"b.kt",
|
||||||
|
]`,
|
||||||
"runtime_deps": `[":java_test_host-1_lib"]`,
|
"runtime_deps": `[":java_test_host-1_lib"]`,
|
||||||
"target_compatible_with": `select({
|
"target_compatible_with": `select({
|
||||||
"//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
|
"//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
|
||||||
|
@@ -3165,6 +3165,7 @@ func javaBinaryHostBp2Build(ctx android.TopDownMutatorContext, m *Binary) {
|
|||||||
|
|
||||||
type javaTestHostAttributes struct {
|
type javaTestHostAttributes struct {
|
||||||
*javaCommonAttributes
|
*javaCommonAttributes
|
||||||
|
Srcs bazel.LabelListAttribute
|
||||||
Deps bazel.LabelListAttribute
|
Deps bazel.LabelListAttribute
|
||||||
Runtime_deps bazel.LabelListAttribute
|
Runtime_deps bazel.LabelListAttribute
|
||||||
}
|
}
|
||||||
@@ -3201,8 +3202,10 @@ func javaTestHostBp2Build(ctx android.TopDownMutatorContext, m *TestHost) {
|
|||||||
hasKotlin: bp2BuildInfo.hasKotlin,
|
hasKotlin: bp2BuildInfo.hasKotlin,
|
||||||
}
|
}
|
||||||
libName := createLibraryTarget(ctx, libInfo)
|
libName := createLibraryTarget(ctx, libInfo)
|
||||||
attrs.Runtime_deps.Add(&bazel.LabelAttribute{Value: &bazel.Label{Label: ":" + libName}})
|
|
||||||
|
|
||||||
|
attrs.Srcs = commonAttrs.Srcs
|
||||||
|
attrs.Deps = deps
|
||||||
|
attrs.Runtime_deps.Add(&bazel.LabelAttribute{Value: &bazel.Label{Label: ":" + libName}})
|
||||||
// Create the BazelTargetModule.
|
// Create the BazelTargetModule.
|
||||||
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, attrs)
|
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, attrs)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user