Standardize Build

The build now uses spring build conventions to simplify the build

Fixes gh-4284
This commit is contained in:
Rob Winch
2017-03-28 15:45:30 -05:00
parent 5a65da400d
commit dd6fc48dd8
119 changed files with 1110 additions and 2227 deletions

View File

@@ -1,80 +1,30 @@
rootProject.name = 'spring-security'
rootProject.children.each {project ->
//assert project.projectDir.isDirectory()
//assert project.buildFile.isFile()
}
def String[] modules = [
'core',
'data',
'remoting',
'web',
'ldap',
'acl',
'config',
'cas',
'openid',
'taglibs',
'aspects',
'crypto',
'messaging',
'test'
]
include modules
modules.each {name ->
def p = findProject(":${name}")
p.name = "spring-security-${name}"
p.buildFileName = "${name}.gradle"
}
def String[] itest = [
'web',
'context'
]
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:manual', 'docs:guides'
def docs = findProject(':docs')
docs.buildFileName = 'docs.gradle'
include 'bom'
findProject(':bom').name = 'spring-security-bom'
includeSamples("samples" + File.separator + "xml")
includeSamples("samples" + File.separator + "javaconfig")
includeSamples("samples" + File.separator + "boot")
void includeSamples(String samplesDir) {
FileTree tree = fileTree(samplesDir) {
include '**' + File.separator + '*.gradle'
FileTree buildFiles = fileTree(rootDir) {
List excludes = gradle.startParameter.projectProperties.get("excludeProjects")?.split(",")
include '**/*.gradle'
exclude '**/gradle', 'settings.gradle', 'buildSrc', '/build.gradle', '.*', 'out'
exclude '**/grails3'
if(excludes) {
exclude excludes
}
tree.each {File file ->
String projectDir = file.path.substring(file.path.indexOf(samplesDir), file.path.lastIndexOf(File.separator))
String projectPath = projectDir.substring(projectDir.lastIndexOf(File.separator) + 1)
String projectNamePrefix = samplesDir.substring(samplesDir.lastIndexOf(File.separator) + 1).toLowerCase();
}
String rootDirPath = rootDir.absolutePath + File.separator
buildFiles.each { File buildFile ->
boolean isDefaultName = 'build.gradle'.equals(buildFile.name)
if(isDefaultName) {
String buildFilePath = buildFile.parentFile.absolutePath
String projectPath = buildFilePath.replace(rootDirPath, '').replaceAll(File.separator, ':')
include projectPath
def project = findProject(":${projectPath}")
project.name = "spring-security-samples-${projectNamePrefix}-${project.name}"
project.projectDir = new File(settingsDir, projectDir)
if (!project.buildFile.exists()) {
project.buildFileName = file.path.substring(file.path.lastIndexOf(File.separator) + 1)
}
} else {
String projectName = buildFile.name.replace('.gradle', '');
String projectPath = ':' + projectName;
include projectPath
def project = findProject("${projectPath}")
project.name = projectName
project.projectDir = buildFile.parentFile
project.buildFileName = buildFile.name
}
}