diff --git a/android/build.gradle b/android/build.gradle index a424fe8c..048c7972 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,109 +1,142 @@ -android { - buildToolsVersion "27.0.3" - compileSdkVersion 28 - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = ['src/main/java'] - aidl.srcDirs = ['src/main/java'] - renderscript.srcDirs = ['src/main/java'] - res.srcDirs = ['res'] - assets.srcDirs = ['assets'] - jniLibs.srcDirs = ['libs'] - } +apply plugin: 'android' +android { + buildToolsVersion "27.0.3" + compileSdkVersion 28 + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src/main/java'] + aidl.srcDirs = ['src/main/java'] + renderscript.srcDirs = ['src/main/java'] + res.srcDirs = ['res'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] } - packagingOptions { - exclude 'META-INF/robovm/ios/robovm.xml' - } - defaultConfig { - applicationId "com.riiablo" - minSdkVersion 23 - targetSdkVersion 28 - versionCode 1 - versionName "1.0" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility 1.8 - targetCompatibility 1.8 - } - productFlavors { + } + packagingOptions { + exclude 'META-INF/robovm/ios/robovm.xml' + } + defaultConfig { + applicationId "com.riiablo" + minSdkVersion 23 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } + } + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } + productFlavors { + } } + +configurations { natives } + +dependencies { + implementation project(":core") + implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" + implementation "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion" +} + +dependencies { + implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" + natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi" + natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a" + natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a" + natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86" + natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64" +} + +repositories { + jcenter() +} + +// build complains this dependency is not found otherwise +dependencies { + compileOnly group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30' +} + // called every time gradle gets executed, takes the native dependencies of // the natives configuration, and extracts them to the proper libs/ folders // so they get packed with the APK. task copyAndroidNatives() { - file("libs/armeabi/").mkdirs(); - file("libs/armeabi-v7a/").mkdirs(); - file("libs/arm64-v8a/").mkdirs(); - file("libs/x86_64/").mkdirs(); - file("libs/x86/").mkdirs(); + file("libs/armeabi/").mkdirs(); + file("libs/armeabi-v7a/").mkdirs(); + file("libs/arm64-v8a/").mkdirs(); + file("libs/x86_64/").mkdirs(); + file("libs/x86/").mkdirs(); - configurations.natives.files.each { jar -> - def outputDir = null - if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a") - if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a") - if (jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi") - if (jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64") - if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86") - if (outputDir != null) { - copy { - from zipTree(jar) - into outputDir - include "*.so" - } - } + configurations.natives.files.each { jar -> + def outputDir = null + if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a") + if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a") + if (jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi") + if (jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64") + if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86") + if (outputDir != null) { + copy { + from zipTree(jar) + into outputDir + include "*.so" + } } + } } task run(type: Exec) { - def path - def localProperties = project.file("../local.properties") - if (localProperties.exists()) { - Properties properties = new Properties() - localProperties.withInputStream { instr -> - properties.load(instr) - } - def sdkDir = properties.getProperty('sdk.dir') - if (sdkDir) { - path = sdkDir - } else { - path = "$System.env.ANDROID_HOME" - } - } else { - path = "$System.env.ANDROID_HOME" + def path + def localProperties = project.file("../local.properties") + if (localProperties.exists()) { + Properties properties = new Properties() + localProperties.withInputStream { instr -> + properties.load(instr) } + def sdkDir = properties.getProperty('sdk.dir') + if (sdkDir) { + path = sdkDir + } else { + path = "$System.env.ANDROID_HOME" + } + } else { + path = "$System.env.ANDROID_HOME" + } - def adb = path + "/platform-tools/adb" - commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.riiablo/com.riiablo.AndroidLauncher' + def adb = path + "/platform-tools/adb" + commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.riiablo/com.riiablo.AndroidLauncher' } // sets up the Android Idea project, using the old Ant based build. idea { - module { - sourceDirs += file("src"); - scopes = [COMPILE: [plus: [project.configurations.compile]]] + module { + sourceDirs += file('src'); + scopes = [COMPILE: [plus: [project.configurations.compile]]] - iml { - withXml { - def node = it.asNode() - def builder = NodeBuilder.newInstance(); - builder.current = node; - builder.component(name: "FacetManager") { - facet(type: "android", name: "Android") { - configuration { - option(name: "UPDATE_PROPERTY_FILES", value: "true") - } - } - } + iml { + withXml { + def node = it.asNode() + def builder = NodeBuilder.newInstance(); + builder.current = node; + builder.component(name: "FacetManager") { + facet(type: "android", name: "Android") { + configuration { + option(name: "UPDATE_PROPERTY_FILES", value: "true") } + } } + } } + } } dependencies { } diff --git a/build.gradle b/build.gradle index 520aa2bf..9033d515 100644 --- a/build.gradle +++ b/build.gradle @@ -1,359 +1,56 @@ buildscript { - repositories { - mavenLocal() - mavenCentral() - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - maven { url "https://plugins.gradle.org/m2/" } - jcenter() - google() - } - dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' - classpath "gradle.plugin.io.netifi:gradle-flatbuffers-plugin:1.0.5" - } - dependencies { - // lib for artemis-odb weaving. - // see https://github.com/junkdog/artemis-odb/wiki/Bytecode-weaving - classpath "net.onedaybeard.artemis:artemis-odb-gradle-plugin:2.2.0" + repositories { + mavenLocal() + mavenCentral() + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + maven { url "https://plugins.gradle.org/m2/" } + jcenter() + google() + } - // lib for artemis-odb fluid. - classpath "net.onedaybeard.artemis:artemis-fluid-gradle-plugin:2.2.0" - } + dependencies { + classpath 'com.android.tools.build:gradle:3.1.3' + classpath "gradle.plugin.io.netifi:gradle-flatbuffers-plugin:1.0.5" + } + + dependencies { + // lib for artemis-odb weaving. + // see https://github.com/junkdog/artemis-odb/wiki/Bytecode-weaving + classpath "net.onedaybeard.artemis:artemis-odb-gradle-plugin:2.2.0" + + // lib for artemis-odb fluid. + classpath "net.onedaybeard.artemis:artemis-fluid-gradle-plugin:2.2.0" + } } allprojects { - apply plugin: "idea" + apply plugin: "idea" - version = '1.0' - ext { - appName = "diablo" - gdxVersion = '1.9.11' - roboVMVersion = '2.3.3' - box2DLightsVersion = '1.4' - aiVersion = '1.8.0' - artemisVersion = '2.3.0' - artemisContribVersion = '2.4.0' - nettyVersion = '4.1.50.Final' - } + version = '1.0' + ext { + appName = "diablo" + roboVMVersion = '2.3.3' + box2DLightsVersion = '1.4' + aiVersion = '1.8.0' + artemisVersion = '2.3.0' + artemisContribVersion = '2.4.0' + nettyVersion = '4.1.50.Final' + } - ext { - cliVersion = '1.4' - } - - repositories { - mavenLocal() - mavenCentral() - google() - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - maven { url "https://oss.sonatype.org/content/repositories/releases/" } - maven { url 'https://jitpack.io' } - } + repositories { + mavenLocal() + mavenCentral() + google() + maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } + maven { url 'https://oss.sonatype.org/content/repositories/releases/' } + maven { url 'https://jitpack.io' } + } } -project(":tester") { - apply plugin: "java" - - ext { - visuiVersion = '1.4.0' - } - - dependencies { - implementation project(":core") - implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - - } - - dependencies { - implementation group: 'commons-cli', name: 'commons-cli', version: cliVersion - implementation "com.kotcrab.vis:vis-ui:$visuiVersion" - } -} - -project(":tools") { - apply plugin: "java" - - ext { - visuiVersion = '1.4.0' - } - - dependencies { - implementation project(":core") - implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" - - } - - dependencies { - implementation group: 'commons-cli', name: 'commons-cli', version: cliVersion - implementation "com.kotcrab.vis:vis-ui:$visuiVersion" - } - - dependencies { - implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" - implementation "com.badlogicgames.box2dlights:box2dlights:1.4" - } -} - -project(":ds1viewer") { - apply plugin: "java" - - ext { - visuiVersion = '1.4.0' - } - - dependencies { - implementation project(":core") - implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - - } - - dependencies { - implementation group: 'commons-cli', name: 'commons-cli', version: cliVersion - implementation "com.kotcrab.vis:vis-ui:$visuiVersion" - } -} - -project(":mpqviewer") { - apply plugin: "java" - - ext { - visuiVersion = '1.4.2' - } - - dependencies { - implementation project(":core") - implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - - } - - dependencies { - implementation group: 'commons-cli', name: 'commons-cli', version: cliVersion - implementation "com.kotcrab.vis:vis-ui:$visuiVersion" - } -} - -project(":desktop") { - apply plugin: "java" - - dependencies { - implementation project(":core") - implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - implementation "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop" - } - - dependencies { - implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" - } - - dependencies { - implementation group: 'commons-cli', name: 'commons-cli', version: cliVersion - } -} - -project(":android") { - apply plugin: "android" - - configurations { natives } - - dependencies { - implementation project(":core") - implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" - natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" - natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a" - natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" - natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" - natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" - implementation "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion" - } - - dependencies { - implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" - natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi" - natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a" - natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a" - natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86" - natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64" - } - - repositories { - jcenter() - } - - dependencies { - implementation "org.sufficientlysecure:openpgp-api:12.0" - } - - // build complains this dependency is not found otherwise - dependencies { - compileOnly group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30' - } -} - -project(":core") { - apply plugin: "java-library" - apply plugin: "artemis" - - dependencies { - api "com.badlogicgames.gdx:gdx:$gdxVersion" - api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" - api "com.badlogicgames.gdx:gdx-ai:1.8.2" - api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" - } - - dependencies { - api group: 'com.google.guava', name: 'guava', version: '20.0' - api group: 'com.android.support', name: 'support-annotations', version: '27.1.1' - api group: 'commons-io', name: 'commons-io', version: '2.5' - api group: 'org.apache.commons', name: 'commons-lang3', version: '3.6' - api group: 'org.apache.commons', name: 'commons-collections4', version: '4.1' - api group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1' - api group: 'org.apache.commons', name: 'commons-text', version: '1.8' - api group: 'com.jcraft', name: 'jzlib', version: '1.1.3' - api group: 'com.google.flatbuffers', name: 'flatbuffers-java', version: '1.11.0' - } - - dependencies { - api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" - api "com.badlogicgames.box2dlights:box2dlights:1.4" - } - - dependencies { - api "org.reflections:reflections:0.9.12" - } - - dependencies { - // components to expose - api "net.onedaybeard.artemis:artemis-odb:$artemisVersion" - api "net.mostlyoriginal.artemis-odb:contrib-core:$artemisContribVersion" - //api "net.mostlyoriginal.artemis-odb:contrib-jam:$artemisContribVersion" - - // Artemis-odb - api "net.onedaybeard.artemis:artemis-odb:$artemisVersion" - api "net.onedaybeard.artemis:artemis-odb-serializer-json-libgdx:$artemisVersion" - - // Artemis-odb bonus functionality (systems, events, components). - api "net.mostlyoriginal.artemis-odb:contrib-core:$artemisContribVersion" - //api "net.mostlyoriginal.artemis-odb:contrib-jam:$artemisContribVersion" - api "net.mostlyoriginal.artemis-odb:contrib-eventbus:$artemisContribVersion" - //api "net.mostlyoriginal.artemis-odb:contrib-plugin-operations:$artemisContribVersion" - //api "net.mostlyoriginal.artemis-odb:contrib-plugin-profiler:$artemisContribVersion" - //api "net.mostlyoriginal.artemis-odb:contrib-plugin-singleton:$artemisContribVersion" // TODO: when added - } - - dependencies { - api group: 'io.netty', name: 'netty-all', version: nettyVersion - } - - dependencies { - testImplementation 'junit:junit:4.12' - testImplementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" - testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - } -} - -project(":server:bnls") { - apply plugin: "java" - - dependencies { - implementation project(":core") - implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - } - - dependencies { - implementation group: 'commons-cli', name: 'commons-cli', version: cliVersion - } - - dependencies { - testImplementation 'junit:junit:4.12' - } -} - -project(":server:bncs") { - apply plugin: "java" - - dependencies { - implementation project(":core") - implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - } - - dependencies { - implementation group: 'commons-cli', name: 'commons-cli', version: cliVersion - } - - dependencies { - testImplementation 'junit:junit:4.12' - } -} - -project(":server:mcp") { - apply plugin: "java" - - dependencies { - implementation project(":core") - implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - } - - dependencies { - implementation group: 'commons-cli', name: 'commons-cli', version: cliVersion - } - - dependencies { - testImplementation 'junit:junit:4.12' - } -} - -project(":server:d2gs") { - apply plugin: "java" - - dependencies { - implementation project(":core") - implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - } - - dependencies { - implementation group: 'commons-cli', name: 'commons-cli', version: cliVersion - } - - dependencies { - testImplementation 'junit:junit:4.12' - } -} - -project(":server:netty") { - apply plugin: "java" - - dependencies { - implementation project(":core") - implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - } - - dependencies { - implementation group: 'commons-cli', name: 'commons-cli', version: cliVersion - } - - dependencies { - testImplementation 'junit:junit:4.12' - } -} - -project(":mpqlib") { - apply plugin: "java" - - dependencies { - implementation project(":core") - implementation "com.badlogicgames.gdx:gdx-jnigen:$gdxVersion" - } +configure(subprojects - project(':android')) { + apply plugin: 'java-library' + sourceCompatibility = 7.0 + compileJava { + options.incremental = true + } } diff --git a/core/build.gradle b/core/build.gradle index acc4ba39..6fc145f9 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,21 +1,73 @@ +apply plugin: 'java-library' +apply plugin: 'artemis' +apply plugin: 'io.netifi.flatbuffers' + import io.netifi.flatbuffers.plugin.tasks.FlatBuffers -apply plugin: "java" -apply plugin: "idea" -apply plugin: "io.netifi.flatbuffers" - -sourceCompatibility = 1.7 [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' sourceSets.main.java.srcDirs += file('gen/') -idea { - module { - generatedSourceDirs += file('gen/') - } +idea.module.generatedSourceDirs += file('gen/') + +dependencies { + api "com.badlogicgames.gdx:gdx:$gdxVersion" + api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + api "com.badlogicgames.gdx:gdx-ai:1.8.2" + api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" +} + +dependencies { + api "com.google.guava:guava:20.0" + api "com.android.support:support-annotations:27.1.1" + api "commons-io:commons-io:2.5" + api "org.apache.commons:commons-lang3:3.6" + api "org.apache.commons:commons-collections4:4.1" + api "org.apache.commons:commons-math3:3.6.1" + api "org.apache.commons:commons-text:1.8" + api "com.jcraft:jzlib:1.1.3" + api "com.google.flatbuffers:flatbuffers-java:1.11.0" +} + +dependencies { + api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" + api "com.badlogicgames.box2dlights:box2dlights:1.4" +} + +dependencies { + api "org.reflections:reflections:0.9.12" +} + +dependencies { + // components to expose + api "net.onedaybeard.artemis:artemis-odb:$artemisVersion" + api "net.mostlyoriginal.artemis-odb:contrib-core:$artemisContribVersion" + //api "net.mostlyoriginal.artemis-odb:contrib-jam:$artemisContribVersion" + + // Artemis-odb + api "net.onedaybeard.artemis:artemis-odb:$artemisVersion" + api "net.onedaybeard.artemis:artemis-odb-serializer-json-libgdx:$artemisVersion" + + // Artemis-odb bonus functionality (systems, events, components). + api "net.mostlyoriginal.artemis-odb:contrib-core:$artemisContribVersion" + //api "net.mostlyoriginal.artemis-odb:contrib-jam:$artemisContribVersion" + api "net.mostlyoriginal.artemis-odb:contrib-eventbus:$artemisContribVersion" + //api "net.mostlyoriginal.artemis-odb:contrib-plugin-operations:$artemisContribVersion" + //api "net.mostlyoriginal.artemis-odb:contrib-plugin-profiler:$artemisContribVersion" + //api "net.mostlyoriginal.artemis-odb:contrib-plugin-singleton:$artemisContribVersion" +} + +dependencies { + api "io.netty:netty-all:$nettyVersion" +} + +dependencies { + testImplementation "junit:junit:4.12" + testImplementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" + testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" } task createFlatBuffers(type: FlatBuffers) { - inputDir = file('src/main/java/com/riiablo/net/') - outputDir = file('gen/main/java/') - language = 'java' + inputDir = file('src/main/java/com/riiablo/net/') + outputDir = file('gen/main/java/') + language = 'java' } diff --git a/desktop/build.gradle b/desktop/build.gradle index 0aafeeb2..6addb1f1 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -1,41 +1,50 @@ +apply plugin: 'java' + import org.apache.tools.ant.taskdefs.condition.Os -apply plugin: "java" +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' -sourceCompatibility = 1.6 +project.ext.mainClassName = 'com.riiablo.DesktopLauncher' +project.ext.assetsDir = new File('../android/assets'); -project.ext.mainClassName = "com.riiablo.DesktopLauncher" -project.ext.assetsDir = new File("../android/assets"); +dependencies { + implementation project(':core') + implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + implementation "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop" + implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" + + implementation "commons-cli:commons-cli:$cliVersion" +} task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue = true - if(Os.isFamily(Os.FAMILY_MAC)) - jvmArgs += "-XstartOnFirstThread" + if(Os.isFamily(Os.FAMILY_MAC)) + jvmArgs += "-XstartOnFirstThread" } task debug(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true - debug = true + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue = true + debug = true } -task dist(type: Jar) { - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.compile.collect {zipTree(it)}} - from files(project.assetsDir); +task dist(dependsOn: classes, type: Jar) { + from files(sourceSets.main.output.classesDirs) + from files(sourceSets.main.output.resourcesDir) + from {configurations.compile.collect {zipTree(it)}} + from files(project.assetsDir); - manifest { - attributes 'Main-Class': project.mainClassName - } + manifest { + attributes 'Main-Class': project.mainClassName + } } - -dist.dependsOn classes diff --git a/ds1viewer/build.gradle b/ds1viewer/build.gradle index 09ddbf14..51fee4ea 100644 --- a/ds1viewer/build.gradle +++ b/ds1viewer/build.gradle @@ -1,28 +1,40 @@ -apply plugin: "java" +apply plugin: 'java' -sourceCompatibility = 1.7 -sourceSets.main.java.srcDirs = ["src/"] +import org.apache.tools.ant.taskdefs.condition.Os -project.ext.mainClassName = "com.riiablo.map.DS1Viewer" -project.ext.assetsDir = new File("../android/assets"); +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' + +project.ext.mainClassName = 'com.riiablo.map.DS1Viewer' +project.ext.assetsDir = new File('../android/assets'); +project.ext.visuiVersion = '1.4.0' + +dependencies { + implementation project(':core') + implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + + implementation "commons-cli:commons-cli:$cliVersion" + implementation "com.kotcrab.vis:vis-ui:$visuiVersion" +} task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue = true + + if(Os.isFamily(Os.FAMILY_MAC)) + jvmArgs += "-XstartOnFirstThread" } -task dist(type: Jar) { - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from { configurations.compile.collect { zipTree(it) } } - from files(project.assetsDir); +task dist(dependsOn: classes, type: Jar) { + from files(sourceSets.main.output.classesDirs) + from files(sourceSets.main.output.resourcesDir) + from { configurations.compile.collect { zipTree(it) } } + from files(project.assetsDir); - manifest { - attributes 'Main-Class': project.mainClassName - } + manifest { + attributes 'Main-Class': project.mainClassName + } } - -dist.dependsOn classes diff --git a/gradle.properties b/gradle.properties index 3d15a2a9..d9a794c7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,6 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms512M -Xmx1G -XX:MaxPermSize=1G -XX:MaxMetaspaceSize=1G org.gradle.configureondemand=false + +gdxVersion=1.9.11 +cliVersion=1.4 diff --git a/mpqlib/build.gradle b/mpqlib/build.gradle deleted file mode 100644 index 951d60ec..00000000 --- a/mpqlib/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -apply plugin: "java" - -sourceCompatibility = 1.7 - -project.ext.mainClassName = "com.riiablo.mpq.MPQLibBuilder" -project.ext.assetsDir = new File("../android/assets"); - -task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true -} - -task dist(type: Jar) { - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from { configurations.compile.collect { zipTree(it) } } - from files(project.assetsDir); - - manifest { - attributes 'Main-Class': project.mainClassName - } -} - -dist.dependsOn classes diff --git a/mpqlib/src/main/java/com/riiablo/mpq/MPQLibBuilder.java b/mpqlib/src/main/java/com/riiablo/mpq/MPQLibBuilder.java deleted file mode 100644 index dcccd5c1..00000000 --- a/mpqlib/src/main/java/com/riiablo/mpq/MPQLibBuilder.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.riiablo.mpq; - -import com.badlogic.gdx.jnigen.AntScriptGenerator; -import com.badlogic.gdx.jnigen.BuildConfig; -import com.badlogic.gdx.jnigen.BuildExecutor; -import com.badlogic.gdx.jnigen.BuildTarget; -import com.badlogic.gdx.jnigen.BuildTarget.TargetOs; -import com.badlogic.gdx.jnigen.NativeCodeGenerator; - -public class MPQLibBuilder { - private MPQLibBuilder() {} - - public static void main(String[] args) throws Exception { - NativeCodeGenerator jnigen = new NativeCodeGenerator(); - jnigen.generate("src", "build/classes/java/main", "jni"); - - BuildTarget win32 = BuildTarget.newDefaultTarget(TargetOs.Windows, false); - win32.compilerPrefix = ""; - - BuildTarget win64 = BuildTarget.newDefaultTarget(TargetOs.Windows, true); - - new AntScriptGenerator().generate(new BuildConfig("mpqlib"), win32, win64); - BuildExecutor.executeAnt("jni/build-windows32.xml", "-v -Dhas-compiler=true clean postcompile"); - BuildExecutor.executeAnt("jni/build-windows64.xml", "-v -Dhas-compiler=true clean postcompile"); - // BuildExecutor.executeAnt("jni/build-linux32.xml", "-v -Dhas-compiler=true clean postcompile"); - // BuildExecutor.executeAnt("jni/build-linux64.xml", "-v -Dhas-compiler=true clean postcompile"); - // BuildExecutor.executeAnt("jni/build-macosx32.xml", "-v -Dhas-compiler=true clean postcompile"); - BuildExecutor.executeAnt("jni/build.xml", "-v"); - } -} diff --git a/mpqlib/src/main/java/com/riiablo/mpq/util/Exploder.java b/mpqlib/src/main/java/com/riiablo/mpq/util/Exploder.java deleted file mode 100644 index 75e69387..00000000 --- a/mpqlib/src/main/java/com/riiablo/mpq/util/Exploder.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.riiablo.mpq.util; - -import java.nio.Buffer; - -public class Exploder { - - /*JNI - #define CMP_NO_ERROR 0 - #define CMP_INVALID_DICTSIZE 1 - #define CMP_INVALID_MODE 2 - #define CMP_BAD_DATA 3 - #define CMP_ABORT 4 - - static unsigned char DistBits[] = - { - 0x02, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 - }; - - static unsigned char DistCode[] = - { - 0x03, 0x0D, 0x05, 0x19, 0x09, 0x11, 0x01, 0x3E, 0x1E, 0x2E, 0x0E, 0x36, 0x16, 0x26, 0x06, 0x3A, - 0x1A, 0x2A, 0x0A, 0x32, 0x12, 0x22, 0x42, 0x02, 0x7C, 0x3C, 0x5C, 0x1C, 0x6C, 0x2C, 0x4C, 0x0C, - 0x74, 0x34, 0x54, 0x14, 0x64, 0x24, 0x44, 0x04, 0x78, 0x38, 0x58, 0x18, 0x68, 0x28, 0x48, 0x08, - 0xF0, 0x70, 0xB0, 0x30, 0xD0, 0x50, 0x90, 0x10, 0xE0, 0x60, 0xA0, 0x20, 0xC0, 0x40, 0x80, 0x00 - }; - - static unsigned char ExLenBits[] = - { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 - }; - - static unsigned short LenBase[] = - { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x000A, 0x000E, 0x0016, 0x0026, 0x0046, 0x0086, 0x0106 - }; - - static unsigned char LenBits[] = - { - 0x03, 0x02, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x07, 0x07 - }; - - static unsigned char LenCode[] = - { - 0x05, 0x03, 0x01, 0x06, 0x0A, 0x02, 0x0C, 0x14, 0x04, 0x18, 0x08, 0x30, 0x10, 0x20, 0x40, 0x00 - }; - - static unsigned char ChBitsAsc[] = - { - 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x07, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, - 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, - 0x04, 0x0A, 0x08, 0x0C, 0x0A, 0x0C, 0x0A, 0x08, 0x07, 0x07, 0x08, 0x09, 0x07, 0x06, 0x07, 0x08, - 0x07, 0x06, 0x07, 0x07, 0x07, 0x07, 0x08, 0x07, 0x07, 0x08, 0x08, 0x0C, 0x0B, 0x07, 0x09, 0x0B, - 0x0C, 0x06, 0x07, 0x06, 0x06, 0x05, 0x07, 0x08, 0x08, 0x06, 0x0B, 0x09, 0x06, 0x07, 0x06, 0x06, - 0x07, 0x0B, 0x06, 0x06, 0x06, 0x07, 0x09, 0x08, 0x09, 0x09, 0x0B, 0x08, 0x0B, 0x09, 0x0C, 0x08, - 0x0C, 0x05, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x0B, 0x07, 0x05, 0x06, 0x05, 0x05, - 0x06, 0x0A, 0x05, 0x05, 0x05, 0x05, 0x08, 0x07, 0x08, 0x08, 0x0A, 0x0B, 0x0B, 0x0C, 0x0C, 0x0C, - 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, - 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, - 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, - 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, - 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, - 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, - 0x0D, 0x0C, 0x0D, 0x0D, 0x0D, 0x0C, 0x0D, 0x0D, 0x0D, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0C, 0x0D, - 0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D - }; - - static unsigned short ChCodeAsc[] = - { - 0x0490, 0x0FE0, 0x07E0, 0x0BE0, 0x03E0, 0x0DE0, 0x05E0, 0x09E0, - 0x01E0, 0x00B8, 0x0062, 0x0EE0, 0x06E0, 0x0022, 0x0AE0, 0x02E0, - 0x0CE0, 0x04E0, 0x08E0, 0x00E0, 0x0F60, 0x0760, 0x0B60, 0x0360, - 0x0D60, 0x0560, 0x1240, 0x0960, 0x0160, 0x0E60, 0x0660, 0x0A60, - 0x000F, 0x0250, 0x0038, 0x0260, 0x0050, 0x0C60, 0x0390, 0x00D8, - 0x0042, 0x0002, 0x0058, 0x01B0, 0x007C, 0x0029, 0x003C, 0x0098, - 0x005C, 0x0009, 0x001C, 0x006C, 0x002C, 0x004C, 0x0018, 0x000C, - 0x0074, 0x00E8, 0x0068, 0x0460, 0x0090, 0x0034, 0x00B0, 0x0710, - 0x0860, 0x0031, 0x0054, 0x0011, 0x0021, 0x0017, 0x0014, 0x00A8, - 0x0028, 0x0001, 0x0310, 0x0130, 0x003E, 0x0064, 0x001E, 0x002E, - 0x0024, 0x0510, 0x000E, 0x0036, 0x0016, 0x0044, 0x0030, 0x00C8, - 0x01D0, 0x00D0, 0x0110, 0x0048, 0x0610, 0x0150, 0x0060, 0x0088, - 0x0FA0, 0x0007, 0x0026, 0x0006, 0x003A, 0x001B, 0x001A, 0x002A, - 0x000A, 0x000B, 0x0210, 0x0004, 0x0013, 0x0032, 0x0003, 0x001D, - 0x0012, 0x0190, 0x000D, 0x0015, 0x0005, 0x0019, 0x0008, 0x0078, - 0x00F0, 0x0070, 0x0290, 0x0410, 0x0010, 0x07A0, 0x0BA0, 0x03A0, - 0x0240, 0x1C40, 0x0C40, 0x1440, 0x0440, 0x1840, 0x0840, 0x1040, - 0x0040, 0x1F80, 0x0F80, 0x1780, 0x0780, 0x1B80, 0x0B80, 0x1380, - 0x0380, 0x1D80, 0x0D80, 0x1580, 0x0580, 0x1980, 0x0980, 0x1180, - 0x0180, 0x1E80, 0x0E80, 0x1680, 0x0680, 0x1A80, 0x0A80, 0x1280, - 0x0280, 0x1C80, 0x0C80, 0x1480, 0x0480, 0x1880, 0x0880, 0x1080, - 0x0080, 0x1F00, 0x0F00, 0x1700, 0x0700, 0x1B00, 0x0B00, 0x1300, - 0x0DA0, 0x05A0, 0x09A0, 0x01A0, 0x0EA0, 0x06A0, 0x0AA0, 0x02A0, - 0x0CA0, 0x04A0, 0x08A0, 0x00A0, 0x0F20, 0x0720, 0x0B20, 0x0320, - 0x0D20, 0x0520, 0x0920, 0x0120, 0x0E20, 0x0620, 0x0A20, 0x0220, - 0x0C20, 0x0420, 0x0820, 0x0020, 0x0FC0, 0x07C0, 0x0BC0, 0x03C0, - 0x0DC0, 0x05C0, 0x09C0, 0x01C0, 0x0EC0, 0x06C0, 0x0AC0, 0x02C0, - 0x0CC0, 0x04C0, 0x08C0, 0x00C0, 0x0F40, 0x0740, 0x0B40, 0x0340, - 0x0300, 0x0D40, 0x1D00, 0x0D00, 0x1500, 0x0540, 0x0500, 0x1900, - 0x0900, 0x0940, 0x1100, 0x0100, 0x1E00, 0x0E00, 0x0140, 0x1600, - 0x0600, 0x1A00, 0x0E40, 0x0640, 0x0A40, 0x0A00, 0x1200, 0x0200, - 0x1C00, 0x0C00, 0x1400, 0x0400, 0x1800, 0x0800, 0x1000, 0x0000 - }; - */ - - private Exploder() {} - - public static native int pkexplode(Buffer src, int offset, Buffer dst, int len); /* - unsigned long ctype = *src++; - unsigned long dsize_bits = *src++; - - if (4 > dsize_bits || dsize_bits > 6) { - return CMP_INVALID_DICTSIZE; - } - - unsigned long dsize_mask = 0xFFFF >> (0x10 - pWork->dsize_bits); // Shifted by 'sar' instruction - if (ctype != CMP_BINARY) { - if (ctype != CMP_ASCII) { - return CMP_INVALID_MODE; - } - - //memcpy(pWork->ChBitsAsc, ChBitsAsc, sizeof(pWork->ChBitsAsc)); - //GenAscTabs(pWork); - } - -// Reference: -//https://raw.githubusercontent.com/ladislav-zezula/StormLib/master/src/pklib/pklib.h -//https://raw.githubusercontent.com/ladislav-zezula/StormLib/master/src/pklib/explode.c - - return CMP_NO_ERROR; - */ - -} diff --git a/mpqviewer/build.gradle b/mpqviewer/build.gradle index 85fb1924..fe6cd1e7 100644 --- a/mpqviewer/build.gradle +++ b/mpqviewer/build.gradle @@ -1,27 +1,40 @@ -apply plugin: "java" +apply plugin: 'java' -sourceCompatibility = 1.7 +import org.apache.tools.ant.taskdefs.condition.Os -project.ext.mainClassName = "com.riiablo.mpq.MPQViewer" -project.ext.assetsDir = new File("assets"); +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' + +project.ext.mainClassName = 'com.riiablo.mpq.MPQViewer' +project.ext.assetsDir = new File('assets'); +project.ext.visuiVersion = '1.4.2' + +dependencies { + implementation project(':core') + implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + + implementation "commons-cli:commons-cli:$cliVersion" + implementation "com.kotcrab.vis:vis-ui:$visuiVersion" +} task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue = true + + if(Os.isFamily(Os.FAMILY_MAC)) + jvmArgs += "-XstartOnFirstThread" } -task dist(type: Jar) { - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.compile.collect {zipTree(it)}} - from files(project.assetsDir); +task dist(dependsOn: classes, type: Jar) { + from files(sourceSets.main.output.classesDirs) + from files(sourceSets.main.output.resourcesDir) + from {configurations.compile.collect {zipTree(it)}} + from files(project.assetsDir); - manifest { - attributes 'Main-Class': project.mainClassName - } + manifest { + attributes 'Main-Class': project.mainClassName + } } - -dist.dependsOn classes diff --git a/server/bncs/build.gradle b/server/bncs/build.gradle index 42fa7d04..a6793287 100644 --- a/server/bncs/build.gradle +++ b/server/bncs/build.gradle @@ -1,24 +1,22 @@ -apply plugin: "java" +apply plugin: 'java' -sourceCompatibility = 1.7 +import org.apache.tools.ant.taskdefs.condition.Os -project.ext.mainClassName = "com.riiablo.server.bncs.Main" +project.ext.mainClassName = 'com.riiablo.server.bncs.Main' task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - ignoreExitValue = true + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + ignoreExitValue = true } -task dist(type: Jar) { - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.compile.collect {zipTree(it)}} +task dist(dependsOn: classes, type: Jar) { + from files(sourceSets.main.output.classesDirs) + from files(sourceSets.main.output.resourcesDir) + from {configurations.compile.collect {zipTree(it)}} - manifest { - attributes 'Server-Class': project.mainClassName - } + manifest { + attributes 'Main-Class': project.mainClassName + } } - -dist.dependsOn classes diff --git a/server/bnls/build.gradle b/server/bnls/build.gradle index a3e171d1..dfabb868 100644 --- a/server/bnls/build.gradle +++ b/server/bnls/build.gradle @@ -1,24 +1,27 @@ -apply plugin: "java" +apply plugin: 'java' -sourceCompatibility = 1.7 +import org.apache.tools.ant.taskdefs.condition.Os -project.ext.mainClassName = "com.riiablo.server.bnls.BNLS" +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' + +project.ext.mainClassName = 'com.riiablo.server.bnls.BNLS' task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - ignoreExitValue = true + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + ignoreExitValue = true + + if(Os.isFamily(Os.FAMILY_MAC)) + jvmArgs += "-XstartOnFirstThread" } -task dist(type: Jar) { - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.compile.collect {zipTree(it)}} +task dist(dependsOn: classes, type: Jar) { + from files(sourceSets.main.output.classesDirs) + from files(sourceSets.main.output.resourcesDir) + from {configurations.compile.collect {zipTree(it)}} - manifest { - attributes 'Server-Class': project.mainClassName - } + manifest { + attributes 'Main-Class': project.mainClassName + } } - -dist.dependsOn classes diff --git a/server/build.gradle b/server/build.gradle new file mode 100644 index 00000000..2d291053 --- /dev/null +++ b/server/build.gradle @@ -0,0 +1,15 @@ +subprojects { + apply plugin: 'java' + + dependencies { + implementation project(':core') + implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + + implementation "commons-cli:commons-cli:$cliVersion" + } + + dependencies { + testImplementation 'junit:junit:4.12' + } +} diff --git a/server/d2gs/build.gradle b/server/d2gs/build.gradle index ec7b4423..e0ed7890 100644 --- a/server/d2gs/build.gradle +++ b/server/d2gs/build.gradle @@ -1,28 +1,30 @@ -apply plugin: "java" +apply plugin: 'java' -sourceCompatibility = 1.7 +import org.apache.tools.ant.taskdefs.condition.Os -project.ext.mainClassName = "com.riiablo.server.d2gs.D2GS" -project.ext.assetsDir = new File("../../android/assets"); +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' + +project.ext.mainClassName = 'com.riiablo.server.d2gs.D2GS' +project.ext.assetsDir = new File('../../android/assets'); task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue = true + + if(Os.isFamily(Os.FAMILY_MAC)) + jvmArgs += "-XstartOnFirstThread" } -task dist(type: Jar) { - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.compile.collect {zipTree(it)}} - from files(project.assetsDir); +task dist(dependsOn: classes, type: Jar) { + from files(sourceSets.main.output.classesDirs) + from files(sourceSets.main.output.resourcesDir) + from {configurations.compile.collect {zipTree(it)}} + from files(project.assetsDir); - manifest { - attributes 'Server-Class': project.mainClassName - attributes 'Main-Class': project.mainClassName // TODO: not needed in production? - } + manifest { + attributes 'Main-Class': project.mainClassName + } } - -dist.dependsOn classes diff --git a/server/mcp/build.gradle b/server/mcp/build.gradle index d8c381d8..f2b2943c 100644 --- a/server/mcp/build.gradle +++ b/server/mcp/build.gradle @@ -1,24 +1,27 @@ -apply plugin: "java" +apply plugin: 'java' -sourceCompatibility = 1.7 +import org.apache.tools.ant.taskdefs.condition.Os -project.ext.mainClassName = "com.riiablo.server.mcp.MCP" +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' + +project.ext.mainClassName = 'com.riiablo.server.mcp.MCP' task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - ignoreExitValue = true + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + ignoreExitValue = true + + if(Os.isFamily(Os.FAMILY_MAC)) + jvmArgs += "-XstartOnFirstThread" } -task dist(type: Jar) { - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.compile.collect {zipTree(it)}} +task dist(dependsOn: classes, type: Jar) { + from files(sourceSets.main.output.classesDirs) + from files(sourceSets.main.output.resourcesDir) + from {configurations.compile.collect {zipTree(it)}} - manifest { - attributes 'Server-Class': project.mainClassName - } + manifest { + attributes 'Main-Class': project.mainClassName + } } - -dist.dependsOn classes diff --git a/server/netty/build.gradle b/server/netty/build.gradle index b275cb25..9b97ce31 100644 --- a/server/netty/build.gradle +++ b/server/netty/build.gradle @@ -1,28 +1,27 @@ -apply plugin: "java" +apply plugin: 'java' -sourceCompatibility = 1.7 +import org.apache.tools.ant.taskdefs.condition.Os -project.ext.mainClassName = "com.riiablo.server.d2gs.Main" +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' + +project.ext.mainClassName = 'com.riiablo.server.d2gs.Main' project.ext.assetsDir = new File("../../android/assets"); task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue = true } -task dist(type: Jar) { - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.compile.collect {zipTree(it)}} - from files(project.assetsDir); +task dist(dependsOn: classes, type: Jar) { + from files(sourceSets.main.output.classesDirs) + from files(sourceSets.main.output.resourcesDir) + from {configurations.compile.collect {zipTree(it)}} + from files(project.assetsDir); - manifest { - attributes 'Server-Class': project.mainClassName - attributes 'Main-Class': project.mainClassName // TODO: not needed in production? - } + manifest { + attributes 'Main-Class': project.mainClassName + } } - -dist.dependsOn classes diff --git a/tester/build.gradle b/tester/build.gradle index c0de3261..c7a1f158 100644 --- a/tester/build.gradle +++ b/tester/build.gradle @@ -1,28 +1,13 @@ -apply plugin: "java" +apply plugin: 'java' -sourceCompatibility = 1.7 -sourceSets.main.java.srcDirs = [ "src/" ] +project.ext.visuiVersion = '1.4.0' -project.ext.mainClassName = "com.riiablo.tester.Tester" -project.ext.assetsDir = new File("../android/assets"); +dependencies { + implementation project(':core') + implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" -task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true + implementation "commons-cli:commons-cli:$cliVersion" + implementation "com.kotcrab.vis:vis-ui:$visuiVersion" } - -task dist(type: Jar) { - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.compile.collect {zipTree(it)}} - from files(project.assetsDir); - - manifest { - attributes 'Main-Class': project.mainClassName - } -} - -dist.dependsOn classes diff --git a/tools/build.gradle b/tools/build.gradle index 4407ac37..02cfb75f 100644 --- a/tools/build.gradle +++ b/tools/build.gradle @@ -1,3 +1,19 @@ -apply plugin: "java" +apply plugin: 'java' -sourceCompatibility = 1.7 +project.ext.visuiVersion = '1.4.0' + +dependencies { + implementation project(':core') + implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" + + implementation "commons-cli:commons-cli:$cliVersion" + implementation "com.kotcrab.vis:vis-ui:$visuiVersion" +} + +dependencies { + implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" + implementation "com.badlogicgames.box2dlights:box2dlights:1.4" +}