Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: GRAILS-11011
Fetching contributors…

Cannot retrieve contributors at this time

379 lines (326 sloc) 12.968 kB
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
repositories {
maven { url "http://repo.grails.org/grails/core" }
//mavenRepo(urls: 'http://evgeny-goldin.org/artifactory/repo/')
}
dependencies {
classpath "commons-io:commons-io:2.1"
//classpath "com.goldin.plugins:gradle:0.1-RC3" // http://evgeny-goldin.com/wiki/Gradle-duplicates-plugin
}
}
apply plugin: 'idea'
ext.optionalDeps = []
ext.providedDeps = []
ext.provided = { providedDeps << it }
ext {
grailsVersion = '2.4.0.BUILD-SNAPSHOT'
isBuildSnapshot = grailsVersion.endsWith(".BUILD-SNAPSHOT")
antTraxVersion = "1.7.1"
antVersion = "1.8.4"
aspectjVersion = "1.8.0.M1"
commonsBeanUtilsVersion = "1.8.3"
commonsCliVersion = "1.2"
commonsCollectionsVersion = "3.2.1"
commonsIOVersion = "2.1"
commonsLangVersion = "2.6"
datastoreVersion = "2.0.7.RELEASE"
gantVersion = "1.9.6"
gdocEngineVersion = "1.0.1"
groovyVersion = "2.2.1"
ivyVersion = "2.3.0"
jansiVersion = "1.11"
jlineVersion = "2.11"
jnaVersion = "4.0.0"
slf4jVersion = "1.7.5"
spockVersion = '0.7-groovy-2.0'
springLoadedVersion = "1.1.4"
springLoadedCommonOptions = "-noverify -Dspringloaded.synchronize=true -Djdk.reflect.allowGetCallerClass=true"
springVersion = "4.0.0.RELEASE"
ehcacheVersion = "2.4.6"
junitVersion = "4.11"
concurrentlinkedhashmapVersion = "1.3.1"
cglibVersion = "2.2.2"
objenesisVersion = "1.2"
}
version = grailsVersion
// directories created during the build which are related
// to turning the workspace root into a GRAILS_HOME
ext {
distInstallDir = file("$buildDir/dist-tmp")
homeDistDir = file("dist")
homeBinDir = file("bin")
homeConfDir = file("conf")
homeDslSupportDir = file("dsl-support")
homeLibDir = file("lib")
homeSrcDir = file("src")
}
// Groovy is added as a dependency to both the 'groovy' and 'compile'
// configurations, so place the dependency in a shared variable. The
// 'compile' is required so that Groovy appears as a dependency in the
// artifacts' POMs.
ext.jointBuildGroovyJarProperty = System.getProperty('groovy.jar')
ext.groovyDependency = null
if (jointBuildGroovyJarProperty) {
jointBuildGroovyJar = file(jointBuildGroovyJarProperty)
if (jointBuildGroovyJar.exists()) {
groovyDependency = dependencies.create(files(jointBuildGroovyJar))
} else {
throw new GradleException("The groovy.jar system property points to ${jointBuildGroovyJar.absolutePath} which does not exist.")
}
} else {
groovyDependency = dependencies.create("org.codehaus.groovy:groovy-all:${groovyVersion}") {
exclude module:"commons-cli"
exclude module:"ant"
}
}
allprojects {
repositories {
maven { url "http://repo.grails.org/grails/core" }
}
configurations {
all {
resolutionStrategy {
def cacheHours = isCiBuild ? 0 : 24
cacheDynamicVersionsFor cacheHours, 'hours'
cacheChangingModulesFor cacheHours, 'hours'
}
}
}
// this will apply the javadoc fix tool to all generated javadocs
// we use it to make sure that the javadocs are not vulnerable independently of the JDK used to build
[Javadoc, Groovydoc].each {
tasks.withType(it).all {
doLast {
def javadocFix = new JavadocFixTool()
javadocFix.recursive = true
javadocFix.doPatch = true
javadocFix.searchAndPatch(destinationDir)
}
}
}
}
apply from: "gradle/idea.gradle"
subprojects { project ->
ext.isTestSuite = project.name.startsWith("grails-test-suite")
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'project-report'
if(!isTestSuite)
apply plugin: 'signing'
//apply plugin: 'duplicates'
sourceCompatibility = "1.6"
targetCompatibility = "1.6"
// archivesBaseName = 'grails'
version = grailsVersion
group = "org.grails"
ext.isCiBuild = project.hasProperty("isCiBuild")
manifest.mainAttributes(
"Built-By": System.properties['user.name'],
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
"Implementation-Title": "Grails",
"Implementation-Version": grailsVersion,
"Implementation-Vendor": 'grails.org')
configure([compileGroovy, compileTestGroovy]) {
groovyOptions.fork(memoryInitialSize: '128M', memoryMaximumSize: '1G')
groovyOptions.encoding = "UTF-8"
groovyOptions.stacktrace = true
options.encoding = "UTF-8"
}
configure([compileJava, compileTestJava]) {
options.deprecation = true
options.debug = true
}
configure([javadoc]) {
options.encoding "UTF-8"
options.docEncoding "UTF-8"
options.charSet "UTF-8"
}
idea {
module.iml.whenMerged { module ->
// adding slf4j-simple with scope TEST to .iml
module.dependencies << new org.gradle.plugins.ide.idea.model.ModuleLibrary(
[new org.gradle.plugins.ide.idea.model.Path("jar://\$GRADLE_USER_HOME/cache/org.slf4j/slf4j-simple/jars/slf4j-simple-${slf4jVersion}.jar!/")], [], [], [], "TEST"
)
}
}
repositories {
if(!isCiBuild) {
mavenLocal()
}
}
dependencies {
// this check is really here only to support the
// joint build. as soon as the 2.1 Groovy branch
// is update to Gradle 1.10 we can remove this and
// remove the call to "groovy groovyDependency"
if('1.10' == project.gradle.gradleVersion) {
compile groovyDependency
} else {
groovy groovyDependency
}
if (project.name != "grails-docs") {
// Logging
compile "org.slf4j:slf4j-api:$slf4jVersion"
compile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
// Testing
testCompile "junit:junit:${junitVersion}"
testCompile("org.spockframework:spock-core:${spockVersion}") {
transitive = false
exclude group:'junit', module: 'junit-dep'
exclude group:'org.codehaus.groovy', module: 'groovy-all'
}
// Required by Spock's Mocking
testCompile "cglib:cglib:${cglibVersion}"
testCompile "org.objenesis:objenesis:${objenesisVersion}"
}
}
test {
excludes = ["**/*TestCase.class", "**/*\$*.class"]
}
if(!isTestSuite) {
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
}
groovydoc.doLast {
delete("${buildDir}/tmp")
}
configurations {
meta
published.extendsFrom archives, meta
all*.exclude group:'commons-logging', module: 'commons-logging'
}
if(!isTestSuite) {
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
signing {
sign configurations.archives
required { !isBuildSnapshot && gradle.taskGraph.hasTask(uploadPublished) }
}
ext {
poms = [project.install.repositories.mavenInstaller.pom]
pomModifications = []
modifyPom = { Closure modification -> project.pomModifications << modification }
}
task installToHomeDist(type: Upload) {
configuration = configurations.archives
repositories {
project.poms << mavenDeployer {
repository(url: distInstallDir.toURL())
uniqueVersion = false
pom.artifactId = project.name
}.pom
}
}
install.dependsOn installToHomeDist
install.doLast {
ant.copy(todir:homeDistDir, flatten:true, includeEmptyDirs:false) {
fileset dir:distInstallDir
}
// This is a temporary hack. Since https://github.com/grails/grails-core/commit/f7c5882057386853fdbf30c42b2212cfebad3c01
// the wrapper support jar is not being copied to the dist dir. Pending a real solution, this should work.
if(project.name == 'grails-wrapper') {
ant.copy(todir: homeDistDir) {
fileset dir: 'build/libs', includes: '*wrapper-support*'
}
}
}
uploadPublished {
repositories {
project.poms << mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: project.hasProperty("sonatypeUsername") ? project.sonatypeUsername : null,
password: project.hasProperty("sonatypePassword") ? project.sonatypePassword : null)
}
// snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
// authentication(userName: project.hasProperty("sonatypeUsername") ? project.sonatypeUsername : null,
// password: project.hasProperty("sonatypePassword") ? project.sonatypePassword : null)
// }
snapshotRepository(url: "http://repo.grails.org/grails/libs-snapshots-local") {
authentication(userName: project.hasProperty("artifactoryPublishUsername") ? project.artifactoryPublishUsername : null,
password: project.hasProperty("artifactoryPublishPassword") ? project.artifactoryPublishPassword : null)
}
}.pom
}
}
modifyPom { pom ->
pom.project {
name 'Grails'
packaging 'jar'
description 'Grails Web Application Framework'
delegate.url 'http://grails.org/'
scm {
delegate.url 'scm:git@github.com:grails/grails-core.git'
connection 'scm:git@github.com:grails/grails-core.git'
developerConnection 'scm:git@github.com:grails/grails-core.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
delegate.url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'graemerocher'
name 'Graeme Rocher'
}
developer {
id 'jeffscottbrown'
name 'Jeff Brown'
}
}
}
}
// Remove any dependencies that shouldn't be included in the POM
modifyPom { pom ->
// respect 'optional' and 'provided' dependencies
optionalDeps.each { dep ->
pom.dependencies.find { it.artifactId == dep.name }?.optional = true
}
providedDeps.each { dep ->
pom.dependencies.find { it.artifactId == dep.name }?.scope = 'provided'
}
configurations.runtime.allDependencies.each { dependency ->
if (dependency.hasProperty("notInPom") && dependency.notInPom) {
pom.dependencies.removeAll { it.groupId == dependency.group && it.artifactId == dependency.name }
}
}
}
poms*.whenConfigured { pomModifications*.call(it) }
}
}
task clean(type: Delete) {
delete buildDir,
homeBinDir,
homeConfDir,
homeDistDir,
homeDslSupportDir,
homeLibDir,
homeSrcDir
}
task allDependencies(dependsOn: { subprojects*.implicitTasks*.dependencies })
// From this point on we need the subprojects to be fully configured, so force their full evaluation
subprojects.each { evaluationDependsOn it.path }
apply {
from 'gradle/docs.gradle' // tasks for building the documentation (e.g. user guide, javadocs)
from 'gradle/assemble.gradle' // tasks for creating an installation or distribution
from 'gradle/findbugs.gradle'
}
task wrapper(type: Wrapper) {
gradleVersion = '1.10'
jarFile = 'gradle/wrapper/gradle-wrapper.jar'
}
Jump to Line
Something went wrong with that request. Please try again.