Can I use a flag in to configure only subset of subprojects?

How I can use a flag in configure()?

I don’t want use the projects names like in example

I’m looking something like this: (It’s not working correctly):

project.ext.specialType = false
configure(allprojects.findAll { it.specialType != 'true' }) {
    apply from: ""
project proj1{
       specialType = true

The reason it doesn’t work is because you set the specialType to the root project, which will automatically propagate to all its sub projects, so in effect you set all projects.

You can do something like:

project(':api').ext.specialType = true
  configure(allprojects.findAll { it.hasProperty("specialType") && !it.specialType }) {
    print + "\n"

Notice if you access it.specialType directly, there will be exception if the project doesn’t have this property, so you need to use hasProperty to do the check.

Thank you!