6161import com .google .common .collect .Iterables ;
6262import com .google .common .collect .Maps ;
6363import com .google .common .eventbus .Subscribe ;
64+ import com .google .common .flogger .GoogleLogger ;
6465import com .google .common .util .concurrent .Futures ;
6566import com .google .common .util .concurrent .ListenableFuture ;
6667import com .google .common .util .concurrent .SettableFuture ;
6768import com .google .devtools .build .lib .actions .ActionInput ;
69+ import com .google .devtools .build .lib .actions .ActionOwner ;
6870import com .google .devtools .build .lib .actions .Artifact ;
6971import com .google .devtools .build .lib .actions .ArtifactPathResolver ;
7072import com .google .devtools .build .lib .actions .EnvironmentalExecException ;
@@ -1983,7 +1985,7 @@ void report(Event evt) {
19831985 }
19841986 }
19851987
1986- private static boolean hasScrubbedInput (Spawn spawn , @ Nullable Scrubber scrubber ) {
1988+ private boolean hasScrubbedInput (Spawn spawn , @ Nullable Scrubber scrubber ) {
19871989 if (scrubber == null ) {
19881990 return false ;
19891991 }
@@ -2000,11 +2002,23 @@ private static boolean hasScrubbedInput(Spawn spawn, @Nullable Scrubber scrubber
20002002 }
20012003 }
20022004 var inputFiles = spawn .getInputFiles ();
2005+
2006+ String mnemonic = spawn .getMnemonic ();
2007+ ActionOwner actionOwner = spawn .getResourceOwner ().getOwner ();
2008+ String label = actionOwner .getLabel ().getCanonicalForm ();
2009+ String kind = actionOwner .getTargetKind ();
2010+
20032011 for (ActionInput inputFile : inputFiles .toList ()) {
20042012 if (spawnScrubber .shouldOmitInput (inputFile .getExecPath ())) {
2013+ if (!spawnScrubber .hasMatcher ) {
2014+ reporter .handle (Event .warn (String .format ("Used file-based scrubber for mnemonic: %s, label: %s, kind: %s" , mnemonic , label , kind )));
2015+ }
20052016 return true ;
20062017 }
20072018 }
2019+ if (spawnScrubber .hasMatcher ) {
2020+ reporter .handle (Event .warn (String .format ("Unused scrubber for mnemonic: %s, label: %s, kind: %s" , mnemonic , label , kind )));
2021+ }
20082022 return false ;
20092023 }
20102024
0 commit comments