Hi,
We have a step in our build process to generate stub CPP files with help of Java class before compiling them into a shared library.
For this I thought of using Exec task which will execute java command and generate cpp stub files and libarries cppsourceset will depend on this task.
syntax used is as below
task generateCPPStubs(dependsOn: removePrevFiles) {
doLast {
exec {
executable ${JAVA}
args ${LOGGING}
args ${ENUM}
args ‘-cp’, ${CP}
args ‘’
args ‘-v’, ${DD_VERSION}
args ‘-s’, ${SERVICES}
args ‘-i’, ${ITEMS}
args ‘-co’, ${CONTAINERS}
args ‘-c’, ${CLASS_MANAGER}
args ‘-l’, cpp
}
}
}
and then
sources {
MyLib {
generateCPPStubsOutput(CppSourceSet) {
generatedBy tasks.generateCPPStubs
}
}
}
but I am getting error
FAILURE: Build failed with an exception.
- What went wrong: A problem occurred configuring project ‘:MY.lib’. > Exception thrown while executing model rule: org.gradle.nativebinaries.plugins.NativeComponentModelPlugin$Rules#configureGeneratedSourceSets(org.gradle.language.base.ProjectSourceSet)
Could not find property ‘sourceDir’ on task ‘:MY.lib:generateCPPStubs’.
Can you please point out what is wrong? where should I specify sourceDir property.