├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── examples ├── LICENSE ├── README.md ├── build.gradle ├── compile-only │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── de │ │ └── richsource │ │ └── gradle │ │ └── plugins │ │ └── gwt │ │ └── example │ │ ├── Example.gwt.xml │ │ └── client │ │ └── ExampleEntryPoint.java ├── compile-to-maven-repo │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── de │ │ └── richsource │ │ └── gradle │ │ └── plugins │ │ └── gwt │ │ └── example │ │ ├── Example.gwt.xml │ │ └── client │ │ └── ExampleEntryPoint.java ├── custom-layout │ ├── .gitignore │ ├── build.gradle │ ├── src │ │ └── de │ │ │ └── richsource │ │ │ └── gradle │ │ │ └── plugins │ │ │ └── gwt │ │ │ └── example │ │ │ ├── Example.gwt.xml │ │ │ └── client │ │ │ └── ExampleEntryPoint.java │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── de │ │ └── richsource │ │ └── gradle │ │ └── plugins │ │ └── gwt │ │ └── example │ │ └── library │ │ ├── Library.gwt.xml │ │ └── client │ │ └── HelloWorldWidget.java ├── settings.gradle ├── simple-war │ ├── build.gradle │ └── src │ │ └── main │ │ ├── java │ │ └── de │ │ │ └── richsource │ │ │ └── gradle │ │ │ └── plugins │ │ │ └── gwt │ │ │ └── example │ │ │ ├── Example.gwt.xml │ │ │ └── client │ │ │ └── ExampleEntryPoint.java │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── super-dev-mode │ ├── build.gradle │ ├── etc │ │ ├── jetty-distribution-9.0.5.v20130815.zip │ │ └── superdevmode-launcher-legacy.jar │ └── src │ │ └── main │ │ ├── java │ │ └── de │ │ │ └── richsource │ │ │ └── gradle │ │ │ └── plugins │ │ │ └── gwt │ │ │ └── example │ │ │ ├── Example.gwt.xml │ │ │ ├── ExampleDev.gwt.xml │ │ │ └── client │ │ │ └── ExampleEntryPoint.java │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── testing │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── de │ │ │ └── richsource │ │ │ └── gradle │ │ │ └── plugins │ │ │ └── gwt │ │ │ └── example │ │ │ └── Test.gwt.xml │ │ └── test │ │ └── java │ │ └── de │ │ └── richsource │ │ └── gradle │ │ └── plugins │ │ └── gwt │ │ └── example │ │ └── client │ │ └── ExampleTests.java ├── war-using-compile-only │ ├── build.gradle │ └── src │ │ └── main │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html └── war-using-library │ ├── build.gradle │ └── src │ └── main │ ├── java │ └── de │ │ └── richsource │ │ └── gradle │ │ └── plugins │ │ └── gwt │ │ └── example │ │ ├── Example.gwt.xml │ │ └── client │ │ └── ExampleEntryPoint.java │ └── webapp │ ├── WEB-INF │ └── web.xml │ └── index.html ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── gwt-gradle-plugin ├── build.gradle └── src │ ├── main │ ├── java │ │ └── de │ │ │ └── richsource │ │ │ └── gradle │ │ │ └── plugins │ │ │ └── gwt │ │ │ ├── AbstractGwtActionTask.java │ │ │ ├── AbstractGwtCompile.java │ │ │ ├── AbstractGwtTask.java │ │ │ ├── ExplodedWar.java │ │ │ ├── GwtBasePlugin.java │ │ │ ├── GwtCheck.java │ │ │ ├── GwtCompile.java │ │ │ ├── GwtCompileOptions.java │ │ │ ├── GwtCompilerPlugin.java │ │ │ ├── GwtDev.java │ │ │ ├── GwtDevOptions.java │ │ │ ├── GwtDraftCompile.java │ │ │ ├── GwtEclipseOptions.java │ │ │ ├── GwtEclipsePlugin.java │ │ │ ├── GwtIdeaPlugin.java │ │ │ ├── GwtPlugin.java │ │ │ ├── GwtPluginExtension.java │ │ │ ├── GwtSuperDev.java │ │ │ ├── GwtSuperDevOptions.java │ │ │ ├── GwtTestExtension.java │ │ │ ├── GwtTestOptions.java │ │ │ ├── GwtTestOptionsBase.java │ │ │ ├── GwtWarPlugin.java │ │ │ ├── JsInteropMode.java │ │ │ ├── LogLevel.java │ │ │ ├── MethodNameDisplayMode.java │ │ │ ├── Namespace.java │ │ │ ├── Style.java │ │ │ ├── eclipse │ │ │ ├── GdtOptions.java │ │ │ ├── GenerateGdt.java │ │ │ └── internal │ │ │ │ └── GdtOptionsImpl.java │ │ │ └── internal │ │ │ ├── ActionClosure.java │ │ │ ├── GwtCompileOptionsImpl.java │ │ │ ├── GwtDevOptionsImpl.java │ │ │ └── GwtSuperDevOptionsImpl.java │ └── resources │ │ ├── META-INF │ │ └── gradle-plugins │ │ │ ├── gwt-base.properties │ │ │ ├── gwt-compiler.properties │ │ │ └── gwt.properties │ │ └── de │ │ └── richsource │ │ └── gradle │ │ └── plugins │ │ └── gwt │ │ └── eclipse │ │ └── defaultGdtPrefs.properties │ └── test │ └── java │ └── de │ └── richsource │ └── gradle │ └── plugins │ └── gwt │ └── GwtPluginTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | .classpath 3 | .project 4 | .gradle/ 5 | .settings/ 6 | build/ 7 | /repo/ 8 | war/ 9 | gwt-unitCache/ 10 | *.md.html 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013-${year} ${name} 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GWT Gradle Plugin 2 | 3 | This plugin makes it easy to build projects using [GWT](http://www.gwtproject.org/). It provides several tasks to support the development and configures several aspects of your project to work with GWT automatically. 4 | 5 | Among other things, the plugin provides these features: 6 | 7 | * Running the GWT compiler and automatic inclusion of the compiled stuff in your *.war file 8 | * Starting GWT Dev Mode 9 | * Support for Super Dev Mode (GWT 2.5+) 10 | * Configuration of different GWT modules for development and production 11 | * GWT specific configuration of Eclipse projects 12 | 13 | # Resources 14 | 15 | * [Version history](http://steffenschaefer.github.io/gwt-gradle-plugin/versions.html) 16 | * [Documentation][doc] 17 | * [JavaDocs][javadoc] 18 | 19 | # Examples 20 | 21 | Several example projects can be found in [/examples](examples). 22 | 23 | # Usage 24 | 25 | The following example shows the code to set up gwt-gradle-plugin for a GWT web application project using Maven/Gradle standard layout. 26 | 27 | buildscript { 28 | repositories { 29 | jcenter() 30 | // Alternatively use: 31 | // maven { 32 | // url 'http://dl.bintray.com/steffenschaefer/maven' 33 | // } 34 | } 35 | dependencies { 36 | classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6' 37 | } 38 | } 39 | 40 | apply plugin: 'war' 41 | apply plugin: 'gwt' 42 | 43 | gwt { 44 | gwtVersion='2.7.0' 45 | modules '' 46 | } 47 | 48 | This will configure your GWT web project to execute the GWT compiler and include the compiler output into your *.war file. The code shown above also configures all GWT core dependencies (gwt-dev, gwt-user, gwt-servlet, ...). 49 | 50 | To build the *.war file including your compiled GWT modules, simply call "gradle build". 51 | If you want to start the GWT development mode simply call "gradle gwtDev". 52 | 53 | To learn about different scenarios or more specific configuration needs, please refer to the [Documentation][doc] 54 | 55 | [doc]: http://steffenschaefer.github.io/gwt-gradle-plugin/doc/latest/ 56 | [javadoc]: http://steffenschaefer.github.io/gwt-gradle-plugin/doc/latest/javadoc/ 57 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | task publish 2 | 3 | task wrapper(type: Wrapper) { 4 | gradleVersion = '2.0' 5 | distributionUrl = 'https://services.gradle.org/distributions/gradle-2.0-all.zip' 6 | } 7 | 8 | ext { 9 | encoding = 'UTF-8' 10 | } 11 | 12 | allprojects { 13 | apply plugin: 'eclipse' 14 | tasks.eclipse << { 15 | File prefs = project.file('.settings/org.eclipse.core.resources.prefs'); 16 | if(!prefs.exists()) { 17 | prefs.parentFile.mkdirs() 18 | project.file('.settings/org.eclipse.core.resources.prefs')<< "eclipse.preferences.version=1\nencoding/=$encoding\n"; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /examples/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013-${year} ${name} 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Example project for the GWT Gradle Plugin 2 | 3 | This directory contains several example projects to demonstrate various aspects of the gwt-gradle-plugin. 4 | 5 | To be able to build these projects, you need to run "gradle publish" in the root directory of this git repository. This will build the plugin to a local Maven repository (which is referenced by the example projects). 6 | 7 | The following example projects are currently available: 8 | 9 | * simple-war: This example shows how to configure a simple GWT web application project. 10 | * library: The library example shows how to configure a library project that is not set up as web application project. This example uses the dependency management and basic eclipse setup. 11 | * war-using-library: This example shows how to configure a web application project that references the library project. 12 | * super-dev-mode: This example is set up with support of Super Dev Mode. To test this, run "gradle jettyDraftWar" in one shell and "gradle gwtSuperDev" in another shell. 13 | * testing: This shows the minimum setup to run GWTTestCases using the gradle "test" task. 14 | -------------------------------------------------------------------------------- /examples/build.gradle: -------------------------------------------------------------------------------- 1 | task licenseFormat 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0' 10 | } 11 | } 12 | 13 | subprojects { 14 | apply plugin: 'java' 15 | 16 | buildscript { 17 | repositories { 18 | maven { 19 | url new File(rootProject.projectDir.parentFile, 'repo').toURI() 20 | } 21 | mavenCentral() 22 | } 23 | dependencies { 24 | classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.7-SNAPSHOT' 25 | } 26 | } 27 | 28 | apply plugin: 'license' 29 | 30 | sourceCompatibility = 1.7 31 | targetCompatibility = 1.7 32 | 33 | license { 34 | ext.year = Calendar.getInstance().get(Calendar.YEAR) 35 | ext.name = 'Steffen Schaefer' 36 | header rootProject.file('LICENSE') 37 | } 38 | 39 | afterEvaluate { 40 | rootProject.tasks.licenseFormat.dependsOn project.tasks.licenseFormatMain 41 | rootProject.tasks.licenseFormat.dependsOn project.tasks.licenseFormatTest 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /examples/compile-only/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'gwt-compiler' 2 | apply plugin: 'eclipse' 3 | 4 | repositories { mavenCentral() } 5 | 6 | gwt { 7 | gwtVersion='2.7.0' 8 | 9 | modules 'de.richsource.gradle.plugins.gwt.example.Example' 10 | 11 | compiler { 12 | strict = true; 13 | enableClosureCompiler = true; 14 | disableClassMetadata = true; 15 | disableCastChecking = true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/compile-only/src/main/java/de/richsource/gradle/plugins/gwt/example/Example.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 25 | -------------------------------------------------------------------------------- /examples/compile-only/src/main/java/de/richsource/gradle/plugins/gwt/example/client/ExampleEntryPoint.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt.example.client; 17 | 18 | import com.google.gwt.core.client.EntryPoint; 19 | import com.google.gwt.user.client.ui.Label; 20 | import com.google.gwt.user.client.ui.RootPanel; 21 | 22 | public class ExampleEntryPoint implements EntryPoint { 23 | 24 | @Override 25 | public void onModuleLoad() { 26 | RootPanel.get().add(new Label("Hello GWT World!")); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /examples/compile-to-maven-repo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'gwt-compiler' 2 | apply plugin: 'eclipse' 3 | apply plugin: 'maven-publish' 4 | 5 | repositories { mavenCentral() } 6 | 7 | gwt { 8 | gwtVersion='2.7.0' 9 | modules 'de.richsource.gradle.plugins.gwt.example.Example' 10 | } 11 | 12 | task gwtZip(type: Zip) { 13 | from tasks.compileGwt.outputs 14 | } 15 | 16 | group='de.richsource.example' 17 | version='1.3.37' 18 | publishing { 19 | publications { 20 | mavenJava(MavenPublication) { 21 | artifact gwtZip { 22 | extension = 'zip' 23 | classifier = 'gwt' 24 | } 25 | } 26 | } 27 | repositories { 28 | maven { 29 | url project.file('repo').toURI() 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/compile-to-maven-repo/src/main/java/de/richsource/gradle/plugins/gwt/example/Example.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 25 | -------------------------------------------------------------------------------- /examples/compile-to-maven-repo/src/main/java/de/richsource/gradle/plugins/gwt/example/client/ExampleEntryPoint.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt.example.client; 17 | 18 | import com.google.gwt.core.client.EntryPoint; 19 | import com.google.gwt.user.client.ui.Label; 20 | import com.google.gwt.user.client.ui.RootPanel; 21 | 22 | public class ExampleEntryPoint implements EntryPoint { 23 | 24 | @Override 25 | public void onModuleLoad() { 26 | RootPanel.get().add(new Label("Hello GWT World!")); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /examples/custom-layout/.gitignore: -------------------------------------------------------------------------------- 1 | /devWar/ 2 | -------------------------------------------------------------------------------- /examples/custom-layout/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'war' 2 | apply plugin: 'gwt' 3 | apply plugin: 'eclipse' 4 | 5 | repositories { mavenCentral() } 6 | 7 | sourceSets { 8 | main { 9 | java { 10 | srcDir 'src' 11 | } 12 | } 13 | } 14 | 15 | war{ 16 | webAppDirName = file('webapp') 17 | } 18 | 19 | gwt { 20 | gwtVersion='2.7.0' 21 | 22 | modules 'de.richsource.gradle.plugins.gwt.example.Example' 23 | 24 | devWar = file('devWar') 25 | } 26 | -------------------------------------------------------------------------------- /examples/custom-layout/src/de/richsource/gradle/plugins/gwt/example/Example.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 25 | -------------------------------------------------------------------------------- /examples/custom-layout/src/de/richsource/gradle/plugins/gwt/example/client/ExampleEntryPoint.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt.example.client; 17 | 18 | import com.google.gwt.core.client.EntryPoint; 19 | import com.google.gwt.user.client.ui.Label; 20 | import com.google.gwt.user.client.ui.RootPanel; 21 | 22 | public class ExampleEntryPoint implements EntryPoint { 23 | 24 | @Override 25 | public void onModuleLoad() { 26 | RootPanel.get().add(new Label("Hello GWT World!")); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /examples/custom-layout/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | index.html 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/custom-layout/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steffenschaefer/gwt-gradle-plugin/087a94377fbd83cab938ffffe51ce8fab871be35/examples/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /examples/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Jan 05 16:31:49 CET 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip 7 | -------------------------------------------------------------------------------- /examples/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /examples/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /examples/library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | apply plugin: 'gwt-base' 3 | apply plugin: 'eclipse' 4 | 5 | repositories { mavenCentral() } 6 | 7 | gwt { 8 | gwtVersion='2.7.0' 9 | } 10 | -------------------------------------------------------------------------------- /examples/library/src/main/java/de/richsource/gradle/plugins/gwt/example/library/Library.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /examples/library/src/main/java/de/richsource/gradle/plugins/gwt/example/library/client/HelloWorldWidget.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt.example.library.client; 17 | 18 | import com.google.gwt.dom.client.Document; 19 | import com.google.gwt.user.client.ui.Widget; 20 | 21 | public class HelloWorldWidget extends Widget { 22 | 23 | public HelloWorldWidget() { 24 | setElement(Document.get().createDivElement()); 25 | getElement().setInnerText("Hello GWT World!"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/settings.gradle: -------------------------------------------------------------------------------- 1 | include 'simple-war' 2 | include 'library' 3 | include 'war-using-library' 4 | include 'super-dev-mode' 5 | include 'testing' 6 | include 'compile-only' 7 | include 'war-using-compile-only' 8 | include 'compile-to-maven-repo' 9 | include 'custom-layout' 10 | 11 | rootProject.children.each {project -> 12 | project.name = "example-${project.name}" 13 | } 14 | -------------------------------------------------------------------------------- /examples/simple-war/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'war' 2 | apply plugin: 'gwt' 3 | apply plugin: 'eclipse' 4 | 5 | repositories { mavenCentral() } 6 | 7 | gwt { 8 | gwtVersion='2.7.0' 9 | 10 | modules 'de.richsource.gradle.plugins.gwt.example.Example' 11 | 12 | compiler { 13 | strict = true; 14 | enableClosureCompiler = true; 15 | disableClassMetadata = true; 16 | disableCastChecking = true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/simple-war/src/main/java/de/richsource/gradle/plugins/gwt/example/Example.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 25 | -------------------------------------------------------------------------------- /examples/simple-war/src/main/java/de/richsource/gradle/plugins/gwt/example/client/ExampleEntryPoint.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt.example.client; 17 | 18 | import com.google.gwt.core.client.EntryPoint; 19 | import com.google.gwt.user.client.ui.Label; 20 | import com.google.gwt.user.client.ui.RootPanel; 21 | 22 | public class ExampleEntryPoint implements EntryPoint { 23 | 24 | @Override 25 | public void onModuleLoad() { 26 | RootPanel.get().add(new Label("Hello GWT World!")); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /examples/simple-war/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | index.html 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/simple-war/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/super-dev-mode/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'war' 2 | apply plugin: 'cargo' 3 | apply plugin: 'jetty' 4 | apply plugin: 'gwt' 5 | apply plugin: 'eclipse' 6 | 7 | buildscript { 8 | repositories { 9 | mavenCentral() 10 | } 11 | 12 | dependencies { 13 | classpath 'org.gradle.api.plugins:gradle-cargo-plugin:0.6.1' 14 | } 15 | } 16 | 17 | repositories { mavenCentral() } 18 | 19 | dependencies { 20 | def cargoVersion = '1.4.4' 21 | cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion", 22 | "org.codehaus.cargo:cargo-ant:$cargoVersion" 23 | 24 | // Needed for Legacy SuperDevMode 25 | // gwt files('etc/superdevmode-launcher-legacy.jar') 26 | } 27 | 28 | gwt { 29 | gwtVersion='2.7.0' 30 | 31 | modules 'de.richsource.gradle.plugins.gwt.example.Example' 32 | devModules 'de.richsource.gradle.plugins.gwt.example.ExampleDev' 33 | 34 | maxHeapSize = "1024M" 35 | 36 | superDev { 37 | noPrecompile=true 38 | } 39 | } 40 | 41 | // Needed for Legacy SuperDevMode 42 | //gwtDev { 43 | // args '-superDevMode' 44 | //} 45 | 46 | cargo { 47 | containerId = 'jetty9x' 48 | port = 8080 49 | 50 | deployable { 51 | file = tasks.draftWar.archivePath 52 | context = 'app' 53 | } 54 | 55 | local { 56 | installer { 57 | installUrl = file("$projectDir/etc/jetty-distribution-9.0.5.v20130815.zip").toURI() 58 | downloadDir = file("$buildDir/download") 59 | extractDir = file("$buildDir/extract") 60 | } 61 | } 62 | } 63 | 64 | task jettyDraftWar(type: JettyRunWar) { 65 | dependsOn draftWar 66 | dependsOn.remove('war') 67 | webApp=draftWar.archivePath 68 | } 69 | 70 | afterEvaluate { 71 | tasks.cargoStartLocal.dependsOn(tasks.draftWar) 72 | tasks.cargoRunLocal.dependsOn(tasks.draftWar) 73 | } 74 | -------------------------------------------------------------------------------- /examples/super-dev-mode/etc/jetty-distribution-9.0.5.v20130815.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steffenschaefer/gwt-gradle-plugin/087a94377fbd83cab938ffffe51ce8fab871be35/examples/super-dev-mode/etc/jetty-distribution-9.0.5.v20130815.zip -------------------------------------------------------------------------------- /examples/super-dev-mode/etc/superdevmode-launcher-legacy.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steffenschaefer/gwt-gradle-plugin/087a94377fbd83cab938ffffe51ce8fab871be35/examples/super-dev-mode/etc/superdevmode-launcher-legacy.jar -------------------------------------------------------------------------------- /examples/super-dev-mode/src/main/java/de/richsource/gradle/plugins/gwt/example/Example.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 25 | -------------------------------------------------------------------------------- /examples/super-dev-mode/src/main/java/de/richsource/gradle/plugins/gwt/example/ExampleDev.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 27 | -------------------------------------------------------------------------------- /examples/super-dev-mode/src/main/java/de/richsource/gradle/plugins/gwt/example/client/ExampleEntryPoint.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt.example.client; 17 | 18 | import com.google.gwt.core.client.EntryPoint; 19 | import com.google.gwt.user.client.ui.Label; 20 | import com.google.gwt.user.client.ui.RootPanel; 21 | 22 | public class ExampleEntryPoint implements EntryPoint { 23 | 24 | @Override 25 | public void onModuleLoad() { 26 | RootPanel.get().add(new Label("Hello GWT World!")); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /examples/super-dev-mode/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | index.html 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/super-dev-mode/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/testing/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | apply plugin: 'gwt' 3 | apply plugin: 'eclipse' 4 | 5 | sourceCompatibility = '1.6' 6 | targetCompatibility = '1.6' 7 | 8 | repositories { mavenCentral() } 9 | 10 | dependencies { 11 | testCompile group: 'junit', name: 'junit', version: '[4.11,5.0[' 12 | } 13 | 14 | gwt { 15 | gwtVersion='2.7.0' 16 | } 17 | -------------------------------------------------------------------------------- /examples/testing/src/main/java/de/richsource/gradle/plugins/gwt/example/Test.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/testing/src/test/java/de/richsource/gradle/plugins/gwt/example/client/ExampleTests.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt.example.client; 17 | 18 | import com.google.gwt.dom.client.Document; 19 | import com.google.gwt.junit.client.GWTTestCase; 20 | 21 | 22 | public class ExampleTests extends GWTTestCase { 23 | 24 | @Override 25 | public String getModuleName() { 26 | return "de.richsource.gradle.plugins.gwt.example.Test"; 27 | } 28 | 29 | public void testSomething() { 30 | assertNotNull(Document.get().getBody()); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /examples/war-using-compile-only/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'war' 2 | apply plugin: 'eclipse' 3 | apply plugin: 'jetty' 4 | 5 | repositories { mavenCentral() } 6 | 7 | war { 8 | from project(':example-compile-only').tasks.compileGwt.outputs 9 | } 10 | -------------------------------------------------------------------------------- /examples/war-using-compile-only/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | index.html 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/war-using-compile-only/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/war-using-library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'war' 2 | apply plugin: 'gwt' 3 | apply plugin: 'eclipse' 4 | 5 | repositories { mavenCentral() } 6 | 7 | dependencies { 8 | compile project(':example-library') 9 | } 10 | 11 | gwt { 12 | gwtVersion='2.7.0' 13 | 14 | modules 'de.richsource.gradle.plugins.gwt.example.Example' 15 | 16 | src += files(project(':example-library').sourceSets.main.allJava.srcDirs) + files(project(':example-library').sourceSets.main.output.resourcesDir) 17 | } 18 | -------------------------------------------------------------------------------- /examples/war-using-library/src/main/java/de/richsource/gradle/plugins/gwt/example/Example.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 25 | -------------------------------------------------------------------------------- /examples/war-using-library/src/main/java/de/richsource/gradle/plugins/gwt/example/client/ExampleEntryPoint.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt.example.client; 17 | 18 | import com.google.gwt.core.client.EntryPoint; 19 | import com.google.gwt.user.client.ui.RootPanel; 20 | 21 | import de.richsource.gradle.plugins.gwt.example.library.client.HelloWorldWidget; 22 | 23 | public class ExampleEntryPoint implements EntryPoint { 24 | 25 | @Override 26 | public void onModuleLoad() { 27 | RootPanel.get().add(new HelloWorldWidget()); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /examples/war-using-library/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | index.html 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/war-using-library/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steffenschaefer/gwt-gradle-plugin/087a94377fbd83cab938ffffe51ce8fab871be35/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Aug 15 11:22:12 CEST 2014 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /gwt-gradle-plugin/build.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.plugins.ide.eclipse.model.* 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0' 10 | classpath 'me.tatarka:gradle-retrolambda:3.2.4' 11 | } 12 | } 13 | 14 | apply plugin: 'java' 15 | apply plugin: 'maven-publish' 16 | apply plugin: 'license' 17 | apply plugin: 'me.tatarka.retrolambda' 18 | 19 | sourceCompatibility = 1.8 20 | targetCompatibility = 1.8 21 | 22 | license { 23 | ext.year = Calendar.getInstance().get(Calendar.YEAR) 24 | ext.name = 'Steffen Schaefer' 25 | header rootProject.file('LICENSE') 26 | } 27 | 28 | repositories { mavenCentral() } 29 | 30 | dependencies { 31 | compile gradleApi() 32 | testCompile group: 'junit', name: 'junit', version: '4.11' 33 | retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:2.1.0' 34 | } 35 | 36 | retrolambda { 37 | javaVersion JavaVersion.VERSION_1_6 38 | if(System.getProperty("os.name").toLowerCase().contains('mac')) { 39 | if(jdk == null) { 40 | jdk = '/usr/libexec/java_home -v 1.8'.execute().text 41 | } 42 | if(oldJdk == null) { 43 | oldJdk = '/usr/libexec/java_home -v 1.6'.execute().text 44 | } 45 | } 46 | } 47 | 48 | tasks.withType(JavaCompile) { 49 | options.encoding = rootProject.encoding 50 | } 51 | 52 | task sourceJar(type: Jar) { 53 | from sourceSets.main.allJava 54 | } 55 | 56 | task javadocJar (type: Jar, dependsOn: javadoc) { 57 | from javadoc.destinationDir 58 | } 59 | 60 | javadoc { 61 | options { 62 | links 'http://www.gradle.org/docs/current/javadoc/', 'http://docs.oracle.com/javase/6/docs/api/' 63 | } 64 | } 65 | 66 | group='de.richsource.gradle.plugins' 67 | version='0.7-SNAPSHOT' 68 | publishing { 69 | publications { 70 | mavenJava(MavenPublication) { 71 | from components.java 72 | artifact javadocJar { classifier = 'javadoc' } 73 | artifact sourceJar { classifier = 'sources' } 74 | pom.withXml { 75 | def root = asNode() 76 | root.appendNode('packaging', 'jar') 77 | root.appendNode('name', 'Gradle GWT plugin') 78 | root.appendNode('description', 'Gradle plugin to support GWT related tasks.') 79 | root.appendNode('inceptionYear', '2013') 80 | root.appendNode('url', 'https://github.com/steffenschaefer/gwt-gradle-plugin') 81 | def license = root.appendNode('licenses').appendNode('license') 82 | license.appendNode('name', 'Apache License, Version 2.0') 83 | license.appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt') 84 | license.appendNode('distribution', 'repo') 85 | def scm = root.appendNode('scm') 86 | scm.appendNode('url', 'https://github.com/steffenschaefer/gwt-gradle-plugin') 87 | scm.appendNode('connection', 'scm:git:https://github.com/steffenschaefer/gwt-gradle-plugin.git') 88 | } 89 | } 90 | } 91 | repositories { 92 | maven { 93 | url new File(rootProject.projectDir, 'repo').toURI() 94 | } 95 | } 96 | } 97 | 98 | rootProject.tasks.publish.dependsOn project.tasks.publish 99 | 100 | eclipse { 101 | classpath { 102 | file { 103 | whenMerged {Classpath cp -> 104 | String gradleHome = gradle.getGradleHomeDir().absolutePath.replace(File.separator, '/') 105 | String gradleSrc = "${gradleHome}/src" 106 | cp.entries.each {ClasspathEntry entry -> 107 | if ((entry in AbstractLibrary) && (entry.library.file.name.startsWith('gradle-'))) { 108 | entry.sourcePath = new org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory().fromPath(gradleSrc) 109 | } 110 | } 111 | } 112 | } 113 | } 114 | } -------------------------------------------------------------------------------- /gwt-gradle-plugin/src/main/java/de/richsource/gradle/plugins/gwt/AbstractGwtActionTask.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt; 17 | 18 | import java.io.File; 19 | import java.util.ArrayList; 20 | import java.util.Arrays; 21 | import java.util.List; 22 | 23 | import org.gradle.api.Action; 24 | import org.gradle.api.DefaultTask; 25 | import org.gradle.api.InvalidUserDataException; 26 | import org.gradle.api.file.FileCollection; 27 | import org.gradle.api.tasks.Input; 28 | import org.gradle.api.tasks.InputFiles; 29 | import org.gradle.api.tasks.TaskAction; 30 | import org.gradle.process.ExecResult; 31 | import org.gradle.process.JavaExecSpec; 32 | 33 | /** 34 | * Base class for all GWT related tasks. 35 | */ 36 | public abstract class AbstractGwtActionTask extends DefaultTask { 37 | 38 | private List modules; 39 | 40 | private FileCollection src; 41 | 42 | private FileCollection classpath; 43 | 44 | private String minHeapSize; 45 | 46 | private String maxHeapSize; 47 | 48 | private final String main; 49 | 50 | private List args = new ArrayList(); 51 | 52 | private List jvmArgs = new ArrayList(); 53 | 54 | private boolean debug; 55 | 56 | private LogLevel logLevel; 57 | 58 | private String sourceLevel; 59 | 60 | private Boolean incremental; 61 | 62 | private JsInteropMode jsInteropMode; 63 | // -[no]generateJsInteropExports 64 | private Boolean generateJsInteropExports; 65 | private MethodNameDisplayMode methodNameDisplayMode; 66 | 67 | public AbstractGwtActionTask(String main) { 68 | this.main = main; 69 | } 70 | 71 | @TaskAction 72 | public void exec() { 73 | final ExecResult execResult = getProject().javaexec(new Action() { 74 | @Override 75 | public void execute(JavaExecSpec javaExecSpec) { 76 | if (getSrc() == null) { 77 | throw new InvalidUserDataException("No Source is set"); 78 | } 79 | if (getClasspath() == null) { 80 | throw new InvalidUserDataException("Classpath is not set"); 81 | } 82 | if (getModules() == null || getModules().isEmpty()) { 83 | throw new InvalidUserDataException("No module[s] given"); 84 | } 85 | 86 | javaExecSpec.setMain(main); 87 | javaExecSpec.setDebug(isDebug()); 88 | 89 | // "Fixes" convention mapping 90 | javaExecSpec.setMinHeapSize(getMinHeapSize()); 91 | javaExecSpec.setMaxHeapSize(getMaxHeapSize()); 92 | 93 | FileCollection classpath = getClasspath(); 94 | if (prependSrcToClasspath()) { 95 | classpath = getSrc().plus(classpath); 96 | } 97 | 98 | if (System.getProperty("os.name").toLowerCase().contains("windows")) { 99 | javaExecSpec.environment("CLASSPATH", classpath.getAsPath()); 100 | } else { 101 | javaExecSpec.setClasspath(classpath); 102 | } 103 | 104 | argIfSet("-XjsInteropMode", getJsInteropMode()); 105 | argOnOff(getGenerateJsInteropExports(), "-generateJsInteropExports", "-nogenerateJsInteropExports"); 106 | argIfSet("-XmethodNameDisplayMode", getMethodNameDisplayMode()); 107 | argOnOff(getIncremental(), "-incremental", "-noincremental"); 108 | argIfSet("-sourceLevel", getSourceLevel()); 109 | argIfSet("-logLevel", getLogLevel()); 110 | 111 | addArgs(); 112 | javaExecSpec.jvmArgs(jvmArgs); 113 | javaExecSpec.args(args); 114 | // the module names are expected to be the last parameters 115 | javaExecSpec.args(getModules()); 116 | } 117 | }); 118 | execResult.assertNormalExitValue().rethrowFailure(); 119 | } 120 | 121 | /** 122 | * If true this causes that the src is prepended to the classpath. This is set to false for Super Dev Mode as the source is given to it as extra parameter. 123 | * 124 | * @return true if src should be prepended to the classpath, false otherwise. 125 | */ 126 | protected boolean prependSrcToClasspath() { 127 | return true; 128 | } 129 | 130 | @Input 131 | public List getModules() { 132 | return modules; 133 | } 134 | 135 | /** 136 | * Sets the GWT modules (fully qualified names) to be used by this task. 137 | * 138 | * @param modules 139 | * GWT modules to be set for this task 140 | */ 141 | public void setModules(List modules) { 142 | this.modules = modules; 143 | } 144 | 145 | protected void args(Object... args) { 146 | this.args.addAll(Arrays.asList(args)); 147 | } 148 | 149 | protected void jvmArgs(Object... args) { 150 | this.jvmArgs.addAll(Arrays.asList(args)); 151 | } 152 | 153 | protected void argIfEnabled(Boolean condition, String arg) { 154 | if (Boolean.TRUE.equals(condition)) { 155 | args(arg); 156 | } 157 | } 158 | 159 | protected void argOnOff(Boolean condition, String onArg, String offArg) { 160 | if (Boolean.TRUE.equals(condition)) { 161 | args(onArg); 162 | } else if (Boolean.FALSE.equals(condition)) { 163 | args(offArg); 164 | } 165 | } 166 | 167 | protected void dirArgIfSet(String arg, File dir) { 168 | if (dir != null) { 169 | dir.mkdirs(); 170 | args(arg, dir); 171 | } 172 | } 173 | 174 | protected void argIfSet(String arg, Object value) { 175 | if (value != null) { 176 | args(arg, value); 177 | } 178 | } 179 | 180 | /** 181 | * Called directly before executing this task. Subclasses are expected to 182 | * add all args/javaArgs needed for the execution. 183 | */ 184 | protected abstract void addArgs(); 185 | 186 | /** 187 | * If true the task instance is treated as being a development related task. Development related tasks will have the devModules set by default. 188 | * 189 | * @return true if the task is development related, false otherwise. 190 | */ 191 | protected boolean isDevTask() { 192 | return true; 193 | } 194 | 195 | @InputFiles 196 | public FileCollection getSrc() { 197 | return src; 198 | } 199 | 200 | /** 201 | * Sets the source directories used by this task instance. These source 202 | * directories are used by GWT to read java source files from. 203 | * 204 | * @param src 205 | * source directories to set 206 | */ 207 | public void setSrc(FileCollection src) { 208 | this.src = src; 209 | } 210 | 211 | @Input 212 | public FileCollection getClasspath() { 213 | return classpath; 214 | } 215 | 216 | /** 217 | * Sets the classpath for the spawned java process. 218 | * 219 | * @param classpath the classpath to set 220 | */ 221 | public void setClasspath(FileCollection classpath) { 222 | this.classpath = classpath; 223 | } 224 | 225 | public String getMinHeapSize() { 226 | return minHeapSize; 227 | } 228 | 229 | /** 230 | * Sets the minimum heap size for the spawned java process. 231 | * 232 | * @param minHeapSize the minimum heap size to set 233 | */ 234 | public void setMinHeapSize(String minHeapSize) { 235 | this.minHeapSize = minHeapSize; 236 | } 237 | 238 | public String getMaxHeapSize() { 239 | return maxHeapSize; 240 | } 241 | 242 | /** 243 | * Sets the maximum heap size for the spawned java process. 244 | * 245 | * @param maxHeapSize the maximum heap size to set 246 | */ 247 | public void setMaxHeapSize(String maxHeapSize) { 248 | this.maxHeapSize = maxHeapSize; 249 | } 250 | 251 | public boolean isDebug() { 252 | return debug; 253 | } 254 | 255 | /** 256 | * If set to true this enables debugging for the spawned java process. 257 | * 258 | * @param debug true to enable debugging, false otherwise. 259 | */ 260 | public void setDebug(boolean debug) { 261 | this.debug = debug; 262 | } 263 | 264 | public LogLevel getLogLevel() { 265 | return logLevel; 266 | } 267 | 268 | /** 269 | * Sets the {@link LogLevel} for this task. 270 | * 271 | * @param logLevel the log level to set 272 | */ 273 | public void setLogLevel(LogLevel logLevel) { 274 | this.logLevel = logLevel; 275 | } 276 | 277 | public String getSourceLevel() { 278 | return sourceLevel; 279 | } 280 | 281 | public void setSourceLevel(String sourceLevel) { 282 | this.sourceLevel = sourceLevel; 283 | } 284 | 285 | public Boolean getIncremental() { 286 | return incremental; 287 | } 288 | 289 | public void setIncremental(Boolean incremental) { 290 | this.incremental = incremental; 291 | } 292 | 293 | public JsInteropMode getJsInteropMode() { 294 | return jsInteropMode; 295 | } 296 | 297 | public void setJsInteropMode(JsInteropMode jsInteropMode) { 298 | this.jsInteropMode = jsInteropMode; 299 | } 300 | 301 | public Boolean getGenerateJsInteropExports() { 302 | return generateJsInteropExports; 303 | } 304 | 305 | /** 306 | * If set to true, this adds the parameter -generateJsInteropExports. 307 | * If set to false, this adds the parameter -nogenerateJsInteropExports. 308 | * Added in GWT 2.8. 309 | */ 310 | public void setGenerateJsInteropExports(Boolean generateJsInteropExports) { 311 | this.generateJsInteropExports = generateJsInteropExports; 312 | } 313 | 314 | public MethodNameDisplayMode getMethodNameDisplayMode() { 315 | return methodNameDisplayMode; 316 | } 317 | 318 | /** 319 | * If set, this causes the "-XmethodNameDisplayMode" (added in GWT 2.7/2.8) parameter to be added. 320 | * 321 | * @param methodNameDisplayMode 322 | */ 323 | public void setMethodNameDisplayMode(MethodNameDisplayMode methodNameDisplayMode) { 324 | this.methodNameDisplayMode = methodNameDisplayMode; 325 | } 326 | } 327 | -------------------------------------------------------------------------------- /gwt-gradle-plugin/src/main/java/de/richsource/gradle/plugins/gwt/AbstractGwtCompile.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt; 17 | 18 | import java.io.File; 19 | import java.util.concurrent.Callable; 20 | 21 | import org.gradle.api.internal.IConventionAware; 22 | import org.gradle.api.tasks.Input; 23 | import org.gradle.api.tasks.Optional; 24 | 25 | import de.richsource.gradle.plugins.gwt.internal.GwtCompileOptionsImpl; 26 | 27 | /** 28 | * Common implementation of tasks used for GWT compilation. 29 | */ 30 | public class AbstractGwtCompile extends AbstractGwtTask implements GwtCompileOptions { 31 | 32 | private final GwtCompileOptions options = new GwtCompileOptionsImpl(); 33 | 34 | public AbstractGwtCompile() { 35 | super("com.google.gwt.dev.Compiler"); 36 | } 37 | 38 | @Override 39 | protected void addArgs() { 40 | super.addArgs(); 41 | 42 | argIfSet("-localWorkers", getLocalWorkers()); 43 | argIfEnabled(getDraftCompile(), "-draftCompile"); 44 | argIfEnabled(getCompileReport(), "-compileReport"); 45 | argIfEnabled(getCompilerMetrics(), "-XcompilerMetrics"); 46 | 47 | argIfEnabled(getValidateOnly(), "-validateOnly"); 48 | argIfEnabled(getDisableGeneratingOnShards(), "-XdisableGeneratingOnShards"); 49 | 50 | argIfSet("-optimize", getOptimize()); 51 | argIfEnabled(getDisableAggressiveOptimization(), "-XdisableAggressiveOptimization"); 52 | argIfEnabled(getDisableClassMetadata(), "-XdisableClassMetadata"); 53 | argIfEnabled(getDisableCastChecking(), "-XdisableCastChecking"); 54 | argIfEnabled(getEa(), "-ea"); 55 | argIfEnabled(getDisableRunAsync(), "-XdisableRunAsync"); 56 | argIfSet("-style", getStyle()); 57 | argIfEnabled(getSoycDetailed(), "-XsoycDetailed"); 58 | argIfEnabled(getStrict(), "-strict"); 59 | argIfEnabled(getDisableSoycHtml(), "-XdisableSoycHtml"); 60 | argIfEnabled(getEnableClosureCompiler(), "-XenableClosureCompiler"); 61 | argIfSet("-XfragmentCount", getFragmentCount()); 62 | argIfSet("-missingDepsFile ", getMissingDepsFile()); 63 | argIfSet("-Xnamespace ", getNamespace()); 64 | argOnOff(getEnforceStrictResources(), "-XenforceStrictResources", "-XnoenforceStrictResources"); 65 | argOnOff(getIncrementalCompileWarnings(), "-incrementalCompileWarnings", "-noincrementalCompileWarnings"); 66 | argOnOff(getOverlappingSourceWarnings(), "-overlappingSourceWarnings", "-nooverlappingSourceWarnings"); 67 | argOnOff(getSaveSource(), "-saveSource", "-nosaveSource"); 68 | argIfSet("-saveSourceOutput", getSaveSourceOutput()); 69 | argOnOff(getClosureFormattedOutput(), "-XclosureFormattedOutput", "-XnoclosureFormattedOutput"); 70 | } 71 | 72 | protected void configure(final GwtCompileOptions options) { 73 | ((IConventionAware)this).getConventionMapping().map("localWorkers", new Callable() { 74 | @Override 75 | public Integer call() throws Exception { 76 | return options.getLocalWorkers(); 77 | } 78 | }); 79 | } 80 | 81 | /** {@inheritDoc} */ 82 | @Override 83 | public Integer getLocalWorkers() { 84 | return options.getLocalWorkers(); 85 | } 86 | 87 | /** {@inheritDoc} */ 88 | @Override 89 | public void setLocalWorkers(Integer localWorkers) { 90 | options.setLocalWorkers(localWorkers); 91 | } 92 | 93 | /** {@inheritDoc} */ 94 | @Override 95 | @Input 96 | @Optional 97 | public Boolean getDraftCompile() { 98 | return options.getDraftCompile(); 99 | } 100 | 101 | /** {@inheritDoc} */ 102 | @Override 103 | public void setDraftCompile(Boolean draftCompile) { 104 | options.setDraftCompile(draftCompile); 105 | } 106 | 107 | /** {@inheritDoc} */ 108 | @Override 109 | @Input 110 | @Optional 111 | public Boolean getCompileReport() { 112 | return options.getCompileReport(); 113 | } 114 | 115 | /** {@inheritDoc} */ 116 | @Override 117 | public void setCompileReport(Boolean compileReport) { 118 | options.setCompileReport(compileReport); 119 | } 120 | 121 | /** {@inheritDoc} */ 122 | @Override 123 | @Input 124 | @Optional 125 | public Boolean getCompilerMetrics() { 126 | return options.getCompilerMetrics(); 127 | } 128 | 129 | /** {@inheritDoc} */ 130 | @Override 131 | public void setCompilerMetrics(Boolean compilerMetrics) { 132 | options.setCompilerMetrics(compilerMetrics); 133 | } 134 | 135 | /** {@inheritDoc} */ 136 | @Override 137 | @Input 138 | @Optional 139 | public Boolean getValidateOnly() { 140 | return options.getValidateOnly(); 141 | } 142 | 143 | /** {@inheritDoc} */ 144 | @Override 145 | public void setValidateOnly(Boolean validateOnly) { 146 | options.setValidateOnly(validateOnly); 147 | } 148 | 149 | /** {@inheritDoc} */ 150 | @Override 151 | @Input 152 | @Optional 153 | public Boolean getDisableGeneratingOnShards() { 154 | return options.getDisableGeneratingOnShards(); 155 | } 156 | 157 | /** {@inheritDoc} */ 158 | @Override 159 | public void setDisableGeneratingOnShards(Boolean disableGeneratingOnShards) { 160 | options.setDisableGeneratingOnShards(disableGeneratingOnShards); 161 | } 162 | 163 | /** {@inheritDoc} */ 164 | @Override 165 | @Input 166 | @Optional 167 | public Integer getOptimize() { 168 | return options.getOptimize(); 169 | } 170 | 171 | /** {@inheritDoc} */ 172 | @Override 173 | public void setOptimize(Integer optimize) { 174 | options.setOptimize(optimize); 175 | } 176 | 177 | /** {@inheritDoc} */ 178 | @Override 179 | @Input 180 | @Optional 181 | public Boolean getDisableAggressiveOptimization() { 182 | return options.getDisableAggressiveOptimization(); 183 | } 184 | 185 | /** {@inheritDoc} */ 186 | @Override 187 | public void setDisableAggressiveOptimization( 188 | Boolean disableAggressiveOptimization) { 189 | options.setDisableAggressiveOptimization(disableAggressiveOptimization); 190 | } 191 | 192 | /** {@inheritDoc} */ 193 | @Override 194 | @Input 195 | @Optional 196 | public Boolean getDisableClassMetadata() { 197 | return options.getDisableClassMetadata(); 198 | } 199 | 200 | /** {@inheritDoc} */ 201 | @Override 202 | public void setDisableClassMetadata(Boolean disableClassMetadata) { 203 | options.setDisableClassMetadata(disableClassMetadata); 204 | } 205 | 206 | /** {@inheritDoc} */ 207 | @Override 208 | @Input 209 | @Optional 210 | public Boolean getDisableCastChecking() { 211 | return options.getDisableCastChecking(); 212 | } 213 | 214 | /** {@inheritDoc} */ 215 | @Override 216 | public void setDisableCastChecking(Boolean disableCastChecking) { 217 | options.setDisableCastChecking(disableCastChecking); 218 | } 219 | 220 | /** {@inheritDoc} */ 221 | @Override 222 | @Input 223 | @Optional 224 | public Boolean getEa() { 225 | return options.getEa(); 226 | } 227 | 228 | /** {@inheritDoc} */ 229 | @Override 230 | public void setEa(Boolean ea) { 231 | options.setEa(ea); 232 | } 233 | 234 | /** {@inheritDoc} */ 235 | @Override 236 | @Input 237 | @Optional 238 | public Boolean getDisableRunAsync() { 239 | return options.getDisableRunAsync(); 240 | } 241 | 242 | /** {@inheritDoc} */ 243 | @Override 244 | public void setDisableRunAsync(Boolean disableRunAsync) { 245 | options.setDisableRunAsync(disableRunAsync); 246 | } 247 | 248 | /** {@inheritDoc} */ 249 | @Override 250 | @Input 251 | @Optional 252 | public Style getStyle() { 253 | return options.getStyle(); 254 | } 255 | 256 | /** {@inheritDoc} */ 257 | @Override 258 | public void setStyle(Style style) { 259 | options.setStyle(style); 260 | } 261 | 262 | /** {@inheritDoc} */ 263 | @Override 264 | @Input 265 | @Optional 266 | public Boolean getSoycDetailed() { 267 | return options.getSoycDetailed(); 268 | } 269 | 270 | /** {@inheritDoc} */ 271 | @Override 272 | public void setSoycDetailed(Boolean soycDetailed) { 273 | options.setSoycDetailed(soycDetailed); 274 | } 275 | 276 | /** {@inheritDoc} */ 277 | @Override 278 | @Input 279 | @Optional 280 | public Boolean getStrict() { 281 | return options.getStrict(); 282 | } 283 | 284 | /** {@inheritDoc} */ 285 | @Override 286 | public void setStrict(Boolean strict) { 287 | options.setStrict(strict); 288 | } 289 | 290 | /** {@inheritDoc} */ 291 | @Override 292 | @Input 293 | @Optional 294 | public Boolean getDisableSoycHtml() { 295 | return options.getDisableSoycHtml(); 296 | } 297 | 298 | /** {@inheritDoc} */ 299 | @Override 300 | public void setDisableSoycHtml(Boolean disableSoycHtml) { 301 | options.setDisableSoycHtml(disableSoycHtml); 302 | } 303 | 304 | /** {@inheritDoc} */ 305 | @Override 306 | @Input 307 | @Optional 308 | public Boolean getEnableClosureCompiler() { 309 | return options.getEnableClosureCompiler(); 310 | } 311 | 312 | /** {@inheritDoc} */ 313 | @Override 314 | public void setEnableClosureCompiler(Boolean enableClosureCompiler) { 315 | options.setEnableClosureCompiler(enableClosureCompiler); 316 | } 317 | 318 | /** {@inheritDoc} */ 319 | @Override 320 | @Input 321 | @Optional 322 | public Integer getFragmentCount() { 323 | return options.getFragmentCount(); 324 | } 325 | 326 | /** {@inheritDoc} */ 327 | @Override 328 | public void setFragmentCount(Integer fragmentCount) { 329 | options.setFragmentCount(fragmentCount); 330 | } 331 | 332 | /** {@inheritDoc} */ 333 | @Override 334 | public File getMissingDepsFile() { 335 | return options.getMissingDepsFile(); 336 | } 337 | 338 | /** {@inheritDoc} */ 339 | @Override 340 | public void setMissingDepsFile(File missingDepsFile) { 341 | options.setMissingDepsFile(missingDepsFile); 342 | } 343 | 344 | /** {@inheritDoc} */ 345 | @Override 346 | public Namespace getNamespace() { 347 | return options.getNamespace(); 348 | } 349 | 350 | /** {@inheritDoc} */ 351 | @Override 352 | public void setNamespace(Namespace namespace) { 353 | options.setNamespace(namespace); 354 | } 355 | 356 | /** {@inheritDoc} */ 357 | @Override 358 | public Boolean getEnforceStrictResources() { 359 | return options.getEnforceStrictResources(); 360 | } 361 | 362 | /** {@inheritDoc} */ 363 | @Override 364 | public void setEnforceStrictResources(Boolean enforceStrictResources) { 365 | options.setEnforceStrictResources(enforceStrictResources); 366 | } 367 | 368 | /** {@inheritDoc} */ 369 | @Override 370 | public Boolean getIncrementalCompileWarnings() { 371 | return options.getIncrementalCompileWarnings(); 372 | } 373 | 374 | /** {@inheritDoc} */ 375 | @Override 376 | public void setIncrementalCompileWarnings(Boolean incrementalCompileWarnings) { 377 | options.setIncrementalCompileWarnings(incrementalCompileWarnings); 378 | } 379 | 380 | /** {@inheritDoc} */ 381 | @Override 382 | public Boolean getOverlappingSourceWarnings() { 383 | return options.getOverlappingSourceWarnings(); 384 | } 385 | 386 | /** {@inheritDoc} */ 387 | @Override 388 | public void setOverlappingSourceWarnings(Boolean overlappingSourceWarnings) { 389 | options.setOverlappingSourceWarnings(overlappingSourceWarnings); 390 | } 391 | 392 | /** {@inheritDoc} */ 393 | @Override 394 | public Boolean getSaveSource() { 395 | return options.getSaveSource(); 396 | } 397 | 398 | /** {@inheritDoc} */ 399 | @Override 400 | public void setSaveSource(Boolean saveSource) { 401 | options.setSaveSource(saveSource); 402 | } 403 | 404 | /** {@inheritDoc} */ 405 | @Override 406 | public File getSaveSourceOutput() { 407 | return options.getSaveSourceOutput(); 408 | } 409 | 410 | /** {@inheritDoc} */ 411 | @Override 412 | public void setSaveSourceOutput(File saveSourceOutput) { 413 | options.setSaveSourceOutput(saveSourceOutput); 414 | } 415 | 416 | /** {@inheritDoc} */ 417 | @Override 418 | public Boolean getClosureFormattedOutput() { 419 | return options.getClosureFormattedOutput(); 420 | } 421 | 422 | /** {@inheritDoc} */ 423 | @Override 424 | public void setClosureFormattedOutput(Boolean closureFormattedOutput) { 425 | options.setClosureFormattedOutput(closureFormattedOutput); 426 | } 427 | } 428 | -------------------------------------------------------------------------------- /gwt-gradle-plugin/src/main/java/de/richsource/gradle/plugins/gwt/AbstractGwtTask.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt; 17 | 18 | import java.io.File; 19 | 20 | /** 21 | * Base class for several GWT related tasks that share specific parameters. 22 | */ 23 | public abstract class AbstractGwtTask extends AbstractGwtActionTask { 24 | public AbstractGwtTask(String main) { 25 | super(main); 26 | } 27 | 28 | private File war; 29 | private File deploy; 30 | private File extra; 31 | private File workDir; 32 | private File gen; 33 | private File cacheDir; 34 | 35 | @Override 36 | protected void addArgs() { 37 | dirArgIfSet("-war", getWar()); 38 | dirArgIfSet("-deploy", getDeploy()); 39 | dirArgIfSet("-extra", getExtra()); 40 | dirArgIfSet("-workDir", getWorkDir()); 41 | dirArgIfSet("-gen", getGen()); 42 | 43 | final File cacheDir = getCacheDir(); 44 | if(cacheDir != null) { 45 | cacheDir.mkdirs(); 46 | 47 | jvmArgs("-Dgwt.persistentunitcachedir="+cacheDir.toString()); 48 | } 49 | } 50 | 51 | public File getWar() { 52 | return war; 53 | } 54 | 55 | /** 56 | * Sets the "-war" option. 57 | * 58 | * @param war 59 | */ 60 | public void setWar(File war) { 61 | this.war = war; 62 | } 63 | 64 | public File getDeploy() { 65 | return deploy; 66 | } 67 | 68 | /** 69 | * Sets the "-deploy" option. 70 | * 71 | * @param deploy 72 | */ 73 | public void setDeploy(File deploy) { 74 | this.deploy = deploy; 75 | } 76 | 77 | public File getExtra() { 78 | return extra; 79 | } 80 | 81 | /** 82 | * Sets the "-extra" option. 83 | * 84 | * @param extra 85 | */ 86 | public void setExtra(File extra) { 87 | this.extra = extra; 88 | } 89 | 90 | public File getWorkDir() { 91 | return workDir; 92 | } 93 | 94 | /** 95 | * Sets the "-workDir" option. 96 | * 97 | * @param workDir 98 | */ 99 | public void setWorkDir(File workDir) { 100 | this.workDir = workDir; 101 | } 102 | 103 | public File getGen() { 104 | return gen; 105 | } 106 | 107 | /** 108 | * Sets the "-gen" option. 109 | * 110 | * @param gen 111 | */ 112 | public void setGen(File gen) { 113 | this.gen = gen; 114 | } 115 | 116 | public File getCacheDir() { 117 | return cacheDir; 118 | } 119 | 120 | /** 121 | * Sets the directory where to put the persistent unit cache. 122 | * 123 | * @param cacheDir 124 | */ 125 | public void setCacheDir(File cacheDir) { 126 | this.cacheDir = cacheDir; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /gwt-gradle-plugin/src/main/java/de/richsource/gradle/plugins/gwt/ExplodedWar.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt; 17 | 18 | import groovy.lang.Closure; 19 | 20 | import java.io.File; 21 | import java.util.Collections; 22 | import java.util.concurrent.Callable; 23 | 24 | import org.gradle.api.Action; 25 | import org.gradle.api.DefaultTask; 26 | import org.gradle.api.file.CopySpec; 27 | import org.gradle.api.file.FileCollection; 28 | import org.gradle.api.specs.Spec; 29 | import org.gradle.api.tasks.InputFile; 30 | import org.gradle.api.tasks.InputFiles; 31 | import org.gradle.api.tasks.Optional; 32 | import org.gradle.api.tasks.TaskAction; 33 | 34 | import de.richsource.gradle.plugins.gwt.internal.ActionClosure; 35 | 36 | public class ExplodedWar extends DefaultTask { 37 | 38 | private final CopySpec root; 39 | 40 | private File destinationDir; 41 | private File webXml; 42 | 43 | private FileCollection classpath; 44 | private final CopySpec webInf; 45 | 46 | public ExplodedWar() { 47 | root = getProject().copySpec(new ActionClosure(this, new Action() { 48 | @Override 49 | public void execute(CopySpec spec) { 50 | } 51 | })); 52 | 53 | webInf = root.into("WEB-INF", new ActionClosure(this, new Action(){ 54 | @Override 55 | public void execute(CopySpec spec) { 56 | }})); 57 | 58 | webInf.into("", (new ActionClosure(this, new Action(){ 59 | @Override 60 | public void execute(CopySpec spec) { 61 | spec.from(new Callable() { 62 | 63 | @Override 64 | public File call() throws Exception { 65 | return getWebXml(); 66 | } 67 | }).rename(".*", "web.xml"); 68 | }}))); 69 | 70 | webInf.into("classes", new ActionClosure(this, new Action(){ 71 | @Override 72 | public void execute(CopySpec spec) { 73 | spec.from(new Callable>() { 74 | 75 | @Override 76 | public Iterable call() throws Exception { 77 | final FileCollection classpath = getClasspath(); 78 | return classpath == null ? Collections.emptyList() : classpath.filter(new Spec() { 79 | @Override 80 | public boolean isSatisfiedBy(File file) { 81 | return file.isDirectory(); 82 | } 83 | }); 84 | } 85 | }); 86 | }})); 87 | 88 | webInf.into("lib", new ActionClosure(this, new Action(){ 89 | @Override 90 | public void execute(CopySpec spec) { 91 | spec.from(new Callable>() { 92 | 93 | @Override 94 | public Iterable call() throws Exception { 95 | final FileCollection classpath = getClasspath(); 96 | return classpath == null ? Collections.emptyList() : classpath.filter(new Spec() { 97 | @Override 98 | public boolean isSatisfiedBy(File file) { 99 | return file.isFile(); 100 | } 101 | }); 102 | } 103 | }); 104 | }})); 105 | } 106 | 107 | @TaskAction 108 | protected void buildWarTemplate() { 109 | // TODO usage of ActionClosure can be removed when updating to Gradle 2.5+ 110 | getProject().copy(new ActionClosure(this, new Action() { 111 | 112 | @Override 113 | public void execute(CopySpec spec) { 114 | spec.into(getDestinationDir()); 115 | spec.with(root); 116 | }})); 117 | } 118 | 119 | public CopySpec getWebInf() { 120 | return webInf.into("", new ActionClosure(this, new Action(){ 121 | @Override 122 | public void execute(CopySpec arg0) { 123 | }})); 124 | } 125 | 126 | public CopySpec webInf(Closure configureClosure) { 127 | return webInf.into("", configureClosure); 128 | } 129 | 130 | @InputFiles 131 | @Optional 132 | public FileCollection getClasspath() { 133 | return classpath; 134 | } 135 | 136 | public void setClasspath(FileCollection classpath) { 137 | this.classpath = classpath; 138 | } 139 | 140 | public void classpath(Object... classpath) { 141 | FileCollection oldClasspath = getClasspath(); 142 | this.classpath = oldClasspath == null ? getProject().files(classpath) : getProject().files( this.classpath, classpath); 143 | } 144 | 145 | @InputFile 146 | @Optional 147 | public File getWebXml() { 148 | return webXml; 149 | } 150 | 151 | public void setWebXml(File webXml) { 152 | this.webXml = webXml; 153 | } 154 | 155 | public File getDestinationDir() { 156 | return destinationDir; 157 | } 158 | 159 | public void setDestinationDir(File destinationDir) { 160 | this.destinationDir = destinationDir; 161 | } 162 | 163 | public CopySpec from(Object... input) { 164 | return root.from(input); 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /gwt-gradle-plugin/src/main/java/de/richsource/gradle/plugins/gwt/GwtCheck.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt; 17 | 18 | import org.gradle.api.Task; 19 | import org.gradle.api.specs.Spec; 20 | 21 | /** 22 | * Task to run the GWT compiler for validation only so that no JavaScript output is produced. 23 | */ 24 | public class GwtCheck extends AbstractGwtCompile { 25 | public GwtCheck() { 26 | setValidateOnly(true); 27 | 28 | getOutputs().upToDateWhen(new Spec(){ 29 | @Override 30 | public boolean isSatisfiedBy(Task task) { 31 | return false; 32 | }}); 33 | } 34 | 35 | /** {@inheritDoc} */ 36 | @Override 37 | protected boolean isDevTask() { 38 | return false; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /gwt-gradle-plugin/src/main/java/de/richsource/gradle/plugins/gwt/GwtCompile.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2014 Steffen Schaefer 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package de.richsource.gradle.plugins.gwt; 17 | 18 | import java.io.File; 19 | import java.util.concurrent.Callable; 20 | 21 | import org.gradle.api.internal.ConventionMapping; 22 | import org.gradle.api.internal.IConventionAware; 23 | import org.gradle.api.tasks.OutputDirectory; 24 | 25 | /** 26 | * Task to run the GWT compiler for production quality output. 27 | */ 28 | public class GwtCompile extends AbstractGwtCompile { 29 | 30 | /** {@inheritDoc} */ 31 | @Override 32 | @OutputDirectory 33 | public File getWar() { 34 | return super.getWar(); 35 | } 36 | 37 | /** {@inheritDoc} */ 38 | @Override 39 | protected boolean isDevTask() { 40 | return false; 41 | } 42 | 43 | protected void configure(final GwtCompileOptions options) { 44 | super.configure(options); 45 | 46 | ConventionMapping conventionMapping =((IConventionAware)this).getConventionMapping(); 47 | conventionMapping.map("draftCompile", new Callable() { 48 | @Override 49 | public Boolean call() throws Exception { 50 | return options.getDraftCompile(); 51 | } 52 | }); 53 | conventionMapping.map("compileReport", new Callable() { 54 | @Override 55 | public Boolean call() throws Exception { 56 | return options.getCompileReport(); 57 | } 58 | }); 59 | conventionMapping.map("compilerMetrics", new Callable() { 60 | @Override 61 | public Boolean call() throws Exception { 62 | return options.getCompilerMetrics(); 63 | } 64 | }); 65 | conventionMapping.map("validateOnly", new Callable() { 66 | @Override 67 | public Boolean call() throws Exception { 68 | return options.getValidateOnly(); 69 | } 70 | }); 71 | conventionMapping.map("disableGeneratingOnShards", new Callable() { 72 | @Override 73 | public Boolean call() throws Exception { 74 | return options.getDisableGeneratingOnShards(); 75 | } 76 | }); 77 | conventionMapping.map("optimize", new Callable() { 78 | @Override 79 | public Integer call() throws Exception { 80 | return options.getOptimize(); 81 | } 82 | }); 83 | conventionMapping.map("disableAggressiveOptimization", new Callable() { 84 | @Override 85 | public Boolean call() throws Exception { 86 | return options.getDisableAggressiveOptimization(); 87 | } 88 | }); 89 | conventionMapping.map("disableClassMetadata", new Callable() { 90 | @Override 91 | public Boolean call() throws Exception { 92 | return options.getDisableClassMetadata(); 93 | } 94 | }); 95 | conventionMapping.map("disableCastChecking", new Callable() { 96 | @Override 97 | public Boolean call() throws Exception { 98 | return options.getDisableCastChecking(); 99 | } 100 | }); 101 | conventionMapping.map("ea", new Callable() { 102 | @Override 103 | public Boolean call() throws Exception { 104 | return options.getEa(); 105 | } 106 | }); 107 | conventionMapping.map("disableRunAsync", new Callable() { 108 | @Override 109 | public Boolean call() throws Exception { 110 | return options.getDisableRunAsync(); 111 | } 112 | }); 113 | conventionMapping.map("style", new Callable