Skip to content

Commit

Permalink
Add deprecation warnings for direct access to the jetbrain repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
restingbull committed Dec 22, 2022
1 parent ce06429 commit 1091cfc
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 11 deletions.
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 = [
"@io_bazel_rules_kotlin//kotlin/compiler:kotlinx-serialization-compiler-plugin",
"@com_github_jetbrains_kotlin//:kotlinx-serialization-compiler-plugin",
],
)

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 = [
"@io_bazel_rules_kotlin//kotlin/compiler:allopen-compiler-plugin",
"@com_github_jetbrains_kotlin//: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 = [
"@io_bazel_rules_kotlin//kotlin/compiler:allopen-compiler-plugin",
"@com_github_jetbrains_kotlin//:allopen-compiler-plugin",
],
)

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

Expand Down Expand Up @@ -64,7 +64,7 @@ kt_jvm_test(
test_class = "plugin.allopennoarg.UserHasNoargConstructorTest",
deps = [
":user",
"@io_bazel_rules_kotlin//kotlin/compiler:kotlin-reflect",
"@com_github_jetbrains_kotlin//: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 = [
"@io_bazel_rules_kotlin//kotlin/compiler:noarg-compiler-plugin",
"@com_github_jetbrains_kotlin//:noarg-compiler-plugin",
],
)

Expand All @@ -35,7 +35,7 @@ kt_jvm_test(
test_class = "plugin.noarg.UserHasNoargConstructorTest",
deps = [
":user",
"@io_bazel_rules_kotlin//kotlin/compiler:kotlin-reflect",
"@com_github_jetbrains_kotlin//: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 = [
"@io_bazel_rules_kotlin//kotlin/compiler:parcelize-compiler-plugin",
"@com_github_jetbrains_kotlin//:parcelize-compiler-plugin",
],
)

Expand All @@ -21,7 +21,7 @@ kt_jvm_library(
],
visibility = ["//visibility:public"],
exports = [
"@io_bazel_rules_kotlin//kotlin/compiler:parcelize-runtime",
"@com_github_jetbrains_kotlin//: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 = [
"@io_bazel_rules_kotlin//kotlin/compiler:sam-with-receiver-compiler-plugin",
"@com_github_jetbrains_kotlin//: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 = [
"@io_bazel_rules_kotlin//kotlin/compiler:kotlinx-serialization-compiler-plugin",
"@com_github_jetbrains_kotlin//:kotlinx-serialization-compiler-plugin",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand All @@ -19,3 +20,115 @@ filegroup(
name = "home",
srcs = glob(["**"]),
)

_DEPRECATION_MESSAGE = "This target has been moved to @{{.KotlinRulesRepository}}//kotlin/compiler"

java_import(
name = "annotations",
deprecation = _DEPRECATION_MESSAGE,
jars = ["lib/annotations-13.0.jar"],
neverlink = 1,
)

java_import(
name = "jvm-abi-gen",
deprecation = _DEPRECATION_MESSAGE,
jars = ["lib/jvm-abi-gen.jar"],
)

# Kotlin dependencies that are internal to this repo and are meant to be loaded manually into a classloader.
[
java_import(
name = "kotlin-%s" % art,
deprecation = _DEPRECATION_MESSAGE,
jars = ["lib/kotlin-%s.jar" % art],
neverlink = 1,
)
for art in [
"annotation-processing",
"annotation-processing-runtime",
"compiler",
]
]

java_import(
name = "kotlinx-serialization-compiler-plugin",
deprecation = _DEPRECATION_MESSAGE,
jars = ["lib/kotlinx-serialization-compiler-plugin.jar"],
)

java_import(
name = "allopen-compiler-plugin",
deprecation = _DEPRECATION_MESSAGE,
jars = ["lib/allopen-compiler-plugin.jar"],
)

java_import(
name = "noarg-compiler-plugin",
deprecation = _DEPRECATION_MESSAGE,
jars = ["lib/noarg-compiler-plugin.jar"],
)

java_import(
name = "sam-with-receiver-compiler-plugin",
deprecation = _DEPRECATION_MESSAGE,
jars = ["lib/sam-with-receiver-compiler-plugin.jar"],
)

java_import(
name = "parcelize-compiler-plugin",
deprecation = _DEPRECATION_MESSAGE,
jars = ["lib/parcelize-compiler.jar"],
)

java_import(
name = "parcelize-runtime",
deprecation = _DEPRECATION_MESSAGE,
jars = ["lib/parcelize-runtime.jar"],
)

# Kotlin dependencies that are internal to this repo and may be linked.
[
java_import(
name = "kotlin-%s" % art,
deprecation = _DEPRECATION_MESSAGE,
jars = ["lib/kotlin-%s.jar" % art],
)
for art in [
"preloader",
]
]

# The Kotlin standard libraries. These should be setup in a Toolchain.
[
java_import(
name = "kotlin-%s" % art,
deprecation = _DEPRECATION_MESSAGE,
jars = ["lib/kotlin-%s.jar" % art],
srcjar = "lib/kotlin-%s-sources.jar" % art,
visibility = ["//visibility:public"],
)
for art in [
"stdlib",
"stdlib-jdk7",
"stdlib-jdk8",
"reflect",
"test",
"script-runtime",
]
]

# The Kotlin JS standard libraries. These should be setup in a Toolchain.
[
java_import(
name = "kotlin-%s" % art,
deprecation = _DEPRECATION_MESSAGE,
jars = ["lib/kotlin-%s.jar" % art],
srcjar = "lib/kotlin-%s-sources.jar" % art,
visibility = ["//visibility:public"],
)
for art in [
"test-js",
"stdlib-js",
]
]
6 changes: 6 additions & 0 deletions src/main/starlark/core/repositories/compiler.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ def _kotlin_compiler_impl(repository_ctx):
"BUILD.bazel",
attr._template,
executable = False,
substitutions = {
"{{.KotlinRulesRepository}}": attr.kotlin_rules_repository,
},
)

kotlin_compiler_repository = repository_rule(
implementation = _kotlin_compiler_impl,
attrs = {
"kotlin_rules_repository": attr.string(
doc = "The rules_kotlin repository name for deprecation warnings.",
),
"urls": attr.string_list(
doc = "A list of urls for the kotlin compiler",
mandatory = True,
Expand Down
1 change: 1 addition & 0 deletions src/main/starlark/core/repositories/initialize.release.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def kotlin_repositories(

kotlin_compiler_repository(
name = compiler_repository_name,
kotlin_rules_repository = RULES_KOTLIN.workspace_name,
urls = [url.format(version = compiler_release.version) for url in compiler_release.url_templates],
sha256 = compiler_release.sha256,
)
Expand Down

0 comments on commit 1091cfc

Please sign in to comment.