We ended up using no plugins for GWT with Gradle. Even if there are some,
none of them fit well.
Luckily, GWT compiler has a nice CLI, so...
Also, we make the gwt a subproject, as we don't use GWT RPC anyway. This
helps keeping gwt-dev out of any runtime classpath!!!
Below is a trimmed version (not sure it even compiles, and it is the
build.gradle for a subproject) of the build.gradle file for reference, for
both compilation (even with a system flag to compile only the dev module)
and for running the super dev mode:
ext {
buildWebapp = "${project(':web').buildDir}/generated/webapp"
gwtDev = Boolean.getBoolean('gwt.development')
}
configurations {
gwt
}
dependencies {
gwt(project(':api')) { transitive = false }
gwt files(project.sourceSets.main.java.srcDirs)
gwt files(project.sourceSets.main.resources.srcDirs)
gwt files(project(':api').sourceSets.main.java.srcDirs)
gwt "com.google.gwt:gwt-user:$gwtVersion"
gwt "com.google.code.gwtx:gwtx:$gwtxVersion"
gwt "com.github.branflake2267:gwt-maps-api:$googleMapsApiVersion"
gwt "com.google.elemental2:elemental2-webstorage:$elementalVersion"
gwt "com.google.elemental2:elemental2-dom:$elementalVersion"
gwt "com.google.elemental2:elemental2-promise:$elementalVersion"
gwt "com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion"
gwt "com.google.gwt:gwt-dev:$gwtVersion"
}
task compileGwt(type: JavaExec) {
dependsOn compileJava
ext {
outDir = "$buildWebapp/gwt"
}
group = 'Build'
description = 'Compile the GWT source'
inputs.files configurations.gwt
inputs.property 'development', gwtDev
outputs.dir outDir
classpath = configurations.gwt
main = 'com.google.gwt.dev.Compiler'
args = []
args += ['-sourceLevel', "1.$javaVersion"]
args += ['-war', buildWebapp]
args += ['-logLevel', 'INFO']
args += ['-workDir', "$buildDir/tmp/gwt"]
args += ['-XfragmentCount', '6']
args += ['-failOnError']
if (gwtDev) {
args += ['-style', 'PRETTY']
args += ['-draftCompile']
args += ['-optimize', '0']
args += ['-XmethodNameDisplayMode', 'ABBREVIATED']
args += ['org.example.MyModuleDev']
} else {
args += ['-style', 'OBFUSCATED']
args += ['-optimize', '9']
args += ['-XnoclassMetadata']
args += ['org.example.MyModule']
}
}
task cleanGwtTemp {
doLast {
ant.delete(dir: "$buildWebapp/gwt")
ant.delete(dir: "$buildDir/tmp/gwt")
}
}
clean {
dependsOn cleanGwtTemp
}
task gwtSuperDev(type: JavaExec) {
dependsOn compileJava
description = 'Run the GWT code server for Super Dev Mode'
classpath = configurations.gwt
main = 'com.google.gwt.dev.codeserver.CodeServer'
args = []
args += ['-sourceLevel', "1.$javaVersion"]
args += ['-launcherDir', buildWebapp]
args += ['-logLevel', 'INFO']
args += ['-workDir', "$buildDir/tmp/gwt"]
args += ['-precompile']
args += ['-failOnError']
args += ['-bindAddress', '0.0.0.0']
args += ['org.example.MyModuleDev']
doFirst {
file("$buildDir/tmp/gwt").mkdirs()
}
}
Em quarta-feira, 10 de março de 2021 às 12:44:57 UTC-3, [email protected]
escreveu:
> Even if it is opinionated, please give us Gradle GWT archetype. :-)
>
> On Wednesday, March 10, 2021 at 5:25:47 PM UTC+2 [email protected] wrote:
>
>>
>>
>> On Wednesday, March 10, 2021 at 4:13:03 PM UTC+1 [email protected]
>> wrote:
>>
>>> We had the same problem with maven but at the end, maven's multi-module
>>> project and profiles helped to solve *hack around* it.
>>>
>>
>> There, fixed it for you 😉
>>
>> Also see https://www.cloudbees.com/blog/maven-profiles-and-maven-way and
>> https://blog.soebes.de/blog/2013/11/09/why-is-it-bad-to-activate-slash-deactive-modules-by-profiles-in-maven/
>>
>> among others, by prominent Maven PMC members.
>> (and yet, gwt-maven-archetypes use a "dev" profile 🤷, but it's know to
>> be kind of hackish in places due to Maven and jetty-maven-plugin's
>> limitations)
>>
>
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-web-toolkit/b369da9d-78fc-4d5f-9227-68a47b18dd61n%40googlegroups.com.