diff --git a/CHANGELOG.md b/CHANGELOG.md index e02254e25..58b4260d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ | Date                   | News | | :----------- | -------- | +| Dec 6, 2019 | Released version [1.3.0-rc4](https://github.com/bazelbuild/rules_kotlin/releases/tag/legacy-1.3.0-rc4). | +| Dec 6, 2019 | Bug fixes and tweaks (#255, #257). | | Dec 6, 2019 | Released version [1.3.0-rc3](https://github.com/bazelbuild/rules_kotlin/releases/tag/legacy-1.3.0-rc3). | | Dec 6, 2019 | Add support for later java versions as target platforms (#236). | | Dec 5, 2019 | Released version [1.3.0-rc2](https://github.com/bazelbuild/rules_kotlin/releases/tag/legacy-1.3.0-rc2). | diff --git a/examples/dagger/src/coffee/BUILD.bazel b/examples/dagger/src/coffee/BUILD.bazel index 4ed03d872..01a2b4bfc 100644 --- a/examples/dagger/src/coffee/BUILD.bazel +++ b/examples/dagger/src/coffee/BUILD.bazel @@ -11,6 +11,9 @@ # 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("@rules_java//java:defs.bzl", "java_binary", "java_library", "java_plugin") +package(default_visibility = ["//visibility:private"]) + load("//kotlin:kotlin.bzl", "kt_jvm_library") # Generate a srcjar to validate intellij plugin correctly attaches it. diff --git a/kotlin/internal/defs.bzl b/kotlin/internal/defs.bzl index 463b3d92c..1f0b1be2e 100644 --- a/kotlin/internal/defs.bzl +++ b/kotlin/internal/defs.bzl @@ -24,6 +24,7 @@ KtJvmInfo = provider( "friend_paths": "The target(s) that this library can see the internals of.", "srcs": "the source files. [intelij-aspect]", "outputs": "output jars produced by this rule. [intelij-aspect]", + "language_version": "version of kotlin used. [intellij-aspect]", }, ) diff --git a/kotlin/internal/jvm/android.bzl b/kotlin/internal/jvm/android.bzl index 05f4c007d..356d52a84 100644 --- a/kotlin/internal/jvm/android.bzl +++ b/kotlin/internal/jvm/android.bzl @@ -52,5 +52,6 @@ def kt_android_library(name, exports = [], visibility = None, **kwargs): name = name, exports = exports + _kt_android_artifact(name, **kwargs), visibility = visibility, - testonly = kwargs.get("testonly", default = 0), + tags = kwargs.get("tags", default=None), + testonly = kwargs.get("testonly", default=0), ) diff --git a/kotlin/internal/jvm/compile.bzl b/kotlin/internal/jvm/compile.bzl index fe69fbc18..ecdbb141f 100644 --- a/kotlin/internal/jvm/compile.bzl +++ b/kotlin/internal/jvm/compile.bzl @@ -264,6 +264,7 @@ def kt_jvm_compile_action(ctx, rule_kind, output_jar): srcs = ctx.files.srcs, module_name = module_name, friend_paths = friend_paths, + language_version = toolchain.api_version, # intelij aspect needs this. outputs = struct( jdeps = ctx.outputs.jdeps, diff --git a/kotlin/internal/jvm/impl.bzl b/kotlin/internal/jvm/impl.bzl index e41f057ef..5c5d86d2b 100644 --- a/kotlin/internal/jvm/impl.bzl +++ b/kotlin/internal/jvm/impl.bzl @@ -156,7 +156,9 @@ def kt_jvm_binary_impl(ctx): _SPLIT_STRINGS = [ "src/test/java/", + "src/test/kotlin/", "javatests/", + "kotlin/", "java/", "test/", ] diff --git a/kotlin/internal/repositories/BUILD.com_github_jetbrains_kotlin b/kotlin/internal/repositories/BUILD.com_github_jetbrains_kotlin index 87b592c4c..069c85c35 100644 --- a/kotlin/internal/repositories/BUILD.com_github_jetbrains_kotlin +++ b/kotlin/internal/repositories/BUILD.com_github_jetbrains_kotlin @@ -14,6 +14,7 @@ package(default_visibility = ["//visibility:public"]) load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_js_import", "kt_jvm_import") +load("@rules_java//java:defs.bzl", "java_import") # Kotlin home filegroup containing everything that is needed. filegroup( diff --git a/src/main/kotlin/BUILD b/src/main/kotlin/BUILD index d1cdb4f53..db9963745 100644 --- a/src/main/kotlin/BUILD +++ b/src/main/kotlin/BUILD @@ -11,6 +11,7 @@ # 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("@rules_java//java:defs.bzl", "java_binary") load("//src/main/kotlin:bootstrap.bzl", "kt_bootstrap_library") load("//kotlin:kotlin.bzl", "kt_jvm_library") load("//third_party:jarjar.bzl", "jar_jar") diff --git a/src/main/kotlin/bootstrap.bzl b/src/main/kotlin/bootstrap.bzl index 2668fc02c..8a8385614 100644 --- a/src/main/kotlin/bootstrap.bzl +++ b/src/main/kotlin/bootstrap.bzl @@ -11,6 +11,7 @@ # 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("@rules_java//java:defs.bzl", "java_import", "java_library") load("//kotlin:kotlin.bzl", _for_ide = "kt_jvm_library") _BOOTSTRAP_LIB_ARGS = ["-jvm-target", "1.8"] @@ -100,7 +101,7 @@ rm $(@D)/$${NAME}_temp.jar ], cmd = command, ) - native.java_import( + java_import( name = name, jars = [jar_label], tags = ["no-ide"], diff --git a/src/main/kotlin/io/bazel/kotlin/builder/BUILD b/src/main/kotlin/io/bazel/kotlin/builder/BUILD index 8b9b99a21..7f9ea786e 100644 --- a/src/main/kotlin/io/bazel/kotlin/builder/BUILD +++ b/src/main/kotlin/io/bazel/kotlin/builder/BUILD @@ -11,6 +11,7 @@ # 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("@rules_java//java:defs.bzl", "java_library") load("//src/main/kotlin:bootstrap.bzl", "kt_bootstrap_library") kt_bootstrap_library( diff --git a/src/main/protobuf/BUILD b/src/main/protobuf/BUILD index 4ee08134a..5a4098b75 100644 --- a/src/main/protobuf/BUILD +++ b/src/main/protobuf/BUILD @@ -11,6 +11,7 @@ # 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("@rules_java//java:defs.bzl", "java_import") package(default_visibility = ["//visibility:public"]) proto_library( diff --git a/src/test/data/jvm/basic/BUILD b/src/test/data/jvm/basic/BUILD index ebfdc3981..e4c00c8f1 100644 --- a/src/test/data/jvm/basic/BUILD +++ b/src/test/data/jvm/basic/BUILD @@ -13,6 +13,7 @@ # limitations under the License. package(default_visibility = ["//visibility:private"]) +load("@rules_java//java:defs.bzl", "java_binary", "java_library") load("//kotlin:kotlin.bzl", "kt_jvm_binary", "kt_jvm_library", "kt_jvm_test") kt_jvm_binary( diff --git a/src/test/data/jvm/kapt/BUILD b/src/test/data/jvm/kapt/BUILD index 547550339..dd6d1090d 100644 --- a/src/test/data/jvm/kapt/BUILD +++ b/src/test/data/jvm/kapt/BUILD @@ -13,6 +13,7 @@ # limitations under the License. package(default_visibility = ["//visibility:private"]) +load("@rules_java//java:defs.bzl", "java_plugin", "java_library") load("//kotlin:kotlin.bzl", "kt_jvm_library") java_plugin( diff --git a/src/test/kotlin/io/bazel/kotlin/builder/BUILD b/src/test/kotlin/io/bazel/kotlin/builder/BUILD index faaaab760..fdbda59c1 100644 --- a/src/test/kotlin/io/bazel/kotlin/builder/BUILD +++ b/src/test/kotlin/io/bazel/kotlin/builder/BUILD @@ -13,6 +13,7 @@ # limitations under the License. package(default_visibility = ["//visibility:private"]) +load("@rules_java//java:defs.bzl", "java_library") load("//src/test/kotlin/io/bazel/kotlin:defs.bzl", "kt_rules_test") _COMMON_DEPS = [ diff --git a/src/test/kotlin/io/bazel/kotlin/defs.bzl b/src/test/kotlin/io/bazel/kotlin/defs.bzl index 0415cc62c..badf3b08f 100644 --- a/src/test/kotlin/io/bazel/kotlin/defs.bzl +++ b/src/test/kotlin/io/bazel/kotlin/defs.bzl @@ -11,6 +11,7 @@ # 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("@rules_java//java:defs.bzl", "java_test") load("//kotlin:kotlin.bzl", "kt_jvm_test") def _get_class_name(kwargs): @@ -30,7 +31,7 @@ def kt_rules_test(name, **kwargs): if f.endswith(".kt"): kt_jvm_test(name = name, **kwargs) return - native.java_test(name = name, **kwargs) + java_test(name = name, **kwargs) def kt_rules_e2e_test(name, **kwargs): kwargs.setdefault("size", "small") diff --git a/third_party/BUILD b/third_party/BUILD index d82360194..c3b279aa0 100644 --- a/third_party/BUILD +++ b/third_party/BUILD @@ -13,6 +13,7 @@ # limitations under the License. package(default_visibility = ["//visibility:public"]) +load("@rules_java//java:defs.bzl", "java_binary", "java_library", "java_plugin") load("//kotlin:kotlin.bzl", "kt_jvm_import") diff --git a/third_party/jvm/com/google/auto/BUILD b/third_party/jvm/com/google/auto/BUILD index 1cdd4e897..cad4ea8fc 100644 --- a/third_party/jvm/com/google/auto/BUILD +++ b/third_party/jvm/com/google/auto/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/google/auto/service/BUILD b/third_party/jvm/com/google/auto/service/BUILD index e15d1e415..084be03e6 100644 --- a/third_party/jvm/com/google/auto/service/BUILD +++ b/third_party/jvm/com/google/auto/service/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/google/auto/value/BUILD b/third_party/jvm/com/google/auto/value/BUILD index 056d0face..13761ab4e 100644 --- a/third_party/jvm/com/google/auto/value/BUILD +++ b/third_party/jvm/com/google/auto/value/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/google/code/findbugs/BUILD b/third_party/jvm/com/google/code/findbugs/BUILD index fd9c398c0..b1e28e9a1 100644 --- a/third_party/jvm/com/google/code/findbugs/BUILD +++ b/third_party/jvm/com/google/code/findbugs/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/google/code/gson/BUILD b/third_party/jvm/com/google/code/gson/BUILD index d4ae8cae7..951558249 100644 --- a/third_party/jvm/com/google/code/gson/BUILD +++ b/third_party/jvm/com/google/code/gson/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/google/dagger/BUILD b/third_party/jvm/com/google/dagger/BUILD index 746e6fc5f..0728e9a41 100644 --- a/third_party/jvm/com/google/dagger/BUILD +++ b/third_party/jvm/com/google/dagger/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/google/errorprone/BUILD b/third_party/jvm/com/google/errorprone/BUILD index d333f3348..7344efce4 100644 --- a/third_party/jvm/com/google/errorprone/BUILD +++ b/third_party/jvm/com/google/errorprone/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/google/googlejavaformat/BUILD b/third_party/jvm/com/google/googlejavaformat/BUILD index 2975aed07..c323f94c6 100644 --- a/third_party/jvm/com/google/googlejavaformat/BUILD +++ b/third_party/jvm/com/google/googlejavaformat/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/google/guava/BUILD b/third_party/jvm/com/google/guava/BUILD index e43dbd9d0..6d94290c7 100644 --- a/third_party/jvm/com/google/guava/BUILD +++ b/third_party/jvm/com/google/guava/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/google/j2objc/BUILD b/third_party/jvm/com/google/j2objc/BUILD index 3c2f585b2..f2c3bfacb 100644 --- a/third_party/jvm/com/google/j2objc/BUILD +++ b/third_party/jvm/com/google/j2objc/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/google/protobuf/BUILD b/third_party/jvm/com/google/protobuf/BUILD index f71657b3e..54dd8208e 100644 --- a/third_party/jvm/com/google/protobuf/BUILD +++ b/third_party/jvm/com/google/protobuf/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/google/truth/BUILD b/third_party/jvm/com/google/truth/BUILD index 1d2a16d01..086d9f4ac 100644 --- a/third_party/jvm/com/google/truth/BUILD +++ b/third_party/jvm/com/google/truth/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/googlecode/java_diff_utils/BUILD b/third_party/jvm/com/googlecode/java_diff_utils/BUILD index 3228e8a38..02dca4a96 100644 --- a/third_party/jvm/com/googlecode/java_diff_utils/BUILD +++ b/third_party/jvm/com/googlecode/java_diff_utils/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/com/squareup/BUILD b/third_party/jvm/com/squareup/BUILD index e7694f9d9..233ca55cb 100644 --- a/third_party/jvm/com/squareup/BUILD +++ b/third_party/jvm/com/squareup/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/javax/annotation/BUILD b/third_party/jvm/javax/annotation/BUILD index a4366e699..60998597d 100644 --- a/third_party/jvm/javax/annotation/BUILD +++ b/third_party/jvm/javax/annotation/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/javax/enterprise/BUILD b/third_party/jvm/javax/enterprise/BUILD index 02ade9ab9..5e48fd5da 100644 --- a/third_party/jvm/javax/enterprise/BUILD +++ b/third_party/jvm/javax/enterprise/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/javax/inject/BUILD b/third_party/jvm/javax/inject/BUILD index 2bcb07691..a7105c5b1 100644 --- a/third_party/jvm/javax/inject/BUILD +++ b/third_party/jvm/javax/inject/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/junit/BUILD b/third_party/jvm/junit/BUILD index 7006bab37..b69c165bd 100644 --- a/third_party/jvm/junit/BUILD +++ b/third_party/jvm/junit/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/net/ltgt/gradle/incap/BUILD b/third_party/jvm/net/ltgt/gradle/incap/BUILD index d1975ad2e..661433bc1 100644 --- a/third_party/jvm/net/ltgt/gradle/incap/BUILD +++ b/third_party/jvm/net/ltgt/gradle/incap/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/apache/ant/BUILD b/third_party/jvm/org/apache/ant/BUILD index 6c2a93882..de93afd03 100644 --- a/third_party/jvm/org/apache/ant/BUILD +++ b/third_party/jvm/org/apache/ant/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/apache/commons/BUILD b/third_party/jvm/org/apache/commons/BUILD index b6bda5b12..08ace1e93 100644 --- a/third_party/jvm/org/apache/commons/BUILD +++ b/third_party/jvm/org/apache/commons/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/apache/maven/BUILD b/third_party/jvm/org/apache/maven/BUILD index 361312570..80e78a1c4 100644 --- a/third_party/jvm/org/apache/maven/BUILD +++ b/third_party/jvm/org/apache/maven/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/checkerframework/BUILD b/third_party/jvm/org/checkerframework/BUILD index 12d849404..0a6a82deb 100644 --- a/third_party/jvm/org/checkerframework/BUILD +++ b/third_party/jvm/org/checkerframework/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/codehaus/mojo/BUILD b/third_party/jvm/org/codehaus/mojo/BUILD index f7d9bb016..2bd572c8e 100644 --- a/third_party/jvm/org/codehaus/mojo/BUILD +++ b/third_party/jvm/org/codehaus/mojo/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/codehaus/plexus/BUILD b/third_party/jvm/org/codehaus/plexus/BUILD index be51291bb..f843c1937 100644 --- a/third_party/jvm/org/codehaus/plexus/BUILD +++ b/third_party/jvm/org/codehaus/plexus/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/eclipse/sisu/BUILD b/third_party/jvm/org/eclipse/sisu/BUILD index 54e41d59d..629f51e0a 100644 --- a/third_party/jvm/org/eclipse/sisu/BUILD +++ b/third_party/jvm/org/eclipse/sisu/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/hamcrest/BUILD b/third_party/jvm/org/hamcrest/BUILD index 916a372a5..600f86087 100644 --- a/third_party/jvm/org/hamcrest/BUILD +++ b/third_party/jvm/org/hamcrest/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/jetbrains/BUILD b/third_party/jvm/org/jetbrains/BUILD index fa6c4387b..c91ca12fe 100644 --- a/third_party/jvm/org/jetbrains/BUILD +++ b/third_party/jvm/org/jetbrains/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/jetbrains/kotlin/BUILD b/third_party/jvm/org/jetbrains/kotlin/BUILD index ad328a947..fef0c36b2 100644 --- a/third_party/jvm/org/jetbrains/kotlin/BUILD +++ b/third_party/jvm/org/jetbrains/kotlin/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/jetbrains/kotlinx/BUILD b/third_party/jvm/org/jetbrains/kotlinx/BUILD index 97f7ae039..2a0cd2da6 100644 --- a/third_party/jvm/org/jetbrains/kotlinx/BUILD +++ b/third_party/jvm/org/jetbrains/kotlinx/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/ow2/asm/BUILD b/third_party/jvm/org/ow2/asm/BUILD index b27a08c90..c203a8ccf 100644 --- a/third_party/jvm/org/ow2/asm/BUILD +++ b/third_party/jvm/org/ow2/asm/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/org/pantsbuild/BUILD b/third_party/jvm/org/pantsbuild/BUILD index b1cfd8a9f..a1ad54ef8 100644 --- a/third_party/jvm/org/pantsbuild/BUILD +++ b/third_party/jvm/org/pantsbuild/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_library") licenses(["notice"]) java_library( diff --git a/third_party/jvm/workspace.bzl b/third_party/jvm/workspace.bzl index a06fead50..8655cbb69 100644 --- a/third_party/jvm/workspace.bzl +++ b/third_party/jvm/workspace.bzl @@ -20,6 +20,7 @@ def _jar_artifact_impl(ctx): srcjar_attr = '\n srcjar = ":%s",' % src_name build_file_contents = """ +load("@rules_java//java:defs.bzl", "java_import") package(default_visibility = ['//visibility:public']) java_import( name = 'jar',