Skip to content

Commit 19658cd

Browse files
Corbin Smithcgruber
Corbin Smith
authored andcommitted
Fix release packaging to exclude references to non-release targets.
Added a query check to release.sh to ensure that the release graph is correct.
1 parent 0517738 commit 19658cd

File tree

18 files changed

+153
-23
lines changed

18 files changed

+153
-23
lines changed

WORKSPACE

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,24 @@
1313
# limitations under the License.
1414
workspace(name = "io_bazel_rules_kotlin")
1515

16-
1716
load("//kotlin:dependencies.bzl", "kt_download_local_dev_dependencies")
17+
1818
kt_download_local_dev_dependencies()
1919

2020
load("//kotlin:kotlin.bzl", "kotlin_repositories", "kt_register_toolchains")
21+
2122
kotlin_repositories()
23+
2224
kt_register_toolchains()
2325

2426
# Creates toolchain configuration for remote execution with BuildKite CI
2527
# for rbe_ubuntu1604
2628
load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
29+
2730
rbe_autoconfig(
2831
name = "buildkite_config",
2932
)
3033

3134
android_sdk_repository(name = "androidsdk")
35+
3236
android_ndk_repository(name = "androidndk")

WORKSPACE.release.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
workspace(name = "io_bazel_rules_kotlin")
14+
workspace(name = "io_bazel_rules_kotlin")

examples/android/WORKSPACE

+3-4
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ local_repository(
5252
path = "../..",
5353
)
5454

55-
5655
load("@io_bazel_rules_kotlin//kotlin:dependencies.bzl", "kt_download_local_dev_dependencies")
56+
5757
kt_download_local_dev_dependencies()
5858

5959
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kotlin_repositories", "kt_register_toolchains")
@@ -62,7 +62,6 @@ kotlin_repositories()
6262

6363
kt_register_toolchains()
6464

65-
6665
# Skylib, for build_test, so don't bother initializing the unit test infrastructure.
6766
http_archive(
6867
name = "bazel_skylib",
@@ -74,6 +73,6 @@ http_archive(
7473

7574
http_archive(
7675
name = "rules_pkg",
77-
url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
7876
sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a",
79-
)
77+
url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
78+
)

examples/node/WORKSPACE

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ workspace(name = "kotlin_node_examples")
33
# Directly load the kotlin rules from the parent repo.
44
local_repository(
55
name = "io_bazel_rules_kotlin",
6-
path = "../.."
6+
path = "../..",
77
)
88

99
load("@io_bazel_rules_kotlin//kotlin:dependencies.bzl", "kt_download_local_dev_dependencies")
10+
1011
kt_download_local_dev_dependencies()
1112

1213
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kotlin_repositories", "kt_register_toolchains")
14+
1315
kotlin_repositories()
16+
1417
kt_register_toolchains()
1518

1619
# Node example dependencies
@@ -40,4 +43,4 @@ yarn_install(
4043
name = "node_ws",
4144
package_json = "//:package.json",
4245
yarn_lock = "//:yarn.lock",
43-
)
46+
)

examples/trivial/WORKSPACE

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ local_repository(
66
)
77

88
load("@io_bazel_rules_kotlin//kotlin:dependencies.bzl", "kt_download_local_dev_dependencies")
9+
910
kt_download_local_dev_dependencies()
1011

