apply from: 'http://svncisd.ethz.ch/repos/cisd/gradle/trunk/javaproject.gradle' apply plugin: 'war' archivesBaseName = 'openBIS-server-standard-technologies' configurations { gwt } configurations { zipping } configurations { admin_partial } configurations { admin_full } dependencies { compile project(':screening'), project(':rtd_phosphonetx') providedCompile 'google:gwt-user:2.4', 'google:gwt-dev:2.4' providedRuntime 'eclipse:jetty-util:8.1.8.v20121106', 'eclipse:jetty-deploy:8.1.8.v20121106' gwt 'reveregroup:gwt-image-loader:1.1.4' zipping 'eclipse:jetty-distribution:8.1.8@zip' admin_partial 'google:gwt-user:2.4' admin_full 'cisd:cisd-base:+', 'apache:commons-httpclient:+', 'apache:commons-logging:+', 'apache:commons-io:+', 'apache:log4j:+', 'springframework:spring-core:+', 'springframework:spring-context:+', 'springframework:spring-jdbc:+', 'springframework:spring-orm:+', 'springframework:spring-aop:+', 'marathon:marathon-spring-util:+', 'springframework:spring-beans:+', 'jline:jline:0.9.94' } buildscript { apply from: '../gradle/repository.gradle' repositories repositoryConfig dependencies { classpath 'apache:commons-codec:+' } } task compileGwt (dependsOn: classes, type: JavaExec) { buildDir = "${project.buildDir}/gwt" extraDir = "${project.buildDir}/extra" inputs.source sourceSets.main.java.srcDirs inputs.dir sourceSets.main.output.resourcesDir outputs.dir buildDir doFirst { file(buildDir).mkdirs() } main = 'com.google.gwt.dev.Compiler' classpath { [ sourceSets.main.java.srcDirs, project(":openbis").sourceSets.main.java.srcDirs, project(":openbis").sourceSets.main.output.resourcesDir, project(":openbis").sourceSets.main.output.classesDir, project(":openbis").sourceSets.main.compileClasspath, project(":common").sourceSets.main.java.srcDirs, project(":openbis_api").sourceSets.main.java.srcDirs, project(":screening").sourceSets.main.java.srcDirs, project(":screening").sourceSets.main.output.resourcesDir, project(":rtd_phosphonetx").sourceSets.main.java.srcDirs, project(":rtd_phosphonetx").sourceSets.main.output.resourcesDir, configurations.gwt ] } args = [ 'ch.systemsx.cisd.openbis.OpenBIS', '-war', buildDir, '-logLevel', 'INFO', '-localWorkers', '2', '-compileReport', '-extra', extraDir, ] maxHeapSize = '1024m' } classpathEntries = files( project(':openbis').file('source/java/applicationContext.xml'), project(':openbis').file('source/java/dbConfigurationContext.xml'), project(':openbis').file('source/java/ehcache.xml'), project(':openbis').file('source/java/genericApplicationContext.xml'), project(':openbis').file('source/java/hibernateContext.xml'), project(':openbis').file('source/java/schema-for-xslt20.xsd'), project(':openbis').file('source/java/XMLSchema.xsd'), project(':screening').file('source/java/screening-applicationContext.xml'), project(':screening').file('source/java/screening-dssApplicationContext.xml'), project(':screening').file('source/java/screening-plugin-applicationContext.xml'), project(':rtd_phosphonetx').file('source/java/proteomics-applicationContext.xml'), project(':rtd_phosphonetx').file('source/java/proteomics-plugin-applicationContext.xml'), project(':common').file('source/java/genericCommonContext.xml'), 'source/java/standard-technologies-applicationContext.xml' ) zipEntries = files( project(':openbis').file('dist/server/check.sh'), project(':openbis').file('dist/server/configure.sh'), project(':openbis').file('dist/server/export-master-data.py'), project(':openbis').file('dist/server/export-master-data.sh'), project(':openbis').file('dist/server/install.sh'), project(':openbis').file('dist/server/jetty.xml'), project(':openbis').file('dist/server/openBIS.keystore'), project(':openbis').file('dist/server/openbis.conf'), project(':openbis').file('dist/server/passwd.sh'), project(':openbis').file('dist/server/register-master-data.sh'), project(':openbis').file('dist/server/service.properties'), project(':openbis').file('dist/server/setup-env'), project(':openbis').file('dist/server/shutdown.sh'), project(':openbis').file('dist/server/startup.sh'), project(':openbis').file('dist/server/status.sh'), project(':openbis').file('dist/server/version.sh'), project(':openbis').file('dist/server/watchdog.sh'), project(':openbis').file('dist/server/web-client.properties') ) task checkFilesExist { inputs.files files(classpathEntries, zipEntries) doLast { classpathEntries.each { x -> assert x.exists() } zipEntries.each { x -> assert x.exists() } } } war.dependsOn compileGwt war.dependsOn checkFilesExist war { from compileGwt.buildDir +"/ch.systemsx.cisd.openbis.OpenBIS" webXml = file('resource/server/web.xml') webInf { from compileGwt.buildDir +"/WEB-INF", project(':openbis').file('resource/server/bis-common.xml'), project(':common').file('resource/server/web-common.xml') } classpath classpathEntries from('../openbis/source'){ into("WEB-INF/classes") include "sql/**/*.sql" exclude "sql/generic/_ERD" } from('../screening/source'){ into("WEB-INF/classes") include "sql/**/*.sql" exclude "sql/imaging/postgresql/_ERD" } from('../rtd_phosphonetx/source/sql'){ into("WEB-INF/classes") include "proteomics/**/*.sql" } } task zipCorePlugins(type: Zip) { archiveName 'core-plugins.zip' from project(':rtd_phosphonetx').fileTree(dir: 'source/core-plugins', includes:['proteomics/**', 'proteomics-optional/**'], excludes:['**/dss/**', '**/package-to-dist']) from project(':screening').fileTree(dir: 'source/core-plugins', includes:['screening/**', 'screening-optional/**'], excludes:['**/dss/**', '**/package-to-dist']) from project(':deep_sequencing_unit').fileTree(dir: 'source/core-plugins', includes:['illumina-ngs/**'], excludes:['**/dss/**', '**/package-to-dist']) from 'dist/server/core-plugins.properties' into 'core-plugins' } task adminConsole(type: Jar) { archiveName 'openbis-admin-console.jar' includeEmptyDirs false from zipTree(project(':common').jar.archivePath).plus( zipTree(project(':openbis-common').jar.archivePath).plus( zipTree(project(':screening').jar.archivePath).plus( zipTree(project(':openbis').jar.archivePath)))).matching { include '**/ch/systemsx/cisd/common/spring/HttpInvokerUtils.class' include '**/ch/systemsx/cisd/common/**/*.class' include '**/ch/systemsx/cisd/openbis/common/**/*.class' include '**/ch/systemsx/cisd/openbis/generic/client/console/**/*.class' include '**/shared/I*.class' include '**/shared/basic/dto/**/*.class' include '**/shared/basic/*.class' include '**/shared/dto/**/*.class' include '**/shared/dto/*PE.class' include '**/shared/authorization/annotation/*.class' include '**/shared/authorization/ISessionProvider.class' include '**/*BuildAndEnvironmentInfo.class' } from zipTree(configurations.admin_partial.files.iterator().next()).matching { include '**/com/google/gwt/user/client/rpc/IsSerializable.class' include '**/com/google/gwt/user/client/rpc/SerializableException.class' } for (File f : configurations.admin_full.files) { from zipTree(f).matching { include '**/**' } } manifest { attributes("Main-Class": "ch.systemsx.cisd.openbis.generic.client.console.AdminConsole", "Class-Path": "openbis-admin-console.jar cisd-base.jar commons-codec.jar commons-httpclient.jar commons-io.jar commons-logging.jar log4j.jar jline.jar spring.jar stream-supporting-httpinvoker.jar") } } adminConsole.dependsOn war task zipAdminConsole(type: Zip) { archiveName 'openbis-admin-console.zip' from adminConsole.archivePath into 'openbis-admin-console' } zipAdminConsole.dependsOn adminConsole def generateMD5(final file) { java.security.MessageDigest digest = java.security.MessageDigest.getInstance("MD5") file.withInputStream(){is-> byte[] buffer = new byte[8192] int read = 0 while( (read = is.read(buffer)) > 0) { digest.update(buffer, 0, read); } } byte[] md5sum = digest.digest() BigInteger bigInt = new BigInteger(1, md5sum) return bigInt.toString(16) } task checksums { ext.destFile = new File(buildDir, 'configuration.MD5') ext.inputFiles = war.getSource().filter({file -> file.name.endsWith('xml') || file.name.endsWith('.conf') || file.name.endsWith('.properties')}) inputs.files inputFiles outputs.file destFile doLast { if (destFile.exists()) { destFile.delete() } destFile.createNewFile() configFiles = classpathEntries.filter({file -> file.name.endsWith('xml') || file.name.endsWith('.conf') || file.name.endsWith('.properties')}) configFiles.each {file -> destFile.text += generateMD5(file)+" webapps/openbis/WEB-INF/classes/"+file.name+"\n" } configFiles = war.getSource().filter({file -> file.name.endsWith('xml') || file.name.endsWith('.conf') || file.name.endsWith('.properties')}).minus(classpathEntries) configFiles.each {file -> destFile.text += generateMD5(file)+" webapps/openbis/WEB-INF/"+file.name+"\n" } } } checksums.dependsOn war task zip(type: Zip) { from war from zipEntries from checksums from configurations.zipping from zipCorePlugins.archivePath from zipAdminConsole.archivePath rename 'jetty-distribution(.*).zip', 'jetty.zip' rename 'openBIS(.*).war', 'openBIS.war' } zip.dependsOn war zip.dependsOn zipCorePlugins zip.dependsOn zipAdminConsole zip.dependsOn checksums build.dependsOn zip