Skip to content

Commit

Permalink
Try using command log instead of piping
Browse files Browse the repository at this point in the history
  • Loading branch information
jjudd committed Nov 12, 2024
1 parent 1239298 commit ceb2b1d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 6 additions & 5 deletions tests/dependencies/indirect/test
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#!/bin/bash -e
. "$(dirname "$0")"/../../common.sh

command_log="$(bazel info command_log)"

# used_deps off
! bazel build :used_deps_off_c || false
bazel build :used_deps_off_c 2>&1| grep "buildozer 'add deps @\?//dependencies/indirect:used_deps_off_a' //dependencies/indirect:used_deps_off_c"
! bazel build :used_deps_off_c && grep "buildozer 'add deps @\?//dependencies/indirect:used_deps_off_a' //dependencies/indirect:used_deps_off_c" "${command_log}"

# direct_deps off
! bazel build :direct_deps_off_c || false
bazel build :direct_deps_off_c 2>&1| grep "buildozer 'remove deps //dependencies/indirect:direct_deps_off_a' //dependencies/indirect:direct_deps_off_b"
! bazel build :direct_deps_off_c && grep "buildozer 'remove deps //dependencies/indirect:direct_deps_off_a' //dependencies/indirect:direct_deps_off_b" "${command_log}"

# toggle used_deps and direct_deps via --define
! bazel build --define=scala_deps_used=off :define_c || false
bazel build --define=scala_deps_used=off :define_c 2>&1| grep "buildozer 'add deps @\?//dependencies/indirect:define_a' //dependencies/indirect:define_c"
! bazel build --define=scala_deps_used=off :define_c && grep "buildozer 'add deps @\?//dependencies/indirect:define_a' //dependencies/indirect:define_c" "${command_log}"

! bazel build --define=scala_deps_direct=off :define_c || false
bazel build --define=scala_deps_direct=off :define_c 2>&1| grep "buildozer 'remove deps //dependencies/indirect:define_a' //dependencies/indirect:define_b"
! bazel build --define=scala_deps_direct=off :define_c && grep "buildozer 'remove deps //dependencies/indirect:define_a' //dependencies/indirect:define_b" "${command_log}"

bazel build --define=scala_deps_used=off --define=scala_deps_direct=off :define_c
6 changes: 4 additions & 2 deletions tests/dependencies/unused/test
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash -e
. "$(dirname "$0")"/../../common.sh

command_log="$(bazel info command_log)"

bazel build :0_used
! bazel build :0_unused || false
bazel build :0_unused 2>&1| grep "buildozer 'remove deps @annex_test//:org_scalacheck_scalacheck_2_13' //dependencies/unused:0_unused"
bazel build :0_unused && grep "buildozer 'remove deps @annex_test//:org_scalacheck_scalacheck_2_13' //dependencies/unused:0_unused" "${command_log}"
bazel build :0_unused_whitelist
bazel build :indirect_unused
! bazel build :indirect_unused_missing || false
bazel build :indirect_unused_missing 2>&1| grep "buildozer 'add deps @annex_test//:org_specs2_specs2_matcher_2_13' //dependencies/unused:indirect_unused_missing"
bazel build :indirect_unused_missing && grep "buildozer 'add deps @annex_test//:org_specs2_specs2_matcher_2_13' //dependencies/unused:indirect_unused_missing" "${command_log}"
bazel build :indirect_unused_whitelist

0 comments on commit ceb2b1d

Please sign in to comment.