Skip to content

Commit

Permalink
Add a srcjar example/test
Browse files Browse the repository at this point in the history
  • Loading branch information
antonsviridov-src committed Oct 10, 2024
1 parent 91c742b commit 4b5e1fc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/bazel-example/src/main/java/srcjar_example/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
genrule(
name = "generated-srcjar",
outs = ["sources.srcjar"],
cmd = "echo 'package com.testing; public class Bar {};' > Bar.java && jar cf $(@) Bar.java",
)

java_library(
name = "testing",
srcs = [
"Foo.java",
":generated-srcjar",
],
)
8 changes: 8 additions & 0 deletions examples/bazel-example/src/main/java/srcjar_example/Foo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// testing/Foo.java
package com.testing;

public class Foo {
public Bar foo(Bar value) {
return value;
}
}

0 comments on commit 4b5e1fc

Please sign in to comment.