From 3704408f187e4ceb619dd39dde08c525a731b942 Mon Sep 17 00:00:00 2001 From: Jaden Peterson Date: Tue, 12 Nov 2024 13:27:28 -0500 Subject: [PATCH] Test that ScalaCheckDeps outputs aren't inputs to other actions --- .../validation_action/BUILD.bazel | 7 ++++++ tests/dependencies/validation_action/test | 24 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 tests/dependencies/validation_action/BUILD.bazel create mode 100755 tests/dependencies/validation_action/test diff --git a/tests/dependencies/validation_action/BUILD.bazel b/tests/dependencies/validation_action/BUILD.bazel new file mode 100644 index 00000000..bc597af7 --- /dev/null +++ b/tests/dependencies/validation_action/BUILD.bazel @@ -0,0 +1,7 @@ +load("@rules_scala_annex//rules:scala.bzl", "scala_library") + +scala_library( + name = "validation_action", + scala = "//scala:2_13", + tags = ["manual"], +) diff --git a/tests/dependencies/validation_action/test b/tests/dependencies/validation_action/test new file mode 100755 index 00000000..24729326 --- /dev/null +++ b/tests/dependencies/validation_action/test @@ -0,0 +1,24 @@ +#!/bin/bash -e +. "$(dirname "$0")"/../../common.sh + +scalacheckdeps_outputs="$( + bazel aquery 'mnemonic("^ScalaCheckDeps$", //dependencies/validation_action)' | + grep -oP '(?<=^ Outputs: \[).*(?=\]$)' | + sed 's/, /\n/g' | + sort -u +)" + +action_inputs="$( + bazel aquery '//dependencies/validation_action' | + grep -oP '(?<=^ Inputs: \[).*(?=\]$)' | + sed 's/, /\n/g' | + sort -u +)" + +common_files="$(comm -12 <(echo "$scalacheckdeps_outputs") <(echo "$action_inputs"))" + +if [ -n "$common_files" ]; then + echo "Found some ScalaCheckDeps outputs that are the inputs to other actons:" + echo "$common_files" + exit 1 +fi