evaluationDependsOn(':commonbase') evaluationDependsOn(':common') evaluationDependsOn(':authentication') evaluationDependsOn(':dbmigration') apply from: '../gradle/javaproject.gradle' eclipse { classpath { downloadSources=true defaultOutputDir = file('targets/www/WEB-INF/classes') } } configurations.create('gwt') configurations.create('zipping') configurations.create('cliJars') configurations.create('partialLibs') configurations.create('appbundler') def jettyVersion = '8.1.8' dependencies { compile project(':common'), project(':authentication'), project(':dbmigration'), 'apache:commons-fileupload:+', 'bouncycastle:bcpg:+', 'jline:jline:+', 'google:gwt-user:+', 'sencha:gxt:+', 'springframework:spring-test:+' testCompile project(path: ':common', configuration: 'tests') zipping "eclipse:jetty-distribution:${jettyVersion}@zip" gwt 'reveregroup:gwt-image-loader:1.1.4', 'google:gwt-dev:+', 'sencha:gxt:+', 'google:gwt-user:+' cliJars 'aopalliance:aopalliance:+', 'bouncycastle:bcpg:+', 'bouncycastle:bcprov:+', 'cisd:cisd-args4j:+', 'sis:sis-base:+', 'apache:commons-codec:+', 'apache:commons-io:+', 'apache:httpclient:+', 'apache:commons-lang:+', 'apache:commons-logging:+', 'jline:jline:+', 'apache:log4j:+', 'springframework:spring-aop:+', 'springframework:spring-beans:+', 'springframework:spring-context:+', 'springframework:spring-core:+', 'springframework:spring-web:+', 'marathon:marathon-spring-util:+' partialLibs 'google:gwt-user:2.4' appbundler 'oracle:appbundler:+' } sourceSets { test { resources { srcDirs = ['source/java'] } } } jar { from zipTree(configurations.partialLibs.files.iterator().next()).matching { include '**/com/google/gwt/user/client/rpc/IsSerializable.class' include '**/com/google/gwt/user/client/rpc/SerializableException.class' } } ext.gwtBuildDir = "${project.buildDir}/gwt" task compileGwt (dependsOn: classes, type: JavaExec) { inputs.source sourceSets.main.java.srcDirs inputs.dir sourceSets.main.output.resourcesDir outputs.dir gwtBuildDir doFirst { file(gwtBuildDir).mkdirs() } main = 'com.google.gwt.dev.Compiler' classpath { [ sourceSets.main.java.srcDirs, project(":common").sourceSets.main.java.srcDirs, project(":authentication").sourceSets.main.java.srcDirs, project(":dbmigration").sourceSets.main.java.srcDirs, configurations.gwt ] } args = [ 'ch.systemsx.cisd.cifex.Cifex', '-war', gwtBuildDir, '-logLevel', 'INFO', '-localWorkers', '2', '-compileReport', '-extra', "${project.buildDir}/extra", ] maxHeapSize = '1024m' } task createWar(type: War) { classpath configurations.runtime.getAsFileTree().plus(files(jar.archivePath)) webXml = file('resource/server/web.xml') webInf { from "${gwtBuildDir}/WEB-INF", file('resource/server/spring-servlet.xml'), project(':common').file('resource/server/web-common.xml') } from('source/java') { into ("WEB-INF/classes") include '*.xml' } from('source/java/ch/systemsx/cisd/cifex') { into ("WEB-INF/classes/ch/systemsx/cisd/cifex") include '*.xml' } from ('../common/source/java/ch/systemsx/cisd/common/shared/') { into ("WEB-INF/classes/ch/systemsx/cisd/common/shared/") include 'CISD-basic.gwt.xml' } from ('../common/source/java') { into ("WEB-INF/classes") include 'genericCommonContext.xml' } from ('source') { into ("WEB-INF/classes") include "sql/**/*.sql" } from "${gwtBuildDir}/ch.systemsx.cisd.cifex.Cifex" } createWar.dependsOn compileGwt createWar.dependsOn jar task createJettyVersionFile { ext.versionFile = new File(buildDir, 'jetty-version.txt') outputs.file versionFile doLast { versionFile.text = "${jettyVersion}" } } ext.toBeSignedFolder = "${buildDir}/to-be-signed-jars" ext.signedFolder = "${buildDir}/signed-jars" task copyJarsForSigning(type: Copy, dependsOn: jar) { from configurations.cliJars.files from (jar.archivePath) from (project(':commonbase').jar.archivePath) from (project(':common').jar.archivePath) from (project(':authentication').jar.archivePath) from (project(':dbmigration').jar.archivePath) into toBeSignedFolder rename '(.+)-[0-9[r]]+.*\\.jar', '$1.jar' rename 'marathon-spring-util.*jar', 'stream-supporting-httpinvoker.jar' rename 'cifex-SNAPSHOT.jar', 'cifex.jar' rename 'authentication-SNAPSHOT.jar', 'authentication.jar' rename 'dbmigration-SNAPSHOT.jar', 'dbmigration.jar' rename 'common-SNAPSHOT.jar', 'common.jar' rename 'commonbase-SNAPSHOT.jar', 'commonbase.jar' } task signCliJars(type: Copy, dependsOn: [copyJarsForSigning]) { def keystoreFile = 'etc/dev.keystore' from toBeSignedFolder into signedFolder inputs.file keystoreFile doLast { file(signedFolder).listFiles().each { file -> if (file.name == 'cifex.jar') { ant.jar(destfile: file, update: true) { delegate.manifest { attribute(name: 'Main-Class', value: 'ch.systemsx.cisd.cifex.rpc.client.cli.CIFEXClient') attribute(name: 'Class-Path', value: 'authentication.jar dbmigration.jar common.jar sis-base.jar cisd-args4j.jar jline.jar commons-lang.jar commons-io.jar commons-logging.jar commons-codec.jar httpclient.jar httpcore.jar spring-core.jar spring-web.jar spring-context.jar spring-beans.jar spring-aop.jar aopalliance.jar stream-supporting-httpinvoker.jar bcpg.jar log4j.jar bcprov.jar') } } } ant.signjar(jar: file, keystore: keystoreFile, alias: 'cifex', storepass: 'cifextest', keypass:'cifex1') } } } task cliZip(type: Zip, dependsOn: signCliJars) { archiveName 'cifex_cli.zip' from ('dist/client') { into 'cifex' } from (signedFolder) { into 'cifex/lib' } } task standaloneJar(type: Jar, dependsOn: signCliJars) { archiveName 'CIFEX App.jar' from ({ fileTree("${signedFolder}").matching { include "authentication.jar" include "dbmigration.jar" include "commonbase.jar" include "common.jar" include "cifex.jar" include "sis-base.jar" include "cisd-args4j.jar" include "commons-lang.jar" include "commons-io.jar" include "commons-logging.jar" include "commons-codec.jar" include "httpclient.jar" include "httpcore.jar" include "spring-core.jar" include "spring-web.jar" include "spring-context.jar" include "spring-beans.jar" include "spring-aop.jar" include "aopalliance.jar" include "log4j.jar" include "stream-supporting-httpinvoker.jar" }.collect { zipTree(it).matching {exclude "META-INF/**"}}}) from ('source/java') { include "**/*.png" } manifest { attributes("Main-Class": "ch.systemsx.cisd.cifex.rpc.client.gui.FileClientMain") attributes("Class-Path": "bcprov.jar bcpg.jar") } } task standaloneApp << { ant.taskdef(name: 'bundle', classname: 'com.oracle.appbundler.AppBundlerTask', classpath: configurations.appbundler.asPath) ant.bundle(outputdirectory: "${buildDir}", name: 'CIFEXAppMac', displayname: 'CIFEXAppMac', identifier: 'ch.systemsx.cisd.cifex.rpc.client.gui.FileClientMain', mainclassname: 'ch.systemsx.cisd.cifex.rpc.client.gui.FileClientMain') { classpath(dir: "${signedFolder}") { include(name: "bcpg.jar") include(name: "bcprov.jar") } classpath(dir: "${buildDir}/libs") { include(name: "CIFEX App.jar") } } } standaloneApp.dependsOn standaloneJar task standaloneJarZip(type: Zip, dependsOn: standaloneJar) { archiveName 'CIFEXApp.zip' from standaloneJar.archivePath from ("${signedFolder}") { include "bcpg.jar" include "bcprov.jar" } } task standaloneAppZip(type: Zip, dependsOn: standaloneApp) { archiveName 'CIFEXAppMac.app.zip' from ("${buildDir}/CIFEXAppMac.app") { into 'CIFEXAppMac.app' } } task mainZip(type: Zip, dependsOn: createJettyVersionFile) { baseName 'cifex' from createJettyVersionFile from cliZip from('dist/server') from('dist/etc') from standaloneAppZip from standaloneJarZip from('etc') { exclude 'dev.keystore' exclude 'log.xml' } from('source/java/ch/systemsx/cisd/cifex/public') { include '*.*' exclude 'index.html' exclude 'tools.html' } from (createWar.archivePath) { rename 'cifex.*war', 'cifex.war' } from (configurations.zipping.files) { rename 'jetty-distribution(.*).zip', 'jetty.zip' } into 'cifex' } mainZip.dependsOn createWar mainZip.dependsOn cliZip mainZip.dependsOn standaloneAppZip mainZip.dependsOn standaloneJarZip build.dependsOn mainZip apply from: 'gwtdev.gradle'