Skip to content

Commit

Permalink
Separate Junit APT from runtime.
Browse files Browse the repository at this point in the history
This allows us to avoid including APT with kotlin_jvm_library targets and avoid extra trigger of the APT.

PiperOrigin-RevId: 565250656
  • Loading branch information
gkdn authored and copybara-github committed Sep 14, 2023
1 parent 1691ba8 commit 1fbb241
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
9 changes: 8 additions & 1 deletion build_defs/internal_do_not_use/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,17 @@ alias(
# ***************************************************

j2cl_library(
name = "internal_junit_runtime",
name = "internal_junit_annotations",
testonly = 1,
exports = [
"//junit/generator/java/com/google/j2cl/junit/apt:internal_junit_annotations",
],
)

j2cl_library(
name = "internal_junit_runtime",
testonly = 1,
exports = [
"//junit/generator/java/com/google/j2cl/junit/runtime:testcase_violator-j2cl",
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jsunit_test(
"""

load(":j2cl_library.bzl", "j2cl_library")
load(":generate_test_input.bzl", "generate_test_input")
load(":j2cl_library.bzl", "j2cl_library")

# buildifier: disable=function-docstring-args
def j2cl_generate_jsunit_suite(name, test_class, deps, tags = []):
Expand Down Expand Up @@ -54,6 +54,7 @@ def j2cl_generate_jsunit_suite(name, test_class, deps, tags = []):
srcs = [test_input],
deps = deps + [
Label("//:jsinterop-annotations-j2cl"),
Label("//build_defs/internal_do_not_use:internal_junit_annotations"),
Label("//build_defs/internal_do_not_use:internal_junit_runtime"),
Label("//build_defs/internal_do_not_use:closure_testcase"),
],
Expand Down
10 changes: 5 additions & 5 deletions build_defs/internal_do_not_use/j2kt_generate_unit_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ j2kt_jvm_generate_unit_test(
"""

load(":j2kt_library.bzl", "j2kt_jvm_library", "j2kt_native_library")
load(":generate_test_input.bzl", "generate_test_input")
load("@bazel_tools//tools/build_defs/kotlin/native:rules.bzl", "kt_apple_test_library")
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("@bazel_tools//tools/build_defs/kotlin/native:rules.bzl", "kt_apple_test_library")
load(":generate_test_input.bzl", "generate_test_input")
load(":j2kt_library.bzl", "j2kt_jvm_library", "j2kt_native_library")

# buildifier: disable=function-docstring-args
def j2kt_generate_unit_test(name, test_class, deps, platform = "J2KT-JVM", tags = []):
Expand All @@ -35,7 +35,7 @@ def j2kt_generate_unit_test(name, test_class, deps, platform = "J2KT-JVM", tags
name = name + "_lib",
srcs = [test_input],
deps = deps + [
"//build_defs/internal_do_not_use:internal_junit_runtime-j2kt-jvm",
"//build_defs/internal_do_not_use:internal_junit_annotations-j2kt-jvm",
],
exports = deps,
javacopts = ["-AtestPlatform=J2KT-JVM"],
Expand All @@ -48,7 +48,7 @@ def j2kt_generate_unit_test(name, test_class, deps, platform = "J2KT-JVM", tags
name = name + "_lib",
srcs = [test_input],
deps = deps + [
"//build_defs/internal_do_not_use:internal_junit_runtime-j2kt-native",
"//build_defs/internal_do_not_use:internal_junit_annotations-j2kt-native",
],
exports = deps,
javacopts = ["-AtestPlatform=J2KT-NATIVE"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jsunit_test(
"""

load(":j2wasm_library.bzl", "j2wasm_library")
load(":j2wasm_application.bzl", "j2wasm_application")
load(":generate_test_input.bzl", "generate_test_input")
load(":j2wasm_application.bzl", "j2wasm_application")
load(":j2wasm_library.bzl", "j2wasm_library")

# buildifier: disable=function-docstring-args
def j2wasm_generate_jsunit_suite(
Expand Down Expand Up @@ -65,6 +65,7 @@ def j2wasm_generate_jsunit_suite(
name = name + "_lib",
srcs = [test_input],
deps = deps + [
"//build_defs/internal_do_not_use:internal_junit_annotations-j2wasm",
"//build_defs/internal_do_not_use:internal_junit_runtime-j2wasm",
],
javacopts = ["-AtestPlatform=WASM"],
Expand Down

0 comments on commit 1fbb241

Please sign in to comment.