From a2e4fe745af7b193fa3707f38c60c8db0026e4e0 Mon Sep 17 00:00:00 2001 From: Ryan Brown Date: Wed, 3 Mar 2021 14:06:12 -0700 Subject: [PATCH 1/5] Add `bazel query` based gopackagesdriver. --- AUTHORS | 1 + go/private/repositories.bzl | 12 + go/tools/gopackagesdriver/BUILD.bazel | 11 + .../bazelquerydriver/BUILD.bazel | 18 + .../bazelquerydriver/driver.go | 323 ++++++++++++++++++ .../bazelquerydriver/pkgconv/BUILD.bazel | 18 + .../bazelquerydriver/pkgconv/go_embed_data.go | 26 ++ .../bazelquerydriver/pkgconv/go_library.go | 109 ++++++ .../pkgconv/go_proto_library.go | 90 +++++ .../bazelquerydriver/pkgconv/gotest.go | 131 +++++++ .../bazelquerydriver/pkgconv/pkgconv.go | 146 ++++++++ .../gopackagesdriver/bazelquerydriver/sdk.go | 110 ++++++ go/tools/gopackagesdriver/gopackagesdriver.go | 29 ++ go/tools/gopackagesdriver/protocol/BUILD | 14 + go/tools/gopackagesdriver/protocol/driver.go | 112 ++++++ .../gopackagesdriver/protocol/protocol.go | 54 +++ 16 files changed, 1204 insertions(+) create mode 100644 go/tools/gopackagesdriver/BUILD.bazel create mode 100644 go/tools/gopackagesdriver/bazelquerydriver/BUILD.bazel create mode 100644 go/tools/gopackagesdriver/bazelquerydriver/driver.go create mode 100644 go/tools/gopackagesdriver/bazelquerydriver/pkgconv/BUILD.bazel create mode 100644 go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_embed_data.go create mode 100644 go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_library.go create mode 100644 go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_proto_library.go create mode 100644 go/tools/gopackagesdriver/bazelquerydriver/pkgconv/gotest.go create mode 100644 go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go create mode 100644 go/tools/gopackagesdriver/bazelquerydriver/sdk.go create mode 100644 go/tools/gopackagesdriver/gopackagesdriver.go create mode 100644 go/tools/gopackagesdriver/protocol/BUILD create mode 100644 go/tools/gopackagesdriver/protocol/driver.go create mode 100644 go/tools/gopackagesdriver/protocol/protocol.go diff --git a/AUTHORS b/AUTHORS index 6a776e77d6..f876ec3376 100644 --- a/AUTHORS +++ b/AUTHORS @@ -9,6 +9,7 @@ Benjamin Staffin Brian Silverman David Santiago +Derivita Inc. Google Inc. Jake Voytko Yuki Yugui Sonoda diff --git a/go/private/repositories.bzl b/go/private/repositories.bzl index c517d2db75..761ec5e6cd 100644 --- a/go/private/repositories.bzl +++ b/go/private/repositories.bzl @@ -120,6 +120,18 @@ def go_rules_dependencies(is_rules_go = False): strip_prefix = "rules_cc-b1c40e1de81913a3c40e5948f78719c28152486d", ) + # Needed for gopackagesdriver + _maybe( + http_archive, + name = "com_github_bazelbuild_bazel_watcher", + # master, as of 2021-03-03 + urls = [ + "https://github.com/bazelbuild/bazel-watcher/archive/512875a4a20b48d7539151e55b896f00be8c4a60.zip", + ], + sha256 = "e822f17ff2c533a068c48fd75764028aaee99f65381469c1b2f269e602e8fad7", + strip_prefix = "bazel-watcher-512875a4a20b48d7539151e55b896f00be8c4a60", + ) + # Proto dependencies # These are limited as much as possible. In most cases, users need to # declare these on their own (probably via go_repository rules generated diff --git a/go/tools/gopackagesdriver/BUILD.bazel b/go/tools/gopackagesdriver/BUILD.bazel new file mode 100644 index 0000000000..cd81720790 --- /dev/null +++ b/go/tools/gopackagesdriver/BUILD.bazel @@ -0,0 +1,11 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary") + +go_binary( + name = "gopackagesdriver", + srcs = ["gopackagesdriver.go"], + visibility = ["//visibility:public"], + deps = [ + "//go/tools/gopackagesdriver/protocol:go_default_library", + "//go/tools/gopackagesdriver/bazelquerydriver:go_default_library", + ], +) diff --git a/go/tools/gopackagesdriver/bazelquerydriver/BUILD.bazel b/go/tools/gopackagesdriver/bazelquerydriver/BUILD.bazel new file mode 100644 index 0000000000..1e17ffdcc5 --- /dev/null +++ b/go/tools/gopackagesdriver/bazelquerydriver/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "driver.go", + "sdk.go", + ], + importpath = "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/bazelquerydriver", + visibility = ["//go/tools/gopackagesdriver:__subpackages__"], + deps = [ + "//go/tools/gopackagesdriver/bazelquerydriver/pkgconv:go_default_library", + "//go/tools/gopackagesdriver/protocol:go_default_library", + "@com_github_bazelbuild_bazel_watcher//third_party/bazel/master/src/main/protobuf/blaze_query:go_default_library", + "@com_github_bazelbuild_bazel_watcher//bazel:go_default_library", + "@org_golang_x_tools//go/packages:go_default_library", + ], +) diff --git a/go/tools/gopackagesdriver/bazelquerydriver/driver.go b/go/tools/gopackagesdriver/bazelquerydriver/driver.go new file mode 100644 index 0000000000..692dfb9955 --- /dev/null +++ b/go/tools/gopackagesdriver/bazelquerydriver/driver.go @@ -0,0 +1,323 @@ +// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bazelquerydriver + +import ( + "fmt" + "go/ast" + "go/parser" + "go/token" + "go/types" + "log" + "os" + "path/filepath" + "regexp" + "runtime" + "strconv" + "strings" + + "github.com/bazelbuild/bazel-watcher/bazel" + "github.com/bazelbuild/bazel-watcher/third_party/bazel/master/src/main/protobuf/blaze_query" + "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/bazelquerydriver/pkgconv" + "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/protocol" + "golang.org/x/tools/go/packages" +) + +const fileQueryPrefix = "file=" + +var gorootPattern = regexp.MustCompile(`^bazel-[^/]+/external/go_sdk\b`) + +const supportedModes = packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | packages.NeedImports | packages.NeedDeps | packages.NeedTypesSizes | packages.NeedModule + +type bazelDriver struct { + cfg protocol.Request + resp protocol.Response + bazel bazel.Bazel + sdk *gosdk + workspaceRoot string + bazelQueries []string + stdlibImports map[string]bool + fileQueries map[string]bool + importQueries map[string]bool + wildcardQuery bool +} + +// New returns a Driver implementation based on bazel query. +func New() protocol.Driver { + return func(cfg protocol.Request, patterns ...string) (*protocol.Response, error) { + bzl := bazel.New() + sdk, err := newGoSDK(bzl) + if err != nil { + return nil, err + } + driver := &bazelDriver{ + cfg: cfg, + bazel: bzl, + sdk: sdk, + stdlibImports: make(map[string]bool), + fileQueries: make(map[string]bool), + importQueries: make(map[string]bool), + } + return driver.loadPackages(patterns...) + } +} + +func (d *bazelDriver) loadPackages(patterns ...string) (*protocol.Response, error) { + if info, err := d.bazel.Info(); err != nil { + return &protocol.Response{NotHandled: true}, nil + } else { + d.workspaceRoot = info["workspace"] + } + + log.Printf("mode: %v", d.cfg.Mode) + unsupportedModes := d.cfg.Mode &^ supportedModes + if unsupportedModes != 0 { + return nil, fmt.Errorf("%v (%b) not implemented", unsupportedModes, unsupportedModes) + } + + if len(patterns) == 0 { + patterns = append(patterns, ".") + } + + var ignoredPkg packages.Package + + for _, patt := range patterns { + switch { + case strings.HasPrefix(patt, fileQueryPrefix): + fp := strings.TrimPrefix(patt, fileQueryPrefix) + if err := d.processFileQuery(fp, &ignoredPkg); err != nil { + return nil, err + } + case patt == ".": + d.bazelQueries = append(d.bazelQueries, goFilter(":all")) + d.wildcardQuery = true + case patt == "./...": + d.bazelQueries = append(d.bazelQueries, goFilter("...")) + d.wildcardQuery = true + case d.sdk.packages[patt]: + d.stdlibImports[patt] = true + default: + // TODO: do we need to check for a package ID instead of import path? + d.importQueries[patt] = true + d.bazelQueries = append(d.bazelQueries, fmt.Sprintf("attr(importpath, '%v', deps(%v))", patt, goFilter("//..."))) + } + } + + var resp protocol.Response + + for pkg := range d.stdlibImports { + resp.Roots = append(resp.Roots, pkg) + } + + if len(d.bazelQueries) != 0 { + pkgs, roots, err := d.packagesFromQueries(d.bazelQueries) + if err != nil { + return nil, err + } + resp.Packages = append(resp.Packages, pkgs...) + resp.Roots = append(resp.Roots, roots...) + } + + if len(ignoredPkg.IgnoredFiles) > 0 { + log.Printf("Ignored %v files", len(ignoredPkg.IgnoredFiles)) + ignoredPkg.GoFiles = ignoredPkg.IgnoredFiles[:1] + ignoredPkg.CompiledGoFiles = ignoredPkg.GoFiles + ignoredPkg.IgnoredFiles = ignoredPkg.IgnoredFiles[1:] + resp.Packages = append(resp.Packages, &ignoredPkg) + resp.Roots = append(resp.Roots, ignoredPkg.ID) + } + + stdlib, err := d.sdk.loadPackages(&d.cfg, d.stdlibImports) + if err != nil { + return nil, err + } + resp.Packages = append(resp.Packages, stdlib...) + + if d.cfg.Mode&packages.NeedTypesSizes != 0 { + goarch := protocol.GetEnv(&d.cfg, "GOARCH", runtime.GOARCH) + // SizesFor always return StdSizesm, + resp.Sizes = types.SizesFor("gc", goarch).(*types.StdSizes) + } + + return &resp, nil +} + +func (d *bazelDriver) processFileQuery(fp string, ignoredPkg *packages.Package) error { + if len(fp) == 0 { + return fmt.Errorf("\"file=\" prefix given with no query after it") + } + stdlibRoot := filepath.Join(d.sdk.goroot, "src") + + if filepath.IsAbs(fp) { + if strings.HasPrefix(fp, stdlibRoot) { + if rel, err := filepath.Rel(stdlibRoot, fp); err == nil { + pkg := filepath.Dir(rel) + if d.sdk.packages[pkg] { + d.stdlibImports[pkg] = true + } + } + return nil + } + if rel, err := filepath.Rel(d.workspaceRoot, fp); err == nil { + fp = rel + } + } + if prefix := gorootPattern.FindString(fp); prefix != "" { + ignoredPkg.Name = prefix + ignoredPkg.ID = prefix + ignoredPkg.IgnoredFiles = append(ignoredPkg.IgnoredFiles, fp) + return nil + } + query, err := d.convertFileQuery(fp) + if err != nil { + return err + } + d.bazelQueries = append(d.bazelQueries, query) + d.fileQueries[fp] = true + return nil +} + +func (d *bazelDriver) convertFileQuery(path string) (string, error) { + log.Printf("bazel query %#v", path) + result, err := d.bazel.Query(path) + if err != nil { + return "", err + } + if len(result.Target) == 0 { + return "", fmt.Errorf("no source file %#v", path) + } else if len(result.Target) > 1 { + return "", fmt.Errorf("multiple results for %#v", path) + } + + t := result.Target[0] + if t.GetType() != blaze_query.Target_SOURCE_FILE { + return "", fmt.Errorf("wanted SOURCE_FILE, but %v is %v", path, t.GetType()) + } + name := t.GetSourceFile().GetName() + pkg := strings.Split(name, ":")[0] + return fmt.Sprintf("attr(srcs, '%v', '%v:*')", name, pkg), nil +} + +func (d *bazelDriver) packagesFromQueries(queries []string) (pkgs []*packages.Package, roots []string, err error) { + query := strings.Join(queries, "+") + if d.cfg.Mode&packages.NeedDeps != 0 { + query = goFilter(fmt.Sprintf("deps(%v)", query)) + } + + log.Printf("bazel query %#v", query) + results, err := d.bazel.Query(query) + if err != nil { + return + } + + pkgs = pkgconv.Load(results.GetTarget()) + + log.Printf("file queries: %v", d.fileQueries) + for _, p := range pkgs { + if d.includeInRoots(p) { + roots = append(roots, p.ID) + } + } + + if d.cfg.Mode&packages.NeedCompiledGoFiles != 0 { + for _, pkg := range pkgs { + pkg.CompiledGoFiles = pkg.GoFiles + } + } + if d.cfg.Mode&(packages.NeedImports|packages.NeedName) != 0 { + for _, pkg := range pkgs { + name, imports, err := d.parsePackage(pkg) + if err != nil { + return nil, nil, fmt.Errorf("parsePackage: %w", err) + } + pkg.Name = name + for _, i := range imports { + if i, err = strconv.Unquote(i); err == nil { + if d.sdk.packages[i] { + if pkg.Imports == nil { + pkg.Imports = make(map[string]*packages.Package) + } + pkg.Imports[i] = &packages.Package{ID: i} + d.stdlibImports[i] = true + } + } + } + } + } + return +} + +func (d *bazelDriver) includeInRoots(pkg *packages.Package) bool { + if d.wildcardQuery { + return strings.HasPrefix(pkg.ID, "//") + } + if pkg.PkgPath != "" && d.importQueries[pkg.PkgPath] { + return true + } else if len(d.fileQueries) > 0 && !strings.HasPrefix(pkg.ID, "@") { + for _, f := range pkg.GoFiles { + if d.fileQueries[f] { + return true + } + if rel, err := filepath.Rel(d.workspaceRoot, f); err == nil && d.fileQueries[rel] { + return true + } + } + } + return false +} + +func (d *bazelDriver) parsePackage(pkg *packages.Package) (packageName string, imports []string, err error) { + triedBuild := false + dedupe := make(map[string]bool) + fset := token.NewFileSet() + + for _, filename := range pkg.GoFiles { + var f *os.File + f, err = os.Open(filename) + if os.IsNotExist(err) && !triedBuild { + triedBuild = true + log.Printf("bazel build %v\n", pkg.ID) + d.bazel.Build(pkg.ID) + f, err = os.Open(filename) + } + if err != nil { + return + } + defer f.Close() + var syntax *ast.File + if syntax, err = parser.ParseFile(fset, filename, f, parser.ImportsOnly); err == nil { + packageName = syntax.Name.Name + for _, i := range syntax.Imports { + pkg := i.Path.Value + if !dedupe[pkg] { + dedupe[pkg] = true + imports = append(imports, pkg) + } + } + if d.cfg.Mode&packages.NeedImports == 0 { + // We don't need to parse all the files just to get the package name. + return + } + } + } + if packageName == "" { + packageName = filepath.Base(pkg.PkgPath) + } + return +} + +func goFilter(expr string) string { + return fmt.Sprintf("kind(\"alias|proto_library|go_\", %s)", expr) +} diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/BUILD.bazel b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/BUILD.bazel new file mode 100644 index 0000000000..353e920713 --- /dev/null +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "go_embed_data.go", + "go_library.go", + "go_proto_library.go", + "gotest.go", + "pkgconv.go", + ], + importpath = "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/bazelquerydriver/pkgconv", + visibility = ["//go/tools/gopackagesdriver:__subpackages__"], + deps = [ + "@org_golang_x_tools//go/packages:go_default_library", + "@com_github_bazelbuild_bazel_watcher//third_party/bazel/master/src/main/protobuf/blaze_query:go_default_library", + ], +) diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_embed_data.go b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_embed_data.go new file mode 100644 index 0000000000..492689d6b8 --- /dev/null +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_embed_data.go @@ -0,0 +1,26 @@ +// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pkgconv + +import ( + "path/filepath" + "strings" +) + +func embedDataPath(t target) string { + parts := strings.SplitN(t.name, ":", 2) + dir := binpath(parts[0]) + return filepath.Join(dir, parts[1]+".go") +} diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_library.go b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_library.go new file mode 100644 index 0000000000..926f054855 --- /dev/null +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_library.go @@ -0,0 +1,109 @@ +// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pkgconv + +import ( + "log" + "path/filepath" + "strings" + + "golang.org/x/tools/go/packages" +) + +func convertGoLibrary(t target, targets map[string]*target) []*packages.Package { + if t.importpath == "" { + log.Printf("no importpath for %v\n", t.name) + return nil + } + + pkg := &packages.Package{ + ID: t.name, + PkgPath: t.importpath, + Imports: make(map[string]*packages.Package), + } + + processGoSrcs(t, targets, pkg) + processDeps(t, targets, pkg) + + // add in any embeds + for _, e := range t.embed { + if et := targets[e]; et != nil { + if epkg := et.toPackage(targets); epkg != nil { + pkg.GoFiles = append(pkg.GoFiles, epkg[0].GoFiles...) + pkg.OtherFiles = append(pkg.OtherFiles, epkg[0].OtherFiles...) + for k, v := range epkg[0].Imports { + if pkg.Imports[k] == nil && v != nil { + pkg.Imports[k] = v + } + } + } + } else { + log.Printf("Unknown embed %v\n", e) + } + } + + if len(pkg.GoFiles)+len(pkg.OtherFiles) == 0 { + log.Printf("no srcs for %v\n", t.name) + return nil + } + + return []*packages.Package{pkg} +} + +func srcPath(t target, targets map[string]*target, src string) string { + packagePrefix := t.name[:strings.Index(t.name, ":")+1] + if generator, defined := targets[src]; defined { + switch generator.rule { + case "go_embed_data": + return embedDataPath(*generator) + default: + log.Printf("Unhandled %v in srcs of %v: %v\n", generator.rule, t.name, generator.name) + return "" + } + } else if strings.HasPrefix(src, packagePrefix) { + return filepath.Join(t.folder, strings.TrimPrefix(src, packagePrefix)) + } else { + log.Printf("Unrecognized entry in srcs of %v: %v\n", t.name, src) + return "" + } +} + +func processGoSrcs(t target, targets map[string]*target, pkg *packages.Package) { + for _, src := range t.srcs { + path := srcPath(t, targets, src) + if path != "" { + switch filepath.Ext(path) { + case ".go": + pkg.GoFiles = append(pkg.GoFiles, path) + default: + pkg.OtherFiles = append(pkg.OtherFiles, path) + } + } + } +} + +func processDeps(t target, targets map[string]*target, pkg *packages.Package) { + for _, depname := range t.deps { + dep := targets[depname] + for dep != nil && dep.rule == "alias" { + dep = targets[dep.actual] + } + if dep != nil && (dep.rule == "go_library" || dep.rule == "go_proto_library") { + pkg.Imports[dep.importpath] = &packages.Package{ID: dep.name} + } else { + log.Printf("%s: Unhandled dep %s", t.name, depname) + } + } +} diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_proto_library.go b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_proto_library.go new file mode 100644 index 0000000000..81d575861a --- /dev/null +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_proto_library.go @@ -0,0 +1,90 @@ +// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pkgconv + +import ( + "log" + "path/filepath" + "strings" + + "golang.org/x/tools/go/packages" +) + +func convertGoProtoLibrary(t target, targets map[string]*target) []*packages.Package { + if t.importpath == "" { + log.Printf("no importpath for %v\n", t.name) + return nil + } + name := strings.SplitN(t.name, ":", 2)[1] + path := filepath.Join(binpath(t.name), name+"_", t.importpath) + + pkg := &packages.Package{ + ID: t.name, + PkgPath: t.importpath, + Imports: make(map[string]*packages.Package), + } + packagePrefix := t.name[:strings.Index(t.name, ":")+1] + + for _, proto := range t.srcs { + for _, src := range protoSrcs(targets, proto) { + basename := strings.TrimSuffix(filepath.Base(strings.TrimPrefix(src, packagePrefix)), ".proto") + for _, cname := range t.compilers { + if compiler := targets[cname]; compiler == nil { + log.Printf("Unknown compiler %v\n", cname) + continue + } else if compiler.rule == "go_proto_wrapper" { + if len(compiler.embed) == 0 || targets[compiler.embed[0]] == nil { + log.Printf("invalid go_proto_wrapper %v", compiler.name) + continue + } + lib := targets[compiler.embed[0]] + libp := lib.toPackage(targets) + if len(libp) == 0 { + log.Printf("not found") + continue + } + pkg.GoFiles = append(pkg.GoFiles, libp[0].GoFiles...) + for k, v := range libp[0].Imports { + pkg.Imports[k] = v + } + } else { + pkg.GoFiles = append(pkg.GoFiles, filepath.Join(path, basename+compiler.suffix)) + t.deps = append(t.deps, compiler.deps...) + } + } + } + } + + processDeps(t, targets, pkg) + + return []*packages.Package{pkg} +} + +func protoSrcs(targets map[string]*target, name string) []string { + for targets[name] != nil && targets[name].rule == "alias" { + log.Printf("%#v -> %#v", name, targets[name].actual) + name = targets[name].actual + } + target := targets[name] + if target == nil || target.rule != "proto_library" { + log.Printf("Unrecognized proto_library %#v\n", name) + return nil + } + var srcs []string + for _, s := range target.srcs { + srcs = append(srcs, srcPath(*target, targets, s)) + } + return srcs +} diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/gotest.go b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/gotest.go new file mode 100644 index 0000000000..a68266f441 --- /dev/null +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/gotest.go @@ -0,0 +1,131 @@ +// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pkgconv + +import ( + "fmt" + "go/parser" + "go/token" + "log" + "path/filepath" + "strings" + + "golang.org/x/tools/go/packages" +) + +func testmainPath(t target) string { + parts := strings.SplitN(t.name, ":", 2) + dir := binpath(parts[0]) + return filepath.Join(dir, fmt.Sprintf("%s_/testmain.go", parts[1])) +} + +func convertGoTest(t target, targets map[string]*target) []*packages.Package { + importPath := t.importpath + var packageName string + + extPackages := make(map[string]*packages.Package) + + embed := packages.Package{ + Imports: make(map[string]*packages.Package), + } + + // First process embedded sources + for _, e := range t.embed { + if et := targets[e]; et != nil { + if epkg := et.toPackage(targets); epkg != nil { + embed.GoFiles = append(embed.GoFiles, epkg[0].GoFiles...) + embed.OtherFiles = append(embed.OtherFiles, epkg[0].OtherFiles...) + if importPath == "" { + importPath = epkg[0].PkgPath + } + for k, v := range epkg[0].Imports { + if embed.Imports[k] == nil && v != nil { + embed.Imports[k] = v + } + } + for _, s := range epkg[0].GoFiles { + if packageName == "" { + packageName = parsePackageName(s) + } else { + break + } + } + } + } else { + log.Printf("Unknown embed %v\n", e) + } + } + + pkg := &packages.Package{ + ID: t.name, + PkgPath: fmt.Sprintf("%v.test", importPath), + Imports: make(map[string]*packages.Package), + } + + processGoSrcs(t, targets, pkg) + processDeps(t, targets, pkg) + + embed.ID = fmt.Sprintf("%s [%s]", importPath, t.name) + embed.PkgPath = embed.ID + for k, v := range pkg.Imports { + if v != nil { + embed.Imports[k] = v + } + } + + // separate internal and external test files + for _, f := range pkg.GoFiles { + name := parsePackageName(f) + if name == packageName || name == "" { + embed.GoFiles = append(embed.GoFiles, f) + } else { + extPkg, ok := extPackages[name] + if !ok { + extImportPath := filepath.Join(filepath.Dir(importPath), name) + extPkg = &packages.Package{ + ID: fmt.Sprintf("%s [%s]", extImportPath, t.name), + PkgPath: extImportPath, + Imports: pkg.Imports, + } + extPackages[name] = extPkg + } + extPkg.GoFiles = append(extPkg.GoFiles, f) + } + } + pkg.Name = "main" + pkg.GoFiles = []string{testmainPath(t)} + pkg.Imports = make(map[string]*packages.Package, len(extPackages)+1) + + pkgs := make([]*packages.Package, 0, len(extPackages)+2) + if len(embed.GoFiles) > 0 { + pkgs = append(pkgs, &embed) + pkg.Imports[importPath] = &packages.Package{ID: embed.ID} + } + for _, p := range extPackages { + pkgs = append(pkgs, p) + pkg.Imports[p.PkgPath] = &packages.Package{ID: p.ID} + } + pkgs = append(pkgs, pkg) + + return pkgs +} + +func parsePackageName(filename string) string { + fset := token.NewFileSet() + if f, err := parser.ParseFile(fset, filename, nil, parser.PackageClauseOnly); err == nil { + return f.Name.Name + } + return "" +} diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go new file mode 100644 index 0000000000..65cb1c6d76 --- /dev/null +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go @@ -0,0 +1,146 @@ +// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pkgconv + +import ( + "fmt" + "log" + "path/filepath" + "strings" + + "github.com/bazelbuild/bazel-watcher/third_party/bazel/master/src/main/protobuf/blaze_query" + "golang.org/x/tools/go/packages" +) + +type target struct { + name string + folder string + srcs []string + deps []string + importpath string + rule string + embed []string + suffix string + compilers []string + actual string +} + +// Load generates packages.Packages from bazel query results. +// Each go rule in the input is converted into a Package with ID, PkgPath, and Imports. +// Imports is generated from bazel deps, so it does not include any standard library packages. +// Name may also be set for test packages. +func Load(protoTargets []*blaze_query.Target) []*packages.Package { + var pkgs []*packages.Package + + targets := make(map[string]*target) + + for _, pt := range protoTargets { + if pt.GetType() != blaze_query.Target_RULE { + continue + } + rule := pt.GetRule() + t := &target{ + name: rule.GetName(), + rule: rule.GetRuleClass(), + folder: filepath.Dir(rule.GetLocation()), + } + for _, a := range rule.GetAttribute() { + switch a.GetName() { + case "deps": + t.deps = a.GetStringListValue() + case "srcs": + t.srcs = a.GetStringListValue() + case "embed": + t.embed = a.GetStringListValue() + case "importpath": + t.importpath = a.GetStringValue() + case "suffix": + t.suffix = a.GetStringValue() + case "proto": + proto := a.GetStringValue() + if proto != "" { + t.srcs = append(t.srcs, proto) + } + case "protos": + t.srcs = append(t.srcs, a.GetStringListValue()...) + case "compilers": + t.compilers = a.GetStringListValue() + case "actual": + t.actual = a.GetStringValue() + case "library": + t.embed = []string{a.GetStringValue()} + } + } + targets[t.name] = t + } + + for _, t := range targets { + pkg := t.toPackage(targets) + pkgs = append(pkgs, pkg...) + } + + return pkgs +} + +func (t target) toPackage(targets map[string]*target) []*packages.Package { + switch t.rule { + case "go_library": + return convertGoLibrary(t, targets) + case "go_proto_library": + return convertGoProtoLibrary(t, targets) + case "go_tool_library": + // ignore + case "go_test": + return convertGoTest(t, targets) + case "alias": + actual := targets[t.actual] + if actual != nil { + return actual.toPackage(targets) + } + default: + if t.importpath != "" { + log.Printf("importpath %#v for %v %v", t.importpath, t.rule, t.name) + } + } + return nil +} + +func binpath(pkg string) string { + if index := strings.Index(pkg, ":"); index != -1 { + pkg = pkg[:index] + } + if pkg[0] == '@' { + parts := strings.Split(pkg[1:], "//") + return filepath.Join("bazel-bin", "external", parts[0], parts[1]) + } + pkg = strings.TrimPrefix(pkg, "//") + return filepath.Join("bazel-bin", pkg) +} + +func targetName(t *blaze_query.Target) string { + switch t.GetType() { + case blaze_query.Target_RULE: + return t.GetRule().GetName() + case blaze_query.Target_SOURCE_FILE: + return t.GetSourceFile().GetName() + case blaze_query.Target_GENERATED_FILE: + return t.GetGeneratedFile().GetName() + case blaze_query.Target_PACKAGE_GROUP: + return t.GetPackageGroup().GetName() + case blaze_query.Target_ENVIRONMENT_GROUP: + return t.GetEnvironmentGroup().GetName() + } + return fmt.Sprintf("%#v", t) +} diff --git a/go/tools/gopackagesdriver/bazelquerydriver/sdk.go b/go/tools/gopackagesdriver/bazelquerydriver/sdk.go new file mode 100644 index 0000000000..155eaff9a2 --- /dev/null +++ b/go/tools/gopackagesdriver/bazelquerydriver/sdk.go @@ -0,0 +1,110 @@ +// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bazelquerydriver + +import ( + "bufio" + "fmt" + "os" + "path/filepath" + "time" + + "github.com/bazelbuild/bazel-watcher/bazel" + "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/protocol" + "golang.org/x/tools/go/packages" +) + +type gosdk struct { + goroot string + packages map[string]bool +} + +func newGoSDK(bazel bazel.Bazel) (*gosdk, error) { + info, err := bazel.Info() + if err != nil { + return nil, err + } + bazelBin := info["bazel-bin"] + _, err = bazel.Build("@go_sdk//:package_list") + if err != nil { + return nil, err + } + + root, err := findGoroot(bazel) + if err != nil { + return nil, err + } + + s := &gosdk{ + goroot: root, + } + + return s.readPackages(filepath.Join(bazelBin, "external/go_sdk/packages.txt")) +} + +func (s *gosdk) readPackages(filename string) (*gosdk, error) { + s.packages = make(map[string]bool) + f, err := os.Open(filename) + if err != nil { + return nil, err + } + defer f.Close() + scanner := bufio.NewScanner(f) + for scanner.Scan() { + s.packages[scanner.Text()] = true + } + return s, scanner.Err() +} + +func (s *gosdk) loadPackages(cfg *protocol.Request, pkgs map[string]bool) ([]*packages.Package, error) { + words := make([]string, 0, len(pkgs)) + for pkg, included := range pkgs { + if included { + words = append(words, pkg) + } + } + if len(words) == 0 { + return nil, nil + } + + sdkConfig := &packages.Config{ + Mode: cfg.Mode, + Env: append(cfg.Env, fmt.Sprintf("GOROOT=%v", s.goroot), "GOPACKAGESDRIVER=off"), + BuildFlags: cfg.BuildFlags, + Tests: cfg.Tests, + } + + // Concurrent calls can result in "failed to cache compiled Go files" errors. + // So retry if we get an error. + // https://github.com/golang/go/issues/29667 + var err error + var result []*packages.Package + for i := 0; i < 5; i++ { + if result, err = packages.Load(sdkConfig, words...); err == nil { + return result, nil + } + time.Sleep(1 * time.Millisecond) + } + return nil, err +} + +func findGoroot(bazel bazel.Bazel) (string, error) { + results, err := bazel.Query("@go_sdk//:ROOT") + if err != nil { + return "", err + } + buildfile := results.Target[0].GetSourceFile().GetLocation() + return filepath.Dir(buildfile), nil +} diff --git a/go/tools/gopackagesdriver/gopackagesdriver.go b/go/tools/gopackagesdriver/gopackagesdriver.go new file mode 100644 index 0000000000..9ed293d1c5 --- /dev/null +++ b/go/tools/gopackagesdriver/gopackagesdriver.go @@ -0,0 +1,29 @@ +// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// gopackagesdriver collects metadata, syntax, and type information for +// Go packages built with bazel. It implements the driver interface for +// golang.org/x/tools/go/packages. When gopackagesdriver is installed +// in PATH, tools like gopls written with golang.org/x/tools/go/packages, +// work in bazel workspaces. +package main + +import ( + "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/bazelquerydriver" + "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/protocol" +) + +func main() { + protocol.Run(bazelquerydriver.New()) +} diff --git a/go/tools/gopackagesdriver/protocol/BUILD b/go/tools/gopackagesdriver/protocol/BUILD new file mode 100644 index 0000000000..d48bfe2c20 --- /dev/null +++ b/go/tools/gopackagesdriver/protocol/BUILD @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "driver.go", + "protocol.go", + ], + importpath = "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/protocol", + visibility = ["//go/tools/gopackagesdriver:__subpackages__"], + deps = [ + "@org_golang_x_tools//go/packages:go_default_library", + ], +) diff --git a/go/tools/gopackagesdriver/protocol/driver.go b/go/tools/gopackagesdriver/protocol/driver.go new file mode 100644 index 0000000000..7e53932858 --- /dev/null +++ b/go/tools/gopackagesdriver/protocol/driver.go @@ -0,0 +1,112 @@ +// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protocol + +import ( + "encoding/json" + "fmt" + "io" + "io/ioutil" + "log" + "os" + "strings" +) + +// Driver is the gopackagesdriver implementation +type Driver func(cfg Request, patterns ...string) (*Response, error) + +// Run implements the gopackagesdriver protocol. +// It reads a DriverRequest from stdin, passes the request to driver, and +// writes the response to stdout. +// If driver returns an error, Run will terminate the process. +func Run(driver Driver) { + cleanup := func() error { return nil } + if logfile := os.Getenv("GOPACKAGESDRIVER_LOGFILE"); logfile != "" { + f, err := os.OpenFile(logfile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) + if err != nil { + log.Fatalf("couldn't open log file: %s", err) + } + errorWriter := io.MultiWriter(f, os.Stderr) + cleanup = f.Close + log.SetOutput(errorWriter) + log.SetFlags(log.Lshortfile | log.Ldate | log.Ltime) + } + + defer cleanup() + + wd, _ := os.Getwd() + targets := strings.Join(os.Args[1:], " ") + if len(targets) > 1000 { + targets = targets[:998] + "..." + } + log.Printf("%v: %v", wd, targets) + + // Make sure any panic goes to the logfile. + defer func() { + if err := recover(); err != nil { + log.Panic(err) + } + }() + + if err := run(driver, os.Args[1:]); err != nil { + log.Fatal(err) + } +} + +func run(driver Driver, args []string) error { + reqData, err := ioutil.ReadAll(os.Stdin) + if err != nil { + return err + } + var req Request + if err := json.Unmarshal(reqData, &req); err != nil { + return fmt.Errorf("could not unmarshal driver request: %v", err) + } + + resp, err := driver(req, args...) + if err != nil { + return err + } + + if os.Getenv("GOPACKAGESDRIVER_DUMP_RESPONSE") != "" { + respDebug, _ := json.MarshalIndent(resp, "", " ") + log.Println("response:", string(respDebug)) + } + respData, err := json.Marshal(resp) + if err != nil { + return fmt.Errorf("could not marshal driver response: %v", err) + } + _, err = os.Stdout.Write(respData) + if err != nil { + return err + } + + log.Printf(" -> %d packages, %d roots", len(resp.Packages), len(resp.Roots)) + + return nil + +} + +// GetEnv returns a value from cfg.Env, or def if the value isn't found. +func GetEnv(cfg *Request, name, def string) string { + prefix := name + "=" + result := def + for _, env := range cfg.Env { + if value := strings.TrimPrefix(env, prefix); value != env { + result = value + } + } + return result +} diff --git a/go/tools/gopackagesdriver/protocol/protocol.go b/go/tools/gopackagesdriver/protocol/protocol.go new file mode 100644 index 0000000000..bac636aa4a --- /dev/null +++ b/go/tools/gopackagesdriver/protocol/protocol.go @@ -0,0 +1,54 @@ +// Copyright 2019 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protocol + +import ( + "go/types" + + "golang.org/x/tools/go/packages" +) + +// Request is a JSON object sent by golang.org/x/tools/go/packages +// on stdin. Keep in sync. +type Request struct { + Command string `json:"command"` // FIXME ??? + Mode packages.LoadMode `json:"mode"` + Env []string `json:"env"` // FIXME handle + BuildFlags []string `json:"build_flags"` + Tests bool `json:"tests"` // FIXME handle + Overlay map[string][]byte `json:"overlay"` // FIXME handle +} + +// Response is a JSON object sent by this program to +// golang.org/x/tools/go/packages on stdout. Keep in sync. +type Response struct { + NotHandled bool + + // Sizes, if not nil, is the types.Sizes to use when type checking. + Sizes *types.StdSizes + + // Roots is the set of package IDs that make up the root packages. + // We have to encode this separately because when we encode a single package + // we cannot know if it is one of the roots as that requires knowledge of the + // graph it is part of. + Roots []string `json:",omitempty"` + + // Packages is the full set of packages in the graph. + // The packages are not connected into a graph. + // The Imports if populated will be stubs that only have their ID set. + // Imports will be connected and then type and syntax information added in a + // later pass (see refine). + Packages []*packages.Package +} From 3b9ffd6c7dd7ec1d50135c3b17e00818c4b17270 Mon Sep 17 00:00:00 2001 From: Ryan Brown Date: Thu, 11 Mar 2021 10:04:16 -0700 Subject: [PATCH 2/5] Address PR comments. --- go/tools/gopackagesdriver/BUILD.bazel | 4 +- .../bazelquerydriver/BUILD.bazel | 6 +- .../bazelquerydriver/driver.go | 67 ++++++++----------- .../bazelquerydriver/pkgconv/BUILD.bazel | 2 +- go/tools/gopackagesdriver/gopackagesdriver.go | 20 +++++- go/tools/gopackagesdriver/protocol/BUILD | 4 +- go/tools/gopackagesdriver/protocol/driver.go | 16 ----- .../gopackagesdriver/protocol/protocol.go | 23 +++++-- 8 files changed, 70 insertions(+), 72 deletions(-) diff --git a/go/tools/gopackagesdriver/BUILD.bazel b/go/tools/gopackagesdriver/BUILD.bazel index cd81720790..f467f8ac85 100644 --- a/go/tools/gopackagesdriver/BUILD.bazel +++ b/go/tools/gopackagesdriver/BUILD.bazel @@ -5,7 +5,7 @@ go_binary( srcs = ["gopackagesdriver.go"], visibility = ["//visibility:public"], deps = [ - "//go/tools/gopackagesdriver/protocol:go_default_library", - "//go/tools/gopackagesdriver/bazelquerydriver:go_default_library", + "//go/tools/gopackagesdriver/protocol", + "//go/tools/gopackagesdriver/bazelquerydriver", ], ) diff --git a/go/tools/gopackagesdriver/bazelquerydriver/BUILD.bazel b/go/tools/gopackagesdriver/bazelquerydriver/BUILD.bazel index 1e17ffdcc5..ae33363bc6 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/BUILD.bazel +++ b/go/tools/gopackagesdriver/bazelquerydriver/BUILD.bazel @@ -1,7 +1,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( - name = "go_default_library", + name = "bazelquerydriver", srcs = [ "driver.go", "sdk.go", @@ -9,8 +9,8 @@ go_library( importpath = "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/bazelquerydriver", visibility = ["//go/tools/gopackagesdriver:__subpackages__"], deps = [ - "//go/tools/gopackagesdriver/bazelquerydriver/pkgconv:go_default_library", - "//go/tools/gopackagesdriver/protocol:go_default_library", + "//go/tools/gopackagesdriver/bazelquerydriver/pkgconv", + "//go/tools/gopackagesdriver/protocol", "@com_github_bazelbuild_bazel_watcher//third_party/bazel/master/src/main/protobuf/blaze_query:go_default_library", "@com_github_bazelbuild_bazel_watcher//bazel:go_default_library", "@org_golang_x_tools//go/packages:go_default_library", diff --git a/go/tools/gopackagesdriver/bazelquerydriver/driver.go b/go/tools/gopackagesdriver/bazelquerydriver/driver.go index 692dfb9955..f82bd32bd0 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/driver.go +++ b/go/tools/gopackagesdriver/bazelquerydriver/driver.go @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// bazelquerydriver implements the driver interface for +// golang.org/x/tools/go/packages. It uses `bazel query` to gather +// information about packages built using bazel. package bazelquerydriver import ( @@ -23,7 +26,6 @@ import ( "log" "os" "path/filepath" - "regexp" "runtime" "strconv" "strings" @@ -37,8 +39,6 @@ import ( const fileQueryPrefix = "file=" -var gorootPattern = regexp.MustCompile(`^bazel-[^/]+/external/go_sdk\b`) - const supportedModes = packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | packages.NeedImports | packages.NeedDeps | packages.NeedTypesSizes | packages.NeedModule type bazelDriver struct { @@ -54,24 +54,22 @@ type bazelDriver struct { wildcardQuery bool } -// New returns a Driver implementation based on bazel query. -func New() protocol.Driver { - return func(cfg protocol.Request, patterns ...string) (*protocol.Response, error) { - bzl := bazel.New() - sdk, err := newGoSDK(bzl) - if err != nil { - return nil, err - } - driver := &bazelDriver{ - cfg: cfg, - bazel: bzl, - sdk: sdk, - stdlibImports: make(map[string]bool), - fileQueries: make(map[string]bool), - importQueries: make(map[string]bool), - } - return driver.loadPackages(patterns...) +// LoadPackages uses bazel query to answer a gopackagesdriver request. +func LoadPackages(cfg protocol.Request, patterns ...string) (*protocol.Response, error) { + bzl := bazel.New() + sdk, err := newGoSDK(bzl) + if err != nil { + return nil, err } + driver := &bazelDriver{ + cfg: cfg, + bazel: bzl, + sdk: sdk, + stdlibImports: make(map[string]bool), + fileQueries: make(map[string]bool), + importQueries: make(map[string]bool), + } + return driver.loadPackages(patterns...) } func (d *bazelDriver) loadPackages(patterns ...string) (*protocol.Response, error) { @@ -91,13 +89,11 @@ func (d *bazelDriver) loadPackages(patterns ...string) (*protocol.Response, erro patterns = append(patterns, ".") } - var ignoredPkg packages.Package - for _, patt := range patterns { switch { case strings.HasPrefix(patt, fileQueryPrefix): fp := strings.TrimPrefix(patt, fileQueryPrefix) - if err := d.processFileQuery(fp, &ignoredPkg); err != nil { + if err := d.prepareFileQuery(fp); err != nil { return nil, err } case patt == ".": @@ -130,15 +126,6 @@ func (d *bazelDriver) loadPackages(patterns ...string) (*protocol.Response, erro resp.Roots = append(resp.Roots, roots...) } - if len(ignoredPkg.IgnoredFiles) > 0 { - log.Printf("Ignored %v files", len(ignoredPkg.IgnoredFiles)) - ignoredPkg.GoFiles = ignoredPkg.IgnoredFiles[:1] - ignoredPkg.CompiledGoFiles = ignoredPkg.GoFiles - ignoredPkg.IgnoredFiles = ignoredPkg.IgnoredFiles[1:] - resp.Packages = append(resp.Packages, &ignoredPkg) - resp.Roots = append(resp.Roots, ignoredPkg.ID) - } - stdlib, err := d.sdk.loadPackages(&d.cfg, d.stdlibImports) if err != nil { return nil, err @@ -154,11 +141,15 @@ func (d *bazelDriver) loadPackages(patterns ...string) (*protocol.Response, erro return &resp, nil } -func (d *bazelDriver) processFileQuery(fp string, ignoredPkg *packages.Package) error { +// prepareFileQuery parses queries starting with file=. +// It determines whether the file is inside the standard library, +// and adds the appropriate stdlib or bazel query to `d`. +// TODO: handle queries for generated files +func (d *bazelDriver) prepareFileQuery(fp string) error { if len(fp) == 0 { return fmt.Errorf("\"file=\" prefix given with no query after it") } - stdlibRoot := filepath.Join(d.sdk.goroot, "src") + stdlibRoot := filepath.Join(d.sdk.goroot, "src") + string(filepath.Separator) if filepath.IsAbs(fp) { if strings.HasPrefix(fp, stdlibRoot) { @@ -174,12 +165,7 @@ func (d *bazelDriver) processFileQuery(fp string, ignoredPkg *packages.Package) fp = rel } } - if prefix := gorootPattern.FindString(fp); prefix != "" { - ignoredPkg.Name = prefix - ignoredPkg.ID = prefix - ignoredPkg.IgnoredFiles = append(ignoredPkg.IgnoredFiles, fp) - return nil - } + query, err := d.convertFileQuery(fp) if err != nil { return err @@ -189,6 +175,7 @@ func (d *bazelDriver) processFileQuery(fp string, ignoredPkg *packages.Package) return nil } +// convertFileQuery returns a bazel query expression to find targets where `srcs` includes `path`. func (d *bazelDriver) convertFileQuery(path string) (string, error) { log.Printf("bazel query %#v", path) result, err := d.bazel.Query(path) diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/BUILD.bazel b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/BUILD.bazel index 353e920713..83e85963d3 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/BUILD.bazel +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/BUILD.bazel @@ -1,7 +1,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( - name = "go_default_library", + name = "pkgconv", srcs = [ "go_embed_data.go", "go_library.go", diff --git a/go/tools/gopackagesdriver/gopackagesdriver.go b/go/tools/gopackagesdriver/gopackagesdriver.go index 9ed293d1c5..429bd159c4 100644 --- a/go/tools/gopackagesdriver/gopackagesdriver.go +++ b/go/tools/gopackagesdriver/gopackagesdriver.go @@ -20,10 +20,28 @@ package main import ( + "io" + "log" + "os" + "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/bazelquerydriver" "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/protocol" ) func main() { - protocol.Run(bazelquerydriver.New()) + cleanup := func() error { return nil } + if logfile := os.Getenv("GOPACKAGESDRIVER_LOGFILE"); logfile != "" { + f, err := os.OpenFile(logfile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) + if err != nil { + log.Fatalf("couldn't open log file: %s", err) + } + errorWriter := io.MultiWriter(f, os.Stderr) + cleanup = f.Close + log.SetOutput(errorWriter) + log.SetFlags(log.Lshortfile | log.Ldate | log.Ltime) + } + + defer cleanup() + + protocol.Run(bazelquerydriver.LoadPackages) } diff --git a/go/tools/gopackagesdriver/protocol/BUILD b/go/tools/gopackagesdriver/protocol/BUILD index d48bfe2c20..4a81dd25e0 100644 --- a/go/tools/gopackagesdriver/protocol/BUILD +++ b/go/tools/gopackagesdriver/protocol/BUILD @@ -1,7 +1,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( - name = "go_default_library", + name = "protocol", srcs = [ "driver.go", "protocol.go", @@ -9,6 +9,6 @@ go_library( importpath = "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/protocol", visibility = ["//go/tools/gopackagesdriver:__subpackages__"], deps = [ - "@org_golang_x_tools//go/packages:go_default_library", + "@org_golang_x_tools//go/packages", ], ) diff --git a/go/tools/gopackagesdriver/protocol/driver.go b/go/tools/gopackagesdriver/protocol/driver.go index 7e53932858..7bfd69587f 100644 --- a/go/tools/gopackagesdriver/protocol/driver.go +++ b/go/tools/gopackagesdriver/protocol/driver.go @@ -17,7 +17,6 @@ package protocol import ( "encoding/json" "fmt" - "io" "io/ioutil" "log" "os" @@ -32,20 +31,6 @@ type Driver func(cfg Request, patterns ...string) (*Response, error) // writes the response to stdout. // If driver returns an error, Run will terminate the process. func Run(driver Driver) { - cleanup := func() error { return nil } - if logfile := os.Getenv("GOPACKAGESDRIVER_LOGFILE"); logfile != "" { - f, err := os.OpenFile(logfile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) - if err != nil { - log.Fatalf("couldn't open log file: %s", err) - } - errorWriter := io.MultiWriter(f, os.Stderr) - cleanup = f.Close - log.SetOutput(errorWriter) - log.SetFlags(log.Lshortfile | log.Ldate | log.Ltime) - } - - defer cleanup() - wd, _ := os.Getwd() targets := strings.Join(os.Args[1:], " ") if len(targets) > 1000 { @@ -96,7 +81,6 @@ func run(driver Driver, args []string) error { log.Printf(" -> %d packages, %d roots", len(resp.Packages), len(resp.Roots)) return nil - } // GetEnv returns a value from cfg.Env, or def if the value isn't found. diff --git a/go/tools/gopackagesdriver/protocol/protocol.go b/go/tools/gopackagesdriver/protocol/protocol.go index bac636aa4a..82a3ace0b3 100644 --- a/go/tools/gopackagesdriver/protocol/protocol.go +++ b/go/tools/gopackagesdriver/protocol/protocol.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Bazel Authors. All rights reserved. +// Copyright 2021 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,17 +23,26 @@ import ( // Request is a JSON object sent by golang.org/x/tools/go/packages // on stdin. Keep in sync. type Request struct { - Command string `json:"command"` // FIXME ??? - Mode packages.LoadMode `json:"mode"` - Env []string `json:"env"` // FIXME handle - BuildFlags []string `json:"build_flags"` - Tests bool `json:"tests"` // FIXME handle - Overlay map[string][]byte `json:"overlay"` // FIXME handle + Mode packages.LoadMode `json:"mode"` + // Env specifies the environment the underlying build system should be run in. + Env []string `json:"env"` + // BuildFlags are flags that should be passed to the underlying build system. + BuildFlags []string `json:"build_flags"` + // Tests specifies whether the patterns should also return test packages. + Tests bool `json:"tests"` + // Overlay maps file paths (relative to the driver's working directory) to the byte contents + // of overlay files. + Overlay map[string][]byte `json:"overlay"` } // Response is a JSON object sent by this program to // golang.org/x/tools/go/packages on stdout. Keep in sync. type Response struct { + // NotHandled is returned if the request can't be handled by the current + // driver. If an external driver returns a response with NotHandled, the + // rest of the driverResponse is ignored, and go/packages will fallback + // to the next driver. If go/packages is extended in the future to support + // lists of multiple drivers, go/packages will fall back to the next driver. NotHandled bool // Sizes, if not nil, is the types.Sizes to use when type checking. From a814eaf5d0c93bc7828b13ffad35428e2ce4ab7a Mon Sep 17 00:00:00 2001 From: Ryan Brown Date: Thu, 11 Mar 2021 10:08:41 -0700 Subject: [PATCH 3/5] Add godoc for package pkgconv. --- go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go index 65cb1c6d76..e5548ff035 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Package pkgconv converts from bazel query protobufs into golang.org/x/tools/go/packages Packages. +// Note that bazel query does not return all the required information about a Package, +// so you will need to do additional processing. For example, the Name is not usually known. package pkgconv import ( From 97a18db7fcf67d86267a295c7f537f898890a0cd Mon Sep 17 00:00:00 2001 From: Ryan Brown Date: Thu, 11 Mar 2021 14:47:30 -0700 Subject: [PATCH 4/5] Update copyright headers. --- go/tools/gopackagesdriver/bazelquerydriver/driver.go | 2 +- .../gopackagesdriver/bazelquerydriver/pkgconv/go_embed_data.go | 2 +- .../gopackagesdriver/bazelquerydriver/pkgconv/go_library.go | 2 +- .../bazelquerydriver/pkgconv/go_proto_library.go | 2 +- go/tools/gopackagesdriver/bazelquerydriver/pkgconv/gotest.go | 2 +- go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go | 2 +- go/tools/gopackagesdriver/bazelquerydriver/sdk.go | 2 +- go/tools/gopackagesdriver/gopackagesdriver.go | 2 +- go/tools/gopackagesdriver/protocol/driver.go | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go/tools/gopackagesdriver/bazelquerydriver/driver.go b/go/tools/gopackagesdriver/bazelquerydriver/driver.go index f82bd32bd0..49693491a0 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/driver.go +++ b/go/tools/gopackagesdriver/bazelquerydriver/driver.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// Copyright 2021 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_embed_data.go b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_embed_data.go index 492689d6b8..1aa1677549 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_embed_data.go +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_embed_data.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// Copyright 2021 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_library.go b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_library.go index 926f054855..69db11c1dc 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_library.go +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_library.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// Copyright 2021 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_proto_library.go b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_proto_library.go index 81d575861a..ae3f69341f 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_proto_library.go +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/go_proto_library.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// Copyright 2021 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/gotest.go b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/gotest.go index a68266f441..106d5788bb 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/gotest.go +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/gotest.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// Copyright 2021 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go index e5548ff035..433ee1d1e9 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/pkgconv.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// Copyright 2021 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/tools/gopackagesdriver/bazelquerydriver/sdk.go b/go/tools/gopackagesdriver/bazelquerydriver/sdk.go index 155eaff9a2..6b7afdc212 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/sdk.go +++ b/go/tools/gopackagesdriver/bazelquerydriver/sdk.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// Copyright 2021 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/tools/gopackagesdriver/gopackagesdriver.go b/go/tools/gopackagesdriver/gopackagesdriver.go index 429bd159c4..865ac7d567 100644 --- a/go/tools/gopackagesdriver/gopackagesdriver.go +++ b/go/tools/gopackagesdriver/gopackagesdriver.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// Copyright 2021 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/tools/gopackagesdriver/protocol/driver.go b/go/tools/gopackagesdriver/protocol/driver.go index 7bfd69587f..0058cff547 100644 --- a/go/tools/gopackagesdriver/protocol/driver.go +++ b/go/tools/gopackagesdriver/protocol/driver.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Bazel Go Rules Authors. All rights reserved. +// Copyright 2021 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From c5e76b0eec21d6aed94739ef487a2e0c00c42ce4 Mon Sep 17 00:00:00 2001 From: Ryan Brown Date: Thu, 11 Mar 2021 15:09:57 -0700 Subject: [PATCH 5/5] Implement more code review feedback. --- go/private/repositories.bzl | 12 - go/tools/gopackagesdriver/bazel/BUILD | 34 + go/tools/gopackagesdriver/bazel/bazel.go | 403 ++++ go/tools/gopackagesdriver/bazel/bazel_test.go | 179 ++ .../bazel/proto/analysis/BUILD.bazel | 12 + .../bazel/proto/analysis/analysis.pb.go | 827 +++++++ .../bazel/proto/blaze_query/BUILD.bazel | 11 + .../bazel/proto/blaze_query/build.pb.go | 2095 +++++++++++++++++ .../bazelquerydriver/BUILD.bazel | 4 +- .../bazelquerydriver/driver.go | 4 +- .../bazelquerydriver/pkgconv/BUILD.bazel | 2 +- .../gopackagesdriver/bazelquerydriver/sdk.go | 2 + 12 files changed, 3568 insertions(+), 17 deletions(-) create mode 100755 go/tools/gopackagesdriver/bazel/BUILD create mode 100755 go/tools/gopackagesdriver/bazel/bazel.go create mode 100755 go/tools/gopackagesdriver/bazel/bazel_test.go create mode 100755 go/tools/gopackagesdriver/bazel/proto/analysis/BUILD.bazel create mode 100755 go/tools/gopackagesdriver/bazel/proto/analysis/analysis.pb.go create mode 100755 go/tools/gopackagesdriver/bazel/proto/blaze_query/BUILD.bazel create mode 100755 go/tools/gopackagesdriver/bazel/proto/blaze_query/build.pb.go diff --git a/go/private/repositories.bzl b/go/private/repositories.bzl index 761ec5e6cd..c517d2db75 100644 --- a/go/private/repositories.bzl +++ b/go/private/repositories.bzl @@ -120,18 +120,6 @@ def go_rules_dependencies(is_rules_go = False): strip_prefix = "rules_cc-b1c40e1de81913a3c40e5948f78719c28152486d", ) - # Needed for gopackagesdriver - _maybe( - http_archive, - name = "com_github_bazelbuild_bazel_watcher", - # master, as of 2021-03-03 - urls = [ - "https://github.com/bazelbuild/bazel-watcher/archive/512875a4a20b48d7539151e55b896f00be8c4a60.zip", - ], - sha256 = "e822f17ff2c533a068c48fd75764028aaee99f65381469c1b2f269e602e8fad7", - strip_prefix = "bazel-watcher-512875a4a20b48d7539151e55b896f00be8c4a60", - ) - # Proto dependencies # These are limited as much as possible. In most cases, users need to # declare these on their own (probably via go_repository rules generated diff --git a/go/tools/gopackagesdriver/bazel/BUILD b/go/tools/gopackagesdriver/bazel/BUILD new file mode 100755 index 0000000000..34ee77ff29 --- /dev/null +++ b/go/tools/gopackagesdriver/bazel/BUILD @@ -0,0 +1,34 @@ +# Copyright 2017 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "bazel", + srcs = ["bazel.go"], + importpath = "github.com/bazelbuild/bazel-watcher/bazel", + visibility = ["//visibility:public"], + deps = [ + "//go/tools/gopackagesdriver/bazel/proto/analysis", + "//go/tools/gopackagesdriver/bazel/proto/blaze_query", + "@com_github_golang_protobuf//proto:go_default_library", + ], +) + +go_test( + name = "go_default_test", + srcs = ["bazel_test.go"], + embed = [":go_default_library"], + importpath = "github.com/bazelbuild/bazel-watcher/bazel", +) diff --git a/go/tools/gopackagesdriver/bazel/bazel.go b/go/tools/gopackagesdriver/bazel/bazel.go new file mode 100755 index 0000000000..e19e98a029 --- /dev/null +++ b/go/tools/gopackagesdriver/bazel/bazel.go @@ -0,0 +1,403 @@ +// Copyright 2017 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bazel + +import ( + "bytes" + "context" + "errors" + "flag" + "fmt" + "io" + "log" + "os" + "os/exec" + "path/filepath" + "strings" + "time" + + "github.com/bazelbuild/bazel-watcher/third_party/bazel/master/src/main/protobuf/analysis" + "github.com/bazelbuild/bazel-watcher/third_party/bazel/master/src/main/protobuf/blaze_query" + + "github.com/golang/protobuf/proto" +) + +var bazelPathFlag = flag.String("bazel_path", "", "Path to the bazel binary to use for actions") + +// bazelNpmPath looks up a relative path to a binary from @bazel/bazel +// This is used as an alternate resolution when no bazel binary is in the $PATH +// When running from the @bazel/ibazel npm package, our binary is +// /DIR/node_modules/@bazel/ibazel/bin/darwin_amd64/ibazel +// We can find bazel in +// /DIR/node_modules/@bazel/bazel-darwin_x64/bazel-0.28.0-darwin-x86_64 +func bazelNpmPath(ibazelBinPath string) (string, error) { + s := strings.Split(ibazelBinPath, "/") + for i := 0; i+4 < len(s); i++ { + prefix, nm, scope, pkg, dir, bin := s[0:i], s[i], s[i+1], s[i+2], s[i+3], s[i+4] + if nm == "node_modules" && scope == "@bazel" && pkg == "ibazel" && dir == "bin" { + // See mapping in release/npm/index.js - ibazel is named with "amd64" arch + // but @bazel/bazel uses node arch names + arch := strings.Replace(bin, "amd64", "x64", 1) + dir := strings.Join(append(prefix, nm, scope, "bazel-"+arch), "/") + // Find the bazel binary in the directory - it will have a version number in the name + // so we list all the files and find a bazel-*-$ARCH + if fd, err := os.Open(filepath.FromSlash(dir)); err == nil { + if names, err := fd.Readdirnames(0); err == nil { + for j := 0; j < len(names); j++ { + if strings.HasPrefix(names[j], "bazel-") { + return dir + "/" + names[j], nil + } + } + } + } + } + } + return "", errors.New("bazel binary not found in @bazel/bazel package") +} + +// bazeliskNpmPath looks up a relative path to a binary from @bazel/bazelisk +// This is used as an alternate resolution when no bazel binary is in the $PATH +// When running from the @bazel/ibazel npm package, our binary is +// /DIR/node_modules/@bazel/ibazel/bin/darwin_amd64/ibazel +// We can find bazelisk in +// /DIR/node_modules/@bazel/bazelisk/bazelizk-darwin_amd64 +func bazeliskNpmPath(ibazelBinPath string) (string, error) { + s := strings.Split(ibazelBinPath, "/") + for i := 0; i+4 < len(s); i++ { + prefix, nm, scope, pkg, dir, bin := s[0:i], s[i], s[i+1], s[i+2], s[i+3], s[i+4] + if nm == "node_modules" && scope == "@bazel" && pkg == "ibazel" && dir == "bin" { + var ext string + if strings.HasPrefix(bin, "windows_") { + ext = ".exe" + } + name := strings.Join(append(prefix, nm, scope, "bazelisk", "bazelisk-"+bin+ext), "/") + _, err := os.Stat(name) + if err != nil { + if !os.IsNotExist(err) { + return "", err + } + continue + } + return name, nil + } + } + return "", errors.New("bazelisk binary not found in @bazel/bazelisk package") +} + +func findBazel() string { + // Trust the user, if they supplied a path we always use it + if len(*bazelPathFlag) > 0 { + return *bazelPathFlag + } + // Frontend devs may have installed @bazel/bazelisk and @bazel/ibazel from npm + // If they also have bazelisk in the $PATH, we want to resolve this one, to avoid version skew + if npmPath, err := bazeliskNpmPath(filepath.ToSlash(os.Args[0])); err == nil { + return filepath.FromSlash(npmPath) + } + // Frontend devs may have installed @bazel/bazel and @bazel/ibazel from npm + // If they also have bazel in the $PATH, we want to resolve this one, to avoid version skew + if npmPath, err := bazelNpmPath(filepath.ToSlash(os.Args[0])); err == nil { + return filepath.FromSlash(npmPath) + } + // Check in $PATH for system-installed Bazelisk + if path, err := exec.LookPath("bazelisk"); err == nil { + return path + } + // Check in $PATH for system-installed Bazel + if path, err := exec.LookPath("bazel"); err == nil { + return path + } + + // If we've fallen through to here, the lookup won't succeed. + // Return "bazel" so that we'll later fail with an error + // exec: "bazel": executable file not found in $PATH + // which helps the user understand that we looked in the $PATH + return "bazel" +} + +type Bazel interface { + SetArguments([]string) + SetStartupArgs([]string) + WriteToStderr(v bool) + WriteToStdout(v bool) + Info() (map[string]string, error) + Query(args ...string) (*blaze_query.QueryResult, error) + CQuery(args ...string) (*analysis.CqueryResult, error) + Build(args ...string) (*bytes.Buffer, error) + Test(args ...string) (*bytes.Buffer, error) + Run(args ...string) (*exec.Cmd, *bytes.Buffer, error) + Wait() error + Cancel() +} + +type bazel struct { + cmd *exec.Cmd + + args []string + startupArgs []string + + ctx context.Context + cancel context.CancelFunc + + writeToStderr bool + writeToStdout bool +} + +func New() Bazel { + return &bazel{} +} + +func (b *bazel) SetArguments(args []string) { + b.args = args +} + +func (b *bazel) SetStartupArgs(args []string) { + b.startupArgs = args +} + +// WriteToStderr when running an operation. +func (b *bazel) WriteToStderr(v bool) { + b.writeToStderr = v +} + +// WriteToStdout when running an operation. +func (b *bazel) WriteToStdout(v bool) { + b.writeToStdout = v +} + +func (b *bazel) newCommand(command string, args ...string) (*bytes.Buffer, *bytes.Buffer) { + b.ctx, b.cancel = context.WithCancel(context.Background()) + + args = append([]string{command}, args...) + args = append(b.startupArgs, args...) + + if b.writeToStderr || b.writeToStdout { + containsColor := false + for _, arg := range args { + if strings.HasPrefix(arg, "--color") { + containsColor = true + } + } + if !containsColor { + args = append(args, "--color=yes") + } + } + + b.cmd = exec.CommandContext(b.ctx, findBazel(), args...) + + stdoutBuffer := new(bytes.Buffer) + stderrBuffer := new(bytes.Buffer) + if b.writeToStdout { + b.cmd.Stdout = io.MultiWriter(os.Stdout, stdoutBuffer) + } else { + b.cmd.Stdout = stdoutBuffer + } + if b.writeToStderr { + b.cmd.Stderr = io.MultiWriter(os.Stderr, stderrBuffer) + } else { + b.cmd.Stderr = stderrBuffer + } + + return stdoutBuffer, stderrBuffer +} + +// Displays information about the state of the bazel process in the +// form of several "key: value" pairs. This includes the locations of +// several output directories. Because some of the +// values are affected by the options passed to 'bazel build', the +// info command accepts the same set of options. +// +// A single non-option argument may be specified (e.g. "bazel-bin"), in +// which case only the value for that key will be printed. +// +// The full list of keys and the meaning of their values is documented in +// the bazel User Manual, and can be programmatically obtained with +// 'bazel help info-keys'. +// +// res, err := b.Info() +func (b *bazel) Info() (map[string]string, error) { + b.WriteToStderr(false) + b.WriteToStdout(false) + stdoutBuffer, _ := b.newCommand("info") + + // This gofunction only prints if 'bazel info' takes longer than 8 seconds + doneCh := make(chan struct{}, 1) + defer func() { + doneCh <- struct{}{} + }() + go func() { + select { + case <-doneCh: + // Do nothing since we're done. + case <-time.After(8 * time.Second): + log.Printf("Running `bazel info`... it's being a little slow") + } + }() + + err := b.cmd.Run() + if err != nil { + return nil, err + } + return b.processInfo(stdoutBuffer.String()) +} + +func (b *bazel) processInfo(info string) (map[string]string, error) { + lines := strings.Split(info, "\n") + output := make(map[string]string, 0) + for _, line := range lines { + if line == "" || strings.Contains(line, "Starting local Bazel server and connecting to it...") { + continue + } + data := strings.SplitN(line, ": ", 2) + if len(data) < 2 { + return nil, errors.New("Bazel info returned a non key-value pair") + } + output[data[0]] = data[1] + } + return output, nil +} + +// Executes a query language expression over a specified subgraph of the +// build dependency graph. +// +// For example, to show all C++ test rules in the strings package, use: +// +// res, err := b.Query('kind("cc_.*test", strings:*)') +// +// or to find all dependencies of //path/to/package:target, use: +// +// res, err := b.Query('deps(//path/to/package:target)') +// +// or to find a dependency path between //path/to/package:target and //dependency: +// +// res, err := b.Query('somepath(//path/to/package:target, //dependency)') +func (b *bazel) Query(args ...string) (*blaze_query.QueryResult, error) { + blazeArgs := append([]string(nil), "--output=proto", "--order_output=no", "--color=no") + blazeArgs = append(blazeArgs, args...) + + b.WriteToStderr(true) + b.WriteToStdout(false) + stdoutBuffer, _ := b.newCommand("query", blazeArgs...) + + err := b.cmd.Run() + + if err != nil { + return nil, err + } + return b.processQuery(stdoutBuffer.Bytes()) +} + +func (b *bazel) processQuery(out []byte) (*blaze_query.QueryResult, error) { + var qr blaze_query.QueryResult + if err := proto.Unmarshal(out, &qr); err != nil { + fmt.Fprintf(os.Stderr, "Could not read blaze query response. Error: %s\nOutput: %s\n", err, out) + return nil, err + } + + return &qr, nil +} + +// Executes a configurable query expression over a specified subgraph of the +// build dependency graph. +// +// For example, to show all C++ test rules in the strings package, use: +// +// res, err := b.CQuery('kind("cc_.*test", strings:*)') +// +// or to find all dependencies of //path/to/package:target, use: +// +// res, err := b.CQuery('deps(//path/to/package:target)') +// +// or to find a dependency path between //path/to/package:target and //dependency: +// +// res, err := b.CQuery('somepath(//path/to/package:target, //dependency)') +func (b *bazel) CQuery(args ...string) (*analysis.CqueryResult, error) { + blazeArgs := append([]string(nil), "--output=proto", "--color=no") + blazeArgs = append(blazeArgs, args...) + + b.WriteToStderr(true) + b.WriteToStdout(false) + stdoutBuffer, _ := b.newCommand("cquery", blazeArgs...) + + err := b.cmd.Run() + + if err != nil { + return nil, err + } + return b.processCQuery(stdoutBuffer.Bytes()) +} + +func (b *bazel) processCQuery(out []byte) (*analysis.CqueryResult, error) { + var qr analysis.CqueryResult + if err := proto.Unmarshal(out, &qr); err != nil { + fmt.Fprintf(os.Stderr, "Could not read blaze query response. Error: %s\nOutput: %s\n", err, out) + return nil, err + } + + return &qr, nil +} + +func (b *bazel) Build(args ...string) (*bytes.Buffer, error) { + stdoutBuffer, stderrBuffer := b.newCommand("build", append(b.args, args...)...) + err := b.cmd.Run() + + _, _ = stdoutBuffer.Write(stderrBuffer.Bytes()) + return stdoutBuffer, err +} + +func (b *bazel) Test(args ...string) (*bytes.Buffer, error) { + stdoutBuffer, stderrBuffer := b.newCommand("test", append(b.args, args...)...) + err := b.cmd.Run() + + _, _ = stdoutBuffer.Write(stderrBuffer.Bytes()) + return stdoutBuffer, err +} + +// Build the specified target (singular) and run it with the given arguments. +func (b *bazel) Run(args ...string) (*exec.Cmd, *bytes.Buffer, error) { + b.WriteToStderr(true) + b.WriteToStdout(true) + stdoutBuffer, stderrBuffer := b.newCommand("run", append(b.args, args...)...) + b.cmd.Stdin = os.Stdin + + _, _ = stdoutBuffer.Write(stderrBuffer.Bytes()) + + err := b.cmd.Run() + if err != nil { + return nil, stderrBuffer, err + } + + return b.cmd, stderrBuffer, err +} + +func (b *bazel) Wait() error { + res := b.cmd.Wait() + if res.Error() == "exec: Wait was already called" { + if b.cmd.ProcessState.Success() { + return nil + } + } + return res +} + +// Cancel the currently running operation. Useful if you call Run(target) and +// would like to stop the action running in a goroutine. +func (b *bazel) Cancel() { + if b.cancel == nil { + return + } + + b.cancel() +} diff --git a/go/tools/gopackagesdriver/bazel/bazel_test.go b/go/tools/gopackagesdriver/bazel/bazel_test.go new file mode 100755 index 0000000000..537d03f51b --- /dev/null +++ b/go/tools/gopackagesdriver/bazel/bazel_test.go @@ -0,0 +1,179 @@ +// Copyright 2017 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bazel + +import ( + "bytes" + "errors" + "io" + "os" + "reflect" + "testing" +) + +func TestNew(t *testing.T) { + b := New() + if b == nil { + t.Fatalf("Created a nil object") + } +} + +func TestProcessInfo(t *testing.T) { + b := &bazel{} + got, err := b.processInfo(`KEY: VALUE +KEY2: VALUE2 +KEY3: value`) + if err != nil { + t.Errorf("Error processing info: %s", err) + } + + expected := map[string]string{ + "KEY": "VALUE", + "KEY2": "VALUE2", + "KEY3": "value", + } + + if !reflect.DeepEqual(got, expected) { + t.Errorf("Objects were unequal. Got:\n%s\nExpected:\n%s", got, expected) + } +} + +func TestWriteToStderrAndStdout(t *testing.T) { + b := &bazel{} + stdoutBuffer := new(bytes.Buffer) + stderrBuffer := new(bytes.Buffer) + + // By default it should write to its own pipe. + b.newCommand("version") + if reflect.DeepEqual(b.cmd.Stdout, io.MultiWriter(os.Stdout, stderrBuffer)) { + t.Errorf("Set stdout to os.Stdout and stderrBuffer") + } + if reflect.DeepEqual(b.cmd.Stderr, io.MultiWriter(os.Stderr, stdoutBuffer)) { + t.Errorf("Set stderr to os.Stderr and stdoutBuffer") + } + + // If set to true it should write to the os version + b.WriteToStderr(true) + b.WriteToStdout(true) + b.newCommand("version") + if !reflect.DeepEqual(b.cmd.Stdout, io.MultiWriter(os.Stdout, stderrBuffer)) { + t.Errorf("Didn't set stdout to os.Stdout and stderrBuffer") + } + if !reflect.DeepEqual(b.cmd.Stderr, io.MultiWriter(os.Stderr, stdoutBuffer)) { + t.Errorf("Didn't set stderr to os.Stderr and stdoutBuffer") + } + + // If set to false it should not write to the os version + b.WriteToStderr(false) + b.WriteToStdout(false) + b.newCommand("version") + if reflect.DeepEqual(b.cmd.Stdout, io.MultiWriter(os.Stdout, stderrBuffer)) { + t.Errorf("Set stdout to os.Stdout and stderrBuffer") + } + if reflect.DeepEqual(b.cmd.Stderr, io.MultiWriter(os.Stderr, stdoutBuffer)) { + t.Errorf("Set stderr to os.Stderr and stdoutBuffer") + } +} + +// Test that cancel doesn't NPE if there is no command running. +func TestCancel(t *testing.T) { + b := New() + b.Cancel() +} + +var bazelNpmPathTests = []struct { + in string + out string + err error +}{ + {"/node_modules/@bazel/ibazel/bin/linux_amd64/ibazel", os.Getenv("TEST_TMPDIR") + "/node_modules/@bazel/bazel-linux_x64/bazel-1.2.3-linux_x86_64", nil}, + {"/node_modules/@bazel/ibazel/bin/windows_amd64/ibazel.exe", os.Getenv("TEST_TMPDIR") + "/node_modules/@bazel/bazel-windows_x64/bazel-1.2.3-windows_x86_64.exe", nil}, + {"/node_modules/@bazel/ibazel/bin/darwin_amd64/ibazel", os.Getenv("TEST_TMPDIR") + "/node_modules/@bazel/bazel-darwin_x64/bazel-1.2.3-darwin_x86_64", nil}, + {"/", "", errors.New("bazel binary not found in @bazel/bazel package")}, +} +func TestBazelNpmPath(t *testing.T) { + // Where bazel gets installed by npm + bazelNpmDir := os.Getenv("TEST_TMPDIR") + "/node_modules/@bazel" + + if err := os.MkdirAll(bazelNpmDir + "/bazel-linux_x64", 0755); err != nil { + t.Errorf(err.Error()) + } + if err := os.MkdirAll(bazelNpmDir + "/bazel-windows_x64", 0755); err != nil { + t.Errorf(err.Error()) + } + if err := os.MkdirAll(bazelNpmDir + "/bazel-darwin_x64", 0755); err != nil { + t.Errorf(err.Error()) + } + if _, err := os.Create(bazelNpmDir + "/bazel-linux_x64/bazel-1.2.3-linux_x86_64"); err != nil { + t.Errorf(err.Error()) + } + if _, err := os.Create(bazelNpmDir + "/bazel-windows_x64/bazel-1.2.3-windows_x86_64.exe"); err != nil { + t.Errorf(err.Error()) + } + if _, err := os.Create(bazelNpmDir + "/bazel-darwin_x64/bazel-1.2.3-darwin_x86_64"); err != nil { + t.Errorf(err.Error()) + } + for _, tt := range bazelNpmPathTests { + t.Run(tt.in, func(t *testing.T) { + result, err := bazelNpmPath(os.Getenv("TEST_TMPDIR") + tt.in) + if result != tt.out { + t.Errorf("Expected to resolve bazel binary to %v but was %v", tt.out, result) + } + if (err != nil && err.Error() != tt.err.Error()) { + t.Errorf("Expected error %v but was %v", tt.err.Error(), err.Error()) + } + }) + } +} + +var bazeliskNpmPathTests = []struct { + in string + out string + err error +}{ + {"/node_modules/@bazel/ibazel/bin/linux_amd64/ibazel", os.Getenv("TEST_TMPDIR") + "/node_modules/@bazel/bazelisk/bazelisk-linux_amd64", nil}, + {"/node_modules/@bazel/ibazel/bin/windows_amd64/ibazel.exe", os.Getenv("TEST_TMPDIR") + "/node_modules/@bazel/bazelisk/bazelisk-windows_amd64.exe", nil}, + {"/node_modules/@bazel/ibazel/bin/darwin_amd64/ibazel", os.Getenv("TEST_TMPDIR") + "/node_modules/@bazel/bazelisk/bazelisk-darwin_amd64", nil}, + {"/", "", errors.New("bazelisk binary not found in @bazel/bazelisk package")}, +} + +func TestBazeliskNpmPath(t *testing.T) { + // Where bazel gets installed by npm + bazeliskNpmDir := os.Getenv("TEST_TMPDIR") + "/node_modules/@bazel/bazelisk" + + if err := os.MkdirAll(bazeliskNpmDir, 0755); err != nil { + t.Errorf(err.Error()) + } + if _, err := os.Create(bazeliskNpmDir + "/bazelisk-linux_amd64"); err != nil { + t.Errorf(err.Error()) + } + if _, err := os.Create(bazeliskNpmDir + "/bazelisk-windows_amd64.exe"); err != nil { + t.Errorf(err.Error()) + } + if _, err := os.Create(bazeliskNpmDir + "/bazelisk-darwin_amd64"); err != nil { + t.Errorf(err.Error()) + } + for _, tt := range bazeliskNpmPathTests { + t.Run(tt.in, func(t *testing.T) { + result, err := bazeliskNpmPath(os.Getenv("TEST_TMPDIR") + tt.in) + if result != tt.out { + t.Errorf("Expected to resolve bazelisk binary from %s to %v but was %v", tt.in, tt.out, result) + } + if err != nil && tt.err != nil && err.Error() != tt.err.Error() { + t.Errorf("Expected error %v but was %v", tt.err.Error(), err.Error()) + } + }) + } +} diff --git a/go/tools/gopackagesdriver/bazel/proto/analysis/BUILD.bazel b/go/tools/gopackagesdriver/bazel/proto/analysis/BUILD.bazel new file mode 100755 index 0000000000..2afe68fc43 --- /dev/null +++ b/go/tools/gopackagesdriver/bazel/proto/analysis/BUILD.bazel @@ -0,0 +1,12 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "analysis", + srcs = ["analysis.pb.go"], + importpath = "github.com/bazelbuild/bazel-watcher/third_party/bazel/master/src/main/protobuf/analysis", + visibility = ["//visibility:public"], + deps = [ + "//go/tools/gopackagesdriver/bazel/proto/blaze_query", + "@com_github_golang_protobuf//proto:go_default_library", + ], +) diff --git a/go/tools/gopackagesdriver/bazel/proto/analysis/analysis.pb.go b/go/tools/gopackagesdriver/bazel/proto/analysis/analysis.pb.go new file mode 100755 index 0000000000..df791b39ab --- /dev/null +++ b/go/tools/gopackagesdriver/bazel/proto/analysis/analysis.pb.go @@ -0,0 +1,827 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: third_party/bazel/master/src/main/protobuf/analysis/analysis.proto + +package analysis + +import ( + fmt "fmt" + blaze_query "github.com/bazelbuild/bazel-watcher/third_party/bazel/master/src/main/protobuf/blaze_query" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type ActionGraphContainer struct { + Artifacts []*Artifact `protobuf:"bytes,1,rep,name=artifacts,proto3" json:"artifacts,omitempty"` + Actions []*Action `protobuf:"bytes,2,rep,name=actions,proto3" json:"actions,omitempty"` + Targets []*Target `protobuf:"bytes,3,rep,name=targets,proto3" json:"targets,omitempty"` + DepSetOfFiles []*DepSetOfFiles `protobuf:"bytes,4,rep,name=dep_set_of_files,json=depSetOfFiles,proto3" json:"dep_set_of_files,omitempty"` + Configuration []*Configuration `protobuf:"bytes,5,rep,name=configuration,proto3" json:"configuration,omitempty"` + AspectDescriptors []*AspectDescriptor `protobuf:"bytes,6,rep,name=aspect_descriptors,json=aspectDescriptors,proto3" json:"aspect_descriptors,omitempty"` + RuleClasses []*RuleClass `protobuf:"bytes,7,rep,name=rule_classes,json=ruleClasses,proto3" json:"rule_classes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ActionGraphContainer) Reset() { *m = ActionGraphContainer{} } +func (m *ActionGraphContainer) String() string { return proto.CompactTextString(m) } +func (*ActionGraphContainer) ProtoMessage() {} +func (*ActionGraphContainer) Descriptor() ([]byte, []int) { + return fileDescriptor_b577e5ef8e9d5380, []int{0} +} + +func (m *ActionGraphContainer) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ActionGraphContainer.Unmarshal(m, b) +} +func (m *ActionGraphContainer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ActionGraphContainer.Marshal(b, m, deterministic) +} +func (m *ActionGraphContainer) XXX_Merge(src proto.Message) { + xxx_messageInfo_ActionGraphContainer.Merge(m, src) +} +func (m *ActionGraphContainer) XXX_Size() int { + return xxx_messageInfo_ActionGraphContainer.Size(m) +} +func (m *ActionGraphContainer) XXX_DiscardUnknown() { + xxx_messageInfo_ActionGraphContainer.DiscardUnknown(m) +} + +var xxx_messageInfo_ActionGraphContainer proto.InternalMessageInfo + +func (m *ActionGraphContainer) GetArtifacts() []*Artifact { + if m != nil { + return m.Artifacts + } + return nil +} + +func (m *ActionGraphContainer) GetActions() []*Action { + if m != nil { + return m.Actions + } + return nil +} + +func (m *ActionGraphContainer) GetTargets() []*Target { + if m != nil { + return m.Targets + } + return nil +} + +func (m *ActionGraphContainer) GetDepSetOfFiles() []*DepSetOfFiles { + if m != nil { + return m.DepSetOfFiles + } + return nil +} + +func (m *ActionGraphContainer) GetConfiguration() []*Configuration { + if m != nil { + return m.Configuration + } + return nil +} + +func (m *ActionGraphContainer) GetAspectDescriptors() []*AspectDescriptor { + if m != nil { + return m.AspectDescriptors + } + return nil +} + +func (m *ActionGraphContainer) GetRuleClasses() []*RuleClass { + if m != nil { + return m.RuleClasses + } + return nil +} + +type Artifact struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ExecPath string `protobuf:"bytes,2,opt,name=exec_path,json=execPath,proto3" json:"exec_path,omitempty"` + IsTreeArtifact bool `protobuf:"varint,3,opt,name=is_tree_artifact,json=isTreeArtifact,proto3" json:"is_tree_artifact,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Artifact) Reset() { *m = Artifact{} } +func (m *Artifact) String() string { return proto.CompactTextString(m) } +func (*Artifact) ProtoMessage() {} +func (*Artifact) Descriptor() ([]byte, []int) { + return fileDescriptor_b577e5ef8e9d5380, []int{1} +} + +func (m *Artifact) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Artifact.Unmarshal(m, b) +} +func (m *Artifact) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Artifact.Marshal(b, m, deterministic) +} +func (m *Artifact) XXX_Merge(src proto.Message) { + xxx_messageInfo_Artifact.Merge(m, src) +} +func (m *Artifact) XXX_Size() int { + return xxx_messageInfo_Artifact.Size(m) +} +func (m *Artifact) XXX_DiscardUnknown() { + xxx_messageInfo_Artifact.DiscardUnknown(m) +} + +var xxx_messageInfo_Artifact proto.InternalMessageInfo + +func (m *Artifact) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *Artifact) GetExecPath() string { + if m != nil { + return m.ExecPath + } + return "" +} + +func (m *Artifact) GetIsTreeArtifact() bool { + if m != nil { + return m.IsTreeArtifact + } + return false +} + +type Action struct { + TargetId string `protobuf:"bytes,1,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"` + AspectDescriptorIds []string `protobuf:"bytes,2,rep,name=aspect_descriptor_ids,json=aspectDescriptorIds,proto3" json:"aspect_descriptor_ids,omitempty"` + ActionKey string `protobuf:"bytes,3,opt,name=action_key,json=actionKey,proto3" json:"action_key,omitempty"` + Mnemonic string `protobuf:"bytes,4,opt,name=mnemonic,proto3" json:"mnemonic,omitempty"` + ConfigurationId string `protobuf:"bytes,5,opt,name=configuration_id,json=configurationId,proto3" json:"configuration_id,omitempty"` + Arguments []string `protobuf:"bytes,6,rep,name=arguments,proto3" json:"arguments,omitempty"` + EnvironmentVariables []*KeyValuePair `protobuf:"bytes,7,rep,name=environment_variables,json=environmentVariables,proto3" json:"environment_variables,omitempty"` + InputDepSetIds []string `protobuf:"bytes,8,rep,name=input_dep_set_ids,json=inputDepSetIds,proto3" json:"input_dep_set_ids,omitempty"` + OutputIds []string `protobuf:"bytes,9,rep,name=output_ids,json=outputIds,proto3" json:"output_ids,omitempty"` + DiscoversInputs bool `protobuf:"varint,10,opt,name=discovers_inputs,json=discoversInputs,proto3" json:"discovers_inputs,omitempty"` + ExecutionInfo []*KeyValuePair `protobuf:"bytes,11,rep,name=execution_info,json=executionInfo,proto3" json:"execution_info,omitempty"` + ParamFiles []*ParamFile `protobuf:"bytes,12,rep,name=param_files,json=paramFiles,proto3" json:"param_files,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Action) Reset() { *m = Action{} } +func (m *Action) String() string { return proto.CompactTextString(m) } +func (*Action) ProtoMessage() {} +func (*Action) Descriptor() ([]byte, []int) { + return fileDescriptor_b577e5ef8e9d5380, []int{2} +} + +func (m *Action) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Action.Unmarshal(m, b) +} +func (m *Action) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Action.Marshal(b, m, deterministic) +} +func (m *Action) XXX_Merge(src proto.Message) { + xxx_messageInfo_Action.Merge(m, src) +} +func (m *Action) XXX_Size() int { + return xxx_messageInfo_Action.Size(m) +} +func (m *Action) XXX_DiscardUnknown() { + xxx_messageInfo_Action.DiscardUnknown(m) +} + +var xxx_messageInfo_Action proto.InternalMessageInfo + +func (m *Action) GetTargetId() string { + if m != nil { + return m.TargetId + } + return "" +} + +func (m *Action) GetAspectDescriptorIds() []string { + if m != nil { + return m.AspectDescriptorIds + } + return nil +} + +func (m *Action) GetActionKey() string { + if m != nil { + return m.ActionKey + } + return "" +} + +func (m *Action) GetMnemonic() string { + if m != nil { + return m.Mnemonic + } + return "" +} + +func (m *Action) GetConfigurationId() string { + if m != nil { + return m.ConfigurationId + } + return "" +} + +func (m *Action) GetArguments() []string { + if m != nil { + return m.Arguments + } + return nil +} + +func (m *Action) GetEnvironmentVariables() []*KeyValuePair { + if m != nil { + return m.EnvironmentVariables + } + return nil +} + +func (m *Action) GetInputDepSetIds() []string { + if m != nil { + return m.InputDepSetIds + } + return nil +} + +func (m *Action) GetOutputIds() []string { + if m != nil { + return m.OutputIds + } + return nil +} + +func (m *Action) GetDiscoversInputs() bool { + if m != nil { + return m.DiscoversInputs + } + return false +} + +func (m *Action) GetExecutionInfo() []*KeyValuePair { + if m != nil { + return m.ExecutionInfo + } + return nil +} + +func (m *Action) GetParamFiles() []*ParamFile { + if m != nil { + return m.ParamFiles + } + return nil +} + +type Target struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` + RuleClassId string `protobuf:"bytes,3,opt,name=rule_class_id,json=ruleClassId,proto3" json:"rule_class_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Target) Reset() { *m = Target{} } +func (m *Target) String() string { return proto.CompactTextString(m) } +func (*Target) ProtoMessage() {} +func (*Target) Descriptor() ([]byte, []int) { + return fileDescriptor_b577e5ef8e9d5380, []int{3} +} + +func (m *Target) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Target.Unmarshal(m, b) +} +func (m *Target) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Target.Marshal(b, m, deterministic) +} +func (m *Target) XXX_Merge(src proto.Message) { + xxx_messageInfo_Target.Merge(m, src) +} +func (m *Target) XXX_Size() int { + return xxx_messageInfo_Target.Size(m) +} +func (m *Target) XXX_DiscardUnknown() { + xxx_messageInfo_Target.DiscardUnknown(m) +} + +var xxx_messageInfo_Target proto.InternalMessageInfo + +func (m *Target) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *Target) GetLabel() string { + if m != nil { + return m.Label + } + return "" +} + +func (m *Target) GetRuleClassId() string { + if m != nil { + return m.RuleClassId + } + return "" +} + +type RuleClass struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RuleClass) Reset() { *m = RuleClass{} } +func (m *RuleClass) String() string { return proto.CompactTextString(m) } +func (*RuleClass) ProtoMessage() {} +func (*RuleClass) Descriptor() ([]byte, []int) { + return fileDescriptor_b577e5ef8e9d5380, []int{4} +} + +func (m *RuleClass) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RuleClass.Unmarshal(m, b) +} +func (m *RuleClass) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RuleClass.Marshal(b, m, deterministic) +} +func (m *RuleClass) XXX_Merge(src proto.Message) { + xxx_messageInfo_RuleClass.Merge(m, src) +} +func (m *RuleClass) XXX_Size() int { + return xxx_messageInfo_RuleClass.Size(m) +} +func (m *RuleClass) XXX_DiscardUnknown() { + xxx_messageInfo_RuleClass.DiscardUnknown(m) +} + +var xxx_messageInfo_RuleClass proto.InternalMessageInfo + +func (m *RuleClass) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *RuleClass) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type AspectDescriptor struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Parameters []*KeyValuePair `protobuf:"bytes,3,rep,name=parameters,proto3" json:"parameters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AspectDescriptor) Reset() { *m = AspectDescriptor{} } +func (m *AspectDescriptor) String() string { return proto.CompactTextString(m) } +func (*AspectDescriptor) ProtoMessage() {} +func (*AspectDescriptor) Descriptor() ([]byte, []int) { + return fileDescriptor_b577e5ef8e9d5380, []int{5} +} + +func (m *AspectDescriptor) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AspectDescriptor.Unmarshal(m, b) +} +func (m *AspectDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AspectDescriptor.Marshal(b, m, deterministic) +} +func (m *AspectDescriptor) XXX_Merge(src proto.Message) { + xxx_messageInfo_AspectDescriptor.Merge(m, src) +} +func (m *AspectDescriptor) XXX_Size() int { + return xxx_messageInfo_AspectDescriptor.Size(m) +} +func (m *AspectDescriptor) XXX_DiscardUnknown() { + xxx_messageInfo_AspectDescriptor.DiscardUnknown(m) +} + +var xxx_messageInfo_AspectDescriptor proto.InternalMessageInfo + +func (m *AspectDescriptor) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *AspectDescriptor) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *AspectDescriptor) GetParameters() []*KeyValuePair { + if m != nil { + return m.Parameters + } + return nil +} + +type DepSetOfFiles struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + TransitiveDepSetIds []string `protobuf:"bytes,2,rep,name=transitive_dep_set_ids,json=transitiveDepSetIds,proto3" json:"transitive_dep_set_ids,omitempty"` + DirectArtifactIds []string `protobuf:"bytes,3,rep,name=direct_artifact_ids,json=directArtifactIds,proto3" json:"direct_artifact_ids,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DepSetOfFiles) Reset() { *m = DepSetOfFiles{} } +func (m *DepSetOfFiles) String() string { return proto.CompactTextString(m) } +func (*DepSetOfFiles) ProtoMessage() {} +func (*DepSetOfFiles) Descriptor() ([]byte, []int) { + return fileDescriptor_b577e5ef8e9d5380, []int{6} +} + +func (m *DepSetOfFiles) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DepSetOfFiles.Unmarshal(m, b) +} +func (m *DepSetOfFiles) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DepSetOfFiles.Marshal(b, m, deterministic) +} +func (m *DepSetOfFiles) XXX_Merge(src proto.Message) { + xxx_messageInfo_DepSetOfFiles.Merge(m, src) +} +func (m *DepSetOfFiles) XXX_Size() int { + return xxx_messageInfo_DepSetOfFiles.Size(m) +} +func (m *DepSetOfFiles) XXX_DiscardUnknown() { + xxx_messageInfo_DepSetOfFiles.DiscardUnknown(m) +} + +var xxx_messageInfo_DepSetOfFiles proto.InternalMessageInfo + +func (m *DepSetOfFiles) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *DepSetOfFiles) GetTransitiveDepSetIds() []string { + if m != nil { + return m.TransitiveDepSetIds + } + return nil +} + +func (m *DepSetOfFiles) GetDirectArtifactIds() []string { + if m != nil { + return m.DirectArtifactIds + } + return nil +} + +type Configuration struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Mnemonic string `protobuf:"bytes,2,opt,name=mnemonic,proto3" json:"mnemonic,omitempty"` + PlatformName string `protobuf:"bytes,3,opt,name=platform_name,json=platformName,proto3" json:"platform_name,omitempty"` + Checksum string `protobuf:"bytes,4,opt,name=checksum,proto3" json:"checksum,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Configuration) Reset() { *m = Configuration{} } +func (m *Configuration) String() string { return proto.CompactTextString(m) } +func (*Configuration) ProtoMessage() {} +func (*Configuration) Descriptor() ([]byte, []int) { + return fileDescriptor_b577e5ef8e9d5380, []int{7} +} + +func (m *Configuration) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Configuration.Unmarshal(m, b) +} +func (m *Configuration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Configuration.Marshal(b, m, deterministic) +} +func (m *Configuration) XXX_Merge(src proto.Message) { + xxx_messageInfo_Configuration.Merge(m, src) +} +func (m *Configuration) XXX_Size() int { + return xxx_messageInfo_Configuration.Size(m) +} +func (m *Configuration) XXX_DiscardUnknown() { + xxx_messageInfo_Configuration.DiscardUnknown(m) +} + +var xxx_messageInfo_Configuration proto.InternalMessageInfo + +func (m *Configuration) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *Configuration) GetMnemonic() string { + if m != nil { + return m.Mnemonic + } + return "" +} + +func (m *Configuration) GetPlatformName() string { + if m != nil { + return m.PlatformName + } + return "" +} + +func (m *Configuration) GetChecksum() string { + if m != nil { + return m.Checksum + } + return "" +} + +type KeyValuePair struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *KeyValuePair) Reset() { *m = KeyValuePair{} } +func (m *KeyValuePair) String() string { return proto.CompactTextString(m) } +func (*KeyValuePair) ProtoMessage() {} +func (*KeyValuePair) Descriptor() ([]byte, []int) { + return fileDescriptor_b577e5ef8e9d5380, []int{8} +} + +func (m *KeyValuePair) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_KeyValuePair.Unmarshal(m, b) +} +func (m *KeyValuePair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_KeyValuePair.Marshal(b, m, deterministic) +} +func (m *KeyValuePair) XXX_Merge(src proto.Message) { + xxx_messageInfo_KeyValuePair.Merge(m, src) +} +func (m *KeyValuePair) XXX_Size() int { + return xxx_messageInfo_KeyValuePair.Size(m) +} +func (m *KeyValuePair) XXX_DiscardUnknown() { + xxx_messageInfo_KeyValuePair.DiscardUnknown(m) +} + +var xxx_messageInfo_KeyValuePair proto.InternalMessageInfo + +func (m *KeyValuePair) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *KeyValuePair) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +type ConfiguredTarget struct { + Target *blaze_query.Target `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + Configuration *Configuration `protobuf:"bytes,2,opt,name=configuration,proto3" json:"configuration,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConfiguredTarget) Reset() { *m = ConfiguredTarget{} } +func (m *ConfiguredTarget) String() string { return proto.CompactTextString(m) } +func (*ConfiguredTarget) ProtoMessage() {} +func (*ConfiguredTarget) Descriptor() ([]byte, []int) { + return fileDescriptor_b577e5ef8e9d5380, []int{9} +} + +func (m *ConfiguredTarget) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConfiguredTarget.Unmarshal(m, b) +} +func (m *ConfiguredTarget) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConfiguredTarget.Marshal(b, m, deterministic) +} +func (m *ConfiguredTarget) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfiguredTarget.Merge(m, src) +} +func (m *ConfiguredTarget) XXX_Size() int { + return xxx_messageInfo_ConfiguredTarget.Size(m) +} +func (m *ConfiguredTarget) XXX_DiscardUnknown() { + xxx_messageInfo_ConfiguredTarget.DiscardUnknown(m) +} + +var xxx_messageInfo_ConfiguredTarget proto.InternalMessageInfo + +func (m *ConfiguredTarget) GetTarget() *blaze_query.Target { + if m != nil { + return m.Target + } + return nil +} + +func (m *ConfiguredTarget) GetConfiguration() *Configuration { + if m != nil { + return m.Configuration + } + return nil +} + +type CqueryResult struct { + Results []*ConfiguredTarget `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CqueryResult) Reset() { *m = CqueryResult{} } +func (m *CqueryResult) String() string { return proto.CompactTextString(m) } +func (*CqueryResult) ProtoMessage() {} +func (*CqueryResult) Descriptor() ([]byte, []int) { + return fileDescriptor_b577e5ef8e9d5380, []int{10} +} + +func (m *CqueryResult) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CqueryResult.Unmarshal(m, b) +} +func (m *CqueryResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CqueryResult.Marshal(b, m, deterministic) +} +func (m *CqueryResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_CqueryResult.Merge(m, src) +} +func (m *CqueryResult) XXX_Size() int { + return xxx_messageInfo_CqueryResult.Size(m) +} +func (m *CqueryResult) XXX_DiscardUnknown() { + xxx_messageInfo_CqueryResult.DiscardUnknown(m) +} + +var xxx_messageInfo_CqueryResult proto.InternalMessageInfo + +func (m *CqueryResult) GetResults() []*ConfiguredTarget { + if m != nil { + return m.Results + } + return nil +} + +type ParamFile struct { + ExecPath string `protobuf:"bytes,1,opt,name=exec_path,json=execPath,proto3" json:"exec_path,omitempty"` + Arguments []string `protobuf:"bytes,2,rep,name=arguments,proto3" json:"arguments,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ParamFile) Reset() { *m = ParamFile{} } +func (m *ParamFile) String() string { return proto.CompactTextString(m) } +func (*ParamFile) ProtoMessage() {} +func (*ParamFile) Descriptor() ([]byte, []int) { + return fileDescriptor_b577e5ef8e9d5380, []int{11} +} + +func (m *ParamFile) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ParamFile.Unmarshal(m, b) +} +func (m *ParamFile) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ParamFile.Marshal(b, m, deterministic) +} +func (m *ParamFile) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParamFile.Merge(m, src) +} +func (m *ParamFile) XXX_Size() int { + return xxx_messageInfo_ParamFile.Size(m) +} +func (m *ParamFile) XXX_DiscardUnknown() { + xxx_messageInfo_ParamFile.DiscardUnknown(m) +} + +var xxx_messageInfo_ParamFile proto.InternalMessageInfo + +func (m *ParamFile) GetExecPath() string { + if m != nil { + return m.ExecPath + } + return "" +} + +func (m *ParamFile) GetArguments() []string { + if m != nil { + return m.Arguments + } + return nil +} + +func init() { + proto.RegisterType((*ActionGraphContainer)(nil), "analysis.ActionGraphContainer") + proto.RegisterType((*Artifact)(nil), "analysis.Artifact") + proto.RegisterType((*Action)(nil), "analysis.Action") + proto.RegisterType((*Target)(nil), "analysis.Target") + proto.RegisterType((*RuleClass)(nil), "analysis.RuleClass") + proto.RegisterType((*AspectDescriptor)(nil), "analysis.AspectDescriptor") + proto.RegisterType((*DepSetOfFiles)(nil), "analysis.DepSetOfFiles") + proto.RegisterType((*Configuration)(nil), "analysis.Configuration") + proto.RegisterType((*KeyValuePair)(nil), "analysis.KeyValuePair") + proto.RegisterType((*ConfiguredTarget)(nil), "analysis.ConfiguredTarget") + proto.RegisterType((*CqueryResult)(nil), "analysis.CqueryResult") + proto.RegisterType((*ParamFile)(nil), "analysis.ParamFile") +} + +func init() { + proto.RegisterFile("third_party/bazel/master/src/main/protobuf/analysis/analysis.proto", fileDescriptor_b577e5ef8e9d5380) +} + +var fileDescriptor_b577e5ef8e9d5380 = []byte{ + // 919 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x5f, 0x8b, 0xe3, 0x36, + 0x10, 0x27, 0xc9, 0x6e, 0x36,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, 0x29, 0x8c, 0x6d, + 0xc4, 0xc0, 0x09, 0x7f, 0xd2, 0x05, 0x9a, 0x40, 0x2f, 0x5a, 0x63, 0xf4, 0x41, 0x16, 0xa9, 0x9b, + 0x3c, 0x77, 0xf7, 0x6f, 0x60, 0x50, 0x2f, 0x10, 0x19, 0x43, 0x47, 0x4f, 0xaf, 0x8d, 0xae, 0x8f, + 0x9a, 0x01, 0x1b, 0xad, 0x76, 0x0c, 0x30, 0x17, 0xff, 0x0f, 0x18, 0xbb, 0xac, 0x31, 0x2e, 0xb9, + 0xf3, 0x2d, 0x74, 0xed, 0x02, 0x31, 0xe6, 0x9a, 0x76, 0xb5, 0x0f, 0xc9, 0x6d, 0xfc, 0x12, 0x72, + 0xb8, 0xae, 0xdb, 0xc6, 0xe6, 0x13, 0xd7, 0xb5, 0xff, 0x00, 0x83, 0x7b, 0xe3, 0x37, 0x40, 0x59, + 0x24, 0x8a, 0xbc, 0x86, 0x13, 0x61, 0x4e, 0xee, 0x1f, 0x9b, 0x1c, 0x3a, 0x72, 0x89, 0x06, 0x0e, + 0xea, 0xbf, 0x85, 0x7e, 0x35, 0x10, 0xfb, 0x2b, 0xb6, 0xd5, 0x58, 0xb1, 0x7b, 0x6b, 0xa7, 0xdd, + 0x58, 0x3b, 0x77, 0xdf, 0xc3, 0xd7, 0x11, 0x4f, 0xa7, 0x2b, 0xce, 0x57, 0x09, 0x4e, 0x63, 0xdc, + 0x28, 0xce, 0x13, 0x39, 0xb5, 0x7f, 0x70, 0xc2, 0x16, 0x55, 0x2e, 0x77, 0xa3, 0xdb, 0xf2, 0xf4, + 0xa4, 0x7f, 0x66, 0xb9, 0xe8, 0x9a, 0x1f, 0xfa, 0xd5, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc0, + 0xc3, 0x2c, 0x88, 0x35, 0x08, 0x00, 0x00, +} diff --git a/go/tools/gopackagesdriver/bazel/proto/blaze_query/BUILD.bazel b/go/tools/gopackagesdriver/bazel/proto/blaze_query/BUILD.bazel new file mode 100755 index 0000000000..11c34aaaeb --- /dev/null +++ b/go/tools/gopackagesdriver/bazel/proto/blaze_query/BUILD.bazel @@ -0,0 +1,11 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "blaze_query", + srcs = ["build.pb.go"], + importpath = "github.com/bazelbuild/bazel-watcher/third_party/bazel/master/src/main/protobuf/blaze_query", + visibility = ["//visibility:public"], + deps = [ + "@com_github_golang_protobuf//proto:go_default_library", + ], +) diff --git a/go/tools/gopackagesdriver/bazel/proto/blaze_query/build.pb.go b/go/tools/gopackagesdriver/bazel/proto/blaze_query/build.pb.go new file mode 100755 index 0000000000..b2db5222fa --- /dev/null +++ b/go/tools/gopackagesdriver/bazel/proto/blaze_query/build.pb.go @@ -0,0 +1,2095 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: third_party/bazel/master/src/main/protobuf/build.proto + +/* +Package blaze_query is a generated protocol buffer package. + +It is generated from these files: + third_party/bazel/master/src/main/protobuf/build.proto + +It has these top-level messages: + License + StringDictEntry + LabelDictUnaryEntry + LabelListDictEntry + LabelKeyedStringDictEntry + StringListDictEntry + FilesetEntry + Attribute + Rule + AttributeAspect + SkylarkAspect + RuleSummary + PackageGroup + EnvironmentGroup + SourceFile + GeneratedFile + Target + QueryResult + AllowedRuleClassInfo + AttributeDefinition + RuleDefinition + BuildLanguage + Location + MakeVarBinding + MakeVar + GlobCriteria + Event +*/ +package blaze_query + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// Indicates what to do when a source file is actually a symlink. +type FilesetEntry_SymlinkBehavior int32 + +const ( + FilesetEntry_COPY FilesetEntry_SymlinkBehavior = 1 + FilesetEntry_DEREFERENCE FilesetEntry_SymlinkBehavior = 2 +) + +var FilesetEntry_SymlinkBehavior_name = map[int32]string{ + 1: "COPY", + 2: "DEREFERENCE", +} +var FilesetEntry_SymlinkBehavior_value = map[string]int32{ + "COPY": 1, + "DEREFERENCE": 2, +} + +func (x FilesetEntry_SymlinkBehavior) Enum() *FilesetEntry_SymlinkBehavior { + p := new(FilesetEntry_SymlinkBehavior) + *p = x + return p +} +func (x FilesetEntry_SymlinkBehavior) String() string { + return proto.EnumName(FilesetEntry_SymlinkBehavior_name, int32(x)) +} +func (x *FilesetEntry_SymlinkBehavior) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FilesetEntry_SymlinkBehavior_value, data, "FilesetEntry_SymlinkBehavior") + if err != nil { + return err + } + *x = FilesetEntry_SymlinkBehavior(value) + return nil +} +func (FilesetEntry_SymlinkBehavior) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{6, 0} +} + +// Indicates the type of attribute. +type Attribute_Discriminator int32 + +const ( + Attribute_INTEGER Attribute_Discriminator = 1 + Attribute_STRING Attribute_Discriminator = 2 + Attribute_LABEL Attribute_Discriminator = 3 + Attribute_OUTPUT Attribute_Discriminator = 4 + Attribute_STRING_LIST Attribute_Discriminator = 5 + Attribute_LABEL_LIST Attribute_Discriminator = 6 + Attribute_OUTPUT_LIST Attribute_Discriminator = 7 + Attribute_DISTRIBUTION_SET Attribute_Discriminator = 8 + Attribute_LICENSE Attribute_Discriminator = 9 + Attribute_STRING_DICT Attribute_Discriminator = 10 + Attribute_FILESET_ENTRY_LIST Attribute_Discriminator = 11 + Attribute_LABEL_LIST_DICT Attribute_Discriminator = 12 + Attribute_STRING_LIST_DICT Attribute_Discriminator = 13 + Attribute_BOOLEAN Attribute_Discriminator = 14 + Attribute_TRISTATE Attribute_Discriminator = 15 + Attribute_INTEGER_LIST Attribute_Discriminator = 16 + Attribute_UNKNOWN Attribute_Discriminator = 18 + Attribute_LABEL_DICT_UNARY Attribute_Discriminator = 19 + Attribute_SELECTOR_LIST Attribute_Discriminator = 20 + Attribute_LABEL_KEYED_STRING_DICT Attribute_Discriminator = 21 + Attribute_DEPRECATED_STRING_DICT_UNARY Attribute_Discriminator = 17 +) + +var Attribute_Discriminator_name = map[int32]string{ + 1: "INTEGER", + 2: "STRING", + 3: "LABEL", + 4: "OUTPUT", + 5: "STRING_LIST", + 6: "LABEL_LIST", + 7: "OUTPUT_LIST", + 8: "DISTRIBUTION_SET", + 9: "LICENSE", + 10: "STRING_DICT", + 11: "FILESET_ENTRY_LIST", + 12: "LABEL_LIST_DICT", + 13: "STRING_LIST_DICT", + 14: "BOOLEAN", + 15: "TRISTATE", + 16: "INTEGER_LIST", + 18: "UNKNOWN", + 19: "LABEL_DICT_UNARY", + 20: "SELECTOR_LIST", + 21: "LABEL_KEYED_STRING_DICT", + 17: "DEPRECATED_STRING_DICT_UNARY", +} +var Attribute_Discriminator_value = map[string]int32{ + "INTEGER": 1, + "STRING": 2, + "LABEL": 3, + "OUTPUT": 4, + "STRING_LIST": 5, + "LABEL_LIST": 6, + "OUTPUT_LIST": 7, + "DISTRIBUTION_SET": 8, + "LICENSE": 9, + "STRING_DICT": 10, + "FILESET_ENTRY_LIST": 11, + "LABEL_LIST_DICT": 12, + "STRING_LIST_DICT": 13, + "BOOLEAN": 14, + "TRISTATE": 15, + "INTEGER_LIST": 16, + "UNKNOWN": 18, + "LABEL_DICT_UNARY": 19, + "SELECTOR_LIST": 20, + "LABEL_KEYED_STRING_DICT": 21, + "DEPRECATED_STRING_DICT_UNARY": 17, +} + +func (x Attribute_Discriminator) Enum() *Attribute_Discriminator { + p := new(Attribute_Discriminator) + *p = x + return p +} +func (x Attribute_Discriminator) String() string { + return proto.EnumName(Attribute_Discriminator_name, int32(x)) +} +func (x *Attribute_Discriminator) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Attribute_Discriminator_value, data, "Attribute_Discriminator") + if err != nil { + return err + } + *x = Attribute_Discriminator(value) + return nil +} +func (Attribute_Discriminator) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 0} } + +// Values for the TriState field type. +type Attribute_Tristate int32 + +const ( + Attribute_NO Attribute_Tristate = 0 + Attribute_YES Attribute_Tristate = 1 + Attribute_AUTO Attribute_Tristate = 2 +) + +var Attribute_Tristate_name = map[int32]string{ + 0: "NO", + 1: "YES", + 2: "AUTO", +} +var Attribute_Tristate_value = map[string]int32{ + "NO": 0, + "YES": 1, + "AUTO": 2, +} + +func (x Attribute_Tristate) Enum() *Attribute_Tristate { + p := new(Attribute_Tristate) + *p = x + return p +} +func (x Attribute_Tristate) String() string { + return proto.EnumName(Attribute_Tristate_name, int32(x)) +} +func (x *Attribute_Tristate) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Attribute_Tristate_value, data, "Attribute_Tristate") + if err != nil { + return err + } + *x = Attribute_Tristate(value) + return nil +} +func (Attribute_Tristate) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 1} } + +type Target_Discriminator int32 + +const ( + Target_RULE Target_Discriminator = 1 + Target_SOURCE_FILE Target_Discriminator = 2 + Target_GENERATED_FILE Target_Discriminator = 3 + Target_PACKAGE_GROUP Target_Discriminator = 4 + Target_ENVIRONMENT_GROUP Target_Discriminator = 5 +) + +var Target_Discriminator_name = map[int32]string{ + 1: "RULE", + 2: "SOURCE_FILE", + 3: "GENERATED_FILE", + 4: "PACKAGE_GROUP", + 5: "ENVIRONMENT_GROUP", +} +var Target_Discriminator_value = map[string]int32{ + "RULE": 1, + "SOURCE_FILE": 2, + "GENERATED_FILE": 3, + "PACKAGE_GROUP": 4, + "ENVIRONMENT_GROUP": 5, +} + +func (x Target_Discriminator) Enum() *Target_Discriminator { + p := new(Target_Discriminator) + *p = x + return p +} +func (x Target_Discriminator) String() string { + return proto.EnumName(Target_Discriminator_name, int32(x)) +} +func (x *Target_Discriminator) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Target_Discriminator_value, data, "Target_Discriminator") + if err != nil { + return err + } + *x = Target_Discriminator(value) + return nil +} +func (Target_Discriminator) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{16, 0} } + +type AllowedRuleClassInfo_AllowedRuleClasses int32 + +const ( + AllowedRuleClassInfo_ANY AllowedRuleClassInfo_AllowedRuleClasses = 1 + AllowedRuleClassInfo_SPECIFIED AllowedRuleClassInfo_AllowedRuleClasses = 2 +) + +var AllowedRuleClassInfo_AllowedRuleClasses_name = map[int32]string{ + 1: "ANY", + 2: "SPECIFIED", +} +var AllowedRuleClassInfo_AllowedRuleClasses_value = map[string]int32{ + "ANY": 1, + "SPECIFIED": 2, +} + +func (x AllowedRuleClassInfo_AllowedRuleClasses) Enum() *AllowedRuleClassInfo_AllowedRuleClasses { + p := new(AllowedRuleClassInfo_AllowedRuleClasses) + *p = x + return p +} +func (x AllowedRuleClassInfo_AllowedRuleClasses) String() string { + return proto.EnumName(AllowedRuleClassInfo_AllowedRuleClasses_name, int32(x)) +} +func (x *AllowedRuleClassInfo_AllowedRuleClasses) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(AllowedRuleClassInfo_AllowedRuleClasses_value, data, "AllowedRuleClassInfo_AllowedRuleClasses") + if err != nil { + return err + } + *x = AllowedRuleClassInfo_AllowedRuleClasses(value) + return nil +} +func (AllowedRuleClassInfo_AllowedRuleClasses) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{18, 0} +} + +type Event_EventKind int32 + +const ( + Event_ERROR Event_EventKind = 1 + Event_WARNING Event_EventKind = 2 + Event_INFO Event_EventKind = 3 + Event_PROGRESS Event_EventKind = 4 +) + +var Event_EventKind_name = map[int32]string{ + 1: "ERROR", + 2: "WARNING", + 3: "INFO", + 4: "PROGRESS", +} +var Event_EventKind_value = map[string]int32{ + "ERROR": 1, + "WARNING": 2, + "INFO": 3, + "PROGRESS": 4, +} + +func (x Event_EventKind) Enum() *Event_EventKind { + p := new(Event_EventKind) + *p = x + return p +} +func (x Event_EventKind) String() string { + return proto.EnumName(Event_EventKind_name, int32(x)) +} +func (x *Event_EventKind) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Event_EventKind_value, data, "Event_EventKind") + if err != nil { + return err + } + *x = Event_EventKind(value) + return nil +} +func (Event_EventKind) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{26, 0} } + +type License struct { + LicenseType []string `protobuf:"bytes,1,rep,name=license_type,json=licenseType" json:"license_type,omitempty"` + Exception []string `protobuf:"bytes,2,rep,name=exception" json:"exception,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *License) Reset() { *m = License{} } +func (m *License) String() string { return proto.CompactTextString(m) } +func (*License) ProtoMessage() {} +func (*License) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *License) GetLicenseType() []string { + if m != nil { + return m.LicenseType + } + return nil +} + +func (m *License) GetException() []string { + if m != nil { + return m.Exception + } + return nil +} + +type StringDictEntry struct { + Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` + Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *StringDictEntry) Reset() { *m = StringDictEntry{} } +func (m *StringDictEntry) String() string { return proto.CompactTextString(m) } +func (*StringDictEntry) ProtoMessage() {} +func (*StringDictEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *StringDictEntry) GetKey() string { + if m != nil && m.Key != nil { + return *m.Key + } + return "" +} + +func (m *StringDictEntry) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +type LabelDictUnaryEntry struct { + Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` + Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *LabelDictUnaryEntry) Reset() { *m = LabelDictUnaryEntry{} } +func (m *LabelDictUnaryEntry) String() string { return proto.CompactTextString(m) } +func (*LabelDictUnaryEntry) ProtoMessage() {} +func (*LabelDictUnaryEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *LabelDictUnaryEntry) GetKey() string { + if m != nil && m.Key != nil { + return *m.Key + } + return "" +} + +func (m *LabelDictUnaryEntry) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +type LabelListDictEntry struct { + Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` + Value []string `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *LabelListDictEntry) Reset() { *m = LabelListDictEntry{} } +func (m *LabelListDictEntry) String() string { return proto.CompactTextString(m) } +func (*LabelListDictEntry) ProtoMessage() {} +func (*LabelListDictEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *LabelListDictEntry) GetKey() string { + if m != nil && m.Key != nil { + return *m.Key + } + return "" +} + +func (m *LabelListDictEntry) GetValue() []string { + if m != nil { + return m.Value + } + return nil +} + +type LabelKeyedStringDictEntry struct { + Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` + Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *LabelKeyedStringDictEntry) Reset() { *m = LabelKeyedStringDictEntry{} } +func (m *LabelKeyedStringDictEntry) String() string { return proto.CompactTextString(m) } +func (*LabelKeyedStringDictEntry) ProtoMessage() {} +func (*LabelKeyedStringDictEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *LabelKeyedStringDictEntry) GetKey() string { + if m != nil && m.Key != nil { + return *m.Key + } + return "" +} + +func (m *LabelKeyedStringDictEntry) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +type StringListDictEntry struct { + Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` + Value []string `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *StringListDictEntry) Reset() { *m = StringListDictEntry{} } +func (m *StringListDictEntry) String() string { return proto.CompactTextString(m) } +func (*StringListDictEntry) ProtoMessage() {} +func (*StringListDictEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *StringListDictEntry) GetKey() string { + if m != nil && m.Key != nil { + return *m.Key + } + return "" +} + +func (m *StringListDictEntry) GetValue() []string { + if m != nil { + return m.Value + } + return nil +} + +// Represents an entry attribute of a Fileset rule in a build file. +type FilesetEntry struct { + // The label pointing to the source target where files are copied from. + Source *string `protobuf:"bytes,1,req,name=source" json:"source,omitempty"` + // The relative path within the fileset rule where files will be mapped. + DestinationDirectory *string `protobuf:"bytes,2,req,name=destination_directory,json=destinationDirectory" json:"destination_directory,omitempty"` + // Whether the files= attribute was specified. This is necessary because + // no files= attribute and files=[] mean different things. + FilesPresent *bool `protobuf:"varint,7,opt,name=files_present,json=filesPresent" json:"files_present,omitempty"` + // A list of file labels to include from the source directory. + File []string `protobuf:"bytes,3,rep,name=file" json:"file,omitempty"` + // If this is a fileset entry representing files within the rule + // package, this lists relative paths to files that should be excluded from + // the set. This cannot contain values if 'file' also has values. + Exclude []string `protobuf:"bytes,4,rep,name=exclude" json:"exclude,omitempty"` + // This field is optional because there will be some time when the new + // PB is used by tools depending on blaze query, but the new blaze version + // is not yet released. + // TODO(bazel-team): Make this field required once a version of Blaze is + // released that outputs this field. + SymlinkBehavior *FilesetEntry_SymlinkBehavior `protobuf:"varint,5,opt,name=symlink_behavior,json=symlinkBehavior,enum=blaze_query.FilesetEntry_SymlinkBehavior,def=1" json:"symlink_behavior,omitempty"` + // The prefix to strip from the path of the files in this FilesetEntry. Note + // that no value and the empty string as the value mean different things here. + StripPrefix *string `protobuf:"bytes,6,opt,name=strip_prefix,json=stripPrefix" json:"strip_prefix,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *FilesetEntry) Reset() { *m = FilesetEntry{} } +func (m *FilesetEntry) String() string { return proto.CompactTextString(m) } +func (*FilesetEntry) ProtoMessage() {} +func (*FilesetEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +const Default_FilesetEntry_SymlinkBehavior FilesetEntry_SymlinkBehavior = FilesetEntry_COPY + +func (m *FilesetEntry) GetSource() string { + if m != nil && m.Source != nil { + return *m.Source + } + return "" +} + +func (m *FilesetEntry) GetDestinationDirectory() string { + if m != nil && m.DestinationDirectory != nil { + return *m.DestinationDirectory + } + return "" +} + +func (m *FilesetEntry) GetFilesPresent() bool { + if m != nil && m.FilesPresent != nil { + return *m.FilesPresent + } + return false +} + +func (m *FilesetEntry) GetFile() []string { + if m != nil { + return m.File + } + return nil +} + +func (m *FilesetEntry) GetExclude() []string { + if m != nil { + return m.Exclude + } + return nil +} + +func (m *FilesetEntry) GetSymlinkBehavior() FilesetEntry_SymlinkBehavior { + if m != nil && m.SymlinkBehavior != nil { + return *m.SymlinkBehavior + } + return Default_FilesetEntry_SymlinkBehavior +} + +func (m *FilesetEntry) GetStripPrefix() string { + if m != nil && m.StripPrefix != nil { + return *m.StripPrefix + } + return "" +} + +// A rule attribute. Each attribute must have a type and one of the various +// value fields populated - for the most part. +// +// Attributes of BOOLEAN and TRISTATE type may set all of the int, bool, and +// string values for backwards compatibility with clients that expect them to +// be set. +// +// Attributes of INTEGER, STRING, LABEL, LICENSE, BOOLEAN, and TRISTATE type +// may set *none* of the values. This can happen if the Attribute message is +// prepared for a client that doesn't support SELECTOR_LIST, but the rule has +// a selector list value for the attribute. (Selector lists for attributes of +// other types--the collection types--are handled differently when prepared +// for such a client. The possible collection values are gathered together +// and flattened.) +// +// By checking the type, the appropriate value can be extracted - see the +// comments on each type for the associated value. The order of lists comes +// from the blaze parsing. If an attribute is of a list type, the associated +// list should never be empty. +type Attribute struct { + // The name of the attribute + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + // The location of the target in the BUILD file in a machine-parseable form. + DEPRECATEDParseableLocation *Location `protobuf:"bytes,12,opt,name=DEPRECATED_parseable_location,json=DEPRECATEDParseableLocation" json:"DEPRECATED_parseable_location,omitempty"` + // Whether the attribute was explicitly specified + ExplicitlySpecified *bool `protobuf:"varint,13,opt,name=explicitly_specified,json=explicitlySpecified" json:"explicitly_specified,omitempty"` + // If this attribute has a string value or a string list value, then this + // may be set to indicate that the value may be treated as a label that + // isn't a dependency of this attribute's rule. + Nodep *bool `protobuf:"varint,20,opt,name=nodep" json:"nodep,omitempty"` + // The type of attribute. This message is used for all of the different + // attribute types so the discriminator helps for figuring out what is + // stored in the message. + Type *Attribute_Discriminator `protobuf:"varint,2,req,name=type,enum=blaze_query.Attribute_Discriminator" json:"type,omitempty"` + // If this attribute has an integer value this will be populated. + // Boolean and TriState also use this field as [0,1] and [-1,0,1] + // for [false, true] and [auto, no, yes] respectively. + IntValue *int32 `protobuf:"varint,3,opt,name=int_value,json=intValue" json:"int_value,omitempty"` + // If the attribute has a string value this will be populated. Label and + // path attributes use this field as the value even though the type may + // be LABEL or something else other than STRING. + StringValue *string `protobuf:"bytes,5,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + // If the attribute has a boolean value this will be populated. + BooleanValue *bool `protobuf:"varint,14,opt,name=boolean_value,json=booleanValue" json:"boolean_value,omitempty"` + // If the attribute is a Tristate value, this will be populated. + TristateValue *Attribute_Tristate `protobuf:"varint,15,opt,name=tristate_value,json=tristateValue,enum=blaze_query.Attribute_Tristate" json:"tristate_value,omitempty"` + // The value of the attribute has a list of string values (label and path + // note from STRING applies here as well). + StringListValue []string `protobuf:"bytes,6,rep,name=string_list_value,json=stringListValue" json:"string_list_value,omitempty"` + // If this is a license attribute, the license information is stored here. + License *License `protobuf:"bytes,7,opt,name=license" json:"license,omitempty"` + // If this is a string dict, each entry will be stored here. + StringDictValue []*StringDictEntry `protobuf:"bytes,8,rep,name=string_dict_value,json=stringDictValue" json:"string_dict_value,omitempty"` + // If the attribute is part of a Fileset, the fileset entries are stored in + // this field. + FilesetListValue []*FilesetEntry `protobuf:"bytes,9,rep,name=fileset_list_value,json=filesetListValue" json:"fileset_list_value,omitempty"` + // If this is a label list dict, each entry will be stored here. + LabelListDictValue []*LabelListDictEntry `protobuf:"bytes,10,rep,name=label_list_dict_value,json=labelListDictValue" json:"label_list_dict_value,omitempty"` + // If this is a string list dict, each entry will be stored here. + StringListDictValue []*StringListDictEntry `protobuf:"bytes,11,rep,name=string_list_dict_value,json=stringListDictValue" json:"string_list_dict_value,omitempty"` + // The glob criteria. This is non-empty if: + // 1. This attribute is a list of strings or labels, and, + // 2. It contained a glob() expression + GlobCriteria []*GlobCriteria `protobuf:"bytes,16,rep,name=glob_criteria,json=globCriteria" json:"glob_criteria,omitempty"` + // The value of the attribute has a list of int32 values + IntListValue []int32 `protobuf:"varint,17,rep,name=int_list_value,json=intListValue" json:"int_list_value,omitempty"` + // If this is a label dict unary, each entry will be stored here. + LabelDictUnaryValue []*LabelDictUnaryEntry `protobuf:"bytes,19,rep,name=label_dict_unary_value,json=labelDictUnaryValue" json:"label_dict_unary_value,omitempty"` + // If this is a label-keyed string dict, each entry will be stored here. + LabelKeyedStringDictValue []*LabelKeyedStringDictEntry `protobuf:"bytes,22,rep,name=label_keyed_string_dict_value,json=labelKeyedStringDictValue" json:"label_keyed_string_dict_value,omitempty"` + // If this attribute's value is an expression containing one or more select + // expressions, then its type is SELECTOR_LIST and a SelectorList will be + // stored here. + SelectorList *Attribute_SelectorList `protobuf:"bytes,21,opt,name=selector_list,json=selectorList" json:"selector_list,omitempty"` + DEPRECATEDStringDictUnaryValue [][]byte `protobuf:"bytes,18,rep,name=DEPRECATED_string_dict_unary_value,json=DEPRECATEDStringDictUnaryValue" json:"DEPRECATED_string_dict_unary_value,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Attribute) Reset() { *m = Attribute{} } +func (m *Attribute) String() string { return proto.CompactTextString(m) } +func (*Attribute) ProtoMessage() {} +func (*Attribute) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *Attribute) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *Attribute) GetDEPRECATEDParseableLocation() *Location { + if m != nil { + return m.DEPRECATEDParseableLocation + } + return nil +} + +func (m *Attribute) GetExplicitlySpecified() bool { + if m != nil && m.ExplicitlySpecified != nil { + return *m.ExplicitlySpecified + } + return false +} + +func (m *Attribute) GetNodep() bool { + if m != nil && m.Nodep != nil { + return *m.Nodep + } + return false +} + +func (m *Attribute) GetType() Attribute_Discriminator { + if m != nil && m.Type != nil { + return *m.Type + } + return Attribute_INTEGER +} + +func (m *Attribute) GetIntValue() int32 { + if m != nil && m.IntValue != nil { + return *m.IntValue + } + return 0 +} + +func (m *Attribute) GetStringValue() string { + if m != nil && m.StringValue != nil { + return *m.StringValue + } + return "" +} + +func (m *Attribute) GetBooleanValue() bool { + if m != nil && m.BooleanValue != nil { + return *m.BooleanValue + } + return false +} + +func (m *Attribute) GetTristateValue() Attribute_Tristate { + if m != nil && m.TristateValue != nil { + return *m.TristateValue + } + return Attribute_NO +} + +func (m *Attribute) GetStringListValue() []string { + if m != nil { + return m.StringListValue + } + return nil +} + +func (m *Attribute) GetLicense() *License { + if m != nil { + return m.License + } + return nil +} + +func (m *Attribute) GetStringDictValue() []*StringDictEntry { + if m != nil { + return m.StringDictValue + } + return nil +} + +func (m *Attribute) GetFilesetListValue() []*FilesetEntry { + if m != nil { + return m.FilesetListValue + } + return nil +} + +func (m *Attribute) GetLabelListDictValue() []*LabelListDictEntry { + if m != nil { + return m.LabelListDictValue + } + return nil +} + +func (m *Attribute) GetStringListDictValue() []*StringListDictEntry { + if m != nil { + return m.StringListDictValue + } + return nil +} + +func (m *Attribute) GetGlobCriteria() []*GlobCriteria { + if m != nil { + return m.GlobCriteria + } + return nil +} + +func (m *Attribute) GetIntListValue() []int32 { + if m != nil { + return m.IntListValue + } + return nil +} + +func (m *Attribute) GetLabelDictUnaryValue() []*LabelDictUnaryEntry { + if m != nil { + return m.LabelDictUnaryValue + } + return nil +} + +func (m *Attribute) GetLabelKeyedStringDictValue() []*LabelKeyedStringDictEntry { + if m != nil { + return m.LabelKeyedStringDictValue + } + return nil +} + +func (m *Attribute) GetSelectorList() *Attribute_SelectorList { + if m != nil { + return m.SelectorList + } + return nil +} + +func (m *Attribute) GetDEPRECATEDStringDictUnaryValue() [][]byte { + if m != nil { + return m.DEPRECATEDStringDictUnaryValue + } + return nil +} + +type Attribute_SelectorEntry struct { + // The key of the selector entry. At this time, this is the label of a + // config_setting rule, or the pseudo-label "//conditions:default". + Label *string `protobuf:"bytes,1,opt,name=label" json:"label,omitempty"` + // True if the entry's value is the default value for the type as a + // result of the condition value being specified as None (ie: + // {"//condition": None}). + IsDefaultValue *bool `protobuf:"varint,16,opt,name=is_default_value,json=isDefaultValue" json:"is_default_value,omitempty"` + // Exactly one of the following fields (except for glob_criteria) must be + // populated - note that the BOOLEAN and TRISTATE caveat in Attribute's + // comment does not apply here. The type field in the SelectorList + // containing this entry indicates which of these fields is populated, + // in accordance with the comments on Discriminator enum values above. + // (To be explicit: BOOLEAN populates the boolean_value field and TRISTATE + // populates the tristate_value field.) + IntValue *int32 `protobuf:"varint,2,opt,name=int_value,json=intValue" json:"int_value,omitempty"` + StringValue *string `protobuf:"bytes,3,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + BooleanValue *bool `protobuf:"varint,4,opt,name=boolean_value,json=booleanValue" json:"boolean_value,omitempty"` + TristateValue *Attribute_Tristate `protobuf:"varint,5,opt,name=tristate_value,json=tristateValue,enum=blaze_query.Attribute_Tristate" json:"tristate_value,omitempty"` + StringListValue []string `protobuf:"bytes,6,rep,name=string_list_value,json=stringListValue" json:"string_list_value,omitempty"` + License *License `protobuf:"bytes,7,opt,name=license" json:"license,omitempty"` + StringDictValue []*StringDictEntry `protobuf:"bytes,8,rep,name=string_dict_value,json=stringDictValue" json:"string_dict_value,omitempty"` + FilesetListValue []*FilesetEntry `protobuf:"bytes,9,rep,name=fileset_list_value,json=filesetListValue" json:"fileset_list_value,omitempty"` + LabelListDictValue []*LabelListDictEntry `protobuf:"bytes,10,rep,name=label_list_dict_value,json=labelListDictValue" json:"label_list_dict_value,omitempty"` + StringListDictValue []*StringListDictEntry `protobuf:"bytes,11,rep,name=string_list_dict_value,json=stringListDictValue" json:"string_list_dict_value,omitempty"` + GlobCriteria []*GlobCriteria `protobuf:"bytes,12,rep,name=glob_criteria,json=globCriteria" json:"glob_criteria,omitempty"` + IntListValue []int32 `protobuf:"varint,13,rep,name=int_list_value,json=intListValue" json:"int_list_value,omitempty"` + LabelDictUnaryValue []*LabelDictUnaryEntry `protobuf:"bytes,15,rep,name=label_dict_unary_value,json=labelDictUnaryValue" json:"label_dict_unary_value,omitempty"` + LabelKeyedStringDictValue []*LabelKeyedStringDictEntry `protobuf:"bytes,17,rep,name=label_keyed_string_dict_value,json=labelKeyedStringDictValue" json:"label_keyed_string_dict_value,omitempty"` + DEPRECATEDStringDictUnaryValue [][]byte `protobuf:"bytes,14,rep,name=DEPRECATED_string_dict_unary_value,json=DEPRECATEDStringDictUnaryValue" json:"DEPRECATED_string_dict_unary_value,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Attribute_SelectorEntry) Reset() { *m = Attribute_SelectorEntry{} } +func (m *Attribute_SelectorEntry) String() string { return proto.CompactTextString(m) } +func (*Attribute_SelectorEntry) ProtoMessage() {} +func (*Attribute_SelectorEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 0} } + +func (m *Attribute_SelectorEntry) GetLabel() string { + if m != nil && m.Label != nil { + return *m.Label + } + return "" +} + +func (m *Attribute_SelectorEntry) GetIsDefaultValue() bool { + if m != nil && m.IsDefaultValue != nil { + return *m.IsDefaultValue + } + return false +} + +func (m *Attribute_SelectorEntry) GetIntValue() int32 { + if m != nil && m.IntValue != nil { + return *m.IntValue + } + return 0 +} + +func (m *Attribute_SelectorEntry) GetStringValue() string { + if m != nil && m.StringValue != nil { + return *m.StringValue + } + return "" +} + +func (m *Attribute_SelectorEntry) GetBooleanValue() bool { + if m != nil && m.BooleanValue != nil { + return *m.BooleanValue + } + return false +} + +func (m *Attribute_SelectorEntry) GetTristateValue() Attribute_Tristate { + if m != nil && m.TristateValue != nil { + return *m.TristateValue + } + return Attribute_NO +} + +func (m *Attribute_SelectorEntry) GetStringListValue() []string { + if m != nil { + return m.StringListValue + } + return nil +} + +func (m *Attribute_SelectorEntry) GetLicense() *License { + if m != nil { + return m.License + } + return nil +} + +func (m *Attribute_SelectorEntry) GetStringDictValue() []*StringDictEntry { + if m != nil { + return m.StringDictValue + } + return nil +} + +func (m *Attribute_SelectorEntry) GetFilesetListValue() []*FilesetEntry { + if m != nil { + return m.FilesetListValue + } + return nil +} + +func (m *Attribute_SelectorEntry) GetLabelListDictValue() []*LabelListDictEntry { + if m != nil { + return m.LabelListDictValue + } + return nil +} + +func (m *Attribute_SelectorEntry) GetStringListDictValue() []*StringListDictEntry { + if m != nil { + return m.StringListDictValue + } + return nil +} + +func (m *Attribute_SelectorEntry) GetGlobCriteria() []*GlobCriteria { + if m != nil { + return m.GlobCriteria + } + return nil +} + +func (m *Attribute_SelectorEntry) GetIntListValue() []int32 { + if m != nil { + return m.IntListValue + } + return nil +} + +func (m *Attribute_SelectorEntry) GetLabelDictUnaryValue() []*LabelDictUnaryEntry { + if m != nil { + return m.LabelDictUnaryValue + } + return nil +} + +func (m *Attribute_SelectorEntry) GetLabelKeyedStringDictValue() []*LabelKeyedStringDictEntry { + if m != nil { + return m.LabelKeyedStringDictValue + } + return nil +} + +func (m *Attribute_SelectorEntry) GetDEPRECATEDStringDictUnaryValue() [][]byte { + if m != nil { + return m.DEPRECATEDStringDictUnaryValue + } + return nil +} + +type Attribute_Selector struct { + // The list of (label, value) pairs in the map that defines the selector. + // At this time, this cannot be empty, i.e. a selector has at least one + // entry. + Entries []*Attribute_SelectorEntry `protobuf:"bytes,1,rep,name=entries" json:"entries,omitempty"` + // Whether or not this has any default values. + HasDefaultValue *bool `protobuf:"varint,2,opt,name=has_default_value,json=hasDefaultValue" json:"has_default_value,omitempty"` + // The error message when no condition matches. + NoMatchError *string `protobuf:"bytes,3,opt,name=no_match_error,json=noMatchError" json:"no_match_error,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Attribute_Selector) Reset() { *m = Attribute_Selector{} } +func (m *Attribute_Selector) String() string { return proto.CompactTextString(m) } +func (*Attribute_Selector) ProtoMessage() {} +func (*Attribute_Selector) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 1} } + +func (m *Attribute_Selector) GetEntries() []*Attribute_SelectorEntry { + if m != nil { + return m.Entries + } + return nil +} + +func (m *Attribute_Selector) GetHasDefaultValue() bool { + if m != nil && m.HasDefaultValue != nil { + return *m.HasDefaultValue + } + return false +} + +func (m *Attribute_Selector) GetNoMatchError() string { + if m != nil && m.NoMatchError != nil { + return *m.NoMatchError + } + return "" +} + +type Attribute_SelectorList struct { + // The type that this selector list evaluates to, and the type that each + // selector in the list evaluates to. At this time, this cannot be + // SELECTOR_LIST, i.e. selector lists do not nest. + Type *Attribute_Discriminator `protobuf:"varint,1,opt,name=type,enum=blaze_query.Attribute_Discriminator" json:"type,omitempty"` + // The list of selector elements in this selector list. At this time, this + // cannot be empty, i.e. a selector list is never empty. + Elements []*Attribute_Selector `protobuf:"bytes,2,rep,name=elements" json:"elements,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Attribute_SelectorList) Reset() { *m = Attribute_SelectorList{} } +func (m *Attribute_SelectorList) String() string { return proto.CompactTextString(m) } +func (*Attribute_SelectorList) ProtoMessage() {} +func (*Attribute_SelectorList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 2} } + +func (m *Attribute_SelectorList) GetType() Attribute_Discriminator { + if m != nil && m.Type != nil { + return *m.Type + } + return Attribute_INTEGER +} + +func (m *Attribute_SelectorList) GetElements() []*Attribute_Selector { + if m != nil { + return m.Elements + } + return nil +} + +// A rule from a BUILD file (e.g., cc_library, java_binary). The rule class +// is the actual name of the rule (e.g., cc_library) and the name is the full +// label of the rule (e.g., //foo/bar:baz). +type Rule struct { + // The name of the rule + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + // The rule class (e.g., java_library) + RuleClass *string `protobuf:"bytes,2,req,name=rule_class,json=ruleClass" json:"rule_class,omitempty"` + // The BUILD file and line number of the rule. + Location *string `protobuf:"bytes,3,opt,name=location" json:"location,omitempty"` + // All of the attributes that describe the rule. + Attribute []*Attribute `protobuf:"bytes,4,rep,name=attribute" json:"attribute,omitempty"` + // All of the inputs to the rule. These are predecessors in the dependency + // graph. A rule_input for a rule should always be described as a + // source_file in some package (either the rule's package or some other one). + RuleInput []string `protobuf:"bytes,5,rep,name=rule_input,json=ruleInput" json:"rule_input,omitempty"` + // All of the outputs of the rule. These are the successors in the + // dependency graph. + RuleOutput []string `protobuf:"bytes,6,rep,name=rule_output,json=ruleOutput" json:"rule_output,omitempty"` + // The set of all default settings affecting this rule. The name of a default + // setting is "_". There currently defined setting + // types are: + // + // - 'blaze': settings implemented in Blaze itself + DefaultSetting []string `protobuf:"bytes,7,rep,name=default_setting,json=defaultSetting" json:"default_setting,omitempty"` + // The location of the target in the BUILD file in a machine-parseable form. + DEPRECATEDParseableLocation *Location `protobuf:"bytes,8,opt,name=DEPRECATED_parseable_location,json=DEPRECATEDParseableLocation" json:"DEPRECATED_parseable_location,omitempty"` + // The rule's class's public by default value. + PublicByDefault *bool `protobuf:"varint,9,opt,name=public_by_default,json=publicByDefault" json:"public_by_default,omitempty"` + // If this rule is of a skylark-defined RuleClass. + IsSkylark *bool `protobuf:"varint,10,opt,name=is_skylark,json=isSkylark" json:"is_skylark,omitempty"` + // List of Skylark aspects that this rule applies. + SkylarkAttributeAspects []*AttributeAspect `protobuf:"bytes,11,rep,name=skylark_attribute_aspects,json=skylarkAttributeAspects" json:"skylark_attribute_aspects,omitempty"` + // Hash encapsulating the behavior of this Skylark rule. Any change to this + // rule's definition that could change its behavior will be reflected here. + SkylarkEnvironmentHashCode *string `protobuf:"bytes,12,opt,name=skylark_environment_hash_code,json=skylarkEnvironmentHashCode" json:"skylark_environment_hash_code,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Rule) Reset() { *m = Rule{} } +func (m *Rule) String() string { return proto.CompactTextString(m) } +func (*Rule) ProtoMessage() {} +func (*Rule) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *Rule) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *Rule) GetRuleClass() string { + if m != nil && m.RuleClass != nil { + return *m.RuleClass + } + return "" +} + +func (m *Rule) GetLocation() string { + if m != nil && m.Location != nil { + return *m.Location + } + return "" +} + +func (m *Rule) GetAttribute() []*Attribute { + if m != nil { + return m.Attribute + } + return nil +} + +func (m *Rule) GetRuleInput() []string { + if m != nil { + return m.RuleInput + } + return nil +} + +func (m *Rule) GetRuleOutput() []string { + if m != nil { + return m.RuleOutput + } + return nil +} + +func (m *Rule) GetDefaultSetting() []string { + if m != nil { + return m.DefaultSetting + } + return nil +} + +func (m *Rule) GetDEPRECATEDParseableLocation() *Location { + if m != nil { + return m.DEPRECATEDParseableLocation + } + return nil +} + +func (m *Rule) GetPublicByDefault() bool { + if m != nil && m.PublicByDefault != nil { + return *m.PublicByDefault + } + return false +} + +func (m *Rule) GetIsSkylark() bool { + if m != nil && m.IsSkylark != nil { + return *m.IsSkylark + } + return false +} + +func (m *Rule) GetSkylarkAttributeAspects() []*AttributeAspect { + if m != nil { + return m.SkylarkAttributeAspects + } + return nil +} + +func (m *Rule) GetSkylarkEnvironmentHashCode() string { + if m != nil && m.SkylarkEnvironmentHashCode != nil { + return *m.SkylarkEnvironmentHashCode + } + return "" +} + +// A pairing of attribute name and a Skylark aspect that is applied to that attribute. +type AttributeAspect struct { + AttributeName *string `protobuf:"bytes,1,req,name=attribute_name,json=attributeName" json:"attribute_name,omitempty"` + Aspect *SkylarkAspect `protobuf:"bytes,2,req,name=aspect" json:"aspect,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *AttributeAspect) Reset() { *m = AttributeAspect{} } +func (m *AttributeAspect) String() string { return proto.CompactTextString(m) } +func (*AttributeAspect) ProtoMessage() {} +func (*AttributeAspect) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *AttributeAspect) GetAttributeName() string { + if m != nil && m.AttributeName != nil { + return *m.AttributeName + } + return "" +} + +func (m *AttributeAspect) GetAspect() *SkylarkAspect { + if m != nil { + return m.Aspect + } + return nil +} + +// Aspect defined in Skylark. +type SkylarkAspect struct { + ExtensionFileLabel *string `protobuf:"bytes,1,req,name=extension_file_label,json=extensionFileLabel" json:"extension_file_label,omitempty"` + ExportedName *string `protobuf:"bytes,2,req,name=exported_name,json=exportedName" json:"exported_name,omitempty"` + Attribute []*Attribute `protobuf:"bytes,3,rep,name=attribute" json:"attribute,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SkylarkAspect) Reset() { *m = SkylarkAspect{} } +func (m *SkylarkAspect) String() string { return proto.CompactTextString(m) } +func (*SkylarkAspect) ProtoMessage() {} +func (*SkylarkAspect) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } + +func (m *SkylarkAspect) GetExtensionFileLabel() string { + if m != nil && m.ExtensionFileLabel != nil { + return *m.ExtensionFileLabel + } + return "" +} + +func (m *SkylarkAspect) GetExportedName() string { + if m != nil && m.ExportedName != nil { + return *m.ExportedName + } + return "" +} + +func (m *SkylarkAspect) GetAttribute() []*Attribute { + if m != nil { + return m.Attribute + } + return nil +} + +// Summary of all transitive dependencies of 'rule,' where each dependent +// rule is included only once in the 'dependency' field. Gives complete +// information to analyze the single build target labeled rule.name, +// including optional location of target in BUILD file. +type RuleSummary struct { + Rule *Rule `protobuf:"bytes,1,req,name=rule" json:"rule,omitempty"` + Dependency []*Rule `protobuf:"bytes,2,rep,name=dependency" json:"dependency,omitempty"` + Location *string `protobuf:"bytes,3,opt,name=location" json:"location,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RuleSummary) Reset() { *m = RuleSummary{} } +func (m *RuleSummary) String() string { return proto.CompactTextString(m) } +func (*RuleSummary) ProtoMessage() {} +func (*RuleSummary) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func (m *RuleSummary) GetRule() *Rule { + if m != nil { + return m.Rule + } + return nil +} + +func (m *RuleSummary) GetDependency() []*Rule { + if m != nil { + return m.Dependency + } + return nil +} + +func (m *RuleSummary) GetLocation() string { + if m != nil && m.Location != nil { + return *m.Location + } + return "" +} + +// A package group. Aside from the name, it contains the list of packages +// present in the group (as specified in the BUILD file). +type PackageGroup struct { + // The name of the package group + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + // The list of packages as specified in the BUILD file. Currently this is + // only a list of packages, but some time in the future, there might be + // some type of wildcard mechanism. + ContainedPackage []string `protobuf:"bytes,2,rep,name=contained_package,json=containedPackage" json:"contained_package,omitempty"` + // The list of sub package groups included in this one. + IncludedPackageGroup []string `protobuf:"bytes,3,rep,name=included_package_group,json=includedPackageGroup" json:"included_package_group,omitempty"` + // The location of the target in the BUILD file in a machine-parseable form. + DEPRECATEDParseableLocation *Location `protobuf:"bytes,4,opt,name=DEPRECATED_parseable_location,json=DEPRECATEDParseableLocation" json:"DEPRECATED_parseable_location,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *PackageGroup) Reset() { *m = PackageGroup{} } +func (m *PackageGroup) String() string { return proto.CompactTextString(m) } +func (*PackageGroup) ProtoMessage() {} +func (*PackageGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } + +func (m *PackageGroup) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *PackageGroup) GetContainedPackage() []string { + if m != nil { + return m.ContainedPackage + } + return nil +} + +func (m *PackageGroup) GetIncludedPackageGroup() []string { + if m != nil { + return m.IncludedPackageGroup + } + return nil +} + +func (m *PackageGroup) GetDEPRECATEDParseableLocation() *Location { + if m != nil { + return m.DEPRECATEDParseableLocation + } + return nil +} + +// An environment group. +type EnvironmentGroup struct { + // The name of the environment group. + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + // The environments that belong to this group (as labels). + Environment []string `protobuf:"bytes,2,rep,name=environment" json:"environment,omitempty"` + // The member environments that rules implicitly support if not otherwise + // specified. + Default []string `protobuf:"bytes,3,rep,name=default" json:"default,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *EnvironmentGroup) Reset() { *m = EnvironmentGroup{} } +func (m *EnvironmentGroup) String() string { return proto.CompactTextString(m) } +func (*EnvironmentGroup) ProtoMessage() {} +func (*EnvironmentGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } + +func (m *EnvironmentGroup) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *EnvironmentGroup) GetEnvironment() []string { + if m != nil { + return m.Environment + } + return nil +} + +func (m *EnvironmentGroup) GetDefault() []string { + if m != nil { + return m.Default + } + return nil +} + +// A file that is an input into the build system. +// Next-Id: 10 +type SourceFile struct { + // The name of the source file (a label). + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + // The location of the source file. This is a path with line numbers, not + // a label in the build system. + Location *string `protobuf:"bytes,2,opt,name=location" json:"location,omitempty"` + // The location of the corresponding label in the BUILD file in a + // machine-parseable form. + DEPRECATEDParseableLocation *Location `protobuf:"bytes,7,opt,name=DEPRECATED_parseable_location,json=DEPRECATEDParseableLocation" json:"DEPRECATED_parseable_location,omitempty"` + // Labels of files that are transitively subincluded in this BUILD file. This + // is present only when the SourceFile represents a BUILD file that + // subincludes other files. The subincluded file can be either a Python + // preprocessed build extension or a Skylark file. + Subinclude []string `protobuf:"bytes,3,rep,name=subinclude" json:"subinclude,omitempty"` + // Labels of package groups that are mentioned in the visibility declaration + // for this source file. + PackageGroup []string `protobuf:"bytes,4,rep,name=package_group,json=packageGroup" json:"package_group,omitempty"` + // Labels mentioned in the visibility declaration (including :__pkg__ and + // //visibility: ones) + VisibilityLabel []string `protobuf:"bytes,5,rep,name=visibility_label,json=visibilityLabel" json:"visibility_label,omitempty"` + // The package-level features enabled for this package. Only present if the + // SourceFile represents a BUILD file. + Feature []string `protobuf:"bytes,6,rep,name=feature" json:"feature,omitempty"` + // License attribute for the file. + License *License `protobuf:"bytes,8,opt,name=license" json:"license,omitempty"` + // True if the package contains an error. Only present if the SourceFile + // represents a BUILD file. + PackageContainsErrors *bool `protobuf:"varint,9,opt,name=package_contains_errors,json=packageContainsErrors" json:"package_contains_errors,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SourceFile) Reset() { *m = SourceFile{} } +func (m *SourceFile) String() string { return proto.CompactTextString(m) } +func (*SourceFile) ProtoMessage() {} +func (*SourceFile) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } + +func (m *SourceFile) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *SourceFile) GetLocation() string { + if m != nil && m.Location != nil { + return *m.Location + } + return "" +} + +func (m *SourceFile) GetDEPRECATEDParseableLocation() *Location { + if m != nil { + return m.DEPRECATEDParseableLocation + } + return nil +} + +func (m *SourceFile) GetSubinclude() []string { + if m != nil { + return m.Subinclude + } + return nil +} + +func (m *SourceFile) GetPackageGroup() []string { + if m != nil { + return m.PackageGroup + } + return nil +} + +func (m *SourceFile) GetVisibilityLabel() []string { + if m != nil { + return m.VisibilityLabel + } + return nil +} + +func (m *SourceFile) GetFeature() []string { + if m != nil { + return m.Feature + } + return nil +} + +func (m *SourceFile) GetLicense() *License { + if m != nil { + return m.License + } + return nil +} + +func (m *SourceFile) GetPackageContainsErrors() bool { + if m != nil && m.PackageContainsErrors != nil { + return *m.PackageContainsErrors + } + return false +} + +// A file that is the output of a build rule. +type GeneratedFile struct { + // The name of the generated file (a label). + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + // The label of the target that generates the file. + GeneratingRule *string `protobuf:"bytes,2,req,name=generating_rule,json=generatingRule" json:"generating_rule,omitempty"` + // The path of the output file (not a label). + Location *string `protobuf:"bytes,3,opt,name=location" json:"location,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *GeneratedFile) Reset() { *m = GeneratedFile{} } +func (m *GeneratedFile) String() string { return proto.CompactTextString(m) } +func (*GeneratedFile) ProtoMessage() {} +func (*GeneratedFile) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } + +func (m *GeneratedFile) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *GeneratedFile) GetGeneratingRule() string { + if m != nil && m.GeneratingRule != nil { + return *m.GeneratingRule + } + return "" +} + +func (m *GeneratedFile) GetLocation() string { + if m != nil && m.Location != nil { + return *m.Location + } + return "" +} + +// A target from a blaze query execution. Similar to the Attribute message, +// the Discriminator is used to determine which field contains information. +// For any given type, only one of these can be populated in a single Target. +type Target struct { + // The type of target contained in the message. + Type *Target_Discriminator `protobuf:"varint,1,req,name=type,enum=blaze_query.Target_Discriminator" json:"type,omitempty"` + // If this target represents a rule, the rule is stored here. + Rule *Rule `protobuf:"bytes,2,opt,name=rule" json:"rule,omitempty"` + // A file that is not generated by the build system (version controlled + // or created by the test harness). + SourceFile *SourceFile `protobuf:"bytes,3,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` + // A generated file that is the output of a rule. + GeneratedFile *GeneratedFile `protobuf:"bytes,4,opt,name=generated_file,json=generatedFile" json:"generated_file,omitempty"` + // A package group. + PackageGroup *PackageGroup `protobuf:"bytes,5,opt,name=package_group,json=packageGroup" json:"package_group,omitempty"` + // An environment group. + EnvironmentGroup *EnvironmentGroup `protobuf:"bytes,6,opt,name=environment_group,json=environmentGroup" json:"environment_group,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Target) Reset() { *m = Target{} } +func (m *Target) String() string { return proto.CompactTextString(m) } +func (*Target) ProtoMessage() {} +func (*Target) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } + +func (m *Target) GetType() Target_Discriminator { + if m != nil && m.Type != nil { + return *m.Type + } + return Target_RULE +} + +func (m *Target) GetRule() *Rule { + if m != nil { + return m.Rule + } + return nil +} + +func (m *Target) GetSourceFile() *SourceFile { + if m != nil { + return m.SourceFile + } + return nil +} + +func (m *Target) GetGeneratedFile() *GeneratedFile { + if m != nil { + return m.GeneratedFile + } + return nil +} + +func (m *Target) GetPackageGroup() *PackageGroup { + if m != nil { + return m.PackageGroup + } + return nil +} + +func (m *Target) GetEnvironmentGroup() *EnvironmentGroup { + if m != nil { + return m.EnvironmentGroup + } + return nil +} + +// Container for all of the blaze query results. +type QueryResult struct { + // All of the targets returned by the blaze query. + Target []*Target `protobuf:"bytes,1,rep,name=target" json:"target,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *QueryResult) Reset() { *m = QueryResult{} } +func (m *QueryResult) String() string { return proto.CompactTextString(m) } +func (*QueryResult) ProtoMessage() {} +func (*QueryResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } + +func (m *QueryResult) GetTarget() []*Target { + if m != nil { + return m.Target + } + return nil +} + +// Information about allowed rule classes for a specific attribute of a rule. +type AllowedRuleClassInfo struct { + Policy *AllowedRuleClassInfo_AllowedRuleClasses `protobuf:"varint,1,req,name=policy,enum=blaze_query.AllowedRuleClassInfo_AllowedRuleClasses" json:"policy,omitempty"` + // Rule class names of rules allowed in this attribute, e.g "cc_library", + // "py_binary". Only present if the allowed_rule_classes field is set to + // SPECIFIED. + AllowedRuleClass []string `protobuf:"bytes,2,rep,name=allowed_rule_class,json=allowedRuleClass" json:"allowed_rule_class,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *AllowedRuleClassInfo) Reset() { *m = AllowedRuleClassInfo{} } +func (m *AllowedRuleClassInfo) String() string { return proto.CompactTextString(m) } +func (*AllowedRuleClassInfo) ProtoMessage() {} +func (*AllowedRuleClassInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } + +func (m *AllowedRuleClassInfo) GetPolicy() AllowedRuleClassInfo_AllowedRuleClasses { + if m != nil && m.Policy != nil { + return *m.Policy + } + return AllowedRuleClassInfo_ANY +} + +func (m *AllowedRuleClassInfo) GetAllowedRuleClass() []string { + if m != nil { + return m.AllowedRuleClass + } + return nil +} + +// This message represents a single attribute of a single rule. +type AttributeDefinition struct { + // Attribute name, i.e. "name", "srcs", "deps" + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + Type *Attribute_Discriminator `protobuf:"varint,2,req,name=type,enum=blaze_query.Attribute_Discriminator" json:"type,omitempty"` + Mandatory *bool `protobuf:"varint,3,req,name=mandatory" json:"mandatory,omitempty"` + // Only present for attributes of type LABEL and LABEL_LIST. + AllowedRuleClasses *AllowedRuleClassInfo `protobuf:"bytes,4,opt,name=allowed_rule_classes,json=allowedRuleClasses" json:"allowed_rule_classes,omitempty"` + Documentation *string `protobuf:"bytes,5,opt,name=documentation" json:"documentation,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *AttributeDefinition) Reset() { *m = AttributeDefinition{} } +func (m *AttributeDefinition) String() string { return proto.CompactTextString(m) } +func (*AttributeDefinition) ProtoMessage() {} +func (*AttributeDefinition) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } + +func (m *AttributeDefinition) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *AttributeDefinition) GetType() Attribute_Discriminator { + if m != nil && m.Type != nil { + return *m.Type + } + return Attribute_INTEGER +} + +func (m *AttributeDefinition) GetMandatory() bool { + if m != nil && m.Mandatory != nil { + return *m.Mandatory + } + return false +} + +func (m *AttributeDefinition) GetAllowedRuleClasses() *AllowedRuleClassInfo { + if m != nil { + return m.AllowedRuleClasses + } + return nil +} + +func (m *AttributeDefinition) GetDocumentation() string { + if m != nil && m.Documentation != nil { + return *m.Documentation + } + return "" +} + +type RuleDefinition struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + // Only contains documented attributes + Attribute []*AttributeDefinition `protobuf:"bytes,2,rep,name=attribute" json:"attribute,omitempty"` + Documentation *string `protobuf:"bytes,3,opt,name=documentation" json:"documentation,omitempty"` + // Only for build extensions: label to file that defines the extension + Label *string `protobuf:"bytes,4,opt,name=label" json:"label,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RuleDefinition) Reset() { *m = RuleDefinition{} } +func (m *RuleDefinition) String() string { return proto.CompactTextString(m) } +func (*RuleDefinition) ProtoMessage() {} +func (*RuleDefinition) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } + +func (m *RuleDefinition) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *RuleDefinition) GetAttribute() []*AttributeDefinition { + if m != nil { + return m.Attribute + } + return nil +} + +func (m *RuleDefinition) GetDocumentation() string { + if m != nil && m.Documentation != nil { + return *m.Documentation + } + return "" +} + +func (m *RuleDefinition) GetLabel() string { + if m != nil && m.Label != nil { + return *m.Label + } + return "" +} + +type BuildLanguage struct { + // Only contains documented rule definitions + Rule []*RuleDefinition `protobuf:"bytes,1,rep,name=rule" json:"rule,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *BuildLanguage) Reset() { *m = BuildLanguage{} } +func (m *BuildLanguage) String() string { return proto.CompactTextString(m) } +func (*BuildLanguage) ProtoMessage() {} +func (*BuildLanguage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } + +func (m *BuildLanguage) GetRule() []*RuleDefinition { + if m != nil { + return m.Rule + } + return nil +} + +type Location struct { + StartOffset *int32 `protobuf:"varint,1,opt,name=start_offset,json=startOffset" json:"start_offset,omitempty"` + StartLine *int32 `protobuf:"varint,2,opt,name=start_line,json=startLine" json:"start_line,omitempty"` + StartColumn *int32 `protobuf:"varint,3,opt,name=start_column,json=startColumn" json:"start_column,omitempty"` + EndOffset *int32 `protobuf:"varint,4,opt,name=end_offset,json=endOffset" json:"end_offset,omitempty"` + EndLine *int32 `protobuf:"varint,5,opt,name=end_line,json=endLine" json:"end_line,omitempty"` + EndColumn *int32 `protobuf:"varint,6,opt,name=end_column,json=endColumn" json:"end_column,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Location) Reset() { *m = Location{} } +func (m *Location) String() string { return proto.CompactTextString(m) } +func (*Location) ProtoMessage() {} +func (*Location) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } + +func (m *Location) GetStartOffset() int32 { + if m != nil && m.StartOffset != nil { + return *m.StartOffset + } + return 0 +} + +func (m *Location) GetStartLine() int32 { + if m != nil && m.StartLine != nil { + return *m.StartLine + } + return 0 +} + +func (m *Location) GetStartColumn() int32 { + if m != nil && m.StartColumn != nil { + return *m.StartColumn + } + return 0 +} + +func (m *Location) GetEndOffset() int32 { + if m != nil && m.EndOffset != nil { + return *m.EndOffset + } + return 0 +} + +func (m *Location) GetEndLine() int32 { + if m != nil && m.EndLine != nil { + return *m.EndLine + } + return 0 +} + +func (m *Location) GetEndColumn() int32 { + if m != nil && m.EndColumn != nil { + return *m.EndColumn + } + return 0 +} + +type MakeVarBinding struct { + Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` + PlatformSetRegexp *string `protobuf:"bytes,2,req,name=platform_set_regexp,json=platformSetRegexp" json:"platform_set_regexp,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *MakeVarBinding) Reset() { *m = MakeVarBinding{} } +func (m *MakeVarBinding) String() string { return proto.CompactTextString(m) } +func (*MakeVarBinding) ProtoMessage() {} +func (*MakeVarBinding) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} } + +func (m *MakeVarBinding) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +func (m *MakeVarBinding) GetPlatformSetRegexp() string { + if m != nil && m.PlatformSetRegexp != nil { + return *m.PlatformSetRegexp + } + return "" +} + +type MakeVar struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + Binding []*MakeVarBinding `protobuf:"bytes,2,rep,name=binding" json:"binding,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *MakeVar) Reset() { *m = MakeVar{} } +func (m *MakeVar) String() string { return proto.CompactTextString(m) } +func (*MakeVar) ProtoMessage() {} +func (*MakeVar) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} } + +func (m *MakeVar) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *MakeVar) GetBinding() []*MakeVarBinding { + if m != nil { + return m.Binding + } + return nil +} + +type GlobCriteria struct { + // List of includes (or items if this criteria did not come from a glob) + Include []string `protobuf:"bytes,1,rep,name=include" json:"include,omitempty"` + // List of exclude expressions + Exclude []string `protobuf:"bytes,2,rep,name=exclude" json:"exclude,omitempty"` + // Whether this message came from a glob + Glob *bool `protobuf:"varint,3,opt,name=glob" json:"glob,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *GlobCriteria) Reset() { *m = GlobCriteria{} } +func (m *GlobCriteria) String() string { return proto.CompactTextString(m) } +func (*GlobCriteria) ProtoMessage() {} +func (*GlobCriteria) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} } + +func (m *GlobCriteria) GetInclude() []string { + if m != nil { + return m.Include + } + return nil +} + +func (m *GlobCriteria) GetExclude() []string { + if m != nil { + return m.Exclude + } + return nil +} + +func (m *GlobCriteria) GetGlob() bool { + if m != nil && m.Glob != nil { + return *m.Glob + } + return false +} + +type Event struct { + Kind *Event_EventKind `protobuf:"varint,1,req,name=kind,enum=blaze_query.Event_EventKind" json:"kind,omitempty"` + DEPRECATEDLocation *Location `protobuf:"bytes,2,opt,name=DEPRECATED_location,json=DEPRECATEDLocation" json:"DEPRECATED_location,omitempty"` + Message *string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Event) Reset() { *m = Event{} } +func (m *Event) String() string { return proto.CompactTextString(m) } +func (*Event) ProtoMessage() {} +func (*Event) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} } + +func (m *Event) GetKind() Event_EventKind { + if m != nil && m.Kind != nil { + return *m.Kind + } + return Event_ERROR +} + +func (m *Event) GetDEPRECATEDLocation() *Location { + if m != nil { + return m.DEPRECATEDLocation + } + return nil +} + +func (m *Event) GetMessage() string { + if m != nil && m.Message != nil { + return *m.Message + } + return "" +} + +func init() { + proto.RegisterType((*License)(nil), "blaze_query.License") + proto.RegisterType((*StringDictEntry)(nil), "blaze_query.StringDictEntry") + proto.RegisterType((*LabelDictUnaryEntry)(nil), "blaze_query.LabelDictUnaryEntry") + proto.RegisterType((*LabelListDictEntry)(nil), "blaze_query.LabelListDictEntry") + proto.RegisterType((*LabelKeyedStringDictEntry)(nil), "blaze_query.LabelKeyedStringDictEntry") + proto.RegisterType((*StringListDictEntry)(nil), "blaze_query.StringListDictEntry") + proto.RegisterType((*FilesetEntry)(nil), "blaze_query.FilesetEntry") + proto.RegisterType((*Attribute)(nil), "blaze_query.Attribute") + proto.RegisterType((*Attribute_SelectorEntry)(nil), "blaze_query.Attribute.SelectorEntry") + proto.RegisterType((*Attribute_Selector)(nil), "blaze_query.Attribute.Selector") + proto.RegisterType((*Attribute_SelectorList)(nil), "blaze_query.Attribute.SelectorList") + proto.RegisterType((*Rule)(nil), "blaze_query.Rule") + proto.RegisterType((*AttributeAspect)(nil), "blaze_query.AttributeAspect") + proto.RegisterType((*SkylarkAspect)(nil), "blaze_query.SkylarkAspect") + proto.RegisterType((*RuleSummary)(nil), "blaze_query.RuleSummary") + proto.RegisterType((*PackageGroup)(nil), "blaze_query.PackageGroup") + proto.RegisterType((*EnvironmentGroup)(nil), "blaze_query.EnvironmentGroup") + proto.RegisterType((*SourceFile)(nil), "blaze_query.SourceFile") + proto.RegisterType((*GeneratedFile)(nil), "blaze_query.GeneratedFile") + proto.RegisterType((*Target)(nil), "blaze_query.Target") + proto.RegisterType((*QueryResult)(nil), "blaze_query.QueryResult") + proto.RegisterType((*AllowedRuleClassInfo)(nil), "blaze_query.AllowedRuleClassInfo") + proto.RegisterType((*AttributeDefinition)(nil), "blaze_query.AttributeDefinition") + proto.RegisterType((*RuleDefinition)(nil), "blaze_query.RuleDefinition") + proto.RegisterType((*BuildLanguage)(nil), "blaze_query.BuildLanguage") + proto.RegisterType((*Location)(nil), "blaze_query.Location") + proto.RegisterType((*MakeVarBinding)(nil), "blaze_query.MakeVarBinding") + proto.RegisterType((*MakeVar)(nil), "blaze_query.MakeVar") + proto.RegisterType((*GlobCriteria)(nil), "blaze_query.GlobCriteria") + proto.RegisterType((*Event)(nil), "blaze_query.Event") + proto.RegisterEnum("blaze_query.FilesetEntry_SymlinkBehavior", FilesetEntry_SymlinkBehavior_name, FilesetEntry_SymlinkBehavior_value) + proto.RegisterEnum("blaze_query.Attribute_Discriminator", Attribute_Discriminator_name, Attribute_Discriminator_value) + proto.RegisterEnum("blaze_query.Attribute_Tristate", Attribute_Tristate_name, Attribute_Tristate_value) + proto.RegisterEnum("blaze_query.Target_Discriminator", Target_Discriminator_name, Target_Discriminator_value) + proto.RegisterEnum("blaze_query.AllowedRuleClassInfo_AllowedRuleClasses", AllowedRuleClassInfo_AllowedRuleClasses_name, AllowedRuleClassInfo_AllowedRuleClasses_value) + proto.RegisterEnum("blaze_query.Event_EventKind", Event_EventKind_name, Event_EventKind_value) +} + +func init() { + proto.RegisterFile("third_party/bazel/master/src/main/protobuf/build.proto", fileDescriptor0) +} + +var fileDescriptor0 = []byte{ + // 2649 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0x4b, 0x73, 0xe3, 0xc6, + 0x11, 0x0e, 0xf8, 0x10, 0xc9, 0xe6, 0x0b, 0x1a, 0x3d, 0x96, 0xfb, 0xb2, 0x69, 0x78, 0x1d, 0xcb, + 0x8f, 0x92, 0x6c, 0x65, 0xed, 0x72, 0xec, 0x64, 0x2b, 0x14, 0x05, 0xc9, 0xf4, 0xd2, 0xa4, 0x32, + 0xa4, 0xd6, 0x51, 0x2e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ae, + 0xdd, 0x3f, 0x39, 0xc3, 0x75, 0x96, 0x26, 0xf3, 0x48, 0x64, 0x51, 0x48, 0xa7, 0xdc, 0xdc, 0x73, + 0xfa, 0xa2, 0xb1, 0xd6, 0xd4, 0x78, 0x24, 0x0a, 0xda, 0x89, 0x20, 0x19, 0xef, 0x43, 0xfd, 0x0a, + 0x18, 0x2a, 0x82, 0x80, 0xd3, 0x35, 0x54, 0x87, 0xf2, 0xa1, 0x89, 0xcd, 0x23, 0x13, 0x9b, 0xbd, + 0xb6, 0xa9, 0x67, 0x8c, 0x7f, 0xde, 0x81, 0x52, 0x2b, 0x8a, 0x42, 0x3a, 0x9a, 0x45, 0x84, 0x3b, + 0xea, 0xdb, 0x93, 0x78, 0x61, 0xc5, 0x7f, 0x74, 0x06, 0x0f, 0x0f, 0xcd, 0x13, 0x6c, 0xb6, 0x5b, + 0x43, 0xf3, 0x90, 0xe7, 0x14, 0x23, 0xf6, 0xc8, 0x23, 0x96, 0x17, 0x38, 0x62, 0x2d, 0x1b, 0x95, + 0xa6, 0xb6, 0x53, 0xde, 0xdf, 0x4a, 0xf9, 0xd6, 0x55, 0x4c, 0x7c, 0x7f, 0xa9, 0x7b, 0x12, 0xab, + 0xc6, 0x4c, 0xf4, 0x21, 0x6c, 0x92, 0x17, 0x53, 0x8f, 0x3a, 0x34, 0xf2, 0xe6, 0x16, 0x9b, 0x12, + 0x87, 0x9e, 0x53, 0xe2, 0x36, 0xaa, 0x62, 0x0f, 0x36, 0x96, 0xbc, 0x41, 0xcc, 0xe2, 0x31, 0xe2, + 0x07, 0x2e, 0x99, 0x36, 0x36, 0x85, 0x8c, 0x1c, 0xa0, 0x4f, 0x20, 0x27, 0x12, 0x93, 0xef, 0x74, + 0x6d, 0xff, 0x51, 0xca, 0x94, 0x85, 0x77, 0xbb, 0x87, 0x94, 0x39, 0x21, 0x9d, 0xf0, 0x18, 0x08, + 0x42, 0x2c, 0x34, 0xd0, 0x7d, 0x28, 0x51, 0x3f, 0x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x3c, 0x76, 0x82, 0xc9, 0xee, 0x38, 0x08, + 0xc6, 0x1e, 0xd9, 0x75, 0xc9, 0xf3, 0x28, 0x08, 0x3c, 0xb6, 0x2b, 0xbf, 0xba, 0x7a, 0x74, 0xb4, + 0x2b, 0x4c, 0xdb, 0x97, 0x1f, 0x60, 0xe5, 0xef, 0xbe, 0x3d, 0xa5, 0xff, 0x0e, 0x00, 0x00, 0xff, + 0xff, 0x53, 0xe5, 0xbe, 0x1e, 0xc3, 0x1d, 0x00, 0x00, +} diff --git a/go/tools/gopackagesdriver/bazelquerydriver/BUILD.bazel b/go/tools/gopackagesdriver/bazelquerydriver/BUILD.bazel index ae33363bc6..827ea604ce 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/BUILD.bazel +++ b/go/tools/gopackagesdriver/bazelquerydriver/BUILD.bazel @@ -11,8 +11,8 @@ go_library( deps = [ "//go/tools/gopackagesdriver/bazelquerydriver/pkgconv", "//go/tools/gopackagesdriver/protocol", - "@com_github_bazelbuild_bazel_watcher//third_party/bazel/master/src/main/protobuf/blaze_query:go_default_library", - "@com_github_bazelbuild_bazel_watcher//bazel:go_default_library", + "//go/tools/gopackagesdriver/bazel/proto/blaze_query", + "//go/tools/gopackagesdriver/bazel", "@org_golang_x_tools//go/packages:go_default_library", ], ) diff --git a/go/tools/gopackagesdriver/bazelquerydriver/driver.go b/go/tools/gopackagesdriver/bazelquerydriver/driver.go index 49693491a0..142e3a17dc 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/driver.go +++ b/go/tools/gopackagesdriver/bazelquerydriver/driver.go @@ -105,7 +105,7 @@ func (d *bazelDriver) loadPackages(patterns ...string) (*protocol.Response, erro case d.sdk.packages[patt]: d.stdlibImports[patt] = true default: - // TODO: do we need to check for a package ID instead of import path? + // TODO(#512): do we need to check for a package ID instead of import path? d.importQueries[patt] = true d.bazelQueries = append(d.bazelQueries, fmt.Sprintf("attr(importpath, '%v', deps(%v))", patt, goFilter("//..."))) } @@ -144,7 +144,7 @@ func (d *bazelDriver) loadPackages(patterns ...string) (*protocol.Response, erro // prepareFileQuery parses queries starting with file=. // It determines whether the file is inside the standard library, // and adds the appropriate stdlib or bazel query to `d`. -// TODO: handle queries for generated files +// TODO(#512): handle queries for generated files func (d *bazelDriver) prepareFileQuery(fp string) error { if len(fp) == 0 { return fmt.Errorf("\"file=\" prefix given with no query after it") diff --git a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/BUILD.bazel b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/BUILD.bazel index 83e85963d3..974dabaf70 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/BUILD.bazel +++ b/go/tools/gopackagesdriver/bazelquerydriver/pkgconv/BUILD.bazel @@ -12,7 +12,7 @@ go_library( importpath = "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver/bazelquerydriver/pkgconv", visibility = ["//go/tools/gopackagesdriver:__subpackages__"], deps = [ + "//go/tools/gopackagesdriver/bazel/proto/blaze_query", "@org_golang_x_tools//go/packages:go_default_library", - "@com_github_bazelbuild_bazel_watcher//third_party/bazel/master/src/main/protobuf/blaze_query:go_default_library", ], ) diff --git a/go/tools/gopackagesdriver/bazelquerydriver/sdk.go b/go/tools/gopackagesdriver/bazelquerydriver/sdk.go index 6b7afdc212..9aa2973e97 100644 --- a/go/tools/gopackagesdriver/bazelquerydriver/sdk.go +++ b/go/tools/gopackagesdriver/bazelquerydriver/sdk.go @@ -32,6 +32,8 @@ type gosdk struct { } func newGoSDK(bazel bazel.Bazel) (*gosdk, error) { + // TODO(#512) This shouldn't hardcode the name go_sdk. + // People could use different names and/or have multiple SDKs. info, err := bazel.Info() if err != nil { return nil, err