Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 45f82bf574
Fetching contributors…

Cannot retrieve contributors at this time

302 lines (247 sloc) 9.259 kb
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
repositories {
mavenRepo(urls: "http://repo.grails.org/grails/core")
}
dependencies {
classpath "commons-io:commons-io:1.4"
}
}
apply plugin: 'idea'
antTraxVersion = "1.7.1"
antVersion = "1.8.2"
aspectjVersion = "1.6.10"
commonsBeanUtilsVersion = "1.8.0"
commonsCliVersion = "1.2"
commonsCollectionsVersion = "3.2.1"
commonsIOVersion = "1.4"
commonsLangVersion = "2.4"
datastoreVersion = "1.0.0.BUILD-SNAPSHOT"
gantVersion = "1.9.5"
gdocEngineVersion = "1.0.1"
grailsVersion = '2.0.0.BUILD-SNAPSHOT'
groovyVersion = "1.8.0"
ivyVersion = "2.2.0"
jansiVersion = "1.2.1"
jlineVersion = "1.0"
jnaVersion = "3.2.3"
slf4jVersion = "1.6.1"
springLoadedVersion = "0.8.5.BUILD-SNAPSHOT"
springVersion = "3.1.0.M2"
springWebflowVersion= "2.0.8.RELEASE"
archivesBaseName = 'grails'
version = grailsVersion
// directories created during the build which are related
// to turning the workspace root into a GRAILS_HOME
homeDistDir = "${rootProject.projectDir}/dist"
homeBinDir = "${rootProject.projectDir}/bin"
homeConfDir = "${rootProject.projectDir}/conf"
homeDslSupportDir = "${rootProject.projectDir}/dsl-support"
homeLibDir = "${rootProject.projectDir}/lib"
homeSrcDir = "${rootProject.projectDir}/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.
if(System.getProperty('groovy.jar')) {
groovyDependency = files(System.getProperty('groovy.jar'))
} else {
groovyDependency = "org.codehaus.groovy:groovy-all:${groovyVersion}"
}
subprojects { project ->
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'project-report'
sourceCompatibility = "1.5"
targetCompatibility = "1.5"
archivesBaseName = 'grails'
version = grailsVersion
group = "org.grails"
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"
}
configure([compileJava, compileTestJava]) {
options.deprecation = true
options.debug = true
}
ideaModule {
// pathVariables GRADLE_USER_HOME: file('/home/myuser/.gradle') // that does not work
whenConfigured { 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 {
mavenRepo(urls: "http://repo.grails.org/grails/core") {
if (project.hasProperty('snapshotTimeout')) {
setSnapshotTimeout(Long.parseLong(project.snapshotTimeout))
}
}
}
dependencies {
// Groovy
if(System.getProperty('groovy.jar')) {
// use the jar specified in the system property (the joint build specifies its own groovy jar)...
groovy groovyDependency
} else {
// resolve the dependency from a repo...
groovy( groovyDependency ) {
exclude module:"commons-cli"
exclude module:"ant"
}
}
compile groovyDependency
// Logging
compile "org.slf4j:slf4j-api:$slf4jVersion"
compile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
// Specs
compile 'javax.servlet:servlet-api:2.5'
compile 'org.hibernate.java-persistence:jpa-api:2.0-cr-1'
// Testing
testCompile 'junit:junit:4.8.1'
testCompile('org.spockframework:spock-core:0.5-groovy-1.8') {
transitive = false
}
}
install.doLast {
copy {
from(project.libsDir) {
include "*-${grailsVersion}.jar"
}
into homeDistDir
}
}
assemble.doLast {
copy {
from(sourcesJar.archivePath)
into homeSrcDir
}
}
test {
excludes = ["**/*TestCase.class", "**/*\$*.class"]
}
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
appendix = project.name[7..-1]
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
appendix = project.name[7..-1]
from javadoc.destinationDir
}
groovydoc.doLast {
delete("${buildDir}/tmp")
}
configurations {
meta
}
artifacts {
meta sourcesJar
meta javadocJar
}
uploadArchives {
repositories {
final url = project.version.endsWith("SNAPSHOT") ? "http://repo.grails.org/grails/libs-snapshots-local" :
"http://repo.grails.org/grails/libs-releases-local"
mavenRepo urls: url
project.deployer = repositories.mavenDeployer {
repository(url: url) {
beforeDeployment { deployment ->
["sources", "javadoc"].each { type ->
deployment.addArtifact configurations.meta.artifacts.find { it.classifier == type }
}
}
final username = project.properties["artifactoryPublishUsername"]
final password = project.properties["artifactoryPublishPassword"]
if(username && password) {
org.apache.ivy.util.url.CredentialsStore.INSTANCE.addCredentials("Artifactory Realm", "repo.grails.org", username, password);
}
authentication(userName: username, password: password)
}
}
}
}
uploadArchives.dependsOn sourcesJar, javadocJar
/*
Install a method that can be used to fine tune the poms, e.g…
modifyPom { pom ->
pom.dependencies.removeAll(pom.dependencies.findAll { it.scope == "test" })
}
Mods are run in order they are encountered in the build script.
The pom argument is of the following type:
http://maven.apache.org/ref/2.2.1/maven-model/apidocs/org/apache/maven/model/Model.html
*/
project.poms = [project.install.repositories.mavenInstaller.pom, project.deployer.pom]
project.pomModifications = []
project.modifyPom = { Closure modification -> project.pomModifications << modification }
project.poms*.whenConfigured {
project.pomModifications*.call(it)
}
}
apply {
from 'gradle/docs.gradle'
from 'gradle/assemble.gradle'
}
task clean << {
delete buildDir
delete homeBinDir
delete homeConfDir
delete homeConfDir
delete homeDslSupportDir
delete homeLibDir
delete homeSrcDir
delete libs.destinationDir
}
task installResources << {
copy {
from('grails-resources/src/grails/home/tests')
into(homeLibDir)
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
}
copy {
from("grails-resources/src/grails/home/bash")
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
filter(ReplaceTokens, tokens: ['groovy.version': groovyVersion])
filter(ReplaceTokens, tokens: ['spring.loaded.version': springLoadedVersion])
fileMode = 0755
into homeBinDir
}
// the fileMode property above should take care of the chmod work, but
// it doesn't per http://jira.codehaus.org/browse/GRADLE-971
ant.chmod(dir: homeBinDir, perm: '755', includes: '*')
copy {
from("grails-resources/src/grails/home/conf")
into homeConfDir
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
filter(ReplaceTokens, tokens: ['groovy.version': groovyVersion])
filter(ReplaceTokens, tokens: ['jline.version': jlineVersion])
filter(ReplaceTokens, tokens: ['jansi.version': jansiVersion])
filter(ReplaceTokens, tokens: ['jna.version': jnaVersion])
filter(ReplaceTokens, tokens: ['commons.cli.version': commonsCliVersion])
filter(ReplaceTokens, tokens: ['ant.version': antVersion])
filter(ReplaceTokens, tokens: ['gant.version': gantVersion])
filter(ReplaceTokens, tokens: ['ivy.version': ivyVersion])
}
copy {
from 'grails-resources/src/grails/home/dsl-support'
into homeDslSupportDir
}
copy {
from "grails-resources/src/war/WEB-INF"
into "${homeSrcDir}/war/WEB-INF"
}
}
task install(dependsOn:[populateDependencies, installResources])
task assemble(dependsOn:zipDist)
Jump to Line
Something went wrong with that request. Please try again.