My project is structured such that I have two components — a library containing all the business logic and an executable which is a thin wrapper around it. I’m using the google-test plugin to run tests over the library, but not the executable.
However, test tasks are still created for the non-existent executable tests (e.g. runMainTestGoogleTestExe
). When this task runs, the build aborts because it runs the executable’s main()
rather than a test suite’s, which then bails because required command-line arguments are missing.
How can I prevent test tasks from being created for my executable?
apply plugin: 'cpp'
apply plugin: 'google-test'
model {
components {
main(NativeExecutableSpec) {
sources {
cpp {
lib library: 'solver', linkage: 'static'
}
}
}
solver(NativeLibrarySpec)
}
}