buildscript { repositories { mavenCentral() } dependencies { classpath 'org.gretty:gretty:3.1.0' } } apply plugin: "gwt" apply plugin: "war" apply plugin: "org.gretty" gwt { gwtVersion = "$gwtFrameworkVersion" // Should match the version used for building the GWT backend. See gradle.properties. maxHeapSize = '1G' // Default 256m is not enough for the GWT compiler. GWT is HUNGRY. minHeapSize = '1G' src = files(file('src/main/java')) // Needs to be in front of "modules" below. modules 'com.openeggbert.GdxDefinition' //,'com.openeggbert.gdx.storage.GdxStorageMainClass' devModules 'com.openeggbert.GdxDefinitionSuperdev' project.webAppDirName = 'webapp' compiler.strict = true compiler.disableCastChecking = true //// The next line can be useful to uncomment if you want output that hasn't been obfuscated. // compiler.style = org.docstr.gradle.plugins.gwt.Style.DETAILED sourceLevel = 1.11 } dependencies { implementation "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion:sources" implementation "com.badlogicgames.gdx:gdx-ai:$aiVersion:sources" implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion:sources" implementation "com.badlogicgames.gdx:gdx:$gdxVersion:sources" implementation "com.github.MrStahlfelge.gdx-websockets:core:$websocketVersion:sources" implementation "com.github.MrStahlfelge.gdx-websockets:html:$websocketVersion:sources" implementation "com.github.MrStahlfelge.gdx-websockets:serialization:$websocketSerializationVersion:sources" implementation "com.github.crykn.guacamole:core:$guacamoleVersion:sources" implementation "com.github.crykn.guacamole:gdx:$guacamoleVersion:sources" implementation "com.github.tommyettinger:formic:$formicVersion:sources" implementation "com.github.tommyettinger:gdx-backend-gwt:1.1210.1" implementation "com.github.tommyettinger:gdx-backend-gwt:1.1210.1:sources" implementation "com.github.tommyettinger:libgdx-utils-box2d:$utilsBox2dVersion:sources" implementation "com.github.tommyettinger:libgdx-utils:$utilsVersion:sources" implementation "com.google.jsinterop:jsinterop-annotations:2.0.2:sources" implementation "de.golfgl.gdxcontrollerutils:gdx-controllerutils-mapping:$controllerMappingVersion:sources" implementation project(':core') implementation "com.pixelgamelibrary:pixel:$pixelVersion:sources" api "com.pixelgamelibrary:pixel-backend-libgdx:$pixelVersion" implementation "com.pixelgamelibrary:pixel-backend-libgdx:$pixelVersion:sources" implementation("com.badlogicgames.gdx-controllers:gdx-controllers-gwt:$gdxControllersVersion:sources"){exclude group: "com.badlogicgames.gdx", module: "gdx-backend-gwt"} implementation("com.badlogicgames.gdx:gdx-box2d-gwt:$gdxVersion:sources") {exclude group: "com.google.gwt", module: "gwt-user"} implementation("com.github.crykn.guacamole:gdx-gwt:$guacamoleVersion:sources"){exclude group: "com.badlogicgames.gdx", module: "gdx-backend-gwt"} implementation "space.earlygrey:shapedrawer:$shapeDrawerVersion:sources" } import org.akhikhl.gretty.AppBeforeIntegrationTestTask import org.docstr.gradle.plugins.gwt.GwtSuperDev gretty.httpPort = 8080 // The line below will need to be changed only if you change the build directory to something other than "build". gretty.resourceBase = "${project.layout.buildDirectory.asFile.get().absolutePath}/gwt/draftOut" gretty.contextPath = "/" gretty.portPropertiesFileName = "TEMP_PORTS.properties" task startHttpServer (dependsOn: [draftCompileGwt]) { doFirst { copy { from "webapp" into gretty.resourceBase } copy { from "war" into gretty.resourceBase } } } task beforeRun(type: AppBeforeIntegrationTestTask, dependsOn: startHttpServer) { // The next line allows ports to be reused instead of // needing a process to be manually terminated. file("build/TEMP_PORTS.properties").delete() // Somewhat of a hack; uses Gretty's support for wrapping a task in // a start and then stop of a Jetty server that serves files while // also running the SuperDev code server. integrationTestTask 'superDev' interactive false } task superDev(type: GwtSuperDev) { doFirst { gwt.modules = gwt.devModules } } //// We delete the (temporary) war/ folder because if any extra files get into it, problems occur. //// The war/ folder shouldn't be committed to version control. clean.delete += [file("war")] // This next line can be changed if you want to, for instance, always build into the // docs/ folder of a Git repo, which can be set to automatically publish on GitHub Pages. // This is relative to the html/ folder. var outputPath = "build/dist/" task dist(dependsOn: [clean, compileGwt]) { doLast { // Uncomment the next line if you have changed outputPath and know that its contents // should be replaced by a new dist build. Some large JS files are not cleaned up by // default unless the outputPath is inside build/ (then the clean task removes them). // Do not uncomment the next line if you changed outputPath to a folder that has // non-generated files that you want to keep! //delete(file(outputPath)) file(outputPath).mkdirs() copy { from("build/gwt/out"){ exclude '**/*.symbolMap' // Not used by a dist, and these can be large. } into outputPath } copy { from("webapp") { exclude 'index.html' // We edit this HTML file later. exclude 'refresh.png' // We don't need this button; this saves some bytes. } into outputPath } copy { from("webapp") { // These next two lines take the index.html page and remove the superdev refresh button. include 'index.html' filter { String line -> line.replaceAll('