| // Plugins |
| plugins { |
| id 'java' |
| id 'application' |
| } |
| |
| /* Meta Data Info */ |
| def title = 'Apache Wave Server' |
| def vendor = 'The Apache Software Foundation' |
| |
| /* 3rd Part Repositories */ |
| repositories { |
| mavenCentral() |
| maven { |
| url 'http://archiva.comunes.org/repository/comunes-snapshots/' |
| } |
| maven { |
| url 'https://oauth.googlecode.com/svn/code/maven/' |
| } |
| maven { |
| url 'https://oss.sonatype.org/content/repositories/google-snapshots/' |
| } |
| |
| } |
| |
| mainClassName = "org.waveprotocol.box.server.ServerMain" |
| applicationDefaultJvmArgs = [ |
| "-Xmx1024M", |
| "-Dorg.eclipse.jetty.LEVEL=DEBUG", |
| "-Djava.security.auth.login.config=config/jaas.config" |
| ] |
| |
| configurations { |
| compile { |
| description = 'compile classpath' |
| } |
| generateGXP { |
| description = 'classpath for generating GXP files' |
| } |
| gwt { |
| description = 'classpath for compiling the gwt sources' |
| } |
| } |
| |
| |
| |
| /* Project Dependencies */ |
| dependencies { |
| // code-gen |
| compile( |
| [group: "org.antlr", name: "antlr", version: "3.2"], |
| //TODO(wisebaldone) renable when gwt using jetty 9 |
| //[group: "com.google.gwt", name: "gwt-dev", version: "2.8.0"], |
| //[group: "com.google.gwt", name: "gwt-user", version: "2.8.0"], |
| //[group: "com.google.gwt", name: "gwt-codeserver", version: "2.8.0"], |
| [group: "org.apache.velocity", name: "velocity", version: "1.6.3"] |
| ) |
| |
| gwt( |
| [group: "org.antlr", name: "antlr", version: "3.2"], |
| [group: "org.apache.velocity", name: "velocity", version: "1.6.3"] |
| ) |
| // compile |
| compile ( |
| [group: "aopalliance", name: "aopalliance", version: "1.0"], |
| [group: "org.bouncycastle", name: "bcprov-jdk16", version: "1.45"], |
| [group: "commons-fileupload", name: "commons-fileupload", version: "1.2.2"], |
| [group: "commons-cli", name: "commons-cli", version: "1.2"], |
| [group: "commons-codec", name: "commons-codec", version: "1.4"], |
| [group: "commons-io", name: "commons-io", version: "2.4"], |
| [group: "commons-collections", name: "commons-collections", version: "3.2.1"], |
| [group: "commons-configuration", name: "commons-configuration", version: "1.6"], |
| [group: "commons-httpclient", name: "commons-httpclient", version: "3.1"], |
| [group: "commons-lang", name: "commons-lang", version: "2.5"], |
| [group: "commons-logging", name: "commons-logging-api", version: "1.1"], |
| [group: "commons-logging", name: "commons-logging", version: "1.1.1"], |
| [group: "dom4j", name: "dom4j", version: "1.6.1"], |
| [group: "com.google.code.gson", name: "gson", version: "2.2.4"], |
| [group: "com.google.guava", name: "guava", version: "15.0"], |
| [group: "com.google.guava", name: "guava-gwt", version: "15.0"], |
| [group: "com.google.inject.extensions", name: "guice-assistedinject", version: "3.0"], |
| [group: "com.google.inject.extensions", name: "guice-servlet", version: "3.0"], |
| [group: "com.google.inject", name: "guice", version: "3.0"], |
| [group: "javax.inject", name: "javax.inject", version: "1"], |
| [group: "com.google.gxp", name: "google-gxp", version: "0.2.4-beta"], |
| [group: "javax.jdo", name: "jdo2-api", version: "2.1"], |
| [group: "org.jdom", name: "jdom", version: "1.1.3"], |
| [group: "com.google.code.findbugs", name: "jsr305", version: "2.0.1"], |
| [group: "jline", name: "jline", version: "0.9.94"], |
| [group: "joda-time", name: "joda-time", version: "1.6"], |
| [group: "org.apache.lucene", name: "lucene-core", version: "3.5.0"], |
| [group: "org.mongodb", name: "mongo-java-driver", version: "2.11.2"], |
| [group: "net.oauth.core", name: "oauth-provider", version: "20100527"], |
| [group: "net.oauth.core", name: "oauth", version: "20100527"], |
| [group: "net.oauth.core", name: "oauth-consumer", version: "20100527"], |
| [group: "com.google.protobuf", name: "protobuf-java", version: "2.5.0"], |
| [group: "com.googlecode.protobuf-java-format", name: "protobuf-java-format", version: "1.2"], |
| [group: "org.igniterealtime", name: "tinder", version: "1.2.1"], |
| [group: "xpp3", name: "xpp3", version: "1.1.4c"], |
| [group: "xpp3", name: "xpp3_xpath", version: "1.1.4c"], |
| [group: "org.gnu.inet", name: "libidn", version: "1.15"], |
| [group: "cc.kune", name: "gwt-initials-avatars-shared", version: "1.0-SNAPSHOT"], |
| [group: "cc.kune", name: "gwt-initials-avatars-server", version: "1.0-SNAPSHOT"], |
| [group: "com.typesafe", name: "config", version: "1.2.1"], |
| [group: "xerces", name: "xerces", version: "2.4.0"], |
| [group: "org.slf4j", name: "slf4j-api", version: "1.6.1"], |
| [group: "org.slf4j", name: "slf4j-simple", version: "1.6.1"], |
| [group: "org.eclipse.jetty", name: "jetty-annotations", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty", name: "jetty-client", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty", name: "jetty-continuation", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty", name: "jetty-http", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty", name: "jetty-io", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty", name: "jetty-proxy", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty", name: "jetty-security", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty", name: "jetty-server", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty", name: "jetty-servlet", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty", name: "jetty-servlets", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty", name: "jetty-util", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty", name: "jetty-webapp", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty", name: "jetty-xml", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty.websocket", name: "websocket-api", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty.websocket", name: "websocket-client", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty.websocket", name: "websocket-common", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty.websocket", name: "websocket-server", version: "9.1.1.v20140108"], |
| [group: "org.eclipse.jetty.websocket", name: "websocket-servlet", version: "9.1.1.v20140108"], |
| //TODO: Following are included due to tests being in the main src directory |
| [group: "org.mockito", name: "mockito-all", version: "1.9.5"], |
| [group: "org.hamcrest", name: "hamcrest-all", version: "1.3"] |
| |
| ) |
| compile fileTree(dir: 'dependencies/compile', include: "**/*.jar") |
| compile fileTree(dir: '../wave-proto/build/libs', include: "**/*.jar") |
| |
| generateGXP ( |
| [group: "com.google.gxp", name: "google-gxp", version: "0.2.4-beta"] |
| ) |
| |
| // tests |
| testCompile( |
| [group: 'junit', name: 'junit', version: '4.11'], |
| [group: "org.ow2.asm", name: "asm", version: "5.0.4"], |
| [group: "cglib", name: "cglib", version: "2.2"], |
| [group: "com.novocode", name: "junit-interface", version: "0.11"], |
| [group: "emma", name: "emma", version: "2.0.5312"], |
| [group: "emma", name: "emma_ant", version: "2.1.5320"], |
| [group: "org.hamcrest", name: "hamcrest-all", version: "1.3"], |
| [group: "org.jmock", name: "jmock-junit3", version: "2.6.0"], |
| [group: "org.jmock", name: "jmock", version: "2.6.0"], |
| [group: "org.mockito", name: "mockito-all", version: "1.9.5"] |
| ) |
| } |
| |
| /* Source Sets */ |
| sourceSets { |
| main { |
| java { |
| srcDirs = [ |
| 'src/main/java', |
| 'src/generated/gxp', |
| 'src/generated/messages' |
| ] |
| } |
| resources { |
| srcDir 'src/main/resources' |
| } |
| } |
| |
| test { |
| java { |
| srcDir 'src/test/java' |
| } |
| resources { |
| srcDir 'src/test/resources' |
| } |
| } |
| } |
| |
| task generateMessages { |
| description = 'Generates source files from Antlr String types and protobuf' |
| FileTree inputFiles = fileTree(dir: '../wave-proto/build/classes/main/', include: '**/*.class') |
| inputs.property "files", inputFiles |
| File outputDir = file("src/generated/messages") |
| outputs.dir outputDir |
| doLast { |
| List<String> proto_classes = [ |
| "../wave-proto/build/classes/main/org/waveprotocol/box/common/comms/WaveClientRpc.class", |
| "../wave-proto/build/classes/main/org/waveprotocol/box/search/SearchProto.class", |
| "../wave-proto/build/classes/main/org/waveprotocol/box/profile/ProfilesProto.class", |
| "../wave-proto/build/classes/main/org/waveprotocol/box/server/rpc/Rpc.class", |
| "../wave-proto/build/classes/main/org/waveprotocol/box/attachment/AttachmentProto.class", |
| "../wave-proto/build/classes/main/org/waveprotocol/wave/federation/Proto.class", |
| "../wave-proto/build/classes/main/org/waveprotocol/wave/concurrencycontrol/ClientServer.class", |
| "../wave-proto/build/classes/main/org/waveprotocol/wave/diff/Diff.class" |
| ] |
| List<String> templates = [ |
| "src/main/java/org/waveprotocol/pst/templates/api/api.st", |
| "src/main/java/org/waveprotocol/pst/templates/builder/builder.st", |
| "src/main/java/org/waveprotocol/pst/templates/pojo/pojo.st", |
| "src/main/java/org/waveprotocol/pst/templates/jso/jso.st", |
| "src/main/java/org/waveprotocol/pst/templates/util/util.st", |
| "src/main/java/org/waveprotocol/pst/templates/gson/gson.st", |
| "src/main/java/org/waveprotocol/pst/templates/proto/proto.st" |
| ] |
| proto_classes.each { proto -> |
| javaexec { |
| main = "org.waveprotocol.pst.PstMain" |
| classpath += configurations.compile |
| args = [ |
| '-s', |
| 'pst', |
| '-d', |
| 'src/generated/messages', |
| '-f', |
| proto |
| ] |
| args += templates |
| } |
| } |
| } |
| } |
| |
| task generateGXP { |
| description = 'Generate source files from GXP prototypes' |
| FileTree inputFiles = fileTree(dir: 'src/main/gxp', include: '**/*.gxp') |
| inputs.property "files", inputFiles |
| File outputDir = file("src/generated/gxp") |
| outputs.dir outputDir |
| doLast { |
| javaexec { |
| main = "com.google.gxp.compiler.cli.Gxpc" |
| classpath += configurations.generateGXP |
| args = [ |
| "--dir", |
| "src/generated/gxp", |
| "--source", |
| "src/main/gxp", |
| "--output_language", |
| "java" |
| ] |
| args += fileTree(dir: 'src/main/gxp', include: '**/*.gxp').getFiles() |
| } |
| } |
| } |
| |
| task compileGwt { |
| description = 'Compiles the GWT sources for production' |
| doLast { |
| javaexec { |
| main = "com.google.gwt.dev.Compiler" |
| classpath { |
| [ |
| sourceSets.main.java.srcDirs, |
| sourceSets.main.compileClasspath, |
| sourceSets.main.resources.srcDirs, |
| configurations.gwt |
| ] |
| } |
| jvmArgs = [ |
| "-Xmx1024M" |
| ] |
| args = [ |
| "-style", "OBFUSCATED", |
| "-XdisableClassMetadata", |
| "-XdisableCastChecking", |
| "-localWorkers", "4", |
| "org.waveprotocol.box.webclient.WebClientProd" |
| ] |
| } |
| } |
| } |
| |
| compileGwt.mustRunAfter compileJava |
| run.dependsOn compileGwt |
| |
| task compileGwtDemo { |
| description = 'Compiles the GWT sources for Demo' |
| doLast { |
| javaexec { |
| main = "com.google.gwt.dev.Compiler" |
| classpath { |
| [ |
| sourceSets.main.java.srcDirs, |
| sourceSets.main.compileClasspath, |
| configurations.gwt |
| ] |
| } |
| args = [ |
| "-style", "Pretty", |
| "-ea", |
| "org.waveprotocol.box.webclient.WebClientDemo" |
| ] |
| } |
| } |
| } |
| |
| task compileGwtDev { |
| description = 'Compiles the GWT sources for Development' |
| doLast { |
| javaexec { |
| main = "com.google.gwt.dev.Compiler" |
| classpath { |
| [ |
| sourceSets.main.java.srcDirs, |
| sourceSets.main.compileClasspath, |
| configurations.gwt |
| ] |
| } |
| args = [ |
| "-style", "PRETTY", |
| "-draftCompile", |
| "-ea", |
| "org.waveprotocol.box.webclient.WebClientDev" |
| ] |
| } |
| } |
| } |
| |
| task extractApi(type: Copy) { |
| from (configurations.compile.collect { zipTree(it) }) { |
| //Note: readonly files which get overwritten crash windows. |
| exclude "LICENSE" |
| } into "$buildDir/api" |
| } |
| |
| extractApi.mustRunAfter compileJava |
| |
| compileJava.dependsOn = [generateMessages, generateGXP] |
| |
| /* Gwt Dev Tasks */ |
| |
| task gwtDev { |
| description = 'Runs the hosted mode server, for debugging the Gwt client ' + |
| 'in a JVM.' |
| doLast { |
| javaexec { |
| main = "com.google.gwt.dev.DevMode" |
| classpath { |
| [ |
| sourceSets.main.java.srcDirs, |
| sourceSets.main.compileClasspath, |
| sourceSets.main.resources.srcDirs, |
| configurations.gwt, |
| ] |
| } |
| args = [ |
| "-noserver", |
| "-bindAddress", "127.0.0.1", |
| "-startupUrl", "http://localhost:9898", |
| "-logLevel", "DEBUG", |
| "org.waveprotocol.box.webclient.WebClientDev", |
| ] |
| } |
| } |
| } |
| |
| /* Test Tasks */ |
| |
| test { |
| include "**/*Test*" |
| exclude "**/*GwtTest*" |
| exclude "**/server/persistence/mongodb/**/*Test*" |
| exclude "**/*LargeTest*" |
| |
| minHeapSize = "512m" |
| maxHeapSize = "1024m" |
| |
| doFirst { |
| println '' |
| println '---------------------' |
| println ' Running unit tests. ' |
| println '---------------------' |
| println '' |
| } |
| } |
| |
| /* TODO(wisebaldone) not working due to gwt conflict talked about above, cant |
| have everything on classpath because 2 jetty versions. */ |
| task testGwt(type: Test) { |
| include "**/*GwtTest*" |
| |
| minHeapSize = "512m" |
| maxHeapSize = "1024m" |
| forkEvery = 1 |
| |
| doFirst { |
| println '' |
| println '--------------------' |
| println ' Running Gwt tests. ' |
| println '--------------------' |
| println '' |
| } |
| } |
| |
| testGwt.dependsOn compileGwt |
| |
| task testMongo(type: Test) { |
| include "**/server/persistence/mongodb/**/*Test*" |
| |
| doFirst { |
| println '' |
| println '--------------------------' |
| println ' Testing MongoDB backend. ' |
| println '--------------------------' |
| println '' |
| } |
| } |
| |
| testMongo.dependsOn compileJava |
| |
| task testLarge(type: Test) { |
| include "**/*LargeTest*" |
| |
| doFirst { |
| println '' |
| println '-------------------------------' |
| println ' Testing Large Tests. ' |
| println 'These tests may take some time.' |
| println '-------------------------------' |
| println '' |
| } |
| } |
| |
| testLarge.dependsOn compileJava |
| |
| task testAll() { |
| doFirst { |
| println '' |
| println '--------------------------' |
| println ' Tests completed. ' |
| println '--------------------------' |
| println '' |
| } |
| } |
| |
| testAll.dependsOn compileJava, compileGwt |
| testAll.dependsOn test, testMongo, testLarge, testGwt |
| |
| testGwt.mustRunAfter compileGwt, testLarge |
| testMongo.mustRunAfter compileJava, test |
| testLarge.mustRunAfter test |
| |
| ant.importBuild 'config/server-config.xml' |
| |
| |
| jar { |
| manifest { |
| attributes "Specification-Vendor": vendor, |
| "Specification-Title": title, |
| "Specification-Version": version, |
| "Implementation-Vendor": vendor, |
| "Implementation-Title": title, |
| "Implementation-Version": version, |
| "Built-By": "No one in particular", |
| "Main-Class": mainClassName |
| } |
| from "$buildDir/api" |
| include "META-INF/services/*" |
| include "com/mongodb/**/*" |
| include "org/slf4j/**/*" |
| include "org/atmosphere/**/*" |
| include "com/google/common/**/*" |
| include "com/google/gson/**/*" |
| include "com/google/gxp/**/*" |
| include "com/google/gwt/core/server/**/*" |
| include "com/google/gwt/core/shared/**/*" |
| include "com/google/gwt/logging/**/*" |
| include "com/google/gwt/user/server/**/*" |
| include "com/google/gwt/user/client/rpc/**/*" |
| include "com/google/inject/**/*" |
| include "com/google/protobuf/**/*" |
| include "com/google/wave/**/*" |
| include "com/typesafe/**/*" |
| include "gnu/inet/**/*" |
| include "javax/inject/**/*" |
| include "javax/servlet/**/*" |
| include "javax/xml/**/*" |
| include "net/oauth/**/*" |
| include "org/aopalliance/**/*" |
| include "org/apache/commons/cli/**/*" |
| include "org/apache/commons/codec/**/*" |
| include "org/apache/commons/collections/**/*" |
| include "org/apache/commons/configuration/**/*" |
| include "org/apache/commons/fileupload/**/*" |
| include "org/apache/commons/httpclient/**/*" |
| include "org/apache/commons/lang/**/*" |
| include "org/apache/commons/logging/**/*" |
| include "org/apache/lucene/**/*" |
| include "org/apache/commons/io/**/*" |
| include "org/apache/xerces/**/*" |
| include "org/bson/**/*" |
| include "org/dom4j/**/*" |
| include "org/eclipse/**/*" |
| include "org/jdom/**/*" |
| include "org/jivesoftware/**/*" |
| include "org/joda/time/**/*" |
| include "org/json/**/*" |
| include "org/waveprotocol/**/*" |
| include "org/xmlpull/**/*" |
| include "org/xmpp/**/*" |
| include "cc/kune/initials/**/*" |
| exclude "org/waveprotocol/box/webclient/**/*" |
| exclude "org/waveprotocol/box/consoleclient/**/*" |
| exclude "org/waveprotocol/box/expimp/**/*" |
| exclude "org/waveprotocol/wave/client/*" |
| exclude "org/waveprotocol/wave/client/account/**/*" |
| exclude "org/waveprotocol/wave/client/autohide/**/*" |
| exclude "org/waveprotocol/wave/client/clipboard/**/*" |
| exclude "org/waveprotocol/wave/client/common/**/*" |
| exclude "org/waveprotocol/wave/client/concurrencycontrol/**/*" |
| exclude "org/waveprotocol/wave/client/debug/**/*" |
| exclude "org/waveprotocol/wave/client/doodad/**/*" |
| exclude "org/waveprotocol/wave/client/paging/**/*" |
| exclude "org/waveprotocol/wave/client/render/**/*" |
| exclude "org/waveprotocol/wave/client/scheduler/**/*" |
| exclude "org/waveprotocol/wave/client/scroll/**/*" |
| exclude "org/waveprotocol/wave/client/state/**/*" |
| exclude "org/waveprotocol/wave/client/testing/**/*" |
| exclude "org/waveprotocol/wave/client/uibuilder/**/*" |
| exclude "org/waveprotocol/wave/client/uibuilder/**/*" |
| exclude "org/waveprotocol/wave/client/util/**/*" |
| exclude "org/waveprotocol/wave/client/wave/**/*" |
| exclude "org/waveprotocol/wave/client/wavepanel/**/*" |
| exclude "org/waveprotocol/wave/client/widget/**/*" |
| exclude "com/google/api/client/**/*" |
| } |
| |
| jar.dependsOn compileJava, compileGwt, extractApi |
| |
| /* Distribution Tasks */ |
| |
| task createPropertiesFile(type: Copy) { |
| from 'src/main/configs' |
| include 'wave.conf' |
| into 'config' |
| expand([ |
| version: version |
| ]) |
| } |
| |
| task createDistZip(type: Zip) { |
| from(jar) { |
| into 'apache-wave/bin' |
| } |
| from('dist') { |
| into 'apache-wave' |
| } |
| from('config') { |
| into 'apache-wave/config' |
| } |
| from('war') { |
| into 'apache-wave/war' |
| } |
| } |
| |
| task createDistTar(type: Tar) { |
| from(jar) { |
| into 'apache-wave/bin' |
| } |
| from('dist') { |
| into 'apache-wave' |
| } |
| from('config') { |
| into 'apache-wave/config' |
| } |
| from('war') { |
| into 'apache-wave/war' |
| } |
| } |
| |
| createDistZip.dependsOn jar, createPropertiesFile |
| createDistTar.dependsOn jar, createPropertiesFile |
| |
| task createDist() { |
| doFirst { |
| println '' |
| println '----------------------------------------------' |
| println ' Creating Deployment ' |
| println 'Zip and Tar files available in wave/build/dist' |
| println '----------------------------------------------' |
| println '' |
| } |
| } |
| |
| createDist.dependsOn createDistZip, createDistTar |