Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid user-provided repo name '' #883

Closed
Clement-Jean opened this issue Dec 14, 2022 · 8 comments
Closed

invalid user-provided repo name '' #883

Clement-Jean opened this issue Dec 14, 2022 · 8 comments

Comments

@Clement-Jean
Copy link

Clement-Jean commented Dec 14, 2022

I'm trying to use this rule and I simply want to use the default compiler and toolchains. So I added this in my WORKSPACE:

rules_kotlin_version = "1.6.0"
rules_kotlin_sha = "a57591404423a52bd6b18ebba7979e8cd2243534736c5c94d35c89718ea38f94"
http_archive(
    name = "io_bazel_rules_kotlin",
    urls = ["https://github.com/bazelbuild/rules_kotlin/releases/download/v%s/rules_kotlin_release.tgz" % rules_kotlin_version],
    sha256 = rules_kotlin_sha,
)

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

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

but once I build, I have the following error:

ERROR: Traceback (most recent call last):
	File "/Users/clement/Git/protobuf/WORKSPACE.bzlmod", line 13, column 20, in <toplevel>
		kotlin_repositories()
	File "/private/var/tmp/_bazel_clement/5892ceef4629d9b2aad305f593ba52a0/external/io_bazel_rules_kotlin/src/main/starlark/core/repositories/initialize.bzl", line 96, column 21, in kotlin_repositories
		rules_repository(
Error in repository_rule: invalid user-provided repo name '': valid names may contain only A-Z, a-z, 0-9, '-', '_', '.', and must start with a letter

This is seems weird to me because I check intialize.bzl where it uses rules_repository and I can't figure out where the repo name could be wrong.

Edit

This is in the context of bzlmod. Apprently bzlmod has stricter repository name validation (ref)

@restingbull
Copy link
Collaborator

bzlmod support is still in progress. Will ping back when it's working.

@restingbull restingbull self-assigned this Dec 15, 2022
@restingbull restingbull added component: common status: open - in progress P3 status: BLOCKED Progress cannot proceed (see comment thread) and removed status: BLOCKED Progress cannot proceed (see comment thread) labels Dec 15, 2022
@vadym-ua
Copy link

any progress on this?

@gregorycollins
Copy link

@vadym-sedna I think the reason this may be happening is that bazel 6.0.0 was just released, and bazelisk auto-updates

@jmthvt
Copy link

jmthvt commented Jan 16, 2023

It looks like this is not correctly skipped with bazel 6.0

if configured_repository_name: # without a repository name, no default kt_* rules repository is created.

@restingbull
Copy link
Collaborator

That is very odd -- python has always considered an empty string to be false.

@jmthvt
Copy link

jmthvt commented Jan 17, 2023

The starlack specs indeed states:

the values None, 0, and the empty sequences "", (), [], and {} have a truth value of False, whereas non-zero numbers and non-empty sequences have a truth value of True

https://github.com/bazelbuild/starlark/blob/master/spec.md#booleans

The current code should work but we clearly see it passes the condition 🤔 am I missing something?

@restingbull
Copy link
Collaborator

The current code should work but we clearly see it passes the condition 🤔 am I missing something?
Could be a regression -- bzlmod changed a lot of weird things in the repository runtime. Let me try to repro.

Till then, this seems like a reasonable work around.

@restingbull
Copy link
Collaborator

No longer an issue in 1.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants