support only a single compiler repository version
diff --git a/README.md b/README.md
index 3605cd4..22f47c6 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,6 @@
this:
```build
-kotlin_release_version="1.2.30"
rules_kotlin_version = "67f4a6050584730ebae7f8a40435a209f8e0b48e"
http_archive(
@@ -57,7 +56,7 @@
)
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kotlin_repositories", "kt_register_toolchains")
-kotlin_repositories(kotlin_release_version=kotlin_release_version)
+kotlin_repositories()
kt_register_toolchains()
```
diff --git a/kotlin/internal/repositories/compiler_releases.bzl b/kotlin/internal/repositories/compiler_releases.bzl
deleted file mode 100644
index db57783..0000000
--- a/kotlin/internal/repositories/compiler_releases.bzl
+++ /dev/null
@@ -1,68 +0,0 @@
-# Copyright 2018 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.
-
-KOTLIN_CURRENT_RELEASE = "1.2.60"
-
-KOTLIN_COMPILER_RELEASES = {
- "1.2.60": {
- "version": "1.2.60",
- "url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.60/kotlin-compiler-1.2.60.zip",
- "sha256": "ff79f695c9be0a500d4b56a69d0b8657b3d106d78a35101e792248af904a623d",
- },
- "1.2.51": {
- "version": "1.2.51",
- "url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.51/kotlin-compiler-1.2.51.zip",
- "sha256": "8a74711c805d3d265b93c13d8c40af5b4dad324591450d2eef0eafc1c9a6f92c",
- },
- "1.2.50": {
- "version": "1.2.50",
- "url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.50/kotlin-compiler-1.2.50.zip",
- "sha256": "bc062c303b376711097a27bda4c28047eda0744e9acc64b9db640c19c7d171a9",
- },
- "1.2.41": {
- "version": "1.2.41",
- "url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.41/kotlin-compiler-1.2.41.zip",
- "sha256": "af872772f268da5ca79d263b2943f1d694d475dddb80b6d408e9548805ed265c",
- },
- "1.2.40": {
- "version": "1.2.40",
- "url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.40/kotlin-compiler-1.2.40.zip",
- "sha256": "3498571126c335be0feec24075c359f1954d46bbabccafc729ec49db1a509658",
- },
- "1.2.30": {
- "version": "1.2.30",
- "url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.30/kotlin-compiler-1.2.30.zip",
- "sha256": "4d6965877301d44241ca6de36480140992dc8a6b1c1884baeb5239ce2c43e071",
- },
- "1.2.21": {
- "version": "1.2.21",
- "url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.21/kotlin-compiler-1.2.21.zip",
- "sha256": "c5f2cbd35daa6c5c394e92e6c06b8eb41d85ad8da64762733874166b6807af22",
- },
- "1.2.20": {
- "version": "1.2.20",
- "url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.20/kotlin-compiler-1.2.20.zip",
- "sha256": "fb63d3d9f37b43f37575e3623c058d42a4b5dc8da08479ab065c4994e421a057",
- },
- "1.2.10": {
- "version": "1.2.10",
- "url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.10/kotlin-compiler-1.2.10.zip",
- "sha256": "95874568919121acb694bec0d6c92c60bdceea53f4c202e23ab734e94a0c26e3",
- },
- "1.2.0": {
- "version": "1.2.0",
- "url": "https://github.com/JetBrains/kotlin/releases/download/v1.2.0/kotlin-compiler-1.2.0.zip",
- "sha256": "895d0f8286db3e4f43d67cd5e09b600af6e0a5017cb74072d1b09c78b697775a",
- },
-}
diff --git a/kotlin/internal/repositories/repositories.bzl b/kotlin/internal/repositories/repositories.bzl
index 4a5e6c2..e15a165 100644
--- a/kotlin/internal/repositories/repositories.bzl
+++ b/kotlin/internal/repositories/repositories.bzl
@@ -24,17 +24,19 @@
_KT_COMPILER_REPO = "KT_COMPILER_REPO",
)
load(
- "//kotlin/internal/repositories:compiler_releases.bzl",
- _KOTLIN_COMPILER_RELEASES = "KOTLIN_COMPILER_RELEASES",
- _KOTLIN_CURRENT_RELEASE = "KOTLIN_CURRENT_RELEASE",
-)
-load(
"//third_party/jvm:workspace.bzl",
_maven_dependencies = "maven_dependencies",
)
_BAZEL_JAVA_LAUNCHER_VERSION = "0.8.1"
+_KOTLIN_CURRENT_COMPILER_RELEASE = {
+ "urls": [
+ "https://github.com/JetBrains/kotlin/releases/download/v1.2.61/kotlin-compiler-1.2.61.zip",
+ ],
+ "sha256": "be6d45385029ae99dee38fc77f554bddd49761067a532bfbf6bbf1b7348d5bbf",
+}
+
def github_archive(name, repo, commit, build_file_content = None):
if build_file_content:
_http_archive(
@@ -52,22 +54,18 @@
type = "zip",
)
-def _compiler_repositories(kotlin_release_version):
- """
- Prime the compiler repository.
+def kotlin_repositories(compiler_release = _KOTLIN_CURRENT_COMPILER_RELEASE):
+ """Call this in the WORKSPACE file to setup the Kotlin rules.
- This function should not be called directly instead `kotlin_repositories` from `//kotlin:kotlin.bzl` should be
- called to ensure common deps are loaded.
+ Args:
+ compiler_release: (internal) dict containing "urls" and "sha256" for the Kotlin compiler.
"""
- release = _KOTLIN_COMPILER_RELEASES[kotlin_release_version]
- if not release:
- fail('"%s" not a valid kotlin release, current release is "%s"' % (kotlin_release_version, _KOTLIN_CURRENT_RELEASE))
-
+ _maven_dependencies()
_http_archive(
name = _KT_COMPILER_REPO,
- url = release["url"],
- sha256 = release["sha256"],
- build_file = "@io_bazel_rules_kotlin//kotlin/internal/repositories:BUILD.com_github_jetbrains_kotlin",
+ urls = compiler_release["urls"],
+ sha256 = compiler_release["sha256"],
+ build_file = "//kotlin/internal/repositories:BUILD.com_github_jetbrains_kotlin",
strip_prefix = "kotlinc",
)
@@ -79,14 +77,3 @@
"java_stub_template.txt")],
sha256 = "86660ee7d5b498ccf611a1e000564f45268dbf301e0b2b08c984dcecc6513f6e",
)
-
-def kotlin_repositories(
- kotlin_release_version = _KOTLIN_CURRENT_RELEASE):
- """Call this in the WORKSPACE file to setup the Kotlin rules.
-
- Args:
- kotlin_release_version: The kotlin compiler release version. If this is not set the latest release version is
- chosen by default.
- """
- _maven_dependencies()
- _compiler_repositories(kotlin_release_version)
diff --git a/scripts/reflow_skylark b/scripts/reflow_skylark
index 6e5c6f4..eeaa195 100755
--- a/scripts/reflow_skylark
+++ b/scripts/reflow_skylark
@@ -15,7 +15,7 @@
# Note: Written on a mac please make it compatible with linux if needed.
#!/usr/bin/env bash
-buildifier -showlog -mode=fix -v $(find src -type f \
+buildifier -showlog -mode=fix -v $(find src kotlin -type f \
-iname "*.bzl" -or \
-iname "BUILD" -or \
-iname "BUILD.com_github_jetbrains_kotlin"