File tree 3 files changed +47
-8
lines changed
src/main/java/com/bazel_diff
3 files changed +47
-8
lines changed Original file line number Diff line number Diff line change 18
18
with :
19
19
java-version : 1.8
20
20
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
28
21
- uses : actions/checkout@v2
29
22
- name : Run integration test
30
23
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
+
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 4
4
import java .security .NoSuchAlgorithmException ;
5
5
import java .util .List ;
6
6
import com .google .devtools .build .lib .query2 .proto .proto2api .Build ;
7
+ import java .util .stream .Collectors ;
7
8
8
9
interface BazelRule {
9
10
byte [] getDigest () throws NoSuchAlgorithmException ;
@@ -32,11 +33,26 @@ public byte[] getDigest() throws NoSuchAlgorithmException {
32
33
33
34
@ Override
34
35
public List <String > getRuleInputList () {
35
- return rule .getRuleInputList ();
36
+ return rule .getRuleInputList ()
37
+ .stream ()
38
+ .map (ruleInput -> transformRuleInput (ruleInput ))
39
+ .collect (Collectors .toList ());
36
40
}
37
41
38
42
@ Override
39
43
public String getName () {
40
44
return rule .getName ();
41
45
}
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
+ }
42
58
}
You can’t perform that action at this time.
0 commit comments