buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "org.javamodularity:moduleplugin:1.6.0" } } apply plugin: 'build-dashboard' allprojects { apply plugin: 'java' apply plugin: 'org.javamodularity.moduleplugin' apply plugin: 'maven' apply plugin: 'jacoco' apply plugin: 'eclipse' // eclipse { // classpath { // downloadSources = true // } // } group = 'org.subshare' version = '1.0.1-SNAPSHOT' // version = '1.0.1' sourceCompatibility = JavaVersion.VERSION_1_9 targetCompatibility = JavaVersion.VERSION_1_9 // modularity.mixedJavaRelease 8 // seems not to work as long as there are still sub-projects *not* containing a module-info.java :-( [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' project.ext.mavenDeployerRepoUrl = "file:/tmp/maven" def mavenDeployerRepoUrlSysProp = System.getProperty("mavenDeployerRepoUrl"); if (mavenDeployerRepoUrlSysProp != null && ! mavenDeployerRepoUrlSysProp.isEmpty()) project.ext.mavenDeployerRepoUrl = mavenDeployerRepoUrlSysProp; if (version.endsWith("-SNAPSHOT")) project.ext.mavenDeployerRepoUrl = project.ext.mavenDeployerRepoUrl + "/snapshot"; else project.ext.mavenDeployerRepoUrl = project.ext.mavenDeployerRepoUrl + "/release"; repositories { mavenCentral() // This sucks: mavenLocal() must be last according to // http://stackoverflow.com/questions/10156847/how-to-tell-gradle-to-download-all-the-source-jars#10655347 // in order to get sources. But it must be first, if we want // to make sure that locally built stuff (=> CloudStore!) is used // instead of an older version built on the Jenkins. mavenLocal() maven { url 'https://codewizards.co/maven/release' } maven { url 'https://codewizards.co/maven/snapshot' } // The following is only needed for snapshots -- and we use release-versions only for quite a while. // maven { // url 'http://www.datanucleus.org/downloads/maven2-nightly' // } } project.ext.subshareVersion = version // project.ext.bouncycastleVersion = '1.60' // Need newer version because of: https://github.com/subshare/subshare/issues/61 project.ext.bouncycastleVersion = '161b03' project.ext.bouncycastleWotVersion = bouncycastleVersion + '.1'; // project.ext.bouncycastleWotVersion = bouncycastleVersion + '.1-SNAPSHOT'; project.ext.cloudstoreVersion = '1.0.1-SNAPSHOT' // project.ext.cloudstoreVersion = '1.0.1' project.ext.slf4jVersion = '2.0.0-alpha1' project.ext.logbackVersion = '1.3.0-alpha4' project.ext.servletApiVersion = '3.1.0' sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/main/java' srcDir 'src/main/resources' } } test { java { srcDir 'src/test/java' } resources { srcDir 'src/test/java' srcDir 'src/test/resources' } } } eclipse { classpath { downloadSources = true } } uploadArchives { repositories { mavenDeployer { repository(url: mavenDeployerRepoUrl) } } } } subprojects { // apply plugin: 'eclipse' // eclipse { // classpath { // //Necessary otherwise the library is not raised to the module level. // containers 'org.eclipse.buildship.core.gradleclasspathcontainer' // // file { // whenMerged { // entries.findAll { isConGradle(it) }.each { // it.entryAttributes['module'] = 'true' // } // } // } // } // } dependencies { compile "org.slf4j:slf4j-api:$slf4jVersion" // compile "org.apache.commons:commons-lang3:3.4" compile "org.apache.commons:commons-collections4:4.0" // jmockit must be *before* junit. // testCompile 'org.jmockit:jmockit:1.24', 'junit:junit:4.12', 'org.assertj:assertj-core:2.4.1' // assertj 3.4.1 requires Java 8 - using the newest one that works with Java 7. testImplementation ('org.jmockit:jmockit:1.49') { exclude group: 'com.google.code.findbugs', module: 'jsr305' } testImplementation 'junit:junit:4.13-rc-2' // testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1' // testImplementation 'org.junit.jupiter:junit-jupiter-params:5.3.1' // testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1' testCompile 'org.assertj:assertj-core:3.14.0' testCompile "org.slf4j:log4j-over-slf4j:$slf4jVersion" testCompile ("ch.qos.logback:logback-classic:$logbackVersion") { exclude group: 'edu.washington.cs.types.checker', module: 'checker-framework' exclude group: 'javax.activation', module: 'activation' } } jar { manifest.attributes Provider: 'CodeWizards GmbH + blackbytes GmbH' } tasks.withType(Test) { // jvmArgs "-XX:MaxPermSize=256m" jvmArgs "-Xmx512m" String igFa = System.properties['test.ignoreFailures']; ignoreFailures = igFa == null ? false : Boolean.parseBoolean(igFa); // We don't use separate processes but separate threads in the same JVM, because this is faster. // maxParallelForks = Runtime.runtime.availableProcessors() * 2 // ...actually we don't do this, yet - and we may very well need multiple JVMs, because quite a few things are configured gobally per JVM! // Well, now, we do run them in parallel (separate processes)! On my machine (having 8 cores) the entire build process is now // significantly faster: // * before (1 process): 6 mins 17.48 sec // * after (8 processes): 4 mins 28.276 secs maxParallelForks = Runtime.runtime.availableProcessors(); // To use all CPUs seems to cause starvations or fail some tests sometimes for other reasons. Reduce by one, if possible. if (maxParallelForks > 1) maxParallelForks = maxParallelForks - 1; } } task copyDistributions(type: Copy) { into "$buildDir/distributions" from 'org.subshare.gui/build/distributions' from 'org.subshare.server/build/distributions' // This task depends on 'subprojects.build' in order to run *after* all sub-projects // have been built. Without this, it would run before the sub-projects (when there's // nothing to be copied, yet). dependsOn subprojects.build } // The 'copyDistributions' task should always run when 'build' runs. build.finalizedBy copyDistributions boolean isConGradle(entry) { entry.kind == 'con' && entry.path == 'org.eclipse.buildship.core.gradleclasspathcontainer' }