File tree Expand file tree Collapse file tree 3 files changed +47
-8
lines changed
src/main/java/com/bazel_diff Expand file tree Collapse file tree 3 files changed +47
-8
lines changed Original file line number Diff line number Diff line change 1818 with :
1919 java-version : 1.8
2020 id : java
21- - name : Setup Go environment
22- uses : actions/setup-go@v2
23- with :
24- go-version : ^1.14
25- id : go
26- - name : Setup Bazelisk
27- run : go get github.com/bazelbuild/bazelisk
2821 - uses : actions/checkout@v2
2922 - name : Run integration test
3023 run : ./integration/integration_test.sh -e
Original file line number Diff line number Diff line change 1+ name : Integration External Target
2+
3+ on :
4+ push :
5+ branches : [ master ]
6+ pull_request :
7+ branches : [ master ]
8+ schedule :
9+ - cron : " 0 */12 * * *"
10+
11+ jobs :
12+ build :
13+ runs-on : ubuntu-latest
14+
15+ steps :
16+ - name : Setup Java JDK
17+ uses : actions/setup-java@v1.4.3
18+ with :
19+ java-version : 1.8
20+ id : java
21+ - uses : actions/checkout@v2
22+ with :
23+ repository : tinder-maxwellelliott/bazel-diff-repro-1
24+ ref : wip_fix
25+ fetch-depth : 0
26+ - name : Run External Target Impact test
27+ run : ./bazel-diff.sh $(pwd) bazel $(git rev-parse HEAD~1) $(git rev-parse HEAD)
28+ - name : Validate Impacted Targets
29+ run : grep -q "//:yo" /tmp/impacted_targets.txt
30+
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