I am using gradle 1.11. As the title described, I have the following configuratin with my library project: model {
buildTypes {
create(“Release”)
create(“Debug”)
} }
binaries.all {
def genratedFileFolder=“GeneratedFilesDebug”
if(buildType == buildTypes.Release)
{
genratedFileFolder = “GeneratedFilesRelease”
}
sources {
main {
cpp {
source {
srcDir genratedFileFolder
include “*.cpp”
}
}
}
} }
For debug build I only want to build the cpp files in “GeneratedFilesDebug” folder, while for release build only in “GeneratedFilesRelease”, seems " GeneratedFilesDebug" will add to release build. Can’t cpp sourceset be configured dynamically for different cases?
It’s possible, but this isn’t the way to do it. When you reference ‘sources’ from inside the ‘binaries.all’ block, you’re configuring the component-level sources. There’s no ‘sources’ attribute on a native binary.
If you want to selectively add sources to a native binary (and not to the entire component), you need to do:
Not yet. However, we’re working on bringing variants to the JVM and Android domains at the moment, so you can expect to see this stuff get some love in the next few months.