Created
December 5, 2014 14:59
-
-
Save anonymous/efca0005e755bbcf1003 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.grails.gradle.plugin.tasks.GrailsTask | |
/* | |
* Applying gradle sub configuration at root level | |
*/ | |
apply from: "${rootDir}/gradle/common-functions.gradle" | |
apply from: "${rootDir}/gradle/version.gradle" | |
apply from: "${rootDir}/gradle/sonar.gradle" | |
def sourceDirsList = ['grails-app/controllers', 'grails-app/domain', 'grails-app/services', | |
'grails-app/taglib', 'grails-app/utils', 'src/groovy', 'src/java', 'scripts', | |
'test/integration', 'test/unit'] | |
/* | |
* Auto execution tasks for codebase at root level | |
*/ | |
task prerequisitesCheck(group:'DPFS', description: 'DPFS prerequisites') { | |
def requiredGradleVersion = '1.12' | |
if (gradle.gradleVersion < requiredGradleVersion) { | |
throw new GradleException("Minimum Gradle v${requiredGradleVersion} is required.") | |
} | |
def requiredJDK = '1.7' | |
def foundJDK = findProperty('java.version')[0..2] | |
if (requiredJDK != foundJDK) { | |
throw new GradleException("ERROR JDK ${requiredJDK} is required (found JDK ${foundJDK}).") | |
} | |
} | |
buildscript { | |
repositories { | |
mavenLocal() | |
maven { url 'http://<hostname>:8080/nexus/content/groups/public/' } | |
} | |
dependencies { | |
classpath 'org.grails:grails-gradle-plugin:2.1.1' | |
} | |
} | |
group = 'com.dexmedia.dpfs' | |
version = projectVersion | |
/* | |
* Subprojects configuration and its tasks | |
*/ | |
subprojects { | |
repositories { | |
mavenLocal() | |
maven { url 'http://<hostname>:8080/nexus/content/groups/public/' } | |
} | |
/* | |
* Applying Plugins at subproject level | |
*/ | |
apply plugin: 'grails' | |
apply plugin: 'eclipse' | |
apply plugin: 'idea' | |
/* | |
* Applying gradle sub configuration at subprojects level | |
*/ | |
apply from: "${rootDir}/gradle/maven.gradle" | |
version = parent.project.version | |
group = parent.project.group | |
grails { | |
grailsVersion = '2.4.0' | |
groovyVersion = '2.3.1' | |
springLoadedVersion = '1.2.0.RELEASE' | |
} | |
/* | |
* Dependencies definition for subprojects | |
*/ | |
dependencies { | |
bootstrap 'org.grails.plugins:tomcat:7.0.54' | |
['hibernate4:4.3.5.3', | |
'webxml:1.4.1', | |
'jquery:1.11.1', | |
'database-migration:1.4.0', | |
'asset-pipeline:1.8.7', | |
'cache:1.1.6', | |
'scaffolding:2.1.0'].each { p -> | |
compile "org.grails.plugins:$p" | |
} | |
compile ('mysql:mysql-connector-java:5.1.27', | |
'org.modeshape:modeshape-common:4.0.0.Beta2', | |
'org.modelmapper:modelmapper:0.7.2') | |
test ('org.grails.plugins:code-coverage:2.0.3-2') { | |
exclude module: 'ant-launcher' | |
exclude module: 'jaxen' | |
} | |
} | |
configurations.all { | |
resolutionStrategy.cacheChangingModulesFor 0, 'seconds' | |
exclude module: 'commons-logging' | |
exclude module: 'xml-apis' | |
} | |
sonarRunner { | |
sonarProperties { | |
property 'sonar.sources', sourceDirsList.join(', ') | |
property 'sonar.surefire.reportsPath', "${buildDir}/test-results/" | |
property 'sonar.groovy.cobertura.reportPath', "${buildDir}/test-results/cobertura/coverage.xml" | |
property 'sonar.exclusions', '**/grails-app/conf/**, **/script/**, **/test/**, *GrailsPlugin*' | |
property 'sonar.inclusions', '**/*.groovy' | |
} | |
} | |
task unitTest(type: GrailsTask, description: 'Executes unit test cases') { | |
command 'test-app' | |
args 'unit:' | |
} | |
task integrationTest(type: GrailsTask, description: 'Executes integration test cases') { | |
command 'test-app' | |
args 'integration:' | |
} | |
task testAndCoverage(type: GrailsTask, description: 'Executes test cases with coverage details') { | |
command 'test-app' | |
args '-coverage -xml -Dgrails.env=test' | |
} | |
run { | |
jvmOptions { | |
jvmArgs([ | |
'-Xdebug', | |
'-Xnoagent', | |
'-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000' | |
]) | |
} | |
} | |
cleanEclipse << { | |
delete '.settings' | |
} | |
// This task is needed in the beginning of the dpfs project development | |
// Due empty directories ignore by Git | |
task grailsDirCreation(group: 'DPFS', description: 'Grails app directory creation') { | |
sourceDirsList.each { | |
def dir = project.file(it) | |
if (!dir.exists()) { | |
dir.mkdirs() | |
} | |
} | |
} | |
task createController(type: GrailsTask, description: 'Creates grails controller class') { | |
command 'create-controller' | |
args findProperty('packagePath', "${project.group}.controller") + '.' + findProperty('className') | |
} | |
task createService(type: GrailsTask, description: 'Creates grails service class') { | |
command 'create-service' | |
args findProperty('packagePath', "${project.group}.service") + '.' + findProperty('className') | |
} | |
task createDomain(type: GrailsTask, description: 'Creates grails domain class') { | |
command 'create-domain-class' | |
args findProperty('packagePath', "${project.group}.domain") + '.' + findProperty('className') | |
} | |
task createFilter(type: GrailsTask, description: 'Creates grails filters') { | |
command 'create-filters' | |
args "${project.group}.filter." + findProperty('className') | |
} | |
tasks.withType(GrailsTask) { GrailsTask task -> | |
task.jvmOptions { | |
minHeapSize = '256m' | |
maxHeapSize = '1524m' | |
jvmArgs '-XX:PermSize=32m -XX:MaxPermSize=512m -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC -XX:+UseParNewGC'.split(' ') | |
} | |
} | |
} | |
// ========================================================================== | |
// The 'preRelease' task the 'release' task depends on is not listed | |
// as part of the 'tasks' property since we want project.version to be set | |
// properly prior to starting execution of the 'release' task's action. | |
// ========================================================================= | |
task release(type: GradleBuild, dependsOn: 'preRelease', group: 'DPFS', description: 'Performing release for DPFS') { | |
startParameter = gradle.startParameter.newInstance() | |
tasks = [ | |
'assemble', | |
'uploadArchives', | |
'doRelease', | |
'assemble', | |
'postRelease' | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment