Skip to content

Commit

Permalink
Polish .gradle file formatting to use tabs
Browse files Browse the repository at this point in the history
Replace spaces with tabs for consistency with Java source code
  • Loading branch information
philwebb committed Dec 10, 2012
1 parent 756bff8 commit a268528
Show file tree
Hide file tree
Showing 8 changed files with 1,069 additions and 1,069 deletions.
1,534 changes: 767 additions & 767 deletions build.gradle

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions gradle/ide.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import org.gradle.plugins.ide.eclipse.model.ProjectDependency

eclipse.classpath.file.whenMerged { classpath ->
// servlet-api (2.5) and tomcat-servlet-api (3.0) classpath entries should not be
// exported to dependent projects in Eclipse to avoid false compilation errors due
// to changing APIs across these versions
classpath.entries.findAll { entry -> entry.path.contains('servlet-api') }*.exported = false
// servlet-api (2.5) and tomcat-servlet-api (3.0) classpath entries should not be
// exported to dependent projects in Eclipse to avoid false compilation errors due
// to changing APIs across these versions
classpath.entries.findAll { entry -> entry.path.contains('servlet-api') }*.exported = false

// GRADLE-1116
def regexp = /.*?\/([^\/]+)\/build\/[^\/]+\/(?:main|test)/ // only match those that end in main or test (avoids removing necessary entries like build/classes/jaxb)
def projectOutputDependencies = classpath.entries.findAll { entry -> entry.path =~ regexp }
projectOutputDependencies.each { entry ->
def matcher = (entry.path =~ regexp)
if(matcher) {
def projectName = matcher[0][1]
def path = "/${projectName}"
if(!classpath.entries.find { e -> e instanceof ProjectDependency && e.path == path }) {
def dependency = new ProjectDependency(path, project(":${projectName}").path)
dependency.exported = true
classpath.entries.add(dependency)
}
classpath.entries.remove(entry)
}
}
classpath.entries.removeAll { entry -> (entry.path =~ /(?!.*?repack.*\.jar).*?\/([^\/]+)\/build\/libs\/[^\/]+\.jar/) }
}
// GRADLE-1116
def regexp = /.*?\/([^\/]+)\/build\/[^\/]+\/(?:main|test)/ // only match those that end in main or test (avoids removing necessary entries like build/classes/jaxb)
def projectOutputDependencies = classpath.entries.findAll { entry -> entry.path =~ regexp }
projectOutputDependencies.each { entry ->
def matcher = (entry.path =~ regexp)
if(matcher) {
def projectName = matcher[0][1]
def path = "/${projectName}"
if(!classpath.entries.find { e -> e instanceof ProjectDependency && e.path == path }) {
def dependency = new ProjectDependency(path, project(":${projectName}").path)
dependency.exported = true
classpath.entries.add(dependency)
}
classpath.entries.remove(entry)
}
}
classpath.entries.removeAll { entry -> (entry.path =~ /(?!.*?repack.*\.jar).*?\/([^\/]+)\/build\/libs\/[^\/]+\.jar/) }
}
102 changes: 51 additions & 51 deletions gradle/jdiff.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,64 +11,64 @@
* @param OLD_VERSION_ROOT required, typically pointing to a separate git clone dir
*/
task jdiff {
description = 'Generates a JDiff report'
group = 'Documentation'
description = 'Generates a JDiff report'
group = 'Documentation'

def jdiffHome = "${rootProject.rootDir}/gradle/jdiff"
def jdiffHome = "${rootProject.rootDir}/gradle/jdiff"

ant.taskdef(
name: 'jdiff',
classname: 'jdiff.JDiffAntTask',
classpath: "${jdiffHome}/antjdiff.jar")
ant.taskdef(
name: 'jdiff',
classname: 'jdiff.JDiffAntTask',
classpath: "${jdiffHome}/antjdiff.jar")

def previousVersion = rootProject.previousVersion
def previousVersion = rootProject.previousVersion

def currentVersion = rootProject.version
def currentVersionRoot = rootProject.rootDir
def currentVersion = rootProject.version
def currentVersionRoot = rootProject.rootDir

def oldVersion = System.getProperty("OLD_VERSION") ?: previousVersion
def oldVersionRoot = System.getProperty("OLD_VERSION_ROOT")
def oldVersion = System.getProperty("OLD_VERSION") ?: previousVersion
def oldVersionRoot = System.getProperty("OLD_VERSION_ROOT")

def outputDir = "${rootProject.buildDir}/reports/jdiff/${oldVersion}_to_${currentVersion}"
def outputDir = "${rootProject.buildDir}/reports/jdiff/${oldVersion}_to_${currentVersion}"

doLast {
if (oldVersionRoot == null)
throw new IllegalArgumentException(
"Set OLD_VERSION_ROOT property to indicate the root directory for ${oldVersion}")
doLast {
if (oldVersionRoot == null)
throw new IllegalArgumentException(
"Set OLD_VERSION_ROOT property to indicate the root directory for ${oldVersion}")

oldVersionRoot = new File(oldVersionRoot)
oldVersionRoot = new File(oldVersionRoot)

ant.property(name: 'JDIFF_HOME', value: jdiffHome)
ant.mkdir(dir: outputDir)
ant.jdiff(
destdir: outputDir,
verbose: 'off',
stats: 'on',
docchanges: 'on') {
old(name: "Spring Framework ${oldVersion}") {
oldVersionRoot.eachDirMatch( {
def candidate = new File(it)
candidate.name.matches("org.springframework.*") ||
candidate.name.matches("spring-.*") }) { match ->
match.eachDirRecurse { subdir ->
if (subdir.path ==~ '.*/src/main/java$') {
dirset(dir: subdir.path, includes: 'org/**')
}
}
}
}
'new'(name: "Spring Framework ${currentVersion}") {
currentVersionRoot.eachDirMatch( {
def candidate = new File(it)
candidate.name.matches("org.springframework.*") ||
candidate.name.matches("spring-.*") }) { match ->
match.eachDirRecurse { subdir ->
if (subdir.path ==~ '.*/src/main/java$') {
dirset(dir: subdir.path, includes: 'org/**')
}
}
}
}
}
}
ant.property(name: 'JDIFF_HOME', value: jdiffHome)
ant.mkdir(dir: outputDir)
ant.jdiff(
destdir: outputDir,
verbose: 'off',
stats: 'on',
docchanges: 'on') {
old(name: "Spring Framework ${oldVersion}") {
oldVersionRoot.eachDirMatch( {
def candidate = new File(it)
candidate.name.matches("org.springframework.*") ||
candidate.name.matches("spring-.*") }) { match ->
match.eachDirRecurse { subdir ->
if (subdir.path ==~ '.*/src/main/java$') {
dirset(dir: subdir.path, includes: 'org/**')
}
}
}
}
'new'(name: "Spring Framework ${currentVersion}") {
currentVersionRoot.eachDirMatch( {
def candidate = new File(it)
candidate.name.matches("org.springframework.*") ||
candidate.name.matches("spring-.*") }) { match ->
match.eachDirRecurse { subdir ->
if (subdir.path ==~ '.*/src/main/java$') {
dirset(dir: subdir.path, includes: 'org/**')
}
}
}
}
}
}
}
50 changes: 25 additions & 25 deletions gradle/merge-artifacts.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,43 @@ def mergeFromProject = project
// invoking a task on mergeFromProject will invoke the task with the same name on mergeIntoProject
def taskNamesToMerge = ['sourcesJar','jar','javadocJar','javadoc','install','artifactoryPublish']
taskNamesToMerge.each { taskName ->
def taskToRemove = mergeFromProject.tasks.findByPath(taskName)
if(taskToRemove) {
taskToRemove.enabled = false
taskToRemove.dependsOn mergeIntoProject."$taskName"
}
def taskToRemove = mergeFromProject.tasks.findByPath(taskName)
if(taskToRemove) {
taskToRemove.enabled = false
taskToRemove.dependsOn mergeIntoProject."$taskName"
}
}

