def String[] modules = [
    'core',
    'remoting',
    'web',
    'ldap',
    'acl',
    'config',
    'cas',
    'openid',
    'taglibs',
    'aspects',
    'crypto'
]

def String[] samples = [
    'tutorial-xml',
    'contacts-xml',
    'openid-xml',
    'aspectj-xml',
    'gae-xml',
    'dms-xml',
    'preauth-xml',
    'cas/server',
    'cas/sample-xml',
    'ldap-xml',
    'jaas-xml',
    'servletapi-xml',
    'concurrency-jc',
    'form-jc',
    'helloworld-jc',
    'hellomvc-jc',
    'insecure',
    'insecuremvc',
    'inmemory-jc',
    'jdbc-jc',
    'ldap-jc',
    'messages-jc',
    'openid-jc',
    'preauth-jc',
    'rememberme-jc',
    'x509-jc'
]

def String[] itest = [
    'web',
    'context'
]

include modules

modules.each {name ->
    def p = findProject(":${name}")
    p.name = "spring-security-${name}"
    p.buildFileName = "${name}.gradle"
}

include samples

samples.each {name ->
    def p = findProject(":${name}")
    def fullName = name.replaceAll('/','')
    p.name = "spring-security-samples-${fullName}"
    p.projectDir = new File(settingsDir, "samples/${name}");
    if(!p.buildFile.exists()) {
        def buildFile = fullName.replaceFirst("-xml","")
        p.buildFileName = "${buildFile}.gradle"
    }
}

include itest

itest.each { name ->
    def p = findProject(":${name}")
    p.name = "itest-${name}"
    p.buildFileName = "itest-${name}.gradle"
    p.projectDir = new File(settingsDir, "itest/${name}");
}

include 'docs', 'docs:faq', 'docs:manual', 'docs:guides'

def docs = findProject(':docs')
docs.buildFileName = 'docs.gradle'

rootProject.name = 'spring-security'

rootProject.children.each {project ->
    //assert project.projectDir.isDirectory()
    //assert project.buildFile.isFile()
}