1112
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kotlin_repositories", "kt_register_toolchains")
@@ -48,6 +49,6 @@ maven_install(
4849

4950
http_archive(
5051
name = "rules_pkg",
51-
url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
5252
sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a",
53+
url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
5354
)

kotlin/BUILD

+16-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
1717

1818
release_archive(
1919
name = "pkg",
20-
srcs = glob(["*.*"]) + ["BUILD"],
20+
srcs = glob(["*.bzl"]),
21+
src_map = {
22+
"BUILD.release.bazel": "BUILD.bazel",
23+
},
2124
deps = [
2225
"//kotlin/internal:pkg",
2326
],
@@ -37,6 +40,18 @@ stardoc(
3740
out = "kotlin.md",
3841
input = "rules.bzl",
3942
rule_template = "//kotlin:doc-templates/rule.vm",
43+
symbol_names = [
44+
"define_kt_toolchain",
45+
"kt_js_library",
46+
"kt_js_import",
47+
"kt_register_toolchains",
48+
"kt_jvm_binary",
49+
"kt_jvm_import",
50+
"kt_jvm_library",
51+
"kt_jvm_test",
52+
"kt_android_library",
53+
"kt_compiler_plugin",
54+
],
4055
deps = [
4156
"kotlin",
4257
],

kotlin/BUILD.release.bazel

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2020 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.

kotlin/internal/defs.bzl

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
# The Kotlin Toolchain type.
1616
TOOLCHAIN_TYPE = "@io_bazel_rules_kotlin//kotlin/internal:kt_toolchain_type"
1717

18+
# Java toolchains
19+
JAVA_TOOLCHAIN_TYPE = "@bazel_tools//tools/jdk:toolchain_type"
20+
JAVA_RUNTIME_TOOLCHAIN_TYPE = "@bazel_tools//tools/jdk:runtime_toolchain_type"
21+
1822
# The name of the Kotlin compiler workspace.
1923
KT_COMPILER_REPO = "com_github_jetbrains_kotlin"
2024

kotlin/internal/jvm/BUILD

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
1717

1818
release_archive(
1919
name = "pkg",
20-
srcs = glob(["*.bzl"]) + ["BUILD"],
20+
srcs = glob(["*.bzl"]),
21+
src_map = {
22+
"BUILD.release.bazel": "BUILD.bazel",
23+
},
2124
)
2225

2326
bzl_library(
2427
name = "jvm",
2528
srcs = glob(["*.bzl"]),
2629
visibility = ["//kotlin:__subpackages__"],
30+
deps = [
31+
"//third_party:java_tools_bzl",
32+
],
2733
)
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2020 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
load("//kotlin/internal:toolchains.bzl", "kt_configure_toolchains")
16+
17+
kt_configure_toolchains()

kotlin/internal/repositories/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ load("//kotlin/internal/utils:packager.bzl", "release_archive")
1616
release_archive(
1717
name = "pkg",
1818
srcs = [
19-
"BUILD",
2019
"BUILD.com_github_jetbrains_kotlin",
2120
"download.bzl",
2221
],
2322
src_map = {
2423
"release_repositories.bzl": "repositories.bzl",
24+
"BUILD.release.bazel": "BUILD.bazel",
2525
},
2626
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2020 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
load("//kotlin/internal:toolchains.bzl", "kt_configure_toolchains")
16+
17+
kt_configure_toolchains()

kotlin/internal/utils/BUILD

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
1616

1717
release_archive(
1818
name = "pkg",
19-
srcs = glob(["*.bzl"]) + ["BUILD"],
19+
srcs = glob(
20+
["*.bzl"],
21+
exclude = ["packager.bzl"],
22+
),
23+
src_map = {
24+
"BUILD.release.bazel": "BUILD.bazel",
25+
},
2026
)
2127

2228
bzl_library(
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2020 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
load("//kotlin/internal:toolchains.bzl", "kt_configure_toolchains")
16+
17+
kt_configure_toolchains()

src/main/kotlin/BUILD

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ release_archive(
5555
"BUILD.release.bazel": "BUILD.bazel",
5656
},
5757
deps = [
58-
"//src/main/kotlin/io/bazel/kotlin/compiler:pkg"
59-
]
58+
"//src/main/kotlin/io/bazel/kotlin/compiler:pkg",
59+
],
6060
)
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1+
# Copyright 2020 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
114
load("@rules_java//java:defs.bzl", "java_import")
215

316
java_import(
417
name = "compiler",
518
jars = ["compiler.jar"],
6-
visibility = ["//src:__subpackages__"]
19+
visibility = ["//src:__subpackages__"],
720
)

src/test/kotlin/io/bazel/kotlin/builder/tasks/BUILD.bazel

+16-7
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,30 @@ kt_rules_test(
3131

3232
kt_rules_test(
3333
name = "KotlinBuilderJvmBasicTest",
34+
size = "large",
3435
srcs = ["jvm/KotlinBuilderJvmBasicTest.java"],
35-
size = "large"
3636
)
3737

3838
kt_jvm_test(
3939
name = "BazelWorkerTest",
4040
srcs = ["BazelWorkerTest.kt"],
4141
test_class = "io.bazel.kotlin.builder.tasks.BazelWorkerTest",
4242
deps = [
43-
"//src/main/kotlin/io/bazel/kotlin/builder/tasks:tasks",
44-
"//src/test/kotlin/io/bazel/kotlin/builder:test_lib",
45-
artifact("org.jetbrains.kotlinx:kotlinx-coroutines-core", repository_name="kotlin_rules_maven"),
46-
artifact("org.jetbrains.kotlinx:kotlinx-coroutines-test", repository_name="kotlin_rules_maven"),
47-
artifact("org.jetbrains.kotlinx:kotlinx-coroutines-debug", repository_name="kotlin_rules_maven"),
48-
]
43+
"//src/main/kotlin/io/bazel/kotlin/builder/tasks",
44+
"//src/test/kotlin/io/bazel/kotlin/builder:test_lib",
45+
artifact(
46+
"org.jetbrains.kotlinx:kotlinx-coroutines-core",
47+
repository_name = "kotlin_rules_maven",
48+
),
49+
artifact(
50+
"org.jetbrains.kotlinx:kotlinx-coroutines-test",
51+
repository_name = "kotlin_rules_maven",
52+
),
53+
artifact(
54+
"org.jetbrains.kotlinx:kotlinx-coroutines-debug",
55+
repository_name = "kotlin_rules_maven",
56+
),
57+
],
4958
)
5059

5160
# TODO(bazelbuild/rules_kotlin/issues/275): Remove full jar reference when the kt_rules_test handles jvm_import data better.

third_party/BUILD

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package(default_visibility = ["//visibility:public"])
1616
load("@rules_java//java:defs.bzl", "java_binary", "java_library", "java_plugin")
1717
load("//kotlin:kotlin.bzl", "kt_jvm_import")
1818
load("//kotlin/internal/utils:packager.bzl", "release_archive")
19+
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
1920

2021
exports_files(["empty.jar"])
2122

@@ -68,6 +69,11 @@ java_import(
6869
visibility = ["//visibility:public"],
6970
)
7071

72+
bzl_library(
73+
name = "java_tools_bzl",
74+
srcs = ["@bazel_tools//tools:bzl_srcs"],
75+
)
76+
7177
release_archive(
7278
name = "pkg",
7379
srcs = ["empty.jar"],

0 commit comments

Comments
 (0)