bazeltools / bazel-deps

Generate bazel dependencies for maven artifacts
MIT License
249 stars 121 forks source link

Validate options to error on ignored options #332

Closed johnynek closed 1 year ago

johnynek commented 1 year ago

We have developed a check-only option which only checks.

Unfortunately, it ignores many options and doesn't actually check everything. I think this is because the people who added the check-only only cared about certain options.

This will break people who are passing options to check-only that are currently ignored, but it may save people who thing more things are being checked than are.

A better solution is to have a check mode for everything, which instead of writing a file, makes sure that the file already exists and has been written. This could possibly be done with the IO abstraction we have already. In that mode, rm would do nothing, read would work as normal, but write would just fail unless we are writing the exact same file (maybe with some decent reporting of differences).

poor person's CI

oboykin@Oscars-MacBook-Pro bazel-deps % git rev-parse HEAD
c0fd4a17adeb2f978b88a045828c1d029b827d95
oboykin@Oscars-MacBook-Pro bazel-deps % ./bazel build //...
INFO: Analyzed 102 targets (0 packages loaded, 0 targets configured).
INFO: Found 102 targets...
INFO: Elapsed time: 0.075s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
oboykin@Oscars-MacBook-Pro bazel-deps % ./bazel test //... 
INFO: Analyzed 102 targets (0 packages loaded, 0 targets configured).
INFO: Found 94 targets and 8 test targets...
INFO: Elapsed time: 0.073s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
//test/scala/com/github/johnynek/bazel_deps:coursier_test       (cached) PASSED in 16.3s
//test/scala/com/github/johnynek/bazel_deps:createpomtest       (cached) PASSED in 8.5s
//test/scala/com/github/johnynek/bazel_deps:graphtest           (cached) PASSED in 5.9s
//test/scala/com/github/johnynek/bazel_deps:modeltest           (cached) PASSED in 6.0s
//test/scala/com/github/johnynek/bazel_deps:normalizertest      (cached) PASSED in 6.1s
//test/scala/com/github/johnynek/bazel_deps:parsegenerateddoctest (cached) PASSED in 33.6s
//test/scala/com/github/johnynek/bazel_deps:parsetest           (cached) PASSED in 6.0s
//test/scala/com/github/johnynek/bazel_deps:parsetestcases      (cached) PASSED in 5.8s

Executed 0 out of 8 tests: 8 tests pass.
INFO: Build completed successfully, 1 total action
johnynek commented 1 year ago

this addresses todos added in #329