Standardize Build

Fixes gh-769
This commit is contained in:
Rob Winch
2017-02-03 22:31:18 -06:00
parent e23aaeca5f
commit d590ca58e4
87 changed files with 710 additions and 1257 deletions

View File

@@ -1,38 +1,27 @@
rootProject.name = 'spring-session-build'
include 'docs'
include 'spring-session'
include 'spring-session-data-gemfire'
include 'spring-session-data-mongo'
include 'spring-session-data-redis'
include 'spring-session-hazelcast'
include 'spring-session-jdbc'
FileTree buildFiles = fileTree(rootDir) {
include '**/*.gradle'
exclude '**/gradle', 'settings.gradle', 'buildSrc', '/build.gradle', '.*'
exclude '**/grails3'
}
includeSamples("samples" + File.separator + "boot")
includeSamples("samples" + File.separator + "javaconfig")
includeSamples("samples" + File.separator + "misc")
includeSamples("samples" + File.separator + "xml")
void includeSamples(String samplesDir) {
FileTree tree = fileTree(samplesDir) {
include '**' + File.separator + '*.gradle'
exclude 'grails3'
}
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-session-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
}
}
}