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

Preserve canonical labels as such #1863

Merged
merged 2 commits into from
Aug 22, 2024
Merged

Preserve canonical labels as such #1863

merged 2 commits into from
Aug 22, 2024

Conversation

fmeum
Copy link
Member

@fmeum fmeum commented Aug 13, 2024

What type of PR is this?

Bug fix

What package or component does this PR mostly affect?

label

What does this PR do? Why is it needed?

Previously, parsing and then stringifying a label would turn @@canonical~name//pkg:target into @canonical~name//pkg:target, which is no longer valid.

The new field on Label defaults to false if not set, which preserves the current behavior.

Which issues(s) does this PR fix?

Fixes #1862

Other notes for review

@fmeum fmeum requested review from linzhp and tyler-french August 13, 2024 08:41
@fmeum fmeum force-pushed the 1862-canonical-labels branch from 266ff49 to dc3789a Compare August 13, 2024 08:41
@fmeum fmeum force-pushed the 1862-canonical-labels branch 2 times, most recently from 1cabe0a to 3e971fc Compare August 20, 2024 12:20
fmeum added 2 commits August 22, 2024 14:50
Previously, parsing and then stringifying a label would turn `@@canonical~name//pkg:target` into `@canonical~name//pkg:target`, which is no longer valid.

The new field on `Label` defaults to `false` if not set, which is preserves the current behavior.
@fmeum fmeum force-pushed the 1862-canonical-labels branch from 3e971fc to f0cadc4 Compare August 22, 2024 12:50
@fmeum fmeum merged commit 2b326f8 into master Aug 22, 2024
18 checks passed
@fmeum fmeum deleted the 1862-canonical-labels branch August 22, 2024 14:43
fmeum added a commit that referenced this pull request Aug 22, 2024
@fmeum fmeum restored the 1862-canonical-labels branch August 22, 2024 14:43
@fmeum fmeum deleted the 1862-canonical-labels branch August 22, 2024 14:43
if strings.HasPrefix(s, "@@") {
s = s[len("@"):]
canonical = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional:

canonical := strings.HasPrefix(s, "@@")
if canonical {
		s = s[len("@"):]
}

sluongng added a commit to buildbuddy-io/buildbuddy that referenced this pull request Sep 25, 2024
Thanks to bazel-contrib/bazel-gazelle#1863, it
seems like using our directive is sufficient.
sluongng added a commit to buildbuddy-io/buildbuddy that referenced this pull request Sep 26, 2024
Thanks to bazel-contrib/bazel-gazelle#1863, it
seems like using our directive is sufficient.
sluongng added a commit to buildbuddy-io/buildbuddy that referenced this pull request Sep 26, 2024
With many promising performance updates
https://github.com/bazelbuild/bazel-gazelle/releases/tag/v0.39.0

Also removed `*_for_bzlmod.patch` files.
Thanks to bazel-contrib/bazel-gazelle#1863, using our Gazelle directivies
is sufficient.
github-merge-queue bot pushed a commit to zemn-me/monorepo that referenced this pull request Sep 29, 2024
##### [`vv0.39.0](https://github.com/bazelbuild/bazel-gazelle/releases/tag/v0.39.0)

#### What's Changed

-   Add QNX and OSX to known platforms by [@hofbi](https://github.com/hofbi) in bazel-contrib/bazel-gazelle#1853
-   Allow `+` in repo names by [@fmeum](https://github.com/fmeum) in bazel-contrib/bazel-gazelle#1856
-   go_repository_cache: set GOTOOLCHAIN to 'local' by [@lbcjbb](https://github.com/lbcjbb) in bazel-contrib/bazel-gazelle#1859
-   Fix Issue [#1855](bazel-contrib/bazel-gazelle#1855): "All Bazel commands fail when changing a Go dependency when using Bzlmod extension" by [@Buzz-Lightyear](https://github.com/Buzz-Lightyear) in bazel-contrib/bazel-gazelle#1861
-   Add default directives for github.com/containerd by [@mering](https://github.com/mering) in bazel-contrib/bazel-gazelle#1866
-   Add gazelle-overrides for argo, grpcgateway by [@udaya2899](https://github.com/udaya2899) in bazel-contrib/bazel-gazelle#1867
-   refactor: remove file reference from ruleRecord by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1869
-   refactor: compute transitive embeds during indexing by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1868
-   refactor: compute labelMap when indexing by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1872
-   refactor: remove reference to rule.Rule in mapResolver interface by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1873
-   refactor: ensure rule index not modified after indexing by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1877
-   docs: fix incorrect gazelle_generation_test param name by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1876
-   refactor: embed gazelle generation_test_binary in gazelle_generation_test instead of recompiling by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1875
-   refactor: make ruleRecord serializable by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1878
-   Add package metadata to `go_repository`s by [@fmeum](https://github.com/fmeum) in bazel-contrib/bazel-gazelle#1852
-   refactor: process KindMap even when not indexing by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1882
-   refactor: move walk util methods into struct by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1881
-   refactor: add nil assignments to verify interface implementations by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1883
-   perf: preload .bazelignore before configure, do not use globs by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1886
-   refactor: remove nested walk function literal by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1884
-   Preserve canonical labels as such by [@fmeum](https://github.com/fmeum) in bazel-contrib/bazel-gazelle#1863
-   perf: check if directory in .bazelignore before readdir by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1890
-   revert [#1873](bazel-contrib/bazel-gazelle#1873) by [@tyler-french](https://github.com/tyler-french) in bazel-contrib/bazel-gazelle#1897
-   rename `main()` entrypoints to `main.go` by [@tyler-french](https://github.com/tyler-french) in bazel-contrib/bazel-gazelle#1901
-   Support timeout and size in gazelle_test by [@rockwotj](https://github.com/rockwotj) in bazel-contrib/bazel-gazelle#1909
-   feat: include package URL in package_info by [@alexeagle](https://github.com/alexeagle) in bazel-contrib/bazel-gazelle#1917
-   perf: Improve rule.Kind by [@dzbarsky](https://github.com/dzbarsky) in bazel-contrib/bazel-gazelle#1919
-   Fix patch file creation using Gazelle in diff mode by [@alandonham](https://github.com/alandonham) in bazel-contrib/bazel-gazelle#1915
-   perf: Improve merger.Mergefile by [@dzbarsky](https://github.com/dzbarsky) in bazel-contrib/bazel-gazelle#1920
-   test: add bazelignore test by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1912
-   perf: walk workspace directories in parallel by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1893
-   refactor: reduce path.join while walking repo by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1913
-   chore: upgrade go mod dependencies by [@jbedard](https://github.com/jbedard) in bazel-contrib/bazel-gazelle#1911
-   prepare gazelle release 0.39 by [@tyler-french](https://github.com/tyler-french) in bazel-contrib/bazel-gazelle#1925
-   Add gazelle overrides to enable building rclone by [@dmcardle](https://github.com/dmcardle) in bazel-contrib/bazel-gazelle#1933

#### New Contributors

-   [@hofbi](https://github.com/hofbi) made their first contribution in bazel-contrib/bazel-gazelle#1853
-   [@Buzz-Lightyear](https://github.com/Buzz-Lightyear) made their first contribution in bazel-contrib/bazel-gazelle#1861
-   [@udaya2899](https://github.com/udaya2899) made their first contribution in bazel-contrib/bazel-gazelle#1867
-   [@rockwotj](https://github.com/rockwotj) made their first contribution in bazel-contrib/bazel-gazelle#1909
-   [@alandonham](https://github.com/alandonham) made their first contribution in bazel-contrib/bazel-gazelle#1915
-   [@dmcardle](https://github.com/dmcardle) made their first contribution in bazel-contrib/bazel-gazelle#1933

**Full Changelog**: bazel-contrib/bazel-gazelle@v0.38.0...v0.39.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't resolve root module from external module
2 participants