aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornickreid <nickreid@google.com>2023-10-09 12:50:38 -0700
committerCopybara-Service <copybara-worker@google.com>2023-10-09 12:51:12 -0700
commit951beec79b6495d0dd5be55dfe3422b0ffb361ef (patch)
tree73c40a0720afd8276f4de042d85ba6c08a87011e
parent8d309c980737b6393f4b6431373c240088652f15 (diff)
downloadbazelbuild-kotlin-rules-951beec79b6495d0dd5be55dfe3422b0ffb361ef.tar.gz
Move tests/analysis/for_testing.bzl to kotlin/jvm/testing/for_analysis.bzl
PiperOrigin-RevId: 572015476 Change-Id: I7b216a18926b6b9bd203b0eb1825c89f9a784d23
-rw-r--r--kotlin/jvm/testing/BUILD37
-rw-r--r--kotlin/jvm/testing/for_analysis.bzl (renamed from tests/analysis/for_test.bzl)8
-rw-r--r--tests/analysis/jvm_library/data/BUILD4
-rw-r--r--tests/analysis/jvm_library/deps/BUILD8
-rw-r--r--tests/analysis/jvm_library/friends/BUILD14
-rw-r--r--tests/analysis/jvm_library/friends/sub/BUILD6
-rw-r--r--tests/analysis/jvm_library/friends/testing/BUILD10
-rw-r--r--tests/analysis/jvm_library/no_java_srcs/BUILD4
-rw-r--r--tests/analysis/jvm_library/no_kt_srcs/BUILD4
-rw-r--r--tests/analysis/jvm_library/nodeps/BUILD4
-rw-r--r--tests/analysis/jvm_library/only_common_srcs/BUILD4
-rw-r--r--tests/analysis/jvm_library/runtime_deps/BUILD6
-rw-r--r--tests/analysis/jvm_library/treeartifacts_srcs/BUILD14
-rw-r--r--tests/jvm/java/neverlink/BUILD4
14 files changed, 83 insertions, 44 deletions
diff --git a/kotlin/jvm/testing/BUILD b/kotlin/jvm/testing/BUILD
new file mode 100644
index 0000000..61722ff
--- /dev/null
+++ b/kotlin/jvm/testing/BUILD
@@ -0,0 +1,37 @@
+# Copyright 2022 Google LLC. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the License);
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+
+package(
+ default_applicable_licenses = ["//:license"],
+ default_testonly = True,
+ default_visibility = ["//:internal"],
+)
+
+licenses(["notice"])
+
+bzl_library(
+ name = "testing_bzl",
+ srcs = glob(["*.bzl"]),
+ visibility = [
+ "//:internal",
+ ],
+ deps = [
+ "//:visibility_bzl",
+ "//kotlin:rules_bzl",
+ "//kotlin/common/testing:testing_bzl",
+ "@bazel_skylib//lib:unittest",
+ ],
+)
diff --git a/tests/analysis/for_test.bzl b/kotlin/jvm/testing/for_analysis.bzl
index 67c8c63..d79c73b 100644
--- a/tests/analysis/for_test.bzl
+++ b/kotlin/jvm/testing/for_analysis.bzl
@@ -12,13 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Rules for test."""
+"""kt_for_analysis"""
load("//:visibility.bzl", "RULES_KOTLIN")
load("//kotlin:jvm_library.bzl", "kt_jvm_library")
load("//kotlin/common/testing:testing_rules.bzl", "kt_testing_rules")
-rules_for_test = struct(
- kt_jvm_library = kt_testing_rules.wrap_for_analysis(kt_jvm_library),
+kt_for_analysis = struct(
+ # go/keep-sorted start
java_library = kt_testing_rules.wrap_for_analysis(native.java_library),
+ kt_jvm_library = kt_testing_rules.wrap_for_analysis(kt_jvm_library),
+ # go/keep-sorted end
)
diff --git a/tests/analysis/jvm_library/data/BUILD b/tests/analysis/jvm_library/data/BUILD
index e92a2e8..ecc2760 100644
--- a/tests/analysis/jvm_library/data/BUILD
+++ b/tests/analysis/jvm_library/data/BUILD
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
package(
@@ -28,7 +28,7 @@ jvm_library_test(
# libX.jar is always in data_runfiles as well - just append it.
"libdata.jar",
],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "data",
srcs = [
"Input.kt",
diff --git a/tests/analysis/jvm_library/deps/BUILD b/tests/analysis/jvm_library/deps/BUILD
index 6db53bd..d733b84 100644
--- a/tests/analysis/jvm_library/deps/BUILD
+++ b/tests/analysis/jvm_library/deps/BUILD
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
package(
@@ -21,14 +21,14 @@ package(
licenses(["notice"])
-rules_for_test.kt_jvm_library(
+kt_for_analysis.kt_jvm_library(
name = "deps_test_kt_dep",
srcs = [
"Input.kt",
],
)
-rules_for_test.java_library(
+kt_for_analysis.java_library(
name = "deps_test_java_dep",
srcs = [
"Input.java",
@@ -37,7 +37,7 @@ rules_for_test.java_library(
jvm_library_test(
name = "deps_test",
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "deps",
srcs = [
"Foo.java",
diff --git a/tests/analysis/jvm_library/friends/BUILD b/tests/analysis/jvm_library/friends/BUILD
index 538bdce..aac0ad5 100644
--- a/tests/analysis/jvm_library/friends/BUILD
+++ b/tests/analysis/jvm_library/friends/BUILD
@@ -13,7 +13,7 @@
# limitations under the License.
load("//kotlin:rules.bzl", "kt_jvm_library")
-load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
load("//tests/analysis:util.bzl", "ONLY_FOR_ANALYSIS_TEST_TAGS")
@@ -27,7 +27,7 @@ licenses(["notice"])
jvm_library_test(
name = "no_kt_exported_friend_cross_package_test",
expected_friend_jar_names = [],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "no_kt_exported_friend_cross_package",
srcs = ["Input.kt"],
deps = [
@@ -43,7 +43,7 @@ jvm_library_test(
"libjava_exports_friend-hjar.jar",
"libfriend-compile.jar",
],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "has_java_exported_friend_in_package",
srcs = ["Input.kt"],
deps = [":java_exports_friend"],
@@ -56,7 +56,7 @@ jvm_library_test(
"libkt_exports_friend-compile.jar",
"libfriend-compile.jar",
],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "has_kt_exported_friend_in_package",
srcs = ["Input.kt"],
deps = [":kt_exports_friend"],
@@ -66,7 +66,7 @@ jvm_library_test(
jvm_library_test(
name = "no_direct_friend_testing_package_test",
expected_friend_jar_names = [],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "no_direct_friend_testing_package",
srcs = ["Input.kt"],
deps = ["//tests/analysis/jvm_library/friends/testing:testingfriend"],
@@ -76,7 +76,7 @@ jvm_library_test(
jvm_library_test(
name = "no_direct_friend_subpackage_test",
expected_friend_jar_names = [],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "no_direct_friend_subpackage",
srcs = ["Input.kt"],
deps = ["//tests/analysis/jvm_library/friends/sub:subfriend"],
@@ -86,7 +86,7 @@ jvm_library_test(
jvm_library_test(
name = "has_direct_friend_in_package_test",
expected_friend_jar_names = ["libfriend-compile.jar"],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "has_direct_friend_in_package",
srcs = ["Input.kt"],
deps = [":friend"],
diff --git a/tests/analysis/jvm_library/friends/sub/BUILD b/tests/analysis/jvm_library/friends/sub/BUILD
index e7c619f..d009501 100644
--- a/tests/analysis/jvm_library/friends/sub/BUILD
+++ b/tests/analysis/jvm_library/friends/sub/BUILD
@@ -13,7 +13,7 @@
# limitations under the License.
load("//kotlin:rules.bzl", "kt_jvm_library")
-load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
load("//tests/analysis:util.bzl", "ONLY_FOR_ANALYSIS_TEST_TAGS")
@@ -30,7 +30,7 @@ jvm_library_test(
"libkt_exports_friend-compile.jar",
# Absent # "libfriend-compile.jar"
],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "no_kt_exported_friend_cross_package",
srcs = ["Input.kt"],
deps = [":kt_exports_friend"],
@@ -40,7 +40,7 @@ jvm_library_test(
jvm_library_test(
name = "no_direct_friend_cross_package_test",
expected_friend_jar_names = [],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "no_direct_friend_cross_package",
srcs = ["Input.kt"],
deps = ["//tests/analysis/jvm_library/friends:friend"],
diff --git a/tests/analysis/jvm_library/friends/testing/BUILD b/tests/analysis/jvm_library/friends/testing/BUILD
index 827aa30..71ce0bc 100644
--- a/tests/analysis/jvm_library/friends/testing/BUILD
+++ b/tests/analysis/jvm_library/friends/testing/BUILD
@@ -13,7 +13,7 @@
# limitations under the License.
load("//kotlin:rules.bzl", "kt_jvm_library")
-load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
load("//tests/analysis:util.bzl", "ONLY_FOR_ANALYSIS_TEST_TAGS")
@@ -30,7 +30,7 @@ jvm_library_test(
"libkt_exports_friend-compile.jar",
"libfriend-compile.jar",
],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "has_kt_exported_friend_impl_package",
srcs = ["Input.kt"],
deps = [":kt_exports_friend"],
@@ -42,7 +42,7 @@ jvm_library_test(
expected_friend_jar_names = [
"libfriend-compile.jar",
],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "has_direct_friend_impl_package",
srcs = ["Input.kt"],
deps = ["//tests/analysis/jvm_library/friends:friend"],
@@ -55,7 +55,7 @@ jvm_library_test(
"libkt_exports_subfriend-compile.jar",
# Absent # "subfriend-compile.jar"
],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "no_kt_exported_friend_sibling_package",
srcs = ["Input.kt"],
deps = [":kt_exports_subfriend"],
@@ -65,7 +65,7 @@ jvm_library_test(
jvm_library_test(
name = "no_direct_friend_sibling_package_test",
expected_friend_jar_names = [],
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "no_direct_friend_sibling_package",
srcs = ["Input.kt"],
deps = ["//tests/analysis/jvm_library/friends/sub:subfriend"],
diff --git a/tests/analysis/jvm_library/no_java_srcs/BUILD b/tests/analysis/jvm_library/no_java_srcs/BUILD
index f149c73..66f6fdc 100644
--- a/tests/analysis/jvm_library/no_java_srcs/BUILD
+++ b/tests/analysis/jvm_library/no_java_srcs/BUILD
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
package(
@@ -23,7 +23,7 @@ licenses(["notice"])
jvm_library_test(
name = "no_java_srcs_test",
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "no_java_srcs",
srcs = [
"Input.kt",
diff --git a/tests/analysis/jvm_library/no_kt_srcs/BUILD b/tests/analysis/jvm_library/no_kt_srcs/BUILD
index d5aafcd..201b669 100644
--- a/tests/analysis/jvm_library/no_kt_srcs/BUILD
+++ b/tests/analysis/jvm_library/no_kt_srcs/BUILD
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
package(
@@ -23,7 +23,7 @@ licenses(["notice"])
jvm_library_test(
name = "no_kt_srcs_test",
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "no_kt_srcs",
srcs = [
"Input.java",
diff --git a/tests/analysis/jvm_library/nodeps/BUILD b/tests/analysis/jvm_library/nodeps/BUILD
index f2ae73b..90c88a5 100644
--- a/tests/analysis/jvm_library/nodeps/BUILD
+++ b/tests/analysis/jvm_library/nodeps/BUILD
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
package(
@@ -23,7 +23,7 @@ licenses(["notice"])
jvm_library_test(
name = "nodeps_test",
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "nodeps",
srcs = [
"Input.java",
diff --git a/tests/analysis/jvm_library/only_common_srcs/BUILD b/tests/analysis/jvm_library/only_common_srcs/BUILD
index aae3068..c26bcee 100644
--- a/tests/analysis/jvm_library/only_common_srcs/BUILD
+++ b/tests/analysis/jvm_library/only_common_srcs/BUILD
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
package(
@@ -23,7 +23,7 @@ licenses(["notice"])
jvm_library_test(
name = "only_common_srcs_test",
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "only_common_srcs",
common_srcs = [
"Input.kt",
diff --git a/tests/analysis/jvm_library/runtime_deps/BUILD b/tests/analysis/jvm_library/runtime_deps/BUILD
index 85f8b55..5e17e71 100644
--- a/tests/analysis/jvm_library/runtime_deps/BUILD
+++ b/tests/analysis/jvm_library/runtime_deps/BUILD
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
package(
@@ -21,14 +21,14 @@ package(
licenses(["notice"])
-rules_for_test.java_library(
+kt_for_analysis.java_library(
name = "runtime_deps_test_dep",
srcs = [],
)
jvm_library_test(
name = "runtime_deps_test",
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "runtime_deps",
srcs = [
"Input.kt",
diff --git a/tests/analysis/jvm_library/treeartifacts_srcs/BUILD b/tests/analysis/jvm_library/treeartifacts_srcs/BUILD
index 2ba8ecf..472fda2 100644
--- a/tests/analysis/jvm_library/treeartifacts_srcs/BUILD
+++ b/tests/analysis/jvm_library/treeartifacts_srcs/BUILD
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
load("//tests/analysis:assert_failure_test.bzl", "assert_failure_test")
load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
load("//tests/analysis:util.bzl", "create_dir")
@@ -25,7 +25,7 @@ licenses(["notice"])
jvm_library_test(
name = "treeartifact_basename_kotlin_test",
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "treeartifact_basename_kotlin",
srcs = [
create_dir(
@@ -40,7 +40,7 @@ jvm_library_test(
jvm_library_test(
name = "treeartifact_basename_java_test",
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "treeartifact_basename_java",
srcs = [
create_dir(
@@ -56,7 +56,7 @@ jvm_library_test(
assert_failure_test(
name = "treeartifact_extension_kt_test",
msg_contains = "/treeartifact_extension.kt",
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "treeartifact_extension_kt",
srcs = [
create_dir(
@@ -69,7 +69,7 @@ assert_failure_test(
assert_failure_test(
name = "treeartifact_extension_java_test",
msg_contains = "/treeartifact_extension.java",
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "treeartifact_extension_java",
srcs = [
create_dir(
@@ -82,7 +82,7 @@ assert_failure_test(
assert_failure_test(
name = "treeartifact_extension_srcjar_test",
msg_contains = "/treeartifact_extension.srcjar",
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "treeartifact_extension_srcjar",
srcs = [
create_dir(
@@ -95,7 +95,7 @@ assert_failure_test(
assert_failure_test(
name = "treeartifact_no_extension_test",
msg_contains = "/treeartifact_no_extension",
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "treeartifact_no_extension",
srcs = [
create_dir(
diff --git a/tests/jvm/java/neverlink/BUILD b/tests/jvm/java/neverlink/BUILD
index c6daa08..9053ec8 100644
--- a/tests/jvm/java/neverlink/BUILD
+++ b/tests/jvm/java/neverlink/BUILD
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
licenses(["notice"])
@@ -20,7 +20,7 @@ licenses(["notice"])
jvm_library_test(
name = "neverlinked_input_library_test",
expect_neverlink = True,
- target_under_test = rules_for_test.kt_jvm_library(
+ target_under_test = kt_for_analysis.kt_jvm_library(
name = "neverlinked_input_library",
srcs = ["Input.kt"],
neverlink = True,