/* * Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved. * Haulmont Technology proprietary and confidential. * Use is subject to license terms. */ def defaultVersion = '4.1' def BUILD_VERSION = 'buildVersion' allprojects { ext.artifactGroup = 'com.haulmont.cuba' ext.artifactVersion = rootProject.hasProperty(BUILD_VERSION) ? rootProject[BUILD_VERSION].replace('-SNAPSHOT', '') : defaultVersion ext.isSnapshot = !rootProject.hasProperty(BUILD_VERSION) || rootProject[BUILD_VERSION].endsWith('-SNAPSHOT') ext.vcs = 'svn' //ext.tomcatDir = rootDir.absolutePath + '/../tomcat' } buildscript { def cubaPluginVersion = '4.1-SNAPSHOT' def docPluginVersion = '1.2.0-SNAPSHOT' def CUBA_PLUGIN_VERSION = 'cubaPluginVersion' def DOC_PLUGIN_VERSION = 'docPluginVersion' cubaPluginVersion = rootProject.hasProperty(CUBA_PLUGIN_VERSION) ? rootProject[CUBA_PLUGIN_VERSION] : cubaPluginVersion docPluginVersion = rootProject.hasProperty(DOC_PLUGIN_VERSION) ? rootProject[DOC_PLUGIN_VERSION] : docPluginVersion repositories { mavenLocal() maven { credentials { username System.getenv('HAULMONT_REPOSITORY_USER') password System.getenv('HAULMONT_REPOSITORY_PASSWORD') } url "http://repository.haulmont.com:8587/nexus/content/groups/work" } } dependencies { classpath group: 'com.haulmont.gradle', name: 'cuba-plugin', version: cubaPluginVersion classpath group: 'com.haulmont.gradle', name: 'doc-plugin', version: docPluginVersion } } apply(plugin: 'base') apply(plugin: 'maven') apply(plugin: 'idea') apply(plugin: 'cuba') apply(plugin: 'doc') def sharedLibModule = project(':cuba-shared-lib') def globalModule = project(':cuba-global') def coreModule = project(':cuba-core') def clientModule = project(':cuba-client') def guiModule = project(':cuba-gui') def webToolkitModule = project(':cuba-web-toolkit') def webModule = project(':cuba-web') def desktopModule = project(':cuba-desktop') def uiTestModule = project(':cuba-test-ui') def portalModule = project(':cuba-portal') def vaadinVersion = '7.1.0.h.M0' def servletApi = [group: 'org.apache.tomcat', name: 'servlet-api', version: '6.0.20'] def groovyArtifact = [group: 'org.codehaus.groovy', name: 'groovy', version: '1.7.10'] def asm = [group: 'asm', name: 'asm', version: '3.3.1'] def poi = [group: 'com.haulmont.thirdparty', name: 'poi', version: '3.9.20130515'] def postgres = [group: 'postgresql', name: 'postgresql', version: '9.1-901.jdbc4'] def hsqldb = [group: 'org.hsqldb', name: 'hsqldb', version: '2.2.9'] configure([sharedLibModule, globalModule, coreModule, clientModule, guiModule, webToolkitModule, webModule, desktopModule, uiTestModule, portalModule]) { apply(plugin: 'java') apply(plugin: 'idea') apply(plugin: 'maven') apply(plugin: 'code-quality') apply(plugin: 'cuba') dependencies { compile(group: 'commons-logging', name: 'commons-logging', version: '1.1.1') compile(group: 'commons-lang', name: 'commons-lang', version: '2.6') compile(group: 'commons-collections', name: 'commons-collections', version: '3.2.1') compile(group: 'commons-io', name: 'commons-io', version: '1.4') compile(group: 'commons-codec', name: 'commons-codec', version: '1.6') compile(group: 'commons-cli', name: 'commons-cli', version: '1.2') compile(group: 'commons-pool', name: 'commons-pool', version: '1.5.1') compile(group: 'org.apache.commons', name: 'commons-compress', version: '1.1') compile(group: 'dom4j', name: 'dom4j', version: '1.6.1') compile(group: 'javax.mail', name: 'mail', version: '1.4.1') compile(group: 'log4j', name: 'log4j', version: '1.2.16') compile(group: 'org.perf4j', name: 'perf4j', version: '0.9.16') compile(group: 'com.google.code.findbugs', name: 'jsr305', version: '2.0.1') compile(group: 'com.haulmont.thirdparty', name: 'javaee-api', version: '6.0.20091228') compile(group: 'org.codehaus.groovy', name: 'groovy', version: '1.7.10') compile(group: 'antlr', name: 'antlr', version: '2.7.7') compile(asm) compile(group: 'com.google.guava', name: 'guava', version: '13.0.1') compile(group: 'org.apache.openjpa', name: 'openjpa', version: '2.2.1') compile(group: 'net.sourceforge.serp', name: 'serp', version: '1.13.1') compile(group: 'org.antlr', name: 'antlr-runtime', version: '3.2') compile(group: 'org.freemarker', name: 'freemarker', version: '2.3.16') compile(group: 'aopalliance', name: 'aopalliance', version: '1.0') compile(group: 'org.springframework', name: 'spring-core', version: '3.1.3.RELEASE') compile(group: 'org.springframework', name: 'spring-beans', version: '3.1.3.RELEASE') compile(group: 'org.springframework', name: 'spring-context', version: '3.1.3.RELEASE') compile(group: 'org.springframework', name: 'spring-web', version: '3.1.3.RELEASE') testCompile(group: 'com.haulmont.thirdparty', name: 'jmockit', version: '0.999.10') testCompile(group: 'junit', name: 'junit', version: '4.5') } task sourceJar(type: Jar) { from file('src') classifier = 'sources' } artifacts { archives sourceJar } String checkstyleConfigDir = '../../config/checkstyle' checkstyleConfigFileName = "$checkstyleConfigDir/checkstyle.xml" checkstyleProperties.checkstyleConfigDir = checkstyleConfigFile.parentFile // Required for suppressions.xml linking checkstyleMain << { def checkstyleDir = "${project.buildDir}/checkstyle".toString() ant.xslt('in': "$checkstyleDir/main.xml", out: "$checkstyleDir/$project.name-checkstyle.html", style: "$checkstyleConfigDir/checkstyle.xsl") } } configure(sharedLibModule) { dependencies { jdbc(postgres) jdbc(hsqldb) } } configure(globalModule) { dependencies { provided(servletApi) } task generateReleaseTimestamp(type: CubaReleaseTimeStamp) { releaseTimeStampPath = "$buildDir/classes/main/com/haulmont/cuba/core/global/release.timestamp" releaseNumberPath = "$buildDir/classes/main/com/haulmont/cuba/core/global/release.number" } task enhance(type: CubaEnhancing) { persistenceXml = "$globalModule.projectDir/src/cuba-persistence.xml" } } configure(coreModule) { dependencies { compile(globalModule) compile(sharedLibModule) compile(group: 'com.haulmont.thirdparty', name: 'xstream', version: '1.4.2.20120702') runtime(group: 'xpp3', name: 'xpp3_min', version: '1.1.4c') runtime(group: 'xmlpull', name:'xmlpull', version: '1.1.3.1') compile(group: 'org.jgroups', name: 'jgroups', version: '2.12.1.Final') compile(group: 'org.aspectj', name: 'aspectjrt', version: '1.6.12') compile(group: 'org.aspectj', name: 'aspectjweaver', version: '1.6.12') compile(group: 'org.mybatis', name: 'mybatis', version: '3.0.5') compile(group: 'org.mybatis', name: 'mybatis-spring', version: '1.0.1') compile(group: 'org.json', name: 'json', version: '20090211') compile(group: 'org.springframework', name: 'spring-context-support', version: '3.1.3.RELEASE') compile(group: 'org.springframework', name: 'spring-orm', version: '3.1.3.RELEASE') compile(group: 'org.springframework', name: 'spring-tx', version: '3.1.3.RELEASE') compile(group: 'org.springframework', name: 'spring-webmvc', version: '3.1.3.RELEASE') compile(poi) // POI is actually not required by core, but remains here to simplify dependencies for reports project provided(servletApi) jdbc(postgres) jdbc(hsqldb) testRuntime(servletApi) testRuntime(hsqldb) } test { scanForTestClasses = false includes = ['**/*Test.class'] jvmArgs '-XX:-UseSplitVerifier' } task testsJar(dependsOn: testClasses, type: Jar) { from sourceSets.test.output.classesDir from sourceSets.test.output.resourcesDir include 'com/haulmont/cuba/core/CubaTestCase*.class' include 'com/haulmont/cuba/testsupport/*' include '*' includeEmptyDirs = false classifier = 'tests' } assembleDbScripts << { copy { from new File(projectDir, 'db') into "$buildDir/db/10-cuba" } } artifacts { archives testsJar } task deploy(dependsOn: assemble, type: CubaDeployment) { appName = 'cuba-core' appJars('cuba-global', 'cuba-core') } def hsqlDbName = 'cubadb' task startDb(description: 'Starts local HSQLDB server', type: CubaHsqlStart) { dbName = hsqlDbName } task stopDb(description: 'Stops local HSQLDB server', type: CubaHsqlStop) { dbName = hsqlDbName } task removeDb(description: 'Removes local HSQL database', type: Delete) { delete new File("$rootProject.projectDir/data") } task killDb(description: 'Kill local HSQLDB server process running on port 9001', type: CubaKillProcess) { port = 9001 } task createDb(dependsOn: assemble, description: 'Creates local HSQL database', type: CubaDbCreation) { dbms = 'hsql' dbName = hsqlDbName dbUser = 'sa' dbPassword = '' } } configure(clientModule) { dependencies { compile(globalModule) } task testsJar(dependsOn: testClasses, type: Jar) { from sourceSets.test.output.classesDir classifier = 'tests' } artifacts { archives testsJar } } configure(guiModule) { apply(plugin: 'groovy') sourceSets { main { groovy { srcDir 'src' } } } dependencies { compile(globalModule) compile(clientModule) compile(poi) compile(group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.2.2') groovy(groovyArtifact) groovy(asm) testCompile(clientModule.sourceSets.test.output) } task enhanceTransient(type: CubaEnhanceTransient) { classes = [ 'com.haulmont.cuba.gui.security.entity.AbstractPermissionTarget', 'com.haulmont.cuba.gui.security.entity.AttributeTarget', 'com.haulmont.cuba.gui.security.entity.BasicPermissionTarget', 'com.haulmont.cuba.gui.security.entity.MultiplePermissionTarget', 'com.haulmont.cuba.gui.security.entity.OperationPermissionTarget', 'com.haulmont.cuba.gui.security.entity.UiPermissionTarget' ] } test { scanForTestClasses = false includes = ['**/*Test.class'] } } configure(webModule) { dependencies { compile(sharedLibModule) compile(globalModule) compile(clientModule) compile(guiModule) compile(group: 'com.haulmont.thirdparty', name: 'jespa', version: '1.0.7') compile(group: 'commons-fileupload', name: 'commons-fileupload', version: '1.2.2') compile(group: 'org.jasig.cas', name: 'cas-client-core', version: '3.1.10') compile(group: 'org.springframework', name: 'spring-webmvc', version: '3.1.3.RELEASE') compile(group: 'com.vaadin', name: 'vaadin-server', version: vaadinVersion) provided(group: 'com.vaadin', name: 'vaadin-theme-compiler', version: vaadinVersion) compile(group: 'org.vaadin.addons', name: 'popupbutton', version: '2.2.1') runtime(group: 'com.haulmont.thirdparty', name: 'jcifs', version: '1.3.10') provided(servletApi) } def resourceBuildTimeStamp = new java.text.SimpleDateFormat('yyyy_MM_dd_HH_mm').format(new Date()) task resourceTimeStampInject() << { new File("${project.buildDir}/classes/main/com/haulmont/cuba/web/resources.timestamp").write(resourceBuildTimeStamp) } classes.dependsOn resourceTimeStampInject task buildScssThemes(type: CubaWebScssThemeCreation) { buildTimeStamp = resourceBuildTimeStamp themes = ['havana'] destDir = "${project.buildDir}/web/VAADIN/themes" // compress = true sprites = true // cleanup = true } def webOutDir = file("$buildDir/web") task webArchive(dependsOn: buildScssThemes, type: Zip) { from file('web') from webOutDir exclude '**/web.xml', '**/app.properties' classifier = 'web' } task scssThemesZip(type: Zip) { from webModule.file('themes') exclude '**/.*' version = artifactVersion + (isSnapshot ? '-SNAPSHOT' : '') classifier = 'web-themes' } artifacts { archives webArchive themes scssThemesZip } task deploy(dependsOn: assemble, type: CubaDeployment) { appName = 'cuba' appJars('cuba-global', 'cuba-client', 'cuba-gui', 'cuba-web') } deploy << { copy { from "$buildDir/web" into "$tomcatDir/webapps/cuba" } } } configure(webToolkitModule) { configurations { widgetSetBuilding } dependencies { compile(webModule) compile(group: 'com.vaadin', name: 'vaadin-client-compiled', version: vaadinVersion) compile(group: 'com.vaadin', name: 'vaadin-client', version: vaadinVersion) compile(group: 'com.vaadin', name: 'vaadin-client-compiler', version: vaadinVersion) widgetSetBuilding(webModule) } def webOutDir = file("$buildDir/web") task buildWidgetSet(type: CubaWidgetSetBuilding) { widgetSetsDir = "$webOutDir/VAADIN/widgetsets" widgetSetClass = 'com.haulmont.cuba.web.toolkit.ui.WidgetSet' //jvmArgs('-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000') compilerArgs = ['-style' : 'PRETTY', '-logLevel' : 'INFO', '-localWorkers' : '2'] } task webArchive(dependsOn: buildWidgetSet, type: Zip) { from file('web') from webOutDir exclude '**/web.xml', '**/app.properties', '**/gwt-unitCache/' classifier = 'web' } artifacts { archives webArchive } task deploy(dependsOn: buildWidgetSet) << { delete { "$tomcatDir/webapps/cuba/VAADIN/widgetsets" } copy { from "$buildDir/web" into "$tomcatDir/webapps/cuba" exclude '**/gwt-unitCache/' } } } configure(desktopModule) { apply(plugin: 'application') mainClassName = 'com.haulmont.cuba.desktop.App' dependencies { compile(globalModule) compile(clientModule) compile(guiModule) compile(group: 'com.miglayout', name: 'miglayout-swing', version: '4.2') compile(group: 'com.haulmont.thirdparty', name: 'glazedlists', version: '1.9.20110801') compile(group: 'org.swinglabs', name: 'swingx-core', version: '1.6.2-2') assemble.dependsOn = [classes] } installApp { into("$buildDir/app/" + applicationName) } task desktopInstall(dependsOn: assemble) << { jar.execute() startScripts.execute() installApp.execute() } task desktopDist(dependsOn: assemble) << { distZip.execute() } task desktopStart(dependsOn: desktopInstall) << { run.execute() } } configure(uiTestModule) { dependencies { } } configure(portalModule) { apply(plugin: 'groovy') sourceSets { main { groovy { srcDir 'src' } } } def springSecurityVersion = '3.1.3.RELEASE' dependencies { compile(globalModule) compile(clientModule) compile(sharedLibModule) provided(servletApi) compile(group: 'org.springframework', name: 'spring-webmvc', version: springSecurityVersion) compile(group: 'org.springframework.security', name: 'spring-security-core', version: springSecurityVersion) compile(group: 'org.springframework.security', name: 'spring-security-web', version: springSecurityVersion) compile(group: 'org.springframework.security', name: 'spring-security-config', version: springSecurityVersion) compile(group: 'org.springframework.security', name: 'spring-security-taglibs', version: springSecurityVersion) compile(group: 'org.json', name: 'json', version: '20090211') groovy(groovyArtifact) groovy(asm) compile(group: 'org.springframework', name: 'spring-tx', version: '3.1.3.RELEASE') compile(group: 'org.springframework', name: 'spring-jdbc', version: '3.1.3.RELEASE') testCompile(clientModule.sourceSets.test.output) } test { scanForTestClasses = false includes = ['**/*Test.class'] } } task restart(dependsOn: ['stop', ':cuba-core:deploy', ':cuba-web:deploy'], description: 'Redeploys applications and restarts local Tomcat') << { ant.waitfor(maxwait: 6, maxwaitunit: 'second', checkevery: 2, checkeveryunit: 'second') { not { socket(server: 'localhost', port: '8787') } } start.execute() } /***************************** Documentation *****************************/ // These variables must be the project properties ext.docSrcDir = file('doc/content') ext.docToolsDir = file('doc/tools') ext.docCssDir = new File(docToolsDir, 'css') ext.docDstDir = new File("$buildDir/doc") ext.docTmpDir = new File("$buildDir/tmp/doc") task transformManual(type: TransformDocbook) { sourceDir = new File(docSrcDir, 'manual/ru') sourceFile = new File(sourceDir, 'manual.xml') destFile = new File(docTmpDir, 'manual/ru/manual.xml') classpath = configurations.buildDoc } /*task buildManualXhtml(type: Docbook2Xhtml, dependsOn: transformManual) { source transformManual.destFile destFile = new File(docTmpDir, 'manual-pdf/manual-pdf.html') stylesheetName = 'pdf.xsl' resources = fileTree(new File(docSrcDir, 'manual/ru')) { include 'img/*.png' include 'img/*.jpg' } resources += fileTree(docCssDir) { include '*.css' } }*/ /*task buildManualPdf(type: Xhtml2Pdf, dependsOn: buildManualXhtml) { inputs.dir docCssDir sourceFile = buildManualXhtml.destFile destFile = new File(docDstDir, 'manual/ru/pdf/manual.pdf') classpath = configurations.buildDoc fonts = zipTree(configurations.docFonts.singleFile) }*/ task transformSecurity(type: TransformDocbook) { sourceDir = new File(docSrcDir, 'security/ru') sourceFile = new File(sourceDir, 'security.xml') destFile = new File(docTmpDir, 'security/ru/security.xml') classpath = configurations.buildDoc } task buildSecurityXhtml(type: Docbook2Xhtml, dependsOn: transformSecurity) { source transformSecurity.destFile destFile = new File(docTmpDir, 'security-pdf/security-pdf.html') stylesheetName = 'pdf.xsl' resources = fileTree(new File(docSrcDir, 'security/ru')) { include 'img/*.png' include 'img/*.jpg' } resources += fileTree(docCssDir) { include '*.css' } } task buildSecurityPdf(type: Xhtml2Pdf, dependsOn: buildSecurityXhtml) { inputs.dir docCssDir sourceFile = buildSecurityXhtml.destFile destFile = new File(docDstDir, 'security/ru/pdf/security.pdf') classpath = configurations.buildDoc fonts = zipTree(configurations.docFonts.singleFile) } task buildManualHtml(type: Docbook2Xhtml, dependsOn: transformManual) { source transformManual.destFile destDir = new File(docDstDir, 'manual/ru/html') stylesheetName = 'html.xsl' resources = fileTree(new File(docSrcDir, 'manual/ru')) { include 'img/*.png' include 'img/*.jpg' } resources += fileTree(docCssDir) { include '*.css' } } task buildSecurityHtml(type: Docbook2Xhtml, dependsOn: transformSecurity) { source transformSecurity.destFile destDir = new File(docDstDir, 'security/ru/html') stylesheetName = 'html.xsl' resources = fileTree(new File(docSrcDir, 'security/ru')) { include 'img/*.png' include 'img/*.jpg' } resources += fileTree(docCssDir) { include '*.css' } } task buildManualSingleHtml(type: Docbook2Xhtml, dependsOn: transformManual) { source transformManual.destFile destFile = new File(docDstDir, 'manual/ru/html-single/manual.html') stylesheetName = 'html-single.xsl' resources = fileTree(new File(docSrcDir, 'manual/ru')) { include 'img/**/*.png' include 'img/**/*.jpg' } resources += fileTree(docCssDir) { include '*.css' } } task buildSecuritySingleHtml(type: Docbook2Xhtml, dependsOn: transformSecurity) { source transformSecurity.destFile destFile = new File(docDstDir, 'security/ru/html-single/security.html') stylesheetName = 'html-single.xsl' resources = fileTree(new File(docSrcDir, 'security/ru')) { include 'img/**/*.png' include 'img/**/*.jpg' } resources += fileTree(docCssDir) { include '*.css' } } task buildDoc(type: Zip, description: 'Build documentation', dependsOn: [buildManualSingleHtml,buildSecuritySingleHtml,buildSecurityPdf]) { //dependsOn: [buildManualSingleHtml,buildManualPdf,buildSecuritySingleHtml,buildSecurityPdf]) { from 'build/doc' destinationDir = file('build/distributions') baseName = 'cuba-doc' version = artifactVersion + (isSnapshot ? '-SNAPSHOT' : '') } artifacts { if (Boolean.valueOf(System.getProperty("buildDoc"))) archives buildDoc }