Skip to content

Commit

Permalink
fix(packages-driver): allow defining additional aspects instead (#3330)
Browse files Browse the repository at this point in the history
Co-authored-by: Zhongpeng Lin <[email protected]>
  • Loading branch information
JamyDev and linzhp authored Oct 24, 2022
1 parent 997520f commit fe4417d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion go/tools/gopackagesdriver/bazel_json_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ func (b *BazelJSONBuilder) Build(ctx context.Context, mode LoadMode) ([]string,
return nil, fmt.Errorf("found no labels matching the requests")
}

aspects := append(additionalAspects, goDefaultAspect)

buildArgs := concatStringsArrays([]string{
"--experimental_convenience_symlinks=ignore",
"--ui_event_filters=-info,-stderr",
"--noshow_progress",
"--aspects=" + customAspect,
"--aspects=" + strings.Join(aspects, ","),
"--output_groups=" + b.outputGroupsForMode(mode),
"--keep_going", // Build all possible packages
}, bazelFlags, bazelBuildFlags, labels)
Expand Down
3 changes: 2 additions & 1 deletion go/tools/gopackagesdriver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ var (
// It seems https://github.com/bazelbuild/bazel/issues/3115 isn't fixed when specifying
// the aspect from the command line. Use this trick in the mean time.
rulesGoRepositoryName = getenvDefault("GOPACKAGESDRIVER_RULES_GO_REPOSITORY_NAME", "@io_bazel_rules_go")
goDefaultAspect = rulesGoRepositoryName + "//go/tools/gopackagesdriver:aspect.bzl%go_pkg_info_aspect"
bazelBin = getenvDefault("GOPACKAGESDRIVER_BAZEL", "bazel")
bazelFlags = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_FLAGS"))
bazelQueryFlags = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_QUERY_FLAGS"))
bazelQueryScope = getenvDefault("GOPACKAGESDRIVER_BAZEL_QUERY_SCOPE", "")
bazelBuildFlags = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_BUILD_FLAGS"))
workspaceRoot = os.Getenv("BUILD_WORKSPACE_DIRECTORY")
customAspect = getenvDefault("GOPACKAGESDRIVER_BAZEL_ASPECT", rulesGoRepositoryName+"//go/tools/gopackagesdriver:aspect.bzl%go_pkg_info_aspect")
additionalAspects = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_ADDTL_ASPECTS"))
additionalKinds = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_KINDS"))
emptyResponse = &driverResponse{
NotHandled: false,
Expand Down

0 comments on commit fe4417d

Please sign in to comment.