Skip to content

Commit

Permalink
Fix release default options visibility (#441)
Browse files Browse the repository at this point in the history
* Update README.md for 1.5.0-alpha-2 release.

* Fix release option default visibility

* Move default options to kt_configure_toolchains for a single source of truth
Limit kt_configure_toolchains to kotlin/internal as it defines the toolchain_type which is a well known target. Configuring them elsewhere could have unexpected issues.
Move the kt_configure_toolchains out of jvm. (I'm pretty sure I did that, and it's just wrong.)
  • Loading branch information
restingbull authored Jan 6, 2021
1 parent 5884879 commit 6e8b04f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 30 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
# Bazel Kotlin Rules

Current release: ***`legacy-1.3.0`***<br />
Release candidate: ***`1.5.0-alpha-1`***<br />
Release candidate: ***`1.5.0-alpha-2`***<br />
Main branch: `master`

# News!
* <b>Dec 30, 2020.</b> Released version [1.5.0-alpha-2](https://github.com/bazelbuild/rules_kotlin/releases/tag/v1.5.0-alpha-2). Includes:
- Expanded kotlinc options
- New optimized compilation path (using JavaBuilder) `--define=experimental_use_abi_jars=1`.
- *Caveat*: compilation may fail due to https://youtrack.jetbrains.com/issue/KT-40133, https://youtrack.jetbrains.com/issue/KT-40340, https://youtrack.jetbrains.com/issue/KT-41381
- *Workaround*: add `tags=['kt_abi_plugin_incompatible']`
* <b>Dec 3, 2020.</b> Released version [1.5.0-alpha-1](https://github.com/bazelbuild/rules_kotlin/releases/tag/v1.5.0-alpha-1). Includes:
- Kotlin 1.4 support
- Lots of different fixes, especially to kotlinc plugins, `exported_compiler_plugins`, etc.
Expand Down
2 changes: 1 addition & 1 deletion examples/android/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ load("@io_bazel_rules_kotlin//kotlin:dependencies.bzl", "kt_download_local_dev_d

kt_download_local_dev_dependencies()

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kotlin_repositories", "kt_register_toolchains")
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kotlin_repositories")

kotlin_repositories()

Expand Down
15 changes: 0 additions & 15 deletions kotlin/internal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,10 @@
# 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("//kotlin/internal:opts.bzl", "kt_javac_options", "kt_kotlinc_options")
load("//kotlin/internal:toolchains.bzl", "kt_configure_toolchains")
load("//kotlin/internal/utils:packager.bzl", "release_archive")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

kt_kotlinc_options(
name = "default_kotlinc_options",
# Used internally as the rule default. This should be
# considered an implementation detail and not used externally
visibility = ["//visibility:public"],
)

kt_javac_options(
name = "default_javac_options",
# Used internally as the rule default. This should be
# considered an implementation detail and not used externally
visibility = ["//visibility:public"],
)

# Configures the toolchains
kt_configure_toolchains()

Expand Down
9 changes: 0 additions & 9 deletions kotlin/internal/BUILD.release.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//kotlin/internal:opts.bzl", "kt_javac_options", "kt_kotlinc_options")
load("//kotlin/internal:toolchains.bzl", "kt_configure_toolchains")

kt_configure_toolchains()

kt_kotlinc_options(
name = "default_kotlinc_options",
)

kt_javac_options(
name = "default_javac_options",
)
4 changes: 0 additions & 4 deletions kotlin/internal/jvm/BUILD.release.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,4 @@
# 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("//kotlin/internal:toolchains.bzl", "kt_configure_toolchains")

kt_configure_toolchains()

exports_files(["jetbrains-deshade.jarjar"])
17 changes: 17 additions & 0 deletions kotlin/internal/toolchains.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ load(
"//kotlin/internal:opts.bzl",
"JavacOptions",
"KotlincOptions",
"kt_javac_options",
"kt_kotlinc_options",
)
load(
"//kotlin/internal:defs.bzl",
Expand Down Expand Up @@ -262,7 +264,22 @@ def define_kt_toolchain(
def kt_configure_toolchains():
"""
Defines the toolchain_type and default toolchain for kotlin compilation.
Must be called in kotlin/internal/BUILD.bazel
"""
if native.package_name() != "kotlin/internal":
fail("kt_configure_toolchains must be called in kotlin/internal not %s" % native.package_name())

kt_kotlinc_options(
name = "default_kotlinc_options",
visibility = ["//visibility:public"],
)

kt_javac_options(
name = "default_javac_options",
visibility = ["//visibility:public"],
)

native.config_setting(
name = "experimental_use_abi_jars",
values = {"define": "experimental_use_abi_jars=1"},
Expand Down

0 comments on commit 6e8b04f

Please sign in to comment.