-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
904 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import io.freefair.gradle.plugins.gwt.tasks.AbstractGwtTask | ||
|
||
plugins { | ||
id "io.freefair.gwt-war" | ||
id "war" | ||
} | ||
|
||
gwt { | ||
modules.add("io.freefair.example.Example") | ||
} | ||
|
||
dependencies { | ||
gwtClasspath "org.gwtproject:gwt-user:2.12.1" | ||
gwtClasspath project(":code-generator:generator") | ||
} |
3 changes: 3 additions & 0 deletions
3
examples/gwt/war/src/main/java/io/freefair/example/Example.gwt.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<module> | ||
<inherits name="com.google.gwt.user.User" /> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,5 @@ include 'plantuml' | |
include ":mjml" | ||
|
||
include ":okhttp" | ||
|
||
include ":gwt:war" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
plugins { | ||
id "maven-publish" | ||
id "java-gradle-plugin" | ||
id "com.gradle.plugin-publish" | ||
} | ||
|
||
dependencies { | ||
|
||
compileOnly 'org.gwtproject:gwt-dev:2.12.1' | ||
|
||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
gwt { | ||
id = "io.freefair.gwt" | ||
implementationClass = "io.freefair.gradle.plugins.gwt.GwtPlugin" | ||
displayName = "GWT Plugin" | ||
description = "GWT Plugin" | ||
tags.set(['gwt']) | ||
} | ||
gwtBase { | ||
id = "io.freefair.gwt-base" | ||
implementationClass = "io.freefair.gradle.plugins.gwt.GwtBasePlugin" | ||
displayName = "GWT Base Plugin" | ||
description = "GWT Plugin" | ||
tags.set(['gwt']) | ||
} | ||
gwtWar { | ||
id = "io.freefair.gwt-war" | ||
implementationClass = "io.freefair.gradle.plugins.gwt.GwtWarPlugin" | ||
displayName = "GWT War Plugin" | ||
description = "GWT Plugin" | ||
tags.set(['gwt']) | ||
} | ||
gwtWebjar { | ||
id = "io.freefair.gwt-webjar" | ||
implementationClass = "io.freefair.gradle.plugins.gwt.GwtWebJarPlugin" | ||
displayName = "GWT WebJar Plugin" | ||
description = "GWT Plugin" | ||
tags.set(['gwt']) | ||
} | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
gwt-plugin/src/main/java/io/freefair/gradle/plugins/gwt/CommonGwtToolOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package io.freefair.gradle.plugins.gwt; | ||
|
||
import org.gradle.api.file.DirectoryProperty; | ||
import org.gradle.api.provider.ListProperty; | ||
import org.gradle.api.provider.MapProperty; | ||
import org.gradle.api.provider.Property; | ||
import org.gradle.api.tasks.Console; | ||
import org.gradle.api.tasks.Input; | ||
import org.gradle.api.tasks.Optional; | ||
import org.gradle.api.tasks.OutputDirectory; | ||
|
||
/** | ||
* @author Lars Grefer | ||
*/ | ||
public interface CommonGwtToolOptions { | ||
|
||
@Console | ||
Property<String> getLogLevel(); | ||
|
||
@Optional | ||
@Input | ||
Property<Boolean> getFailOnError(); | ||
|
||
@Optional | ||
@OutputDirectory | ||
DirectoryProperty getWorkDir(); | ||
|
||
@Optional | ||
@Input | ||
Property<String> getStyle(); | ||
|
||
/** | ||
* Set the values of a property in the form of propertyName=value1[,value2...]. | ||
*/ | ||
@Optional | ||
@Input | ||
MapProperty<String, String> getSetProperty(); | ||
|
||
@Optional | ||
@Input | ||
Property<Boolean> getIncremental(); | ||
|
||
@Optional | ||
@Input | ||
Property<String> getSourceLevel(); | ||
|
||
/** | ||
* Generate exports for JsInterop purposes. If no -includeJsInteropExport/-excludeJsInteropExport provided, generates all exports. (defaults to OFF) | ||
*/ | ||
@Optional | ||
@Input | ||
Property<Boolean> getGenerateJsInteropExports(); | ||
|
||
/** | ||
* Include members and classes while generating JsInterop exports. Flag could be set multiple times to expand the pattern. (The flag has only effect if exporting is enabled via -generateJsInteropExports) | ||
*/ | ||
@Optional | ||
@Input | ||
ListProperty<String> getIncludeJsInteropExports(); | ||
|
||
/** | ||
* Include/exclude members and classes while generating JsInterop exports. Flag could be set multiple times to expand the pattern. (The flag has only effect if exporting is enabled via -generateJsInteropExports) | ||
*/ | ||
@Optional | ||
@Input | ||
ListProperty<String> getExcludeJsInteropExports(); | ||
|
||
/** | ||
* @return EXPERIMENTAL: Specifies method display name mode for chrome devtools: NONE, ONLY_METHOD_NAME, ABBREVIATED or FULL (defaults to NONE) | ||
*/ | ||
@Optional | ||
@Input | ||
Property<String> getXmethodNameDisplayMode(); | ||
|
||
/** | ||
* The GWT modules that the code server should compile. (Example: com.example.MyApp) | ||
*/ | ||
@Input | ||
ListProperty<String> getModule(); | ||
} |
82 changes: 82 additions & 0 deletions
82
gwt-plugin/src/main/java/io/freefair/gradle/plugins/gwt/GwtBasePlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package io.freefair.gradle.plugins.gwt; | ||
|
||
import io.freefair.gradle.plugins.gwt.tasks.AbstractGwtTask; | ||
import io.freefair.gradle.plugins.gwt.tasks.GwtCodeServerTask; | ||
import io.freefair.gradle.plugins.gwt.tasks.GwtCompileTask; | ||
import io.freefair.gradle.plugins.gwt.tasks.GwtDevModeTask; | ||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.artifacts.Configuration; | ||
import org.gradle.api.attributes.DocsType; | ||
import org.gradle.api.attributes.VerificationType; | ||
import org.gradle.api.plugins.JavaPlugin; | ||
import org.gradle.api.plugins.JavaPluginExtension; | ||
import org.gradle.api.tasks.SourceSet; | ||
import org.gradle.api.tasks.TaskProvider; | ||
import org.gradle.api.tasks.compile.AbstractCompile; | ||
import org.gradle.api.tasks.compile.JavaCompile; | ||
|
||
/** | ||
* @author Lars Grefer | ||
*/ | ||
public class GwtBasePlugin implements Plugin<Project> { | ||
|
||
@Override | ||
public void apply(Project project) { | ||
|
||
project.getPlugins().apply(JavaPlugin.class); | ||
|
||
Configuration gwtDev = project.getConfigurations().create("gwtDev"); | ||
|
||
Configuration gwtClasspath = project.getConfigurations().create("gwtClasspath"); | ||
|
||
Configuration gwtSources = project.getConfigurations().create("gwtSources"); | ||
gwtSources.extendsFrom(gwtClasspath); | ||
|
||
gwtSources.getAttributes().attribute(VerificationType.VERIFICATION_TYPE_ATTRIBUTE, project.getObjects().named(VerificationType.class, VerificationType.MAIN_SOURCES)); | ||
gwtSources.getAttributes().attribute(DocsType.DOCS_TYPE_ATTRIBUTE, project.getObjects().named(DocsType.class, DocsType.SOURCES)); | ||
|
||
GwtExtension gwtExtension = project.getExtensions().create("gwt", GwtExtension.class); | ||
|
||
project.afterEvaluate(p -> { | ||
gwtDev.defaultDependencies(ds -> { | ||
ds.add(project.getDependencies().create("org.gwtproject:gwt-dev:" + gwtExtension.getToolVersion().get())); | ||
}); | ||
}); | ||
|
||
project.getTasks().withType(AbstractGwtTask.class, gwtTask -> { | ||
gwtTask.setGroup("gwt"); | ||
|
||
gwtTask.getGwtClasspath().from(gwtDev); | ||
gwtTask.getGwtClasspath().from(gwtClasspath); | ||
JavaPluginExtension pluginExtension = project.getExtensions().getByType(JavaPluginExtension.class); | ||
SourceSet main = pluginExtension.getSourceSets().getByName("main"); | ||
gwtTask.getGwtClasspath().from(main.getAllJava().getSourceDirectories()); | ||
|
||
gwtTask.getWorkDir().set(gwtTask.getTemporaryDir()); | ||
|
||
gwtTask.getModule().convention(gwtExtension.getModules()); | ||
|
||
gwtTask.getSourceLevel().convention(project.getTasks().named("compileJava", JavaCompile.class).map(AbstractCompile::getSourceCompatibility)); | ||
}); | ||
|
||
TaskProvider<GwtCompileTask> gwtCompileTaskProvider = project.getTasks().register("gwtCompile", GwtCompileTask.class, gwtCompile -> { | ||
gwtCompile.getWar().convention(project.getLayout().getBuildDirectory().dir("gwt/compile/war")); | ||
gwtCompile.getDeploy().convention(project.getLayout().getBuildDirectory().dir("gwt/compile/deploy")); | ||
gwtCompile.getExtra().convention(project.getLayout().getBuildDirectory().dir("gwt/compile/extra")); | ||
|
||
gwtCompile.getGwtClasspath().from(gwtSources); | ||
}); | ||
|
||
TaskProvider<GwtDevModeTask> gwtDevModeTaskProvider = project.getTasks().register("gwtDevMode", GwtDevModeTask.class, gwtDevMode -> { | ||
gwtDevMode.getWar().convention(project.getLayout().getBuildDirectory().dir("gwt/dev-mode/war")); | ||
gwtDevMode.getDeploy().convention(project.getLayout().getBuildDirectory().dir("gwt/dev-mode/deploy")); | ||
gwtDevMode.getExtra().convention(project.getLayout().getBuildDirectory().dir("gwt/dev-mode/extra")); | ||
}); | ||
|
||
project.getTasks().register("gwtCodeServer", GwtCodeServerTask.class, gwtCodeServer -> { | ||
gwtCodeServer.getLauncherDir().convention(project.getLayout().getBuildDirectory().dir("gwt/code-server")); | ||
}); | ||
|
||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
gwt-plugin/src/main/java/io/freefair/gradle/plugins/gwt/GwtCodeServerOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package io.freefair.gradle.plugins.gwt; | ||
|
||
import org.gradle.api.file.DirectoryProperty; | ||
import org.gradle.api.provider.Property; | ||
import org.gradle.api.tasks.*; | ||
|
||
/** | ||
* @author Lars Grefer | ||
*/ | ||
public interface GwtCodeServerOptions extends CommonGwtToolOptions { | ||
|
||
/** | ||
* Allows -src flags to reference missing directories. (defaults to OFF) | ||
*/ | ||
@Optional | ||
@Input | ||
Property<Boolean> getAllowMissingSrc(); | ||
|
||
/** | ||
* Exits after compiling the modules. The exit code will be 0 if the compile succeeded. (defaults to OFF) | ||
*/ | ||
@Optional | ||
@Input | ||
Property<Boolean> getCompileTest(); | ||
|
||
/** | ||
* The number of times to recompile (after the first one) during a compile test. | ||
*/ | ||
@Optional | ||
@Input | ||
Property<Integer> getCompileTestRecompiles(); | ||
|
||
/** | ||
* Precompile modules. (defaults to ON) | ||
*/ | ||
@Optional | ||
@Input | ||
Property<Boolean> getPrecompile(); | ||
|
||
/** | ||
* The port where the code server will run. | ||
*/ | ||
@Optional | ||
@Input | ||
Property<Integer> getPort(); | ||
|
||
/** | ||
* A directory containing GWT source to be prepended to the classpath for compiling. | ||
*/ | ||
@Optional | ||
@InputDirectory | ||
DirectoryProperty getSrc(); | ||
|
||
/** | ||
* An output directory where files for launching Super Dev Mode will be written. (Optional.) | ||
*/ | ||
@Optional | ||
@OutputDirectory | ||
DirectoryProperty getLauncherDir(); | ||
|
||
/** | ||
* Specifies the bind address for the code server and web server (defaults to 127.0.0.1) | ||
*/ | ||
@Optional | ||
@Input | ||
Property<String> getBindAddress(); | ||
|
||
/** | ||
* EXPERIMENTAL: Enables Javascript output suitable for post-compilation by Closure Compiler (defaults to OFF) | ||
*/ | ||
@Optional | ||
@Input | ||
Property<Boolean> getXclosureFormattedOutput(); | ||
|
||
|
||
|
||
} |
Oops, something went wrong.