File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/main/java/com/bazel_diff Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 44import java .security .NoSuchAlgorithmException ;
55import java .util .List ;
66import com .google .devtools .build .lib .query2 .proto .proto2api .Build ;
7+ import java .util .stream .Collectors ;
78
89interface BazelRule {
910 byte [] getDigest () throws NoSuchAlgorithmException ;
@@ -32,11 +33,26 @@ public byte[] getDigest() throws NoSuchAlgorithmException {
3233
3334 @ Override
3435 public List <String > getRuleInputList () {
35- return rule .getRuleInputList ();
36+ return rule .getRuleInputList ()
37+ .stream ()
38+ .map (ruleInput -> transformRuleInput (ruleInput ))
39+ .collect (Collectors .toList ());
3640 }
3741
3842 @ Override
3943 public String getName () {
4044 return rule .getName ();
4145 }
46+
47+ private String transformRuleInput (String ruleInput ) {
48+ if (ruleInput .startsWith ("@" )) {
49+ String [] splitRule = ruleInput .split ("//" );
50+ if (splitRule .length == 2 ) {
51+ String externalRule = splitRule [0 ];
52+ externalRule = externalRule .replaceFirst ("@" , "" );
53+ return String .format ("//external:%s" , externalRule );
54+ }
55+ }
56+ return ruleInput ;
57+ }
4258}
You can’t perform that action at this time.
0 commit comments