import org.apache.tools.ant.filters.* dependencies { compile group: 'co.codewizards.cloudstore', name: 'co.codewizards.cloudstore.server', version: cloudstoreVersion // compile group: 'co.codewizards.cloudstore', name: 'co.codewizards.cloudstore.core.oio.nio', version: cloudstoreVersion compile project(':org.subshare.rest.server') compile project(':org.subshare.local') compile project(':org.subshare.local.dbrepo') compile project(':org.subshare.ls.server') // Just like every other app, we need an auto-update. compile project(':org.subshare.updater') } // The REST client is not needed, because a SubShare server does not talk to other servers. // If we ever add a server-to-server-sync, we'll have to re-add this (and probably subshare-specific projects, too). configurations.all*.exclude module: "co.codewizards.cloudstore.rest.client" // The CloudStore client is not usable with SubShare => exclude it. configurations.all*.exclude module: "co.codewizards.cloudstore.client" jar { manifest { attributes( 'Main-Class': 'org.subshare.server.SubShareServer', 'Class-Path': configurations.runtime.collect { it.getName() }.join(' ')) } } task copyDependencies(type: Copy) { into "$buildDir/assembly/subshare-server/lib" from configurations.runtime } task copyJar(type: Copy) { into "$buildDir/assembly/subshare-server/lib" from "$buildDir/libs" } def filterTokenMap = [ 'project.artifactId' : project.name, 'project.version' : project.version ] task copyUnfilteredFilesFromAssembly(type: Copy) { into "$buildDir/assembly/subshare-server" from 'src/assembly' exclude '*.properties' } task copyFilteredFilesFromAssembly(type: Copy, dependsOn: [ copyUnfilteredFilesFromAssembly ] ) { into "$buildDir/assembly/subshare-server" from 'src/assembly' include '*.properties' // Use ANT filter ReplaceTokens. filter(ReplaceTokens, tokens: filterTokenMap) } task copyFilesFromBin(type: Copy) { into "$buildDir/assembly/subshare-server/bin" from 'src/bin' // Use ANT filter ReplaceTokens. filter(ReplaceTokens, tokens: filterTokenMap) } task chmodMainExecutable(type:Exec, dependsOn: [ copyFilesFromBin, copyFilteredFilesFromAssembly ]) { commandLine = ['chmod', 'a+x', 'subshare-server'] workingDir = file("$buildDir/assembly/subshare-server/bin") } task tarGzAssembly(type: Tar, dependsOn: [ chmodMainExecutable, copyJar, copyDependencies ]) { compression = Compression.GZIP classifier = 'bin' extension = 'tar.gz' // default is 'tgz' includeEmptyDirs true from "$buildDir/assembly" } task zipAssembly(type: Zip, dependsOn: tarGzAssembly) { classifier = 'bin' includeEmptyDirs true from "$buildDir/assembly" } artifacts{ archives tarGzAssembly, zipAssembly } build.dependsOn(zipAssembly) // TODO this should be in the root build.gradle in subprojects {...} or allprojects {...}, but it does not work :-( // I get errors like this: // >> Could not get unknown property 'modularity' for project ':org.subshare.test' of type org.gradle.api.Project. << // But it works fine, if I put it into the sub-projects individually. This sucks :-( but at least it works. // ...maybe this is because there are still some sub-projects not containing a module-info.java... //modularity.mixedJavaRelease 8 // sets "--release 8" for main code, and "--release 9" for "module-info.java"