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

Avoid putting -repo_config after directories #1544

Merged
merged 2 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ tasks:
working_directory: tests/bcr
shell_commands:
# Regenerate the BUILD file for the test module using Gazelle.
# Also verify -repo_config are generated correctly in gazelle.bash
- rm pkg/BUILD.bazel
- bazel run //:gazelle
- bazel run //:gazelle -- update pkg
- bazel run //:gazelle -- pkg
build_flags:
- "--allow_yanked_versions=all"
test_flags:
Expand Down
20 changes: 13 additions & 7 deletions internal/gazelle.bash.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,18 @@ function set_goroot {

# If arguments were provided on the command line, either replace or augment
# the generated args.
if [ "${1-}" = "-args" ]; then
shift
ARGS+=("$@")
elif [ $# -ne 0 ]; then
ARGS=("$@")
fi
case "${1-}" in
"fix" | "update" | "help" | "update-repos")
ARGS=("$@")
;;
"-args")
linzhp marked this conversation as resolved.
Show resolved Hide resolved
shift
ARGS+=("$@")
;;
*)
ARGS+=("$@")
;;
esac

# Invoke Gazelle.
# Note that we don't change directories first; if we did, Gazelle wouldn't be
Expand Down Expand Up @@ -100,7 +106,7 @@ fi
# the definitions of go_repository rules from. Instead, we pass the path to
# the repo config file as a flag.
if [[ "${is_fix_or_update:-}" == "true" ]] && [[ -n $REPO_CONFIG_SHORT_PATH ]]; then
ARGS+=("-repo_config" "$(find_runfile "$REPO_CONFIG_SHORT_PATH")")
ARGS=("${ARGS[0]}" "-repo_config" "$(find_runfile "$REPO_CONFIG_SHORT_PATH")" "${ARGS[@]:1}")
fi

"$gazelle_short_path" "${ARGS[@]}"
2 changes: 1 addition & 1 deletion tests/bcr/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.0
6.2.0