Open urdak opened 4 years ago
Thanks @urdak for the feedback. Sadly, not everything is properly explained in the documentation and it's also hard to explain the everything, especially the work in progress aspect. The InstallExecutable
task is one way to prepare a distributable package for your application. It's certainly not the best nor the only way to do it. What you are asking makes perfect sense and should be possible to customize with the present version. One downside though is it's not possible to remove the current InstallExecutable
task but you can certainly disable it.
What would be your ideal install task for your project? We can start from there and create a sample for that specific use case. Then we can look what should be improved in the plugin to make it easier to use for that use case.
On another note, we are always searching for great user like you to drive the adoption forward, especially the migration from the software model plugin to the new C++ plugins. Send me a quick description of your project as well as your top 5 issues that would unblock your migration (most important) or that would make Gradle easier to use in your project at native-team@gradle.com
Hi @lacasseio, thank you for the quick response.
Here's a rough representation of what the current implementation does:
binaries.withType(SharedLibraryBinarySpec)
.binaries.withType(NativeExecutableBinarySpec)
.This is all done by concatenating a bunch of strings and saving them to a bash file (similar to what InstallExecutable
does).
Regarding other issues: I would love to provide more feedback. I will try to get back to you via email some time in January.
Hi @lacasseio,
I'm still wondering what are the alternatives to InstallExecutable
for running a unit test. Do I create my own tasks on top of compiling/linking provided by the unit test plugin and disable InstallExecutable
and RunTestExecutable
tasks?
Sorry I didn't have time to provide more feedback via email, I will do that as soon as I can.
Hi @lacasseio
I have a very similar use case that I solved in the Software Model plugins by doing an almost identical implementation to what @urdak described. I have created my own flavor of Boost-Test plugin extrapolated from the GoogleTest plugin. I disabled the InstallExecutable and the dependency to RunTestExecutable and substituted the runExecutable with a generated script that I create modeled after what InstallExecutable was doing. So, what @urdak describes is very doable.
Currently I am porting this solution to the new C++ library plugins by forking the code in the cpp-unit-test-plugin to my own construction for a few reasons:
Imagine copying a substantial set of dependencies over hundredfold. I would need terabytes of disk space and time to create and build tests for a single repository build.
For large multi-project builds copying all libraries that the executable depends on produces significant overhead in both disk space usage and execution time.
Expected Behavior
InstallExecutable task should be able to construct a library path from dependencies without copying them to a dedicated directory.
Current Behavior
InstallExecutable task copies all dependent libraries to a directory and adds that directory to the path.
Context
I maintain a large multi-project gradle build. Most of the projects are C++ and are currently using the old model-based plugin. A self-written test plugin creates a run script that adds all library dependency directories to LD_LIBRARY_PATH. I would like to migrate to the new C++ plugins. One of the major issues preventing this migration is the fact that the library dependency chains take too much disk space when copied for each test.
Possible Solutions