| buildscript { |
| repositories { |
| mavenLocal() |
| maven { url "https://repo.grails.org/grails/core" } |
| jcenter() |
| } |
| dependencies { |
| classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2" |
| classpath "com.netflix.nebula:gradle-extra-configurations-plugin:2.2.0" |
| classpath 'com.bmuschko:gradle-nexus-plugin:2.3' |
| classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.8.0" |
| classpath "io.github.groovylang.groovydoc:groovydoc-gradle-plugin:1.0.1" |
| } |
| } |
| |
| |
| |
| project.ext { |
| springBootVersion = '1.3.7.RELEASE' |
| springVersion = "4.1.9.RELEASE" |
| grailsVersion = "3.0.15" |
| grails2Version = '2.5.5' |
| slf4jVersion = "1.7.21" |
| junitVersion = "4.12" |
| groovyVersion = System.getProperty('groovyVersion') ?: '2.4.10' |
| isTravisBuild = System.getenv().get("TRAVIS") == 'true' |
| |
| projectMajorVersion = "6" |
| projectMinorVersion = "0" |
| projectPatchVersion = "14" |
| // releaseType = "RELEASE" |
| // releaseType = "M1" |
| // releaseType = "RC2" |
| releaseType = "BUILD-SNAPSHOT" |
| |
| // overall project version |
| projectVersion = "${projectMajorVersion}.${projectMinorVersion}.${projectPatchVersion}" |
| |
| // plugin versions |
| hibernateVersion = "4.3.11" |
| hibernate5Version = "5.1.3" |
| |
| def defaultPluginVersion = releaseType == 'RELEASE' ? projectVersion : "${projectVersion}.${releaseType}" |
| hibernatePluginVersion = defaultPluginVersion |
| mongodbPluginVersion = defaultPluginVersion |
| neo4jPluginVersion = defaultPluginVersion |
| cassandraPluginVersion = defaultPluginVersion |
| redisPluginVersion = defaultPluginVersion |
| |
| |
| isCiBuild = project.hasProperty("isCiBuild") |
| isBuildSnapshot = releaseType == "BUILD-SNAPSHOT" |
| |
| servletApiVersion = "3.0.1" |
| |
| nexusUsername = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : '' |
| nexusPassword = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : '' |
| } |
| |
| def groovyMajorVersion = groovyVersion[0..2] |
| def spockDependency = "org.spockframework:spock-core:1.0-groovy-2.4" |
| |
| def groovyProjects() { |
| subprojects.findAll { project -> isGroovyProject(project) } |
| } |
| |
| def isGroovyProject(project) { |
| !project.name.contains("grails-plugins") |
| } |
| |
| configurations { |
| all*.exclude group: "commons-logging" |
| } |
| |
| version = "${projectVersion}.${releaseType}" |
| group = "org.grails" |
| |
| |
| apply plugin: 'idea' |
| apply plugin: 'project-report' |
| apply plugin: 'io.codearte.nexus-staging' |
| |
| nexusStaging { |
| delayBetweenRetriesInMillis = 5000 |
| } |
| |
| ext { |
| isCiBuild = project.hasProperty("isCiBuild") |
| } |
| |
| allprojects { |
| repositories { |
| mavenLocal() |
| maven { url "https://repo.grails.org/grails/core" } |
| if(isBuildSnapshot) { |
| maven { url "https://repo.grails.org/grails/libs-snapshots-local" } |
| } |
| } |
| |
| configurations { |
| all { |
| resolutionStrategy { |
| force "org.codehaus.groovy:groovy:$groovyVersion" |
| force "org.codehaus.groovy:groovy-xml:$groovyVersion" |
| } |
| } |
| } |
| } |
| |
| apply from: "gradle/idea.gradle" |
| |
| subprojects { |
| configurations { |
| documentation |
| } |
| version = "${projectVersion}.${releaseType}" |
| group = "org.grails" |
| |
| if(project.name.contains('grails-plugins') || project.name.contains('grails2-plugins')) { |
| project.tasks.all { Task t -> |
| t.onlyIf { |
| !Boolean.getBoolean('skipPlugins') |
| } |
| } |
| } |
| else { |
| project.tasks.all { Task t -> |
| t.onlyIf { |
| !Boolean.getBoolean('onlyPlugins') |
| } |
| } |
| } |
| |
| if(project.name.endsWith("spring-boot")) return |
| if(project.name.contains("grails2-plugins")) return |
| |
| afterEvaluate { project -> |
| if (isGroovyProject(project)) { |
| def hasSnapshotVersion = project.version.endsWith("-SNAPSHOT") |
| if(isBuildSnapshot != hasSnapshotVersion) { |
| throw new StopExecutionException("${project.name} has version \"${project.version}\" which is${isBuildSnapshot ? 'n\'t' : ''} a snapshot version. Current release type is ${releaseType}") |
| } |
| } |
| } |
| |
| |
| ext { |
| pomInfo = { |
| delegate.name 'Grails GORM' |
| delegate.description 'GORM - Grails Data Access Framework' |
| delegate.url 'http://grails.org/' |
| |
| delegate.licenses { |
| delegate.license { |
| delegate.name 'The Apache Software License, Version 2.0' |
| delegate.url 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
| delegate.distribution 'repo' |
| } |
| } |
| |
| delegate.scm { |
| delegate.url 'scm:git@github.com:grails/grails-data-mapping.git' |
| delegate.connection 'scm:git@github.com:grails/grails-data-mapping.git' |
| delegate.developerConnection 'scm:git@github.com:grails/grails-data-mapping.git' |
| } |
| |
| |
| delegate.developers { |
| delegate.developer { |
| delegate.id 'graemerocher' |
| delegate.name 'Graeme Rocher' |
| } |
| delegate.developer { |
| delegate.id 'jeffscottbrown' |
| delegate.name 'Jeff Brown' |
| } |
| delegate.developer { |
| delegate.id 'burtbeckwith' |
| delegate.name 'Burt Beckwith' |
| } |
| } |
| |
| } |
| } |
| |
| |
| def isStandardGroovyMavenProject = isGroovyProject(project) |
| |
| if (isStandardGroovyMavenProject) { |
| apply plugin: 'groovy' |
| apply plugin: "io.github.groovylang.groovydoc" |
| apply plugin: 'eclipse' |
| apply plugin: 'com.bmuschko.nexus' |
| apply plugin: 'maven-publish' |
| apply plugin: 'idea' |
| apply plugin: 'provided-base' |
| apply plugin: 'optional-base' |
| sourceCompatibility = "1.7" |
| targetCompatibility = "1.7" |
| } |
| |
| def isGormDatasource = project.name.startsWith("grails-datastore-gorm-") && |
| !project.name.endsWith("tck") && |
| !project.name.endsWith("-support") && |
| !project.name.endsWith("-core") && |
| !project.name.endsWith("-gorm-validation") && |
| !project.name.contains("-rx") && |
| project.name != 'grails-datastore-gorm-rest-client' |
| |
| |
| dependencies { |
| if (isStandardGroovyMavenProject) { |
| documentation "org.fusesource.jansi:jansi:1.11" |
| compile group: 'org.codehaus.groovy', name: 'groovy', version: groovyVersion |
| |
| testCompile group: 'org.codehaus.groovy', name: 'groovy-test', version: groovyVersion |
| |
| testCompile "junit:junit:$junitVersion" |
| testCompile (spockDependency) { |
| exclude group:'junit',module:'junit-dep' |
| exclude group:'org.codehaus.groovy',module:'groovy-all' |
| exclude group:'org.hamcrest',module:'hamcrest-core' |
| transitive = false |
| } |
| } |
| |
| if (project.name == "grails-datastore-gorm-tck") { |
| compile spockDependency, { |
| exclude group:'junit',module:'junit-dep' |
| exclude group:'org.codehaus.groovy',module:'groovy-all' |
| exclude group:'org.hamcrest',module:'hamcrest-core' |
| transitive = false |
| } |
| } |
| } |
| |
| 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 |
| } |
| } |
| |
| compileTestGroovy { |
| configure(groovyOptions.forkOptions) { |
| jvmArgs = [ '-Xmx768m'] |
| } |
| } |
| |
| test { |
| testLogging { |
| exceptionFormat ='full' |
| } |
| if (isTravisBuild) { |
| maxParallelForks = 2 |
| jvmArgs = ['-server', '-Xmx1024M', '-XX:MaxPermSize=128m'] |
| forkEvery = 20 |
| afterSuite { |
| System.out.print('.') |
| System.out.flush() |
| } |
| } else { |
| maxParallelForks = 4 |
| forkEvery = 100 |
| jvmArgs = ['-server', '-Xmx2048M', '-XX:MaxPermSize=256m'] |
| } |
| if(System.getProperty("debug.tests")) { |
| jvmArgs '-Xmx2g', '-Xdebug', '-Xnoagent', '-Djava.compiler=NONE', |
| '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005' |
| } |
| } |
| test.doFirst { |
| def tckClassesDir = project(":grails-datastore-gorm-tck").sourceSets.main.output.classesDir |
| def thisProjectsTests = // surely there is a less hardcoded way to do this |
| copy { |
| from tckClassesDir |
| into sourceSets.test.output.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. |
| |
| if (!details.file.isFile()) { |
| return false |
| } |
| 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() |
| } |
| } |
| } |
| } |
| |
| if (isStandardGroovyMavenProject) { |
| |
| configure([javadoc]) { |
| options.encoding "UTF-8" |
| options.docEncoding "UTF-8" |
| options.charSet "UTF-8" |
| options.jFlags "-Xms64M", "-Xmx512M", "-XX:MaxPermSize=256m" |
| } |
| |
| configure([groovydoc]) { |
| classpath += configurations.documentation |
| jvmArgs "-Xmx512M" |
| } |
| |
| modifyPom { |
| delegate.project { |
| def updatePom = pomInfo.clone() |
| updatePom.delegate = delegate |
| updatePom() |
| } |
| } |
| |
| publishing { |
| |
| repositories { |
| maven { |
| credentials { |
| def u = System.getenv("ARTIFACTORY_USERNAME") ?: project.hasProperty("artifactoryPublishUsername") ? project.artifactoryPublishUsername : '' |
| def p = System.getenv("ARTIFACTORY_PASSWORD") ?: project.hasProperty("artifactoryPublishPassword") ? project.artifactoryPublishPassword : '' |
| username = u |
| password = p |
| } |
| if(isBuildSnapshot) { |
| url "https://repo.grails.org/grails/libs-snapshots-local" |
| } |
| else { |
| url "https://repo.grails.org/grails/libs-releases-local" |
| } |
| |
| } |
| } |
| |
| publications { |
| maven(MavenPublication) { |
| from components.java |
| |
| artifact sourcesJar { |
| classifier "sources" |
| } |
| artifact javadocJar { |
| classifier "javadoc" |
| } |
| |
| pom.withXml { |
| def xml = asNode() |
| def dependency = xml.dependencies.find { dep -> dep.artifactId == 'slf4j-simple' } |
| dependency?.optional = true |
| xml.children().last() + pomInfo |
| } |
| |
| } |
| } |
| } |
| |
| } |
| } |
| |
| configurations { |
| build |
| } |
| |
| 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 install(dependsOn: subprojects*.tasks*.withType(PublishToMavenLocal)) |
| |
| |
| 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) |
| } |
| |
| } |