Skip to content
Snippets Groups Projects
build.gradle 15.3 KiB
Newer Older
evaluationDependsOn(':commonbase')
evaluationDependsOn(':common')
evaluationDependsOn(':openbis_api')
evaluationDependsOn(':openbis-common')
evaluationDependsOn(':authentication')
evaluationDependsOn(':dbmigration')
evaluationDependsOn(':openbis')
evaluationDependsOn(':datastore_server')
evaluationDependsOn(':rtd_phosphonetx')
evaluationDependsOn(':screening')
evaluationDependsOn(':rtd_yeastx')
evaluationDependsOn(':deep_sequencing_unit')
evaluationDependsOn(':plasmid')
felmer's avatar
felmer committed
apply from: '../gradle/javaproject.gradle'
apply from: 'screening-api.gradle'
apply from: 'proteomics-api.gradle'
apply from: 'admin-console.gradle'
archivesBaseName = 'openBIS-server-standard-technologies'
configurations.create('gwt')
configurations.create('zipping')
configurations.create('datastore_server')
configurations.create('javadoc_sources')
configurations.create('javadoc_compilation')
def jettyVersion = '9.4.9'
dependencies {
	compile project(':screening'),
			project(':rtd_phosphonetx')
	
	providedCompile 'google:gwt-user:2.4'
	providedRuntime "eclipse:jetty-deploy:${jettyVersion}.v20180320@jar",
                    "eclipse:jetty-xml:${jettyVersion}.v20180320@jar",
                    "eclipse:jetty-webapp:${jettyVersion}.v20180320@jar",
                    "eclipse:jetty-servlet:${jettyVersion}.v20180320@jar",
                    "eclipse:jetty-security:${jettyVersion}.v20180320@jar",
                    "eclipse:jetty-server:${jettyVersion}.v20180320@jar",
                    "eclipse:jetty-continuation:${jettyVersion}.v20180320@jar"
	gwt 'reveregroup:gwt-image-loader:1.1.4',
                'google:gwt-dev:+'
	zipping "eclipse:jetty-distribution:${jettyVersion}@zip"
	datastore_server project(':deep_sequencing_unit'),
					 project(':rtd_yeastx'),
					 project(':screening'),
					 'bioformats:bioformats:+',
					 'imagej:ij:+',
					 'cisd:cisd-openbis-knime-server:+',
					 'apache:xml-apis:+',
					 'javax:jaxb:+',
					 'slf4j:slf4j:+',
					 'slf4j:slf4j-log4j12:+',
					 'sybit:image-viewer:+'
	javadoc_sources	project(path:':commonbase', configuration: 'archives'),
		    	project(path:':common', configuration: 'archives'),
		    	project(path:':openbis_api', configuration: 'archives'),
		    	project(path:':openbis-common', configuration: 'archives'),
		    	project(path:':openbis', configuration: 'archives'),
		    	project(path:':datastore_server', configuration: 'archives'),
		    	project(path:':rtd_phosphonetx', configuration: 'archives'),
		    	project(path:':screening', configuration: 'archives'),
		    	'cisd:cisd-args4j:+:sources',
		    	'cisd:cisd-hotdeploy:+:sources'

	javadoc_compilation	project(path:':rtd_phosphonetx'),
				    	project(path:':screening')
buildscript {
    apply from: '../gradle/repository.gradle'
    
    repositories repositoryConfig
    
    dependencies {
        classpath 'apache:commons-codec:+'
    }
task compileGwt (dependsOn: classes, type: JavaExec) {

	ext.buildDir = "${project.buildDir}/gwt"
	def 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 {
		[
			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,			
			'ch.systemsx.cisd.openbis.OpenBIS',
			'-war', buildDir,
			'-logLevel', 'INFO',
			'-localWorkers', '2',
			'-compileReport', 
			'-extra', extraDir,
		]
	
	maxHeapSize = '1024m'
	
	systemProperty "javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl"
	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'
)

	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/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/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'),
anttil's avatar
anttil committed
	project(':openbis').fileTree(dir: 'dist/server').matching {
	   include 'base/**'
	}, 	
	file('dist/server/service.properties'),
	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 checkFilesExist
    rootSpec.eachFile { file ->
        if (file.name.startsWith('cisd-cifex') || file.name.startsWith('datastore_server')) {
            file.exclude()
        }
    }

    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'),
        file('resource/server/spring-servlet.xml'),
        file('resource/server/jetty-web.xml'),
        project(':common').file('resource/server/web-common.xml')
    }
    
    from (classpathEntries) {
        into("WEB-INF/classes") 
    from('dist/server'){ 
        include "etc/log.xml" 
    } 

    from('targets/dist'){ 
        into("WEB-INF/classes") 
        include 'BUILD*INFO' 
        rename 'BUILD.*INFO', 'BUILD-openbis.INFO'
    } 

    from('../screening/source'){ 
        into("WEB-INF/classes") 
        include "sql/**/*.sql" 
        exclude "sql/imaging/postgresql/_ERD"        
    } 

    from('../openbis/source'){ 
        into("WEB-INF/classes") 
        include "sql/**/*.sql" 
        exclude "sql/generic/_ERD"
        duplicatesStrategy 'exclude' 
    } 

    from('../rtd_phosphonetx/source/sql'){ 
        into("WEB-INF/classes") 
        include "proteomics/**/*.sql" 
    } 
def downloadFile(url, filename) {
  def file = project(':openbis').file("../openbis_standard_technologies/targets/downloads/$filename")
  if (file.exists() == false || System.currentTimeMillis() - file.lastModified() > 3600000) {
    ext.executeFunction('curl', [url, '-sLk', '-o', file.getAbsolutePath()])
task zipCorePlugins(type: Zip) {
  downloadFile('https://github.com/aarpon/obit_flow_core_technology/archive/master.zip', 'flow.zip')
  downloadFile('https://github.com/aarpon/obit_microscopy_core_technology/archive/master.zip', 'microscopy.zip')
  downloadFile('https://github.com/aarpon/obit_shared_core_technology/archive/master.zip', 'shared.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 zipTree('targets/downloads/flow.zip')
  from zipTree('targets/downloads/microscopy.zip')
  from zipTree('targets/downloads/shared.zip')
  from 'dist/server/core-plugins.properties'
  into 'core-plugins'
  eachFile { FileCopyDetails fcd -> 
    def rp = fcd.relativePath
    if (rp.pathString.contains("obit_")) {
      if (rp.pathString.contains("/core-plugins/") && fcd.name.equals("core-plugins.properties") == false) {
        fcd.relativePath = new RelativePath(fcd.isDirectory() == false, rp.segments[2..-1] as String[])
      } else if (fcd.name.equals("LICENSE")) {
        fcd.relativePath = new RelativePath(true, ["core-plugins", rp.pathString.split("_")[1], "LICENSE"] as String[])
      } else {
        fcd.exclude()
      }
    }
  }
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()
		
		def 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 createJettyVersionFile {
    ext.versionFile = new File(buildDir, 'jetty-version.txt')
    outputs.file versionFile
    doLast {
        versionFile.text = "${jettyVersion}"
    }
}

task zip(type: Zip, dependsOn: createJettyVersionFile) {
    from createJettyVersionFile
	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
task zipDss(type: Zip, dependsOn: signWebStartJars) {
	baseName 'datastore_server-standard-technologies'
	includeEmptyDirs true
	from (configurations.datastore_server) {
		into 'datastore_server/lib'
		exclude '**/gwt*.jar'
		exclude '**/gxt*.jar'
		exclude '**/hibernate*.jar'
		exclude '**/jmock*.jar'
		exclude '**/junit*.jar'
		exclude '**/lucene*.jar'
		exclude '**/restrictions*.jar'
		exclude '**/testng*.jar'
		rename 'common-.*jar', 'common.jar'
		rename 'commonbase-.*jar', 'commonbase.jar'
	   into 'datastore_server/lib/dss_upload_gui'
	   exclude openbisClientJarName
	   exclude dssCliClientJarName
	from (project(':datastore_server').fileTree(dir: 'dist', includes: ['**/*'], excludes:['dss_client.sh', 'etc/**'])) {
		into 'datastore_server';
	}

	from (project(':datastore_server').files('dist/etc/datastore_server.conf', 'dist/etc/openBIS.keystore')) {
		into 'datastore_server/etc';
	}
	
	from (fileTree(dir: 'dist', includes: ['etc/service.properties', 'etc/log.xml'])) {
		into 'datastore_server'
	}
	
	from (project(':screening').file('dist/etc/tabular-data-graph.properties')) {
		into 'datastore_server/etc';
	}
	
	from (project(':rtd_phosphonetx').fileTree(dir: 'source/core-plugins', includes:['proteomics/**', 'proteomics-optional/**'], excludes:['**/as/**', '**/package-to-dist']).plus(
		 project(':screening').fileTree(dir: 'source/core-plugins', includes:['screening/**', 'screening-optional/**'], excludes:['**/as/**', '**/package-to-dist']).plus(
		 project(':deep_sequencing_unit').fileTree(dir: 'source/core-plugins', includes:['illumina-ngs/**'], excludes:['**/as/**', '**/package-to-dist'])))) {
		into 'core-plugins'
	}
}

task clientsAndApis(type: Zip, dependsOn: [dssClientZip, queryApiZip, apiV3Zip, proteomicsApiZip, screeningApiZip]) {
  baseName 'openBIS-clients-and-APIs'
  downloadFile("https://sissource.ethz.ch/sispub/pybis/repository/master/archive.zip", "pybis.zip")
  from "targets/downloads/pybis.zip"
  from dssClientZip.archivePath
  from queryApiZip.archivePath
  from apiV3Zip.archivePath
  from proteomicsApiZip.archivePath
  from screeningApiZip.archivePath
  from ('../openbis_all/dist/readme.txt')
  def contentOfSetUpFile = zipTree('targets/downloads/pybis.zip').getFiles().findAll {it.path.endsWith('PyBis/setup.py') }.iterator().next().text
  def pybisVersion = ( contentOfSetUpFile =~ /version.*=.*'(.*)'/)[0][1]
  rename 'pybis.zip', "pybis-${pybisVersion}.zip"
task generateJavadoc(type: Javadoc) {
	source = configurations.javadoc_sources.collect { zipTree(it).matching {
felmer's avatar
felmer committed
		include "**/ch/ethz/sis/openbis/generic/asapi/**/*.java"
		include "**/ch/ethz/sis/openbis/generic/dssapi/**/*.java"
		include "**/ch/systemsx/cisd/**/api/**/*.java"
		include "**/ch/systemsx/cisd/common/annotation/*.java"
		include "**/ch/systemsx/cisd/base/**/*.java"		
		include "**/OpenBISScreeningML.java"
		include "**/ch/systemsx/cisd/**/etlserver/TopLevelDataSetRegistratorGlobalState.java"
		include "**/ch/systemsx/cisd/**/etlserver/registrator/*.java"
		include "**/ch/systemsx/cisd/common/mail/*.java"
	}}
	classpath = configurations.javadoc_compilation
	maxMemory = "1024m"
	options.addStringOption("source", "1.8")
build.dependsOn dssUploadGuiStandaloneJar
build.dependsOn generateJavadoc