salesforce / rules_spring

Bazel rule for building Spring Boot apps as a deployable jar
BSD 3-Clause "New" or "Revised" License
224 stars 48 forks source link

Add deps_usetestclasspath attribute to SpringBoot rule #114

Closed plaird closed 3 years ago

plaird commented 3 years ago

This is a parity feature for the Spring Boot maven plugin. The Maven plugin supports the idea of building an edition of the Spring Boot application with the test classpath added to it. It seems like this is for creating test versions of the application. We haven't done this internally at Salesforce, but perhaps there are people finding use of it.

useTestClasspath https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#goals-start-parameters-details-useTestClasspath

Here is an example of someone using it: https://stackoverflow.com/questions/40094423/spring-boot-usetestclasspath-throws-cannotloadbeanclassexception-and-classnotfou

I would expect a BUILD file then to have two springboot() rule invocations, one normal and one with the test classes:

springboot(name = "myservice", ...)
springboot(name = "myservice_test", ...)
plaird commented 3 years ago

With more thought, this is a no-op. We can do this already with existing springboot rule attributes.

springboot(name = "myservice", ...)

test_deps = [ ... ]
springboot(name = "myservice_test", deps = test_deps, ...)