-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix java_binary targets in test trees
Before they were generated with a dependency on a target which didn't exist. Instead, add the dependency on the -test-lib target of the java_test_suite in their package, and mark them as testonly. This is hopefully a pretty rare edge-case, but has been observed.
- Loading branch information
1 parent
bc11fb4
commit 3cdd446
Showing
8 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# gazelle:resolve java org.junit @maven//:junit_junit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# gazelle:resolve java org.junit @maven//:junit_junit |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"level":"warn","_c":"maven-resolver","error":"open %WORKSPACEPATH%/maven_install.json: no such file or directory","message":"not loading maven dependencies"} |
19 changes: 19 additions & 0 deletions
19
java/gazelle/testdata/bin_in_test_tree/src/test/java/com/example/test/BUILD.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
load("@rules_java//java:defs.bzl", "java_binary") | ||
load("@contrib_rules_jvm//java:defs.bzl", "java_test_suite") | ||
|
||
java_binary( | ||
name = "SomeTestBinary", | ||
testonly = True, | ||
main_class = "com.example.test.SomeTestBinary", | ||
visibility = ["//visibility:public"], | ||
runtime_deps = [":test-test-lib"], | ||
) | ||
|
||
java_test_suite( | ||
name = "test", | ||
srcs = [ | ||
"SomeOtherTest.java", | ||
"SomeTestBinary.java", | ||
], | ||
deps = ["@maven//:junit_junit"], | ||
) |
8 changes: 8 additions & 0 deletions
8
java/gazelle/testdata/bin_in_test_tree/src/test/java/com/example/test/SomeOtherTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.example.test; | ||
|
||
import org.junit.Test; | ||
|
||
public class SomeOtherTest { | ||
@Test | ||
public void testPasses() {} | ||
} |
7 changes: 7 additions & 0 deletions
7
java/gazelle/testdata/bin_in_test_tree/src/test/java/com/example/test/SomeTestBinary.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example.test; | ||
|
||
public class SomeTestBinary { | ||
public static void main(String[] args) { | ||
System.out.println("Test passed!"); | ||
} | ||
} |