gogradle
gogradle copied to clipboard
Local subproject dependency
Hi,
Here is the situation I'd like :
- project
- subProjectA
- subProjectB
subProjectA is a golang project and must be compiled into a docker image (until here no problem) subProjectB is a grpc/protobuf project that generates .pb.go files (generation is fine).
Is it then possible to reference the .pb.go files generated in subProjectB into subProjectA?
Something like the build.gradle
file of subProjectA :
...
dependencies{
golang{
build ...
// How to translate this line into something gogradle plugin can handle?
compile project(':subProjectB')
}
}
...
Thanks in advance
If I understand you correctly, you want to generate something in subprojectB and use the generated go code in subprojectA, right?
If this is the case, currently you have to do this manually, like:
task copyGeneratedGoCodeToVendor(type: Copy) {
dependsOn('vendor')
// ... do the copy work here
}
rootProject.projectA.build.dependsOn(copyGeneratedGoCodeToVendor)
There's no equivalent of project()
in gogradle plugin, since project()
is a pure Java conception - when you declare a project('A')
you are actually declaring some dependency on A.jar
.
Please let me know if I didn't make myself clear.