Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

277 lines (232 sloc) 9.84 kb
springVersion = "3.0.5.RELEASE"
grailsVersion = "1.3.7"
slf4jVersion = "1.6.1"
groovyVersion = System.getProperty('groovyVersion') ?: '1.7.8'
def groovyMajorVersion = groovyVersion[0..2]
def spockDependency = "org.spockframework:spock-core:0.5-groovy-${groovyMajorVersion}"
def groovyProjects() {
subprojects.findAll { project -> isGroovyProject(project) }
}
def isGroovyProject(project) {
def isGrailsPlugin = project.name.contains("grails-plugins")
def isDocumentation = project.name.contains("documentation")
!isGrailsPlugin && !isDocumentation
}
configurations {
all*.exclude group: "commons-logging"
}
apply plugin: 'idea'
subprojects {
releaseType = "BUILD-SNAPSHOT"
/* releaseType = "M8"*/
version = "1.0.0.${releaseType}"
def isStandardGroovyMavenProject = isGroovyProject(project)
if (isStandardGroovyMavenProject) {
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'idea'
apply from: "file:${rootDir}/clover.gradle"
}
def isGormDatasource = project.name.startsWith("grails-datastore-gorm-") && !project.name.endsWith("tck") && !project.name.endsWith("plugin-support")
repositories {
mavenRepo name:'mavenLocal',
urls:new File(System.getProperty("user.home"), ".m2/repository").toURL().toString()
mavenRepo(urls: "http://repo.grails.org/grails/core") {
if (project.hasProperty('snapshotTimeout')) {
setSnapshotTimeout(Long.parseLong(project.snapshotTimeout))
}
}
}
dependencies {
if (isStandardGroovyMavenProject) {
groovy group: 'org.codehaus.groovy', name: 'groovy-all', version: groovyVersion
testCompile 'junit:junit:4.8.2'
testCompile (spockDependency) {
transitive = false
}
}
if (project.name == "grails-datastore-gorm-tck") {
compile spockDependency
}
}
if (isGormDatasource) {
dependencies {
testCompile project(":grails-datastore-gorm-tck")
}
// We need to test against the TCK. Gradle cannot find/run tests from jars
// without a lot of plumbing, so here we copy the class files from the TCK
// project into this project's test classes dir so Gradle can find the test
// classes and run them. See grails.gorm.tests.GormDatastoreSpec for on the TCK.
// helper, used below.
def toBaseClassRelativePathWithoutExtension = { String base, String classFile ->
if (classFile.startsWith(base)) {
def sansClass = classFile[0 .. classFile.size() - ".class".size() - 1]
def dollarIndex = sansClass.indexOf('$')
def baseClass = dollarIndex > 0 ? sansClass[0..dollarIndex - 1] : sansClass
def relative = baseClass - base - '/'
relative
}
else {
null
}
}
test.doFirst {
def tckClassesDir = project(":grails-datastore-gorm-tck").sourceSets.main.classesDir
def thisProjectsTests = // surely there is a less hardcoded way to do this
copy {
from tckClassesDir
into sourceSets.test.classesDir
include "**/*.class"
exclude { details ->
// Do not copy across any TCK class (or nested classes of that class)
// If there is a corresponding source file in the particular modules
// test source tree. Allows a module to override a test/helper.
def candidatePath = details.file.absolutePath
def relativePath = toBaseClassRelativePathWithoutExtension(tckClassesDir.absolutePath, candidatePath)
if (relativePath == null) {
throw new IllegalStateException("$candidatePath does not appear to be in the TCK")
}
project.file("src/test/groovy/${relativePath}.groovy").exists()
}
}
}
}
group = "org.grails"
archivesBaseName = "grails-datastore"
if (isStandardGroovyMavenProject) {
configurations {
meta
}
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
appendix = project.name[17..-1]
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
appendix = project.name[17..-1]
from javadoc.destinationDir
}
artifacts {
meta sourcesJar
meta javadocJar
}
configure(install.repositories.mavenInstaller) {
pom.whenConfigured { pom ->
def dependency = pom.dependencies.find { dep -> dep.artifactId == 'slf4j-simple' }
dependency?.optional = true
}
pom.project {
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'http://github.com/SpringSource/grails-data-mapping/'
}
}
}
}
uploadArchives {
description = "Does a maven deploy of archives artifacts"
def milestoneRepositoryUrl = "http://repo.grails.org/grails/libs-releases-local"
def snapshotRepositoryUrl = "http://repo.grails.org/grails/libs-snapshots-local"
// add a configuration with a classpath that includes our s3 maven deployer
configurations { deployerJars }
dependencies {
deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
}
repositories.mavenDeployer {
switch (releaseType) {
case 'RELEASE':
// TODO: Will need to update this when doing a non-snapshot/milestone release
// repository(url: releaseRepositoryUrl)
// description += releaseRepositoryUrl
break;
case ~/M[0-9]+/:
description += milestoneRepositoryUrl
// fall through and pick up config below
case 'BUILD-SNAPSHOT':
description += snapshotRepositoryUrl
final username = project.properties["artifactoryPublishUsername"]
final password = project.properties["artifactoryPublishPassword"]
def credentials = [userName: username, password: password]
org.apache.ivy.util.url.CredentialsStore.INSTANCE.addCredentials("Artifactory Realm", "repo.grails.org", username, password);
configuration = configurations.deployerJars
repository(url: milestoneRepositoryUrl) {
authentication(credentials)
}
snapshotRepository(url: snapshotRepositoryUrl) {
authentication(credentials)
}
break;
}
pom.project {
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
}
}
uploadArchives.dependsOn sourcesJar, javadocJar
}
}
configurations {
build
}
repositories {
mavenCentral()
}
dependencies {
build "com.cenqua.clover:clover:3.0.2"
build "org.apache.ant:ant-junit:1.8.1"
build "org.apache.ant:ant-nodeps:1.8.1"
}
task test(dependsOn: getTasksByName("test", true)) << {
def reportsDir = "${buildDir}/reports"
// Aggregate the test results
ant.taskdef(
name: 'junitreport2',
classname: "org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator",
classpath: configurations.build.asPath
)
def testReportsDir = new File("${reportsDir}/tests")
if (testReportsDir.exists()) {
testReportsDir.deleteDir()
}
testReportsDir.mkdirs()
ant.junitreport2(todir: testReportsDir) {
subprojects.each {
def testResultsDir = "${it.buildDir}/test-results"
if (new File(testResultsDir).exists()) {
fileset(dir: testResultsDir) {
include(name: "TEST-*.xml")
}
}
}
report(todir: testReportsDir)
}
// Aggregate the coverage results
if (project.hasProperty("withClover")) {
def db = "clover/clover.db"
def mergedDb = "${buildDir}/${db}"
def cloverReportsDir = "${reportsDir}/clover"
ant.taskdef(resource: "cloverlib.xml", classpath: configurations.build.asPath)
ant."clover-merge"(initstring: mergedDb) {
subprojects.each {
def projectCloverDb = "${it.buildDir}/${db}"
if (new File(projectCloverDb).exists()) {
cloverdb(initstring: projectCloverDb)
}
}
}
ant."clover-report"(initstring: mergedDb) {
current(outfile:"${cloverReportsDir}/clover.xml")
}
ant."clover-html-report"(initstring: mergedDb, outdir:"${cloverReportsDir}/html")
}
}
Jump to Line
Something went wrong with that request. Please try again.