Code Monkey home page Code Monkey logo

bazel-tools's People

Contributors

aditya-2001 avatar amckague avatar ash2k avatar balestrapatrick avatar ben181231 avatar com6056 avatar cristifalcas avatar danmx avatar dohe avatar duxi90 avatar highvoltag3 avatar keith avatar kevingessner avatar kriscfoster avatar laszlocsomor avatar lirlia avatar longlho avatar mennanov avatar renovate-bot avatar rmohr avatar scottgreenup avatar shiwano avatar ychen-atlassian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bazel-tools's Issues

multirun with py_binary enhancement

I was assuming that py_binary could be called by multirun. Is there a way to detect the binary object type (andriod_binary, java_binary, cc_binary, sh_binary or py_binary) and execute based on that?

Pass stdin to process when executing

Would it be possible to set Stdin on the exec.Cmd to os.Stdin when multirun is used without parallelization so user input could be accepted? Thanks!

Release notes include WORKSPACE snippet

Hello. This is a request for future releases, that they follow the Bazel ecosystem convention of including the WORKSPACE snippet in the release notes.

Although many of us are perfectly comfortable writing that ourselves, there seem to be a lot of new folks coming into the Bazel ecosystem now learning for the first time.

Support for Go version to v1.18

bazel run //:golangcilint. works fine with go_register_toolchains("1.17.7")

But with go_register_toolchains("1.18") we get error
ERRO Running error: buildir: failed to load package goarch: could not load export data: cannot import "internal/goarch" (unknown iexport format version 2), export data is newer version - update tool

I understand, 1.18 is not supported here yet. Hence the request.

Please create a github release

Hi,

Please could you create a github release to allow pulling this repo with Bazel's http_archive? One benefit is that http_archive allows mirror URLs to be specified.

Thanks!

Bug with go 1.18

I'm noticing odd behavior when I switched my version of go from 1.17.1 to 1.18:

Working Example:

  1. Clone this repo: https://github.com/cloudflare/sciuro/tree/master
  2. Run command: bazel run :golangcilint --sandbox_debug
  3. Output:
INFO: SHA256 (https://golang.org/dl/?mode=json&include=all) = 23bea3b79d741aa5a9cc1fd49e79344ebb097b2e057a471d1f59ee6fa736c223
INFO: Analyzed target //:golangcilint (4 packages loaded, 7528 targets configured).
INFO: Found 1 target...
Target //:golangcilint up-to-date:
  bazel-bin/golangcilint.bash
INFO: Elapsed time: 14.051s, Critical Path: 5.13s
INFO: 3 processes: 3 internal.
INFO: Build completed successfully, 3 total actions
INFO: Build completed successfully, 3 total actions
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 24 linters: [bodyclose deadcode dogsled errcheck gochecknoinits goconst gocritic godox goimports gosec gosimple govet ineffassign interfacer misspell nakedret prealloc structcheck stylecheck typecheck unconvert unparam unused varcheck]
INFO [loader] Go packages loading at mode 575 (files|imports|name|exports_file|deps|types_sizes|compiled_files) took 26.60414599s
WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
WARN [runner] The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner.
WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 1.560931ms
INFO [linters_context/goanalysis] analyzers took 57.594345968s with top 10 stages: buildir: 48.005146656s, gocritic: 2.614569304s, inspect: 2.051173251s, printf: 1.593158111s, ctrlflow: 1.251261296s, fact_purity: 1.238065289s, buildssa: 372.291988ms, interfacer: 112.679051ms, unparam: 98.398849ms, goimports: 81.000019ms
INFO [runner] Issues before processing: 6, after processing: 3
INFO [runner] Processors filtering stat (out/in): path_prettifier: 6/6, skip_files: 6/6, skip_dirs: 6/6, exclude: 6/6, diff: 3/3, path_prefixer: 3/3, cgo: 6/6, filename_unadjuster: 6/6, identifier_marker: 6/6, nolint: 3/3, path_shortener: 3/3, severity-rules: 3/3, max_from_linter: 3/3, autogenerated_exclude: 6/6, exclude-rules: 3/6, uniq_by_line: 3/3, max_per_file_from_linter: 3/3, max_same_issues: 3/3, source_code: 3/3, sort_results: 3/3
INFO [runner] processing took 1.540216ms with stages: nolint: 638.869µs, autogenerated_exclude: 278.346µs, path_prettifier: 265.082µs, exclude-rules: 107.305µs, source_code: 106.464µs, identifier_marker: 90.068µs, skip_dirs: 44.209µs, max_same_issues: 2.299µs, uniq_by_line: 1.498µs, cgo: 1.209µs, max_from_linter: 1.121µs, path_shortener: 998ns, max_per_file_from_linter: 880ns, filename_unadjuster: 668ns, skip_files: 315ns, exclude: 209ns, diff: 205ns, severity-rules: 197ns, sort_results: 148ns, path_prefixer: 126ns
INFO [runner] linters took 9.531411011s with stages: goanalysis_metalinter: 9.529793486s
cmd/sciuro/main.go:103:3        gocritic     commentedOutCode: may want to remove commented-out code
internal/node/reconciler.go:57  goimports    File is not `goimports`-ed
cmd/sciuro/main.go:94:7         ineffassign  ineffectual assignment to err
INFO File cache stats: 9 entries of total size 66.4KiB
INFO Memory: 363 samples, avg is 284.2MB, max is 1486.0MB
INFO Execution took 36.149926528s

Steps to produce error:

  1. Update go version in WORKSPACE:
    From
go_register_toolchains(version = "1.17.11")

To

go_register_toolchains(version = "1.18")
  1. Run command: bazel run :golangcilint --sandbox_debug
  2. Output:
~/d/sciuro[1]►bazel run :golangcilint --sandbox_debug                                   74.584s (master|💩) 16:33
INFO: Analyzed target //:golangcilint (1 packages loaded, 8109 targets configured).
INFO: Found 1 target...
Target //:golangcilint up-to-date:
  bazel-bin/golangcilint.bash
INFO: Elapsed time: 16.554s, Critical Path: 6.17s
INFO: 3 processes: 3 internal.
INFO: Build completed successfully, 3 total actions
INFO: Build completed successfully, 3 total actions
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 24 linters: [bodyclose deadcode dogsled errcheck gochecknoinits goconst gocritic godox goimports gosec gosimple govet ineffassign interfacer misspell nakedret prealloc structcheck stylecheck typecheck unconvert unparam unused varcheck]
INFO [loader] Go packages loading at mode 575 (compiled_files|files|types_sizes|deps|exports_file|imports|name) took 13.605686256s
WARN [runner] The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner.
WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 1.981737ms
INFO [linters_context/goanalysis] analyzers took 15.884239895s with top 10 stages: buildir: 12.702594634s, inspect: 992.303679ms, printf: 890.490565ms, ctrlflow: 771.030558ms, fact_purity: 525.691774ms, cgocall: 60.004µs, nakedret: 55.137µs, S1032: 46.473µs, errcheck: 43.938µs, buildssa: 43.069µs
INFO [runner/max_same_issues] 13/16 issues with text "client.On undefined (type *mockAlertCache has no field or method On)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 4/7 issues with text "m.Called undefined (type *mockK8SClient has no field or method Called)" were hidden, use --max-same-issues
INFO [runner/max_same_issues] 1/4 issues with text "mockAlertClient.AssertExpectations undefined (type *mockAlertClient has no field or method AssertExpectations)" were hidden, use --max-same-issues
INFO [runner] Issues before processing: 3816, after processing: 18
INFO [runner] Processors filtering stat (out/in): skip_files: 3816/3816, skip_dirs: 3816/3816, exclude: 3816/3816, uniq_by_line: 36/3816, path_shortener: 18/18, sort_results: 18/18, filename_unadjuster: 3816/3816, identifier_marker: 3816/3816, exclude-rules: 3816/3816, max_same_issues: 18/36, path_prettifier: 3816/3816, max_per_file_from_linter: 36/36, source_code: 18/18, severity-rules: 18/18, path_prefixer: 18/18, cgo: 3816/3816, autogenerated_exclude: 3816/3816, nolint: 3816/3816, diff: 36/36, max_from_linter: 18/18
INFO [runner] processing took 178.45023ms with stages: exclude-rules: 120.702092ms, identifier_marker: 53.547395ms, path_prettifier: 1.795468ms, nolint: 1.645285ms, skip_dirs: 247.682µs, cgo: 105.475µs, source_code: 102.918µs, uniq_by_line: 91.262µs, filename_unadjuster: 83.321µs, autogenerated_exclude: 77.762µs, max_same_issues: 43.576µs, path_shortener: 2.718µs, max_from_linter: 2.084µs, max_per_file_from_linter: 1.794µs, skip_files: 327ns, exclude: 250ns, sort_results: 226ns, severity-rules: 217ns, diff: 209ns, path_prefixer: 169ns
INFO [runner] linters took 4.219147507s with stages: goanalysis_metalinter: 4.040560649s
internal/alert/sync_test.go:29:18        typecheck  mockAlertClient.AssertExpectations undefined (type *mockAlertClient has no field or method AssertExpectations)
internal/alert/sync_test.go:35:18        typecheck  mockAlertClient.On undefined (type *mockAlertClient has no field or method On)
internal/alert/sync_test.go:44:18        typecheck  mockAlertClient.AssertExpectations undefined (type *mockAlertClient has no field or method AssertExpectations)
internal/alert/sync_test.go:49:18        typecheck  mockAlertClient.AssertExpectations undefined (type *mockAlertClient has no field or method AssertExpectations)
internal/alert/sync_test.go:51:18        typecheck  mockAlertClient.On undefined (type *mockAlertClient has no field or method On)
internal/alert/sync_test.go:88:12        typecheck  m.Called undefined (type *mockAlertClient has no field or method Called)
internal/node/reconciler_test.go:43:11   typecheck  cache.On undefined (type *mockAlertCache has no field or method On)
internal/node/reconciler_test.go:59:7    typecheck  c.On undefined (type *mockK8SClient has no field or method On)
internal/node/reconciler_test.go:87:7    typecheck  c.On undefined (type *mockK8SClient has no field or method On)
internal/node/reconciler_test.go:95:11   typecheck  cache.On undefined (type *mockAlertCache has no field or method On)
internal/node/reconciler_test.go:112:7   typecheck  c.On undefined (type *mockK8SClient has no field or method On)
internal/node/reconciler_test.go:189:12  typecheck  client.On undefined (type *mockAlertCache has no field or method On)
internal/node/reconciler_test.go:228:12  typecheck  client.On undefined (type *mockAlertCache has no field or method On)
internal/node/reconciler_test.go:268:12  typecheck  client.On undefined (type *mockAlertCache has no field or method On)
internal/node/reconciler_test.go:818:12  typecheck  m.Called undefined (type *mockAlertCache has no field or method Called)
internal/node/reconciler_test.go:845:12  typecheck  m.Called undefined (type *mockK8SClient has no field or method Called)
internal/node/reconciler_test.go:850:12  typecheck  m.Called undefined (type *mockK8SClient has no field or method Called)
internal/node/reconciler_test.go:855:12  typecheck  m.Called undefined (type *mockK8SClient has no field or method Called)
INFO File cache stats: 2 entries of total size 25.3KiB
INFO Memory: 180 samples, avg is 134.8MB, max is 780.9MB
INFO Execution took 17.840796251s

Notice how typecheck is detected when go version is set to 1.18, but not in 1.17.1

Goimports fails on go 1.18 upgrade

Switching the Go SDK to 1.18 gives the following output during a goimports run.

4:1: expected statement, found 'package'
7:2: expected '}', found 'EOF'
4:1: expected statement, found 'package'
7:2: expected '}', found 'EOF'
4:1: expected statement, found 'package'
6:2: expected '}', found 'EOF'

Seems like an upgrade to the latest Go SDK might be necessary.

Multirun option to select only one command to pass command line arguments to

Some circumstances may involve calling multiple run targets, with only one of them actually needing command line arguments. The current behavior is that all run targets get the arguments passed to them, which makes it so users have to "hack around" the fact that the others should not get the arguments. Ideal interface:

multirun(
    name = "bar",
    commands = [
        "cmd_1",
        "cmd_2",
    ],
    
    # when doing `bazel run //foo:bar -- --some --arguments`
    # only cmd_1 should see `--some --arguments`
    argument_command="cmd_1",
)

goimports only works with go binary on the host path when cgo is involved

When defining goimports for example like this:

goimports(
    name = "goimports",
    display_diffs = True,
    exclude_paths = [
        "./vendor/*",
        "./.history/*",
        "./.git/*",
        "./_ci-configs/*",
    ],
    local = ["kubevirt.io"],
    prefix = "kubevirt.io/kubevirt",
    write = True,
)

and executing it on a file which needs cgo, one gets

err: go command required, not found: exec: "go": executable file not found in $PATH: stderr: 

if go is not installed on the host. It would be great if goimports could just pick up the go sdk from rules_go.

multirun support for *_binary args

All Bazel binary rules have a common args attribute. However if you set up a *_binary target with args and then name it in a multirun target's commands, multirun doesn't run it with those args. You can work around this with multirun's command, but it would be better if you didn't need to duplicate the args in two places. Perhaps multirun could use an aspect to obtain the args from any *_binary dependencies?

(This is effectively a generalization of #14, which asked about py_binary specifically. The discussion there glosses over the built in args attribute though.)

Multirun support for ibazel_notify_changes

I'd love to have support for bazel-watcher's ibazel_notify_changes.

Basically, ibazel watches for changes and restart executables. But it doesn't restart executables with the ibazel_notify_changes tag (e.g. a live reload web server), rather it writes events to stdin to notify them.

The multirun would need to be a ibazel_notify_changes executable and understand which of its children should be restarted vs be passed build events on stdin.

`command` rule should use config "exec"

Any reason for setting the cfg parameter for command rule as "target", instead of "exec"?
Here

The commands are run on the "exec" platform.
I don't see a command rule as being the target used at runtime, but mostly to run other tools.
For example we use it to push containers, or kubectl commands, both of which we need to run on exec platform

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.