Closed simontoens closed 3 years ago
Just using a java_library
indirection isn't equivalent, because nothing ends up in BOOT-INF/classes. The "real" jar still ends up as the first jar entry in BOOT-INF/lib, so it seems that runtime classloading order is preserved, but there may be subtle differences. I will debug this a bit more.
the jdeps output is coming from here: https://github.com/bazelbuild/rules_kotlin/blob/master/kotlin/internal/jvm/impl.bzl#L37
I just removed some old code coverage logic that was handling a similar issue (extra positional arg). It wasn't applicable anymore to code coverage, but maybe we need to add it back for this case. See the script update in PR #80
Reminder to selves: Work on this in the 1.1.x branch, and cut a new 1.1.x release with the fix from there. Then merge to master. master will soon be back incompat with 1.x.
Released in 1.1.1 https://github.com/salesforce/bazel-springboot-rule/releases/tag/1.1.1
This is with rules kotlin version v1.5.0-alpha-3
The error is, when running the springboot jar:
This error is caused by a corrupt jar manifest.
In
springboot.bzl
, when we use a genrule to callspringboot_pkg.sh
, we use the$(SRCS)
syntax. For thejava_library
attribute, when it references akt_jvm_library target
, we get more than one file path although we expect only one. The first one we get is the jar produced bykt_jvm_library
as expected. But the next one is a .jdeps file, which is unexpected. Whenspringboot_pkg.sh
runs, since it uses positional arguments, the jdeps file replaces the manifest file, and things go downhill from there. See around here: https://github.com/salesforce/bazel-springboot-rule/blob/master/tools/springboot/springboot.bzl#L350There is a workaround - add a
java_library
target indirection between the kt_jvm_library target and the springboot target.We are currently testing this workaround internally. If it works as expected, we can encapsulate this within
springboot.bzl