// update mergeIntoProject artifacts to contain the mergeFromProject artifact contents
mergeIntoProject."sourcesJar" {
from mergeFromProject.sourcesJar.source
from mergeFromProject.sourcesJar.source
}
mergeIntoProject."jar" {
from mergeFromProject.jar.source
from mergeFromProject.jar.source
}
mergeIntoProject."javadoc" {
source += mergeFromProject.javadoc.source
classpath += mergeFromProject.javadoc.classpath
source += mergeFromProject.javadoc.source
classpath += mergeFromProject.javadoc.classpath
}

// Update mergeIntoProject to contain additional configurations that contains all the dependencies from mergeFromProject
// so that Maven pom generation works
gradle.taskGraph.whenReady {
mergeFromProject.configurations.archives.artifacts.clear()
mergeFromProject.configurations.archives.artifacts.clear()

mergeFromProject.configurations.each { config->
def mapping = mergeFromProject.conf2ScopeMappings.getMapping([config])
if(mapping.scope) {
def newConfigName = mergeFromProject.name + "-"+ config.name
mergeIntoProject.configurations.add(newConfigName)
config.dependencies.each { dependency ->
mergeIntoProject.dependencies.add(newConfigName, dependency)
}
configure(mergeIntoProject.install.repositories.mavenInstaller.pom.scopeMappings) {
addMapping(mapping.priority + 100, mergeIntoProject.configurations."$newConfigName", mapping.scope)
}
mergeIntoProject.optionalDeps += mergeFromProject.optionalDeps
mergeIntoProject.providedDeps += mergeFromProject.providedDeps
}
}
mergeFromProject.configurations.each { config->
def mapping = mergeFromProject.conf2ScopeMappings.getMapping([config])
if(mapping.scope) {
def newConfigName = mergeFromProject.name + "-"+ config.name
mergeIntoProject.configurations.add(newConfigName)
config.dependencies.each { dependency ->
mergeIntoProject.dependencies.add(newConfigName, dependency)
}
configure(mergeIntoProject.install.repositories.mavenInstaller.pom.scopeMappings) {
addMapping(mapping.priority + 100, mergeIntoProject.configurations."$newConfigName", mapping.scope)
}
mergeIntoProject.optionalDeps += mergeFromProject.optionalDeps
mergeIntoProject.providedDeps += mergeFromProject.providedDeps
}
}
}
90 changes: 45 additions & 45 deletions gradle/publish-maven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,54 @@ ext.optional = { optionalDeps << it }
ext.provided = { providedDeps << it }

install {
repositories.mavenInstaller {
customizePom(pom, project)
}
repositories.mavenInstaller {
customizePom(pom, project)
}
}

def customizePom(pom, gradleProject) {
pom.whenConfigured { generatedPom ->
// respect 'optional' and 'provided' dependencies
gradleProject.optionalDeps.each { dep ->
generatedPom.dependencies.findAll { it.artifactId == dep.name }*.optional = true
}
gradleProject.providedDeps.each { dep ->
generatedPom.dependencies.findAll { it.artifactId == dep.name }*.scope = 'provided'
}
pom.whenConfigured { generatedPom ->
// respect 'optional' and 'provided' dependencies
gradleProject.optionalDeps.each { dep ->
generatedPom.dependencies.findAll { it.artifactId == dep.name }*.optional = true
}
gradleProject.providedDeps.each { dep ->
generatedPom.dependencies.findAll { it.artifactId == dep.name }*.scope = 'provided'
}

// eliminate test-scoped dependencies (no need in maven central poms)
generatedPom.dependencies.removeAll { dep ->
dep.scope == 'test'
}
// eliminate test-scoped dependencies (no need in maven central poms)
generatedPom.dependencies.removeAll { dep ->
dep.scope == 'test'
}

// add all items necessary for maven central publication
generatedPom.project {
name = gradleProject.description
description = gradleProject.description
url = 'https://github.com/SpringSource/spring-framework'
organization {
name = 'SpringSource'
url = 'http://springsource.org/spring-framework'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url = 'https://github.com/SpringSource/spring-framework'
connection = 'scm:git:git://github.com/SpringSource/spring-framework'
developerConnection = 'scm:git:git://github.com/SpringSource/spring-framework'
}
developers {
developer {
id = 'jhoeller'
name = 'Juergen Hoeller'
email = '[email protected]'
}
}
}
}
// add all items necessary for maven central publication
generatedPom.project {
name = gradleProject.description
description = gradleProject.description
url = 'https://github.com/SpringSource/spring-framework'
organization {
name = 'SpringSource'
url = 'http://springsource.org/spring-framework'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url = 'https://github.com/SpringSource/spring-framework'
connection = 'scm:git:git://github.com/SpringSource/spring-framework'
developerConnection = 'scm:git:git://github.com/SpringSource/spring-framework'
}
developers {
developer {
id = 'jhoeller'
name = 'Juergen Hoeller'
email = '[email protected]'
}
}
}
}
}
Loading

0 comments on commit a268528

Please sign in to comment.