You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow setting wrapper targets based on annotations
This allows for registering that, e.g.
```java
@RequiresNetwork
class SomeTest {}
```
should be generated as:
```starlark
requires_network(
java_test,
...
)
```
instead of:
```starlark
java_test(
...
)
```
In suite mode, separate targets will be generated for these special
targets.
fs.Var(&jc.annotationToAttribute, "java-annotation-to-attribute", "Mapping of annotations (on test classes) to attributes which should be set for that test rule. Examples: com.example.annotations.FlakyTest=flaky=True com.example.annotations.SlowTest=timeout=\"long\"")
37
+
fs.Var(&jc.annotationToWrapper, "java-annotation-to-wrapper", "Mapping of annotations (on test classes) to wrapper rules which should be used around the test rule. Example: com.example.annotations.RequiresNetwork=@some//wrapper:file.bzl=requires_network")
35
38
fs.StringVar(&jc.mavenInstallFile, "java-maven-install-file", "", "Path of the maven_install.json file. Defaults to \"maven_install.json\".")
returnfmt.Errorf("want --java-annotation-to-wrapper to have format com.example.RequiresNetwork=@some_repo//has:wrapper.bzl,wrapper_rule but didn't see exactly one equals sign")
223
+
}
224
+
annotation:=parts[0]
225
+
226
+
if_, ok:= (*f)[annotation]; ok {
227
+
returnfmt.Errorf("saw conflicting values for --java-annotation-to-wrapper flag for annotation %v", annotation)
228
+
}
229
+
230
+
vParts:=strings.Split(parts[1], ",")
231
+
iflen(vParts) !=2 {
232
+
returnfmt.Errorf("want --java-annotation-to-wrapper to have format com.example.RequiresNetwork=@some_repo//has:wrapper.bzl,wrapper_rule but didn't see exactly one comma after equals sign")
log.Error().Str("file", file.pathRelativeToBazelWorkspaceRoot).Msgf("Saw conflicting wrappers from annotations: %v and %v. Picking one at random.", wrapper, newWrapper)
0 commit comments