Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

fix(bazel): surface error message when gazelle cant process glob expression#64214

Merged
BolajiOlajide merged 5 commits intomainfrom
bo/nsc/gazelle-glob-fix
Aug 6, 2024
Merged

fix(bazel): surface error message when gazelle cant process glob expression#64214
BolajiOlajide merged 5 commits intomainfrom
bo/nsc/gazelle-glob-fix

Conversation

@BolajiOlajide
Copy link
Contributor

@BolajiOlajide BolajiOlajide commented Aug 1, 2024

Closes DINF-89

Gazelle sometimes have trouble processing glob expressions, and this isn't reported as a failure even though it ultimately results in the BUILD.bazel not being correctly updated.

Test plan

  • Manual testing

In client/web/BUILD.bazel, add a new src to the web_lib ts_project target that includes a glob pattern.

...
ts_project(
    name = "web_lib",
    srcs = glob(["!src/playwright/*.spec.ts"]) + [
        "src/Index.tsx",
        "src/LegacyLayout.tsx",
        "src/LegacyRouteContext.tsx",
        "src/LegacySourcegraphWebApp.tsx",
        "src/PageError.tsx",
        "src/SearchQueryStateObserver.tsx",
        "src/SourcegraphWebApp.tsx",
...

When you run go run ./dev/sg bazel configure, the command should fail with an error message instead of returning exit 0.

Changelog

@BolajiOlajide BolajiOlajide requested review from a team and Strum355 August 1, 2024 12:13
@BolajiOlajide BolajiOlajide self-assigned this Aug 1, 2024
@cla-bot cla-bot bot added the cla-signed label Aug 1, 2024
@BolajiOlajide BolajiOlajide force-pushed the bo/nsc/gazelle-glob-fix branch from 800069a to 932e7c5 Compare August 5, 2024 09:57
@BolajiOlajide BolajiOlajide requested a review from Strum355 August 5, 2024 10:01
echo "${stderr_output}"

gazelle_err_line=$(echo "${stderr_output}" | grep -m 1 -o '^gazelle:.*')
echo "gazelle encountered an issue processing glob expression, the BUILD file is not updated. ${gazelle_err_line}"
Copy link
Contributor

Choose a reason for hiding this comment

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

nice touch 🙏

BolajiOlajide and others added 2 commits August 5, 2024 12:03
Co-authored-by: Jean-Hadrien Chabran <jean-hadrien.chabran@sourcegraph.com>
@BolajiOlajide BolajiOlajide merged commit 2e642bc into main Aug 6, 2024
@BolajiOlajide BolajiOlajide deleted the bo/nsc/gazelle-glob-fix branch August 6, 2024 22:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants