Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into nk-compilationAvo…
Browse files Browse the repository at this point in the history
…idanceKotlin_upstream

* upstream/master:
  Move the KSP and compiler target definitions into rules_kotlin (bazelbuild#1014)
  Avoid running java_common#compile against KSP generated outputs (bazelbuild#990)
  Update kt_java_stub_template to 6.2.1 (bazelbuild#992)
  Disable strict deps for Android example (bazelbuild#1013)
  Group the all_tests jobs together in presubmit.yml (bazelbuild#1008)
  Add rules_java 6.4.0 (bazelbuild#1010)
  Update Bazel to 6.3.2 (bazelbuild#1007)
  Update rules_jvm_external to 5.3 (bazelbuild#1009)
  Migrate usages of deprecated `JavaInfo` fields (bazelbuild#1005)
  Remove unnecessary Java runtime dependencies (bazelbuild#1000)
  • Loading branch information
nkoroste committed Sep 15, 2023
2 parents ce390b2 + 8d79e6a commit bc3ab47
Show file tree
Hide file tree
Showing 59 changed files with 437 additions and 333 deletions.
8 changes: 4 additions & 4 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
validate_config: 1
bazel: 6.1.1
bazel: 6.3.2
buildifier:
version: 6.1.0
# no lint warnings for the moment. They are basically a smoke alarm in hell.
Expand All @@ -12,6 +12,9 @@ tasks:
- "//:all_tests"
build_targets:
- "//:rules_kotlin_release"
macos:
test_targets:
- "//:all_tests"
rbe_ubuntu1604:
test_targets:
- "--"
Expand All @@ -24,9 +27,6 @@ tasks:
# Override the default worker strategy for remote builds (worker strategy
# cannot be used with remote builds)
- "--strategy=KotlinCompile=remote"
macos:
test_targets:
- "//:all_tests"
example-android:
name: "Example - Android"
platform: ubuntu1804
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.1
6.3.2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ kt_compiler_plugin(
"annotation": "plugin.allopen.OpenForTesting",
},
deps = [
"@com_github_jetbrains_kotlin//:allopen-compiler-plugin",
"//kotlin/compiler:allopen-compiler-plugin",
],
)

Expand Down
4 changes: 2 additions & 2 deletions docs/kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ kt_jvm_test(<a href="#kt_jvm_test-name">name</a>, <a href="#kt_jvm_test-associat
**Notes:**
* The kotlin test library is not added implicitly, it is available with the label
`@com_github_jetbrains_kotlin//:kotlin-test`.
`@io_bazel_rules_kotlin//kotlin/compiler:kotlin-test`.


**ATTRIBUTES**
Expand Down Expand Up @@ -330,7 +330,7 @@ kt_compiler_plugin(<a href="#kt_compiler_plugin-name">name</a>, <a href="#kt_com
"annotation": "plugin.OpenForTesting",
},
deps = [
"@com_github_jetbrains_kotlin//:allopen-compiler-plugin",
"//kotlin/compiler:allopen-compiler-plugin",
],
)
Expand Down
5 changes: 4 additions & 1 deletion examples/android/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ http_archive(
name = "rules_jvm_external",
sha256 = versions.RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (
versions.RULES_JVM_EXTERNAL_TAG,
versions.RULES_JVM_EXTERNAL_TAG,
),
)

load("@rules_jvm_external//:defs.bzl", "maven_install")
Expand Down
4 changes: 0 additions & 4 deletions examples/android/bzl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ kt_javac_options(
define_kt_toolchain(
name = "experimental_toolchain",
api_version = "1.5",
# TODO(630): enable when the reduced classpath can correctly manage transitive maven dependencies.
# experimental_reduce_classpath_mode = "KOTLINBUILDER_REDUCED",
experimental_report_unused_deps = "warn",
experimental_strict_kotlin_deps = "warn",
experimental_use_abi_jars = True,
javac_options = ":default_javac_options",
kotlinc_options = ":default_kotlinc_options",
Expand Down
2 changes: 1 addition & 1 deletion examples/android/libKtAndroid/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ kt_compiler_plugin(
id = "org.jetbrains.kotlin.serialization",
stubs_phase = True,
deps = [
"@com_github_jetbrains_kotlin//:kotlinx-serialization-compiler-plugin",
"@io_bazel_rules_kotlin//kotlin/compiler:kotlinx-serialization-compiler-plugin",
],
)

Expand Down
5 changes: 4 additions & 1 deletion examples/anvil/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ http_archive(
name = "rules_jvm_external",
sha256 = versions.RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (
versions.RULES_JVM_EXTERNAL_TAG,
versions.RULES_JVM_EXTERNAL_TAG,
),
)

load("@rules_jvm_external//:defs.bzl", "maven_install")
Expand Down
5 changes: 4 additions & 1 deletion examples/associates/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ http_archive(
name = "rules_jvm_external",
sha256 = versions.RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (
versions.RULES_JVM_EXTERNAL_TAG,
versions.RULES_JVM_EXTERNAL_TAG,
),
)

load("@rules_jvm_external//:defs.bzl", "maven_install")
Expand Down
5 changes: 4 additions & 1 deletion examples/dagger/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ http_archive(
name = "rules_jvm_external",
sha256 = versions.RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (
versions.RULES_JVM_EXTERNAL_TAG,
versions.RULES_JVM_EXTERNAL_TAG,
),
)

load("@rules_jvm_external//:defs.bzl", "maven_install")
Expand Down
5 changes: 4 additions & 1 deletion examples/deps/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ http_archive(
name = "rules_jvm_external",
sha256 = versions.RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (
versions.RULES_JVM_EXTERNAL_TAG,
versions.RULES_JVM_EXTERNAL_TAG,
),
)

load("@rules_jvm_external//:defs.bzl", "maven_install")
Expand Down
5 changes: 4 additions & 1 deletion examples/jetpack_compose/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ http_archive(
name = "rules_jvm_external",
sha256 = versions.RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (
versions.RULES_JVM_EXTERNAL_TAG,
versions.RULES_JVM_EXTERNAL_TAG,
),
)

load("@rules_jvm_external//:defs.bzl", "maven_install")
Expand Down
5 changes: 4 additions & 1 deletion examples/ksp/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ http_archive(
name = "rules_jvm_external",
sha256 = versions.RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (
versions.RULES_JVM_EXTERNAL_TAG,
versions.RULES_JVM_EXTERNAL_TAG,
),
)

load("@rules_jvm_external//:defs.bzl", "maven_install")
Expand Down
5 changes: 4 additions & 1 deletion examples/node/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ http_archive(
name = "rules_jvm_external",
sha256 = versions.RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (
versions.RULES_JVM_EXTERNAL_TAG,
versions.RULES_JVM_EXTERNAL_TAG,
),
)

http_archive(
Expand Down
5 changes: 4 additions & 1 deletion examples/plugin/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ http_archive(
name = "rules_jvm_external",
sha256 = versions.RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (
versions.RULES_JVM_EXTERNAL_TAG,
versions.RULES_JVM_EXTERNAL_TAG,
),
)

load("@rules_jvm_external//:defs.bzl", "maven_install")
Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/src/allopen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ kt_compiler_plugin(
},
stubs_phase = True,
deps = [
"@com_github_jetbrains_kotlin//:allopen-compiler-plugin",
"@io_bazel_rules_kotlin//kotlin/compiler:allopen-compiler-plugin",
],
)

Expand Down
6 changes: 3 additions & 3 deletions examples/plugin/src/allopennoarg/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ kt_compiler_plugin(
},
stubs_phase = True,
deps = [
"@com_github_jetbrains_kotlin//:allopen-compiler-plugin",
"@io_bazel_rules_kotlin//kotlin/compiler:allopen-compiler-plugin",
],
)

Expand All @@ -23,7 +23,7 @@ kt_compiler_plugin(
},
stubs_phase = True,
deps = [
"@com_github_jetbrains_kotlin//:noarg-compiler-plugin",
"@io_bazel_rules_kotlin//kotlin/compiler:noarg-compiler-plugin",
],
)

Expand Down Expand Up @@ -64,7 +64,7 @@ kt_jvm_test(
test_class = "plugin.allopennoarg.UserHasNoargConstructorTest",
deps = [
":user",
"@com_github_jetbrains_kotlin//:kotlin-reflect",
"@io_bazel_rules_kotlin//kotlin/compiler:kotlin-reflect",
"@maven//:junit_junit",
],
)
4 changes: 2 additions & 2 deletions examples/plugin/src/noarg/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ kt_compiler_plugin(
},
stubs_phase = True,
deps = [
"@com_github_jetbrains_kotlin//:noarg-compiler-plugin",
"@io_bazel_rules_kotlin//kotlin/compiler:noarg-compiler-plugin",
],
)

Expand All @@ -35,7 +35,7 @@ kt_jvm_test(
test_class = "plugin.noarg.UserHasNoargConstructorTest",
deps = [
":user",
"@com_github_jetbrains_kotlin//:kotlin-reflect",
"@io_bazel_rules_kotlin//kotlin/compiler:kotlin-reflect",
"@maven//:junit_junit",
],
)
4 changes: 2 additions & 2 deletions examples/plugin/src/parcelize/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ kt_compiler_plugin(
id = "org.jetbrains.kotlin.parcelize",
stubs_phase = True,
deps = [
"@com_github_jetbrains_kotlin//:parcelize-compiler-plugin",
"@io_bazel_rules_kotlin//kotlin/compiler:parcelize-compiler-plugin",
],
)

Expand All @@ -21,7 +21,7 @@ kt_jvm_library(
],
visibility = ["//visibility:public"],
exports = [
"@com_github_jetbrains_kotlin//:parcelize-runtime",
"@io_bazel_rules_kotlin//kotlin/compiler:parcelize-runtime",
],
)

Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/src/sam_with_receiver/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ kt_compiler_plugin(
},
stubs_phase = True,
deps = [
"@com_github_jetbrains_kotlin//:sam-with-receiver-compiler-plugin",
"@io_bazel_rules_kotlin//kotlin/compiler:sam-with-receiver-compiler-plugin",
],
)

Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/src/serialization/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ kt_compiler_plugin(
id = "org.jetbrains.kotlin.serialization",
stubs_phase = True,
deps = [
"@com_github_jetbrains_kotlin//:kotlinx-serialization-compiler-plugin",
"@io_bazel_rules_kotlin//kotlin/compiler:kotlinx-serialization-compiler-plugin",
],
)

Expand Down
5 changes: 4 additions & 1 deletion examples/trivial/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ http_archive(
name = "rules_jvm_external",
sha256 = versions.RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % versions.RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (
versions.RULES_JVM_EXTERNAL_TAG,
versions.RULES_JVM_EXTERNAL_TAG,
),
)

load("@rules_jvm_external//:defs.bzl", "maven_install")
Expand Down
1 change: 1 addition & 0 deletions kotlin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ release_archive(
"BUILD.release.bazel": "BUILD.bazel",
},
deps = [
"//kotlin/compiler:pkg",
"//kotlin/internal:pkg",
"//kotlin/settings:pkg",
],
Expand Down
32 changes: 32 additions & 0 deletions kotlin/compiler/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2020 The Bazel Authors. 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(":compiler.bzl", "kt_configure_compiler")
load(":ksp.bzl", "kt_configure_ksp")
load("//src/main/starlark/release:packager.bzl", "release_archive")

package(default_visibility = ["//visibility:public"])

# Configures the compiler
kt_configure_compiler()

# Configures the KSP plugins
kt_configure_ksp()

release_archive(
name = "pkg",
srcs = glob(["*.bzl"]),
src_map = {
"BUILD.release.bazel": "BUILD.bazel",
},
)
23 changes: 23 additions & 0 deletions kotlin/compiler/BUILD.release.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2020 The Bazel Authors. 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(":compiler.bzl", "kt_configure_compiler")
load(":ksp.bzl", "kt_configure_ksp")

package(default_visibility = ["//visibility:public"])

# Configures the compiler
kt_configure_compiler()

# Configures the KSP plugins
kt_configure_ksp()
Loading

0 comments on commit bc3ab47

Please sign in to comment.