So, I’m trying the native binary support in gradle 2.2.1, and I must be doing something wrong. Either I’m missing some groovy-fu or the ‘cpp’ plugin is doing something that feels ‘dirty’.
We have two projects, one of which has a subset of the platforms of the other. So, let’s just call them project A and B. And, I want to make it easier to specify the different project libraries’ and executables’ targetPlatforms (because there are 100’s of them):
apply plugin: 'cpp'
def projectAPlatforms = [
'linux64', 'linux32',
'mac64',
'solaris_sparc32', 'solaris_sparc64', 'solaris64',
'vc10x32', 'vc10x64', 'vc11x32', 'vc11x64'
]
def projectBPlatforms = [
'linux64', 'mac64', 'vc10x32', 'vc10x64'
]
// assume all platforms have been defined via models.platforms...
libraries {
projectALib {
targetPlatforms projectAPlatforms
}
projectBLib {
targetPlatforms projectBPlatforms
}
}
Using this form, results in:
Error:(18, 0) [Ljava.lang.String; cannot be cast to java.util.List
Okay, so targetPlatforms can’t handle a closure in this form. That’s fine. I’ll use the explicit equals:
libraries {
projectALib {
targetPlatforms = projectAPlatforms
}
projectBLib {
targetPlatforms = projectBPlatforms
}
}
But, this results in:
Error:(18, 0) Cannot set the value of read-only property 'targetPlatforms' on native library 'projectALib'.
Does this mean I can’t define two simple lists and set the targetPlatforms for all of my native components with these? What if we want to add, rename, or delete a platform for either project? I have to update this in 100+ build files? Please tell me that my groovy-fu is too weak to understand the usage here.