aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKotlin Google Eng <kotlin-google-eng@google.com>2022-12-09 15:55:39 -0800
committerCopybara-Service <copybara-worker@google.com>2022-12-09 15:56:11 -0800
commit0904db290987a7e48a708369e5093b6d033769e7 (patch)
treea8131c27e740b90f358d43e03da5b39fc1cbc9fd
parent621808203f0b57d82efdda691265940e5b546e97 (diff)
downloadbazelbuild-kotlin-rules-0904db290987a7e48a708369e5093b6d033769e7.tar.gz
Move the kt_jvm_library data, deps, runtime_deps analysis tests into separate files.
Also moved and renamed targets for test. PiperOrigin-RevId: 494283522
-rw-r--r--tests/analysis/BUILD1
-rw-r--r--tests/analysis/for_test.bzl39
-rw-r--r--tests/analysis/jvm_library/data/BUILD40
-rw-r--r--tests/analysis/jvm_library/data/Input.kt16
-rw-r--r--tests/analysis/jvm_library/data/data.txt13
-rw-r--r--tests/analysis/jvm_library/deps/BUILD48
-rw-r--r--tests/analysis/jvm_library/deps/Foo.java16
-rw-r--r--tests/analysis/jvm_library/deps/Input.java16
-rw-r--r--tests/analysis/jvm_library/deps/Input.kt16
-rw-r--r--tests/analysis/jvm_library/friends/BUILD15
-rw-r--r--tests/analysis/jvm_library/friends/sub/BUILD7
-rw-r--r--tests/analysis/jvm_library/friends/testing/BUILD11
-rw-r--r--tests/analysis/jvm_library/no_java_srcs/BUILD5
-rw-r--r--tests/analysis/jvm_library/no_kt_srcs/BUILD5
-rw-r--r--tests/analysis/jvm_library/nodeps/BUILD5
-rw-r--r--tests/analysis/jvm_library/only_common_srcs/BUILD5
-rw-r--r--tests/analysis/jvm_library/runtime_deps/BUILD38
-rw-r--r--tests/analysis/jvm_library/runtime_deps/Input.java16
-rw-r--r--tests/analysis/jvm_library/runtime_deps/Input.kt16
-rw-r--r--tests/analysis/jvm_library_test.bzl124
-rw-r--r--tests/jvm/java/neverlink/BUILD5
21 files changed, 308 insertions, 149 deletions
diff --git a/tests/analysis/BUILD b/tests/analysis/BUILD
index b927805..0533e13 100644
--- a/tests/analysis/BUILD
+++ b/tests/analysis/BUILD
@@ -17,6 +17,7 @@
load("//tests/analysis:jvm_compile_test.bzl", jvm_compile_test_suite = "test_suite")
load("//tests/analysis:jvm_import_test.bzl", jvm_import_test_suite = "test_suite")
load("//tests/analysis:jvm_library_test.bzl", jvm_library_test_suite = "test_suite")
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
licenses(["notice"])
diff --git a/tests/analysis/for_test.bzl b/tests/analysis/for_test.bzl
new file mode 100644
index 0000000..434c1a4
--- /dev/null
+++ b/tests/analysis/for_test.bzl
@@ -0,0 +1,39 @@
+# 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.
+
+"""Rules for test."""
+
+load("//kotlin:jvm_library.bzl", "kt_jvm_library")
+load("//tests/analysis:util.bzl", "ONLY_FOR_ANALYSIS_TEST_TAGS")
+
+def _kt_jvm_library_for_test(name, **kwargs):
+ kt_jvm_library(
+ name = name,
+ tags = ONLY_FOR_ANALYSIS_TEST_TAGS,
+ **kwargs
+ )
+ return name
+
+def _java_library_for_test(name, **kwargs):
+ native.java_library(
+ name = name,
+ tags = ONLY_FOR_ANALYSIS_TEST_TAGS,
+ **kwargs
+ )
+ return name
+
+rules_for_test = struct(
+ kt_jvm_library = _kt_jvm_library_for_test,
+ java_library = _java_library_for_test,
+)
diff --git a/tests/analysis/jvm_library/data/BUILD b/tests/analysis/jvm_library/data/BUILD
new file mode 100644
index 0000000..1809aa1
--- /dev/null
+++ b/tests/analysis/jvm_library/data/BUILD
@@ -0,0 +1,40 @@
+# 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("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
+
+package(default_testonly = True)
+
+licenses(["notice"])
+
+jvm_library_test(
+ name = "data_test",
+ expected = dict(
+ data = [
+ "data.txt",
+ # libX.jar is always in data_runfiles as well - just append it.
+ "libdata.jar",
+ ],
+ ),
+ target_under_test = rules_for_test.kt_jvm_library(
+ name = "data",
+ srcs = [
+ "Input.kt",
+ ],
+ data = [
+ "data.txt",
+ ],
+ ),
+)
diff --git a/tests/analysis/jvm_library/data/Input.kt b/tests/analysis/jvm_library/data/Input.kt
new file mode 100644
index 0000000..e675bc1
--- /dev/null
+++ b/tests/analysis/jvm_library/data/Input.kt
@@ -0,0 +1,16 @@
+/*
+ * * 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.
+ */
+
diff --git a/tests/analysis/jvm_library/data/data.txt b/tests/analysis/jvm_library/data/data.txt
new file mode 100644
index 0000000..e3ba5e8
--- /dev/null
+++ b/tests/analysis/jvm_library/data/data.txt
@@ -0,0 +1,13 @@
+# 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. \ No newline at end of file
diff --git a/tests/analysis/jvm_library/deps/BUILD b/tests/analysis/jvm_library/deps/BUILD
new file mode 100644
index 0000000..ccb03a0
--- /dev/null
+++ b/tests/analysis/jvm_library/deps/BUILD
@@ -0,0 +1,48 @@
+# 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("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
+
+package(default_testonly = True)
+
+licenses(["notice"])
+
+rules_for_test.kt_jvm_library(
+ name = "deps_test_kt_dep",
+ srcs = [
+ "Input.kt",
+ ],
+)
+
+rules_for_test.java_library(
+ name = "deps_test_java_dep",
+ srcs = [
+ "Input.java",
+ ],
+)
+
+jvm_library_test(
+ name = "deps_test",
+ target_under_test = rules_for_test.kt_jvm_library(
+ name = "deps",
+ srcs = [
+ "Foo.java",
+ ],
+ deps = [
+ ":deps_test_java_dep",
+ ":deps_test_kt_dep",
+ ],
+ ),
+)
diff --git a/tests/analysis/jvm_library/deps/Foo.java b/tests/analysis/jvm_library/deps/Foo.java
new file mode 100644
index 0000000..e675bc1
--- /dev/null
+++ b/tests/analysis/jvm_library/deps/Foo.java
@@ -0,0 +1,16 @@
+/*
+ * * 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.
+ */
+
diff --git a/tests/analysis/jvm_library/deps/Input.java b/tests/analysis/jvm_library/deps/Input.java
new file mode 100644
index 0000000..e675bc1
--- /dev/null
+++ b/tests/analysis/jvm_library/deps/Input.java
@@ -0,0 +1,16 @@
+/*
+ * * 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.
+ */
+
diff --git a/tests/analysis/jvm_library/deps/Input.kt b/tests/analysis/jvm_library/deps/Input.kt
new file mode 100644
index 0000000..e675bc1
--- /dev/null
+++ b/tests/analysis/jvm_library/deps/Input.kt
@@ -0,0 +1,16 @@
+/*
+ * * 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.
+ */
+
diff --git a/tests/analysis/jvm_library/friends/BUILD b/tests/analysis/jvm_library/friends/BUILD
index 707b589..538bdce 100644
--- a/tests/analysis/jvm_library/friends/BUILD
+++ b/tests/analysis/jvm_library/friends/BUILD
@@ -13,7 +13,8 @@
# limitations under the License.
load("//kotlin:rules.bzl", "kt_jvm_library")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test", "kt_jvm_library_under_test")
+load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
load("//tests/analysis:util.bzl", "ONLY_FOR_ANALYSIS_TEST_TAGS")
package(
@@ -26,7 +27,7 @@ licenses(["notice"])
jvm_library_test(
name = "no_kt_exported_friend_cross_package_test",
expected_friend_jar_names = [],
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.kt_jvm_library(
name = "no_kt_exported_friend_cross_package",
srcs = ["Input.kt"],
deps = [
@@ -42,7 +43,7 @@ jvm_library_test(
"libjava_exports_friend-hjar.jar",
"libfriend-compile.jar",
],
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.kt_jvm_library(
name = "has_java_exported_friend_in_package",
srcs = ["Input.kt"],
deps = [":java_exports_friend"],
@@ -55,7 +56,7 @@ jvm_library_test(
"libkt_exports_friend-compile.jar",
"libfriend-compile.jar",
],
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.kt_jvm_library(
name = "has_kt_exported_friend_in_package",
srcs = ["Input.kt"],
deps = [":kt_exports_friend"],
@@ -65,7 +66,7 @@ jvm_library_test(
jvm_library_test(
name = "no_direct_friend_testing_package_test",
expected_friend_jar_names = [],
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.kt_jvm_library(
name = "no_direct_friend_testing_package",
srcs = ["Input.kt"],
deps = ["//tests/analysis/jvm_library/friends/testing:testingfriend"],
@@ -75,7 +76,7 @@ jvm_library_test(
jvm_library_test(
name = "no_direct_friend_subpackage_test",
expected_friend_jar_names = [],
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.kt_jvm_library(
name = "no_direct_friend_subpackage",
srcs = ["Input.kt"],
deps = ["//tests/analysis/jvm_library/friends/sub:subfriend"],
@@ -85,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 = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.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 3a77ed3..e7c619f 100644
--- a/tests/analysis/jvm_library/friends/sub/BUILD
+++ b/tests/analysis/jvm_library/friends/sub/BUILD
@@ -13,7 +13,8 @@
# limitations under the License.
load("//kotlin:rules.bzl", "kt_jvm_library")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test", "kt_jvm_library_under_test")
+load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
load("//tests/analysis:util.bzl", "ONLY_FOR_ANALYSIS_TEST_TAGS")
package(
@@ -29,7 +30,7 @@ jvm_library_test(
"libkt_exports_friend-compile.jar",
# Absent # "libfriend-compile.jar"
],
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.kt_jvm_library(
name = "no_kt_exported_friend_cross_package",
srcs = ["Input.kt"],
deps = [":kt_exports_friend"],
@@ -39,7 +40,7 @@ jvm_library_test(
jvm_library_test(
name = "no_direct_friend_cross_package_test",
expected_friend_jar_names = [],
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.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 8f08a3d..827aa30 100644
--- a/tests/analysis/jvm_library/friends/testing/BUILD
+++ b/tests/analysis/jvm_library/friends/testing/BUILD
@@ -13,7 +13,8 @@
# limitations under the License.
load("//kotlin:rules.bzl", "kt_jvm_library")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test", "kt_jvm_library_under_test")
+load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
load("//tests/analysis:util.bzl", "ONLY_FOR_ANALYSIS_TEST_TAGS")
package(
@@ -29,7 +30,7 @@ jvm_library_test(
"libkt_exports_friend-compile.jar",
"libfriend-compile.jar",
],
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.kt_jvm_library(
name = "has_kt_exported_friend_impl_package",
srcs = ["Input.kt"],
deps = [":kt_exports_friend"],
@@ -41,7 +42,7 @@ jvm_library_test(
expected_friend_jar_names = [
"libfriend-compile.jar",
],
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.kt_jvm_library(
name = "has_direct_friend_impl_package",
srcs = ["Input.kt"],
deps = ["//tests/analysis/jvm_library/friends:friend"],
@@ -54,7 +55,7 @@ jvm_library_test(
"libkt_exports_subfriend-compile.jar",
# Absent # "subfriend-compile.jar"
],
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.kt_jvm_library(
name = "no_kt_exported_friend_sibling_package",
srcs = ["Input.kt"],
deps = [":kt_exports_subfriend"],
@@ -64,7 +65,7 @@ jvm_library_test(
jvm_library_test(
name = "no_direct_friend_sibling_package_test",
expected_friend_jar_names = [],
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.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 c7a1144..116dcfd 100644
--- a/tests/analysis/jvm_library/no_java_srcs/BUILD
+++ b/tests/analysis/jvm_library/no_java_srcs/BUILD
@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test", "kt_jvm_library_under_test")
+load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
package(default_testonly = True)
@@ -20,7 +21,7 @@ licenses(["notice"])
jvm_library_test(
name = "no_java_srcs_test",
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.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 a61492c..a6e4f18 100644
--- a/tests/analysis/jvm_library/no_kt_srcs/BUILD
+++ b/tests/analysis/jvm_library/no_kt_srcs/BUILD
@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test", "kt_jvm_library_under_test")
+load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
package(default_testonly = True)
@@ -20,7 +21,7 @@ licenses(["notice"])
jvm_library_test(
name = "no_kt_srcs_test",
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.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 b8e96d7..fc3e673 100644
--- a/tests/analysis/jvm_library/nodeps/BUILD
+++ b/tests/analysis/jvm_library/nodeps/BUILD
@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test", "kt_jvm_library_under_test")
+load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
package(default_testonly = True)
@@ -20,7 +21,7 @@ licenses(["notice"])
jvm_library_test(
name = "nodeps_test",
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.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 a893003..49930f2 100644
--- a/tests/analysis/jvm_library/only_common_srcs/BUILD
+++ b/tests/analysis/jvm_library/only_common_srcs/BUILD
@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test", "kt_jvm_library_under_test")
+load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
package(default_testonly = True)
@@ -20,7 +21,7 @@ licenses(["notice"])
jvm_library_test(
name = "only_common_srcs_test",
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.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
new file mode 100644
index 0000000..17457ba
--- /dev/null
+++ b/tests/analysis/jvm_library/runtime_deps/BUILD
@@ -0,0 +1,38 @@
+# 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("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
+
+package(default_testonly = True)
+
+licenses(["notice"])
+
+rules_for_test.java_library(
+ name = "runtime_deps_test_dep",
+ srcs = [],
+)
+
+jvm_library_test(
+ name = "runtime_deps_test",
+ target_under_test = rules_for_test.kt_jvm_library(
+ name = "runtime_deps",
+ srcs = [
+ "Input.kt",
+ ],
+ runtime_deps = [
+ ":runtime_deps_test_dep",
+ ],
+ ),
+)
diff --git a/tests/analysis/jvm_library/runtime_deps/Input.java b/tests/analysis/jvm_library/runtime_deps/Input.java
new file mode 100644
index 0000000..e675bc1
--- /dev/null
+++ b/tests/analysis/jvm_library/runtime_deps/Input.java
@@ -0,0 +1,16 @@
+/*
+ * * 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.
+ */
+
diff --git a/tests/analysis/jvm_library/runtime_deps/Input.kt b/tests/analysis/jvm_library/runtime_deps/Input.kt
new file mode 100644
index 0000000..e675bc1
--- /dev/null
+++ b/tests/analysis/jvm_library/runtime_deps/Input.kt
@@ -0,0 +1,16 @@
+/*
+ * * 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.
+ */
+
diff --git a/tests/analysis/jvm_library_test.bzl b/tests/analysis/jvm_library_test.bzl
index 9e169ea..6435cc5 100644
--- a/tests/analysis/jvm_library_test.bzl
+++ b/tests/analysis/jvm_library_test.bzl
@@ -120,14 +120,6 @@ _test = analysistest.make(
jvm_library_test = _test
-def kt_jvm_library_under_test(name, **kwargs):
- kt_jvm_library(
- name = name,
- tags = ONLY_FOR_ANALYSIS_TEST_TAGS,
- **kwargs
- )
- return name
-
def _coverage_test_impl(ctx):
env = analysistest.begin(ctx)
target_under_test = analysistest.target_under_test(env)
@@ -155,77 +147,6 @@ _coverage_test = analysistest.make(
def _extract_data_runfiles(target):
return [f.basename for f in target[DefaultInfo].data_runfiles.files.to_list()]
-def _test_kt_jvm_library_with_deps():
- test_name = "kt_jvm_library_with_deps_test"
-
- kt_jvm_library(
- name = test_name + "_kt_dep",
- srcs = [create_file(
- name = test_name + "/Hello.kt",
- content = """
-package test
-
-fun hello(): String = "Hello!"
-""",
- )],
- )
- native.java_library(
- name = test_name + "_java_dep",
- srcs = ["testinputs/Foo.java"],
- )
- kt_jvm_library(
- name = test_name + "_tut",
- srcs = [
- create_file(
- name = test_name + "/Hi.kt",
- content = """
-package test
-
-fun hi(): String = "Hi!"
-""",
- ),
- "testinputs/Bar.java",
- ],
- deps = [
- test_name + "_kt_dep",
- test_name + "_java_dep",
- ],
- )
- _test(
- name = test_name,
- target_under_test = test_name + "_tut",
- )
- return test_name
-
-def _test_kt_jvm_library_with_runtime_deps():
- test_name = "kt_jvm_library_with_runtime_deps_test"
- create_file(
- name = test_name + "/Salutations.kt",
- content = """
-package test
-
-fun greeting(): String = "Hello World!"
-""",
- )
- native.java_library(
- name = test_name + "_dep",
- srcs = [],
- )
- kt_jvm_library(
- name = test_name + "_tut",
- srcs = [
- test_name + "/Salutations.kt",
- ],
- runtime_deps = [
- test_name + "_dep",
- ],
- )
- _test(
- name = test_name,
- target_under_test = test_name + "_tut",
- )
- return test_name
-
def _test_kt_jvm_library_with_proguard_specs():
test_name = "kt_jvm_library_with_proguard_specs_test"
create_file(
@@ -291,48 +212,6 @@ Hi!
)
return test_name
-def _test_kt_jvm_library_with_data():
- test_name = "kt_jvm_library_with_data_test"
- kt_jvm_lib_name = test_name + "_tut"
-
- data_txt = create_file(
- name = test_name + "data.txt",
- content = """
-Hello World!
-""",
- )
-
- # Kotlin file
- muchdata_kt = create_file(
- name = test_name + "/MuchData.kt",
- content = """
-package test
-
-import java.io.File
-
-fun greeting(): String = File("data.txt").readText()
-""",
- )
-
- kt_jvm_library(
- name = kt_jvm_lib_name,
- srcs = [muchdata_kt],
- data = [data_txt],
- )
-
- _test(
- name = test_name,
- target_under_test = kt_jvm_lib_name,
- expected = dict(
- data = [
- data_txt,
- # libX.jar is always in data_runfiles as well - just append it.
- "lib%s.jar" % kt_jvm_lib_name,
- ],
- ),
- )
- return test_name
-
def _test_kt_jvm_library_with_plugin():
test_name = "kt_jvm_library_with_plugin_test"
create_file(
@@ -752,8 +631,6 @@ def test_suite(name):
_test_kt_jvm_library_dep_on_exported_plugin(),
_test_kt_jvm_library_java_dep_on_exported_plugin(),
_test_kt_jvm_library_no_kt_srcs_with_plugin(),
- _test_kt_jvm_library_with_data(),
- _test_kt_jvm_library_with_deps(),
_test_kt_jvm_library_with_export_that_exports_plugin(),
_test_kt_jvm_library_with_exported_plugin(),
_test_kt_jvm_library_with_exports(),
@@ -763,7 +640,6 @@ def test_suite(name):
_test_kt_jvm_library_with_plugin(),
_test_kt_jvm_library_with_proguard_specs(),
_test_kt_jvm_library_with_resources(),
- _test_kt_jvm_library_with_runtime_deps(),
_test_kt_jvm_library_coverage(),
],
)
diff --git a/tests/jvm/java/neverlink/BUILD b/tests/jvm/java/neverlink/BUILD
index 1072405..c6daa08 100644
--- a/tests/jvm/java/neverlink/BUILD
+++ b/tests/jvm/java/neverlink/BUILD
@@ -12,14 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test", "kt_jvm_library_under_test")
+load("//tests/analysis:for_test.bzl", "rules_for_test")
+load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
licenses(["notice"])
jvm_library_test(
name = "neverlinked_input_library_test",
expect_neverlink = True,
- target_under_test = kt_jvm_library_under_test(
+ target_under_test = rules_for_test.kt_jvm_library(
name = "neverlinked_input_library",
srcs = ["Input.kt"],
neverlink = True,