Skip to content

Issue using rules_kotlin as local_repository #570

@jeffzoch

Description

@jeffzoch

Been a few months since i used the rules locally but im running into two strange errors:

  1. Unable to find package for @rkt_1_4//jvm:opts.bzl: The repository '@rkt_1_4' could not be resolved
  2. If i specify a kotlin compiler release I get an error Error: 'dict' value has no field or method 'url_templates'

here is my workspace:

local_repository(
    name = "io_bazel_rules_kotlin",
    path = "../rules_kotlin",
)

load("@io_bazel_rules_kotlin//kotlin:dependencies.bzl", "kt_download_local_dev_dependencies")
kt_download_local_dev_dependencies()
# KOTLIN
load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")

KOTLINC_RELEASE = {
    "version" : "1.5.20",
    "url_templates" : [
        "https://github.com/JetBrains/kotlin/releases/download/v{version}/kotlin-compiler-{version}.zip",
    ],
    "sha256" : "edf34263ddaabd48f7ec59661e4c0d1dc868462fd3a1ea323083d0e3e83a8a8b",
}

kotlin_repositories(compiler_release = KOTLINC_RELEASE)

register_toolchains("//tools/kotlin:kotlin_toolchain")

and here is my toolchain:

load(
    "@io_bazel_rules_kotlin//kotlin:core.bzl",
    "define_kt_toolchain",
    "kt_compiler_plugin",
    "kt_kotlinc_options",
)
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library", "kt_javac_options")

KOTLIN_LANGUAGE_LEVEL = "1.4"

kt_kotlinc_options(
    name = "kotlinc_options",
    x_allow_result_return_type = True,
    x_inline_classes = True,
)

kt_javac_options(
    name = "default_javac_options",
)

define_kt_toolchain(
    name = "kotlin_toolchain",
    api_version = KOTLIN_LANGUAGE_LEVEL,  # "1.1", "1.2", or "1.3"
    javac_options = "//:default_javac_options",
    jvm_target = "1.8",  # "1.6", "1.8", "9", "10", "11", or "12",
    kotlinc_options = "//:kotlinc_options",
    language_version = KOTLIN_LANGUAGE_LEVEL,  # "1.1", "1.2", or "1.3"
    experimental_strict_kotlin_deps = "warn"
)

I am on the latest commit a73e838
Both seem related to the large versioning change added by @restingbull

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions