diff --git a/build.gradle b/build.gradle index a6ad50ead..192392751 100644 --- a/build.gradle +++ b/build.gradle @@ -14,15 +14,33 @@ * GNU General Public License for more details. */ -apply plugin: 'idea' +buildscript { + repositories { + mavenCentral() + maven { + url 'https://maven.ej-technologies.com/repository' + } + maven { + url "https://plugins.gradle.org/m2/" + } + } + dependencies { + classpath group: 'de.undercouch', name: 'gradle-download-task', version: '4.1.1' + classpath group: 'com.install4j', name: 'install4j-gradle', version: '8.0.7' + } +} + +plugins { + id "idea" +} -task wrapper(type: Wrapper) { - gradleVersion = '3.5' +wrapper { + gradleVersion = '6.7' } idea { project { - languageLevel = '1.8' + languageLevel = '15' } } @@ -36,7 +54,7 @@ allprojects { task gitVersion { task -> def gitVersion = 'unknown' def branch = 'develop' - def File rootDir = project.rootDir + File rootDir = project.rootDir for (def gitCmd in ['git', 'git.cmd']) { try { def procBranch = "$gitCmd rev-parse --abbrev-ref HEAD".execute(null as List, rootDir) @@ -55,7 +73,7 @@ allprojects { } } - def String mainVersion + String mainVersion def indexOfSeparator = gitVersion.indexOf('-') if (indexOfSeparator == -1) { mainVersion = gitVersion @@ -86,35 +104,25 @@ allprojects { repositories { mavenCentral() maven { - url 'http://illarion.org/media/java/maven' + url 'https://illarion.org/media/java/maven' } maven { - url 'http://oss.sonatype.org/content/repositories/releases' + url 'https://oss.sonatype.org/content/repositories/releases' } - } -} - -buildscript { - repositories { - mavenCentral() maven { - url 'http://maven.ej-technologies.com/repository' + url 'https://dl.bintray.com/flowtick/jgraphx' } } - dependencies { - classpath group: 'net.sf.proguard', name: 'proguard-gradle', version: '5.2.1' - classpath group: 'de.undercouch', name: 'gradle-download-task', version: '2.1.0' - classpath group: 'com.install4j', name: 'install4j-gradle', version: '6.0.4' - } } subprojects { group = 'org.illarion' - plugins.withType(JavaPlugin) { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + apply plugin: 'java' + sourceCompatibility = JavaVersion.VERSION_15 + targetCompatibility = JavaVersion.VERSION_15 + plugins.withType(JavaPlugin) { tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } @@ -136,30 +144,23 @@ subprojects { test.runtimeClasspath += configurations.provided } dependencies { - testCompile group: 'org.testng', name: 'testng', version: '6.9.10' - testCompile group: 'org.easymock', name: 'easymock', version: '3.4' - testCompile group: 'org.powermock', name: 'powermock-module-testng', version: '1.6.4' - testCompile group: 'org.powermock', name: 'powermock-api-easymock', version: '1.6.4' - testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3' - compile group: 'org.jetbrains', name: 'annotations', version: '15.0' - compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1' + testImplementation group: 'org.testng', name: 'testng', version: '7.3.0' + testImplementation group: 'org.easymock', name: 'easymock', version: '4.2' + testImplementation group: 'org.powermock', name: 'powermock-module-testng', version: '2.0.9' + testImplementation group: 'org.powermock', name: 'powermock-api-easymock', version: '2.0.9' + testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3' + implementation group: 'org.jetbrains', name: 'annotations', version: '20.1.0' } } apply plugin: 'idea' - apply plugin: 'findbugs' apply plugin: 'pmd' - findbugs { - ignoreFailures = true - effort = "max" - reportLevel = "high" - } + pmd { ignoreFailures = true ruleSetFiles = files(new File(rootDir, 'pmd.xml')) ruleSets = [] - toolVersion = '5.4.1' - targetJdk = '1.7' + toolVersion = '6.21.0' } idea { module { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 4dd9da4cd..e708b1c02 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f9df4ad62..4d9ca1649 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Sun May 03 21:12:38 CEST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip diff --git a/gradlew b/gradlew index 4453ccea3..4f906e0c8 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,16 +44,16 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -66,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -109,10 +126,11 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -138,35 +156,30 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi # Escape application args -save ( ) { +save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index f9553162f..107acd32c 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/illabuild/build.gradle b/illabuild/build.gradle index d536ac6ca..22b58c079 100644 --- a/illabuild/build.gradle +++ b/illabuild/build.gradle @@ -20,25 +20,26 @@ apply plugin: 'maven-publish' archivesBaseName = 'illarion_build' dependencies { - compile project(':common') - compile group: 'org.l33tlabs.twl', name: 'pngdecoder', version: '1.0' - compile gradleApi() - compile localGroovy() + implementation project(':common') + implementation group: 'org.l33tlabs.twl', name: 'pngdecoder', version: '1.0' + implementation gradleApi() + implementation localGroovy() } jar { dependsOn { gitVersion } manifest { - attributes \ - 'Permissions': 'all-permissions', \ - 'Codebase': 'illarion.org', \ - 'Trusted-Library': true, \ - 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), \ - 'Built-By': System.getProperty('user.name'), \ - 'Built-JDK': System.getProperty('java.version'), \ - 'Implementation-Title': 'Illarion Build Utility', \ - 'Implementation-Vendor': 'Illarion e.V.', \ + attributes( + 'Permissions': 'all-permissions', + 'Codebase': 'illarion.org', + 'Trusted-Library': true, + 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), + 'Built-By': System.getProperty('user.name'), + 'Built-JDK': System.getProperty('java.version'), + 'Implementation-Title': 'Illarion Build Utility', + 'Implementation-Vendor': 'Illarion e.V.', 'Implementation-Version': project.ext.fullVersion + ) } } diff --git a/illabuild/src/main/groovy/illarion/build/ConvertPlugin.groovy b/illabuild/src/main/groovy/illarion/build/ConvertPlugin.groovy index 4162608de..83347bd84 100644 --- a/illabuild/src/main/groovy/illarion/build/ConvertPlugin.groovy +++ b/illabuild/src/main/groovy/illarion/build/ConvertPlugin.groovy @@ -20,7 +20,6 @@ import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.artifacts.Dependency import org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact -import org.gradle.api.internal.java.JavaLibrary import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet import org.gradle.api.internal.project.ProjectInternal import org.gradle.api.plugins.BasePlugin @@ -44,7 +43,7 @@ class ConvertPlugin implements Plugin { private final Instantiator instantiator @Inject - public ConvertPlugin(Instantiator instantiator) { + ConvertPlugin(Instantiator instantiator) { this.instantiator = instantiator } @@ -101,7 +100,7 @@ class ConvertPlugin implements Plugin { compileConfiguration.artifacts.add(jarArtifact) project.extensions.getByType(DefaultArtifactPublicationSet).addCandidate(jarArtifact) - project.components.add(new JavaLibrary(jarArtifact, compileConfiguration.allDependencies)); + project.artifacts.add(COMPILE_CONFIGURATION_NAME, jar); } static void configureConfigurations(Project project) { diff --git a/illaclient/build.gradle b/illaclient/build.gradle index 03a78dcea..f30959ed2 100644 --- a/illaclient/build.gradle +++ b/illaclient/build.gradle @@ -23,30 +23,33 @@ archivesBaseName = 'illarion_client' mainClassName = 'illarion.client.IllaClient' dependencies { - compile project(':common') - compile project(':engine') - runtime project(':engine-libgdx') - compile project(':engine-nifty') - compile project(':nifty-controls') - runtime project(':nifty-style') - compile group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'jul-to-slf4j', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'log4j-over-slf4j', version: project.ext.slf4jVersion - compile group: 'ch.qos.logback', name: 'logback-classic', version: project.ext.logbackVersion - compile group: 'org.bushe', name: 'eventbus', version: '1.4' - compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0' - compile group: 'com.google.guava', name: 'guava', version: '21.0' - compile group: 'com.github.nifty-gui', name: 'nifty', version: project.ext.niftyGuiVersion - runtime group: 'org.illarion', name: 'rsc_books', version: project.ext.illarionResourcesVersion - runtime group: 'org.illarion', name: 'rsc_chars', version: project.ext.illarionResourcesVersion - runtime group: 'org.illarion', name: 'rsc_effects', version: project.ext.illarionResourcesVersion - runtime group: 'org.illarion', name: 'rsc_gui', version: project.ext.illarionResourcesVersion - runtime group: 'org.illarion', name: 'rsc_items', version: project.ext.illarionResourcesVersion - runtime group: 'org.illarion', name: 'rsc_music', version: project.ext.illarionResourcesVersion - runtime group: 'org.illarion', name: 'rsc_sounds', version: project.ext.illarionResourcesVersion - runtime group: 'org.illarion', name: 'rsc_tables', version: project.ext.illarionResourcesVersion - runtime group: 'org.illarion', name: 'rsc_tiles', version: project.ext.illarionResourcesVersion + implementation project(':common') + implementation project(':engine') + runtimeOnly project(':engine-libgdx') + implementation project(':engine-nifty') + implementation project(':nifty-controls') + runtimeOnly project(':nifty-style') + implementation group: 'com.github.nifty-gui', name: 'nifty', version: project.ext.niftyGuiVersion + implementation group: 'com.github.nifty-gui', name: 'nifty-default-controls', version: project.ext.niftyGuiVersion + implementation group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'jul-to-slf4j', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'log4j-over-slf4j', version: project.ext.slf4jVersion + implementation group: 'ch.qos.logback', name: 'logback-classic', version: project.ext.logbackVersion + implementation group: 'org.bushe', name: 'eventbus', version: '1.4' + implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.0' + implementation group: 'com.google.guava', name: 'guava', version: '21.0' + implementation 'com.google.code.findbugs:jsr305:3.0.2' + implementation group: 'com.github.nifty-gui', name: 'nifty', version: project.ext.niftyGuiVersion + runtimeOnly group: 'org.illarion', name: 'rsc_books', version: project.ext.illarionResourcesVersion + runtimeOnly group: 'org.illarion', name: 'rsc_chars', version: project.ext.illarionResourcesVersion + runtimeOnly group: 'org.illarion', name: 'rsc_effects', version: project.ext.illarionResourcesVersion + runtimeOnly group: 'org.illarion', name: 'rsc_gui', version: project.ext.illarionResourcesVersion + runtimeOnly group: 'org.illarion', name: 'rsc_items', version: project.ext.illarionResourcesVersion + runtimeOnly group: 'org.illarion', name: 'rsc_music', version: project.ext.illarionResourcesVersion + runtimeOnly group: 'org.illarion', name: 'rsc_sounds', version: project.ext.illarionResourcesVersion + runtimeOnly group: 'org.illarion', name: 'rsc_tables', version: project.ext.illarionResourcesVersion + runtimeOnly group: 'org.illarion', name: 'rsc_tiles', version: project.ext.illarionResourcesVersion } jar { diff --git a/illaclient/src/test/java/illarion/client/util/translation/TranslateTaskTest.java b/illaclient/src/test/java/illarion/client/util/translation/TranslateTaskTest.java deleted file mode 100644 index 8a3454136..000000000 --- a/illaclient/src/test/java/illarion/client/util/translation/TranslateTaskTest.java +++ /dev/null @@ -1,277 +0,0 @@ -/* - * This file is part of the Illarion project. - * - * Copyright © 2015 - Illarion e.V. - * - * Illarion is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Illarion is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ -package illarion.client.util.translation;/* - * This file is part of the Illarion project. - * - * Copyright © 2015 - Illarion e.V. - * - * Illarion is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Illarion is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -import org.easymock.EasyMockSupport; -import org.easymock.Mock; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.testng.PowerMockObjectFactory; -import org.testng.IObjectFactory; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.ObjectFactory; -import org.testng.annotations.Test; - -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; - -import static org.easymock.EasyMock.expect; - -/** - * @author Martin Karing <nitram@illarion.org> - */ -@PrepareForTest({TranslateSentenceTask.class, TranslateTask.class}) -@PowerMockIgnore({"javax.management.*", "javax.xml.parsers.*", "com.sun.org.apache.xerces.internal.jaxp.*", - "ch.qos.logback.*", "org.slf4j.*"}) -public class TranslateTaskTest extends EasyMockSupport { - @Mock - private ExecutorService service; - @Mock - private TranslationProvider provider; - @Mock - private TranslatorCallback callback; - - /** - * Test if the translation task correctly splits a complex chat line into sentences. - * - * @throws Exception - */ - @SuppressWarnings({"ConstantConditions", "unchecked", "OverlyLongMethod"}) - @Test - public void testSentenceSplit() throws Exception { - service = createMock(ExecutorService.class); - provider = createMock(TranslationProvider.class); - callback = createMock(TranslatorCallback.class); - replayAll(); - - Callable task = new TranslateTask(service, provider, TranslationDirection.EnglishToGerman, - "Hello. This is a multi sentence line! It should be split. Even if the last part is not terminated", - callback); - verifyAll(); - resetAll(); - - // until now nothing should happen to ensure that the creation of the task is very cheap - // the next thing is calling the task and that should actually do things. - Future firstFuture = createMock(Future.class); - expect(firstFuture.get()).andReturn("Hallo.").anyTimes(); - TranslateSentenceTask task1Mock = PowerMock.createMock(TranslateSentenceTask.class); - PowerMock.expectStrictNew(TranslateSentenceTask.class, - new Class[]{TranslationProvider.class, TranslationDirection.class, String.class}, - provider, TranslationDirection.EnglishToGerman, "Hello.") - .andReturn(task1Mock); - expect(service.submit(task1Mock)).andReturn(firstFuture); - - Future secondFuture = createMock(Future.class); - expect(secondFuture.get()).andReturn("Das ist eine Zeile mit mehreren Sätzen.").anyTimes(); - TranslateSentenceTask task2Mock = PowerMock.createMock(TranslateSentenceTask.class); - PowerMock.expectStrictNew(TranslateSentenceTask.class, - new Class[]{TranslationProvider.class, TranslationDirection.class, String.class}, - provider, TranslationDirection.EnglishToGerman, - "This is a multi sentence line!").andReturn(task2Mock); - expect(service.submit(task2Mock)).andReturn(secondFuture); - - Future thirdFuture = createMock(Future.class); - expect(thirdFuture.get()).andReturn("Sie sollte geteilt werden.").anyTimes(); - TranslateSentenceTask task3Mock = PowerMock.createMock(TranslateSentenceTask.class); - PowerMock.expectStrictNew(TranslateSentenceTask.class, - new Class[]{TranslationProvider.class, TranslationDirection.class, String.class}, - provider, TranslationDirection.EnglishToGerman, - "It should be split.").andReturn(task3Mock); - expect(service.submit(task3Mock)).andReturn(thirdFuture); - - Future fourthFuture = createMock(Future.class); - expect(fourthFuture.get()).andReturn("Auch wenn der letzte Teil nicht abgeschlossen ist").anyTimes(); - TranslateSentenceTask task4Mock = PowerMock.createMock(TranslateSentenceTask.class); - PowerMock.expectStrictNew(TranslateSentenceTask.class, - new Class[]{TranslationProvider.class, TranslationDirection.class, String.class}, - provider, TranslationDirection.EnglishToGerman, - "Even if the last part is not terminated").andReturn(task4Mock); - expect(service.submit(task4Mock)).andReturn(fourthFuture); - - callback.sendTranslation("Hallo. Das ist eine Zeile mit mehreren Sätzen. Sie sollte geteilt werden. Auch wenn" + - " der letzte Teil nicht abgeschlossen ist"); - - PowerMock.replay(task1Mock, task2Mock, task3Mock, task4Mock); - PowerMock.replay(TranslateSentenceTask.class); - replayAll(); - // Everything we expect is recorded. Let's do this. - - task.call(); - - PowerMock.verify(task1Mock, task2Mock, task3Mock, task4Mock); - PowerMock.verify(TranslateSentenceTask.class); - verifyAll(); - } - - /** - * Test if the translation task correctly excludes the default headers from the text. - * - * @throws Exception - */ - @SuppressWarnings({"ConstantConditions", "unchecked"}) - @Test - public void testHeaderExclusion1() throws Exception { - service = createMock(ExecutorService.class); - provider = createMock(TranslationProvider.class); - callback = createMock(TranslatorCallback.class); - replayAll(); - - Callable task = new TranslateTask(service, provider, TranslationDirection.EnglishToGerman, - "You hear: ALL YOUR BASE ARE BELONG TO US.", - callback); - verifyAll(); - resetAll(); - - // until now nothing should happen to ensure that the creation of the task is very cheap - // the next thing is calling the task and that should actually do things. - Future translationFuture = createMock(Future.class); - expect(translationFuture.get()).andReturn("ALL DEINE STÜTZPUNKT SIND GEHÖREN UNS.").anyTimes(); - TranslateSentenceTask sentenceTask = PowerMock.createMock(TranslateSentenceTask.class); - PowerMock.expectStrictNew(TranslateSentenceTask.class, - new Class[]{TranslationProvider.class, TranslationDirection.class, String.class}, - provider, TranslationDirection.EnglishToGerman, "ALL YOUR BASE ARE BELONG TO US.") - .andReturn(sentenceTask); - expect(service.submit(sentenceTask)).andReturn(translationFuture); - - callback.sendTranslation("You hear: ALL DEINE STÜTZPUNKT SIND GEHÖREN UNS."); - - PowerMock.replay(sentenceTask); - PowerMock.replay(TranslateSentenceTask.class); - replayAll(); - // Everything we expect is recorded. Let's do this. - - task.call(); - - PowerMock.verify(sentenceTask); - PowerMock.verify(TranslateSentenceTask.class); - verifyAll(); - } - - /** - * Test if the translation task correctly excludes headers that contain generic parts (names) from the text. - * - * @throws Exception - */ - @SuppressWarnings({"ConstantConditions", "unchecked"}) - @Test - public void testHeaderExclusion2() throws Exception { - service = createMock(ExecutorService.class); - provider = createMock(TranslationProvider.class); - callback = createMock(TranslatorCallback.class); - replayAll(); - - Callable task = new TranslateTask(service, provider, TranslationDirection.EnglishToGerman, - "Somebody says: ALL YOUR BASE ARE BELONG TO US.", - callback); - verifyAll(); - resetAll(); - - // until now nothing should happen to ensure that the creation of the task is very cheap - // the next thing is calling the task and that should actually do things. - Future translationFuture = createMock(Future.class); - expect(translationFuture.get()).andReturn("ALL DEINE STÜTZPUNKT SIND GEHÖREN UNS.").anyTimes(); - TranslateSentenceTask sentenceTask = PowerMock.createMock(TranslateSentenceTask.class); - PowerMock.expectStrictNew(TranslateSentenceTask.class, - new Class[]{TranslationProvider.class, TranslationDirection.class, String.class}, - provider, TranslationDirection.EnglishToGerman, "ALL YOUR BASE ARE BELONG TO US.") - .andReturn(sentenceTask); - expect(service.submit(sentenceTask)).andReturn(translationFuture); - - callback.sendTranslation("Somebody says: ALL DEINE STÜTZPUNKT SIND GEHÖREN UNS."); - - PowerMock.replay(sentenceTask); - PowerMock.replay(TranslateSentenceTask.class); - replayAll(); - // Everything we expect is recorded. Let's do this. - - task.call(); - - PowerMock.verify(sentenceTask); - PowerMock.verify(TranslateSentenceTask.class); - verifyAll(); - } - - /** - * Test if the translation task correctly identifies and excludes OOC marks from the translation. - * - * @throws Exception - */ - @SuppressWarnings({"ConstantConditions", "unchecked"}) - @Test - public void testHeaderExclusionOoc() throws Exception { - service = createMock(ExecutorService.class); - provider = createMock(TranslationProvider.class); - callback = createMock(TranslatorCallback.class); - replayAll(); - - Callable task = new TranslateTask(service, provider, TranslationDirection.EnglishToGerman, - "Somebody says: ((ALL YOUR BASE ARE BELONG TO US.))", - callback); - verifyAll(); - resetAll(); - - // until now nothing should happen to ensure that the creation of the task is very cheap - // the next thing is calling the task and that should actually do things. - Future translationFuture = createMock(Future.class); - expect(translationFuture.get()).andReturn("ALL DEINE STÜTZPUNKT SIND GEHÖREN UNS.").anyTimes(); - TranslateSentenceTask sentenceTask = PowerMock.createMock(TranslateSentenceTask.class); - PowerMock.expectStrictNew(TranslateSentenceTask.class, - new Class[]{TranslationProvider.class, TranslationDirection.class, String.class}, - provider, TranslationDirection.EnglishToGerman, "ALL YOUR BASE ARE BELONG TO US.") - .andReturn(sentenceTask); - expect(service.submit(sentenceTask)).andReturn(translationFuture); - - callback.sendTranslation("Somebody says: ((ALL DEINE STÜTZPUNKT SIND GEHÖREN UNS.))"); - - PowerMock.replay(sentenceTask); - PowerMock.replay(TranslateSentenceTask.class); - replayAll(); - // Everything we expect is recorded. Let's do this. - - task.call(); - - PowerMock.verify(sentenceTask); - PowerMock.verify(TranslateSentenceTask.class); - verifyAll(); - } - - @BeforeMethod - public void prepareTests() { - resetAll(); - PowerMock.reset(TranslateSentenceTask.class); - } - - @ObjectFactory - public IObjectFactory getObjectFactory() { - return new PowerMockObjectFactory(); - } -} diff --git a/illacommon/build.gradle b/illacommon/build.gradle index 29557a69b..adcbbd33e 100644 --- a/illacommon/build.gradle +++ b/illacommon/build.gradle @@ -16,19 +16,20 @@ import de.undercouch.gradle.tasks.download.Download apply plugin: 'java' +apply plugin: 'java-library' apply plugin: 'maven-publish' apply from: '../versions.gradle' archivesBaseName = 'illarion_common' dependencies { - compile group: 'org.jetbrains', name: 'annotations', version: '15.0' - compile group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'log4j-over-slf4j', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion - compile group: 'org.ogce', name: 'xpp3', version: '1.1.6' - compile group: 'org.bushe', name: 'eventbus', version: '1.4' - compile group: 'biz.futureware.mantis', name: 'mantis-axis-soap-client', version: '1.2.19' + api group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion + api group: 'org.slf4j', name: 'log4j-over-slf4j', version: project.ext.slf4jVersion + api group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion + implementation group: 'org.ogce', name: 'xpp3', version: '1.1.6' + implementation group: 'org.bushe', name: 'eventbus', version: '1.4' + implementation group: 'biz.futureware.mantis', name: 'mantis-axis-soap-client', version: '1.2.19' + api 'com.google.code.findbugs:jsr305:3.0.2' } processResources.dependsOn("downloadSkills") @@ -47,16 +48,17 @@ task downloadSkills(type: Download) { jar { dependsOn { gitVersion } manifest { - attributes \ - 'Permissions': 'all-permissions', \ - 'Codebase': 'illarion.org', \ - 'Trusted-Library': true, \ - 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), \ - 'Built-By': System.getProperty('user.name'), \ - 'Built-JDK': System.getProperty('java.version'), \ - 'Implementation-Title': 'Illarion Common Library', \ - 'Implementation-Vendor': 'Illarion e.V.', \ - 'Implementation-Version': project.ext.fullVersion + attributes( + 'Permissions': 'all-permissions', + 'Codebase': 'illarion.org', + 'Trusted-Library': true, + 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), + 'Built-By': System.getProperty('user.name'), + 'Built-JDK': System.getProperty('java.version'), + 'Implementation-Title': 'Illarion Common Library', + 'Implementation-Vendor': 'Illarion e.V.', + 'Implementation-Version': project.ext.fullVersion + ) } } diff --git a/illacommon/src/main/java/illarion/common/memory/MemoryPool.java b/illacommon/src/main/java/illarion/common/memory/MemoryPool.java index e9947fb62..d8859c825 100644 --- a/illacommon/src/main/java/illarion/common/memory/MemoryPool.java +++ b/illacommon/src/main/java/illarion/common/memory/MemoryPool.java @@ -3,6 +3,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.lang.reflect.InvocationTargetException; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; @@ -26,8 +27,8 @@ public T get (Class cls) { if (obj == null) { // There is no free object in queue --> allocate a new one try { - obj = cls.newInstance(); - } catch (InstantiationException | IllegalAccessException e) { + obj = cls.getDeclaredConstructor().newInstance(); + } catch (NoSuchMethodException | InvocationTargetException |InstantiationException | IllegalAccessException e) { throw new MemoryAllocatorException(cls, e); } } diff --git a/illacompiler/build.gradle b/illacompiler/build.gradle index 22b4bf209..6d48a69bc 100644 --- a/illacompiler/build.gradle +++ b/illacompiler/build.gradle @@ -13,8 +13,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -import proguard.gradle.ProGuardTask - apply plugin: 'java' apply plugin: 'application' apply from: '../versions.gradle' @@ -23,78 +21,42 @@ archivesBaseName = 'illarion_compiler' mainClassName = 'illarion.compile.Compiler' dependencies { - compile project(':common') - compile project(':easynpc') - compile project(':easyquest') - compile group: 'commons-cli', name: 'commons-cli', version: '1.4' - compile group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion - compile group: 'ch.qos.logback', name: 'logback-classic', version: project.ext.logbackVersion + implementation project(':easynpc') + implementation project(':easyquest') + implementation project(':common') + implementation group: 'commons-cli', name: 'commons-cli', version: '1.4' + implementation group: 'org.slf4j', name: 'jul-to-slf4j', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion + implementation group: 'ch.qos.logback', name: 'logback-classic', version: project.ext.logbackVersion + implementation group: 'com.mxgraph', name: 'jgraphx', version: '3.7.4' } jar { dependsOn { gitVersion } manifest { - attributes \ - 'Main-Class': 'illarion.compile.Compiler', \ - 'Permissions': 'all-permissions', \ - 'Codebase': 'illarion.org', \ - 'Application-Name': 'Illarion Compiler', \ - 'Application-Library-Allowable-Codebase': 'illarion.org', \ - 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), \ - 'Built-By': System.getProperty('user.name'), \ - 'Built-JDK': System.getProperty('java.version'), \ - 'Implementation-Title': 'Illarion Compiler', \ - 'Implementation-Vendor': 'Illarion e.V.', \ - 'Implementation-Version': project.ext.fullVersion - } -} - -task proguard(type: ProGuardTask, dependsOn: 'jar') { - final def mainFile = new File(project.buildDir, "libs/${project.archivesBaseName}-${project.version}.jar") - - injars(mainFile) - - configurations.runtime.each { File file -> - if (file.absolutePath.startsWith(System.getProperty('java.home'))) { - libraryjars file.absolutePath - } else if (!file.equals(mainFile)) { - def filter = "!META-INF/*,!META-INF/plexus/*,!META-INF/sisu/*,!META-INF/maven/**,!about.html,!LICENSE," + - "!OSGI-OPT/**,!**/packageinfo,!**.java,!xmlns/**" - if (file.absolutePath.contains("xpp3") || file.absolutePath.contains("axis-jaxrpc")) { - filter += ",!javax/xml/namespace/QName.class" - } - if (file.absolutePath.contains("illarion")) { - filter += ",!*.png,!logback.xml,!logback-to-file.xml" - filter += ",!Books.dat" - filter += ",!Chars.dat" - filter += ",!Cloth.dat" - filter += ",!Effects.dat" - filter += ",!Gui.dat" - filter += ",!Overlays.dat" - filter += ",!Runes.dat" - filter += ",!Sounds.dat" - filter += ",!Tiles.dat" - } - injars([filter: filter], file) - } + attributes( + 'Main-Class': 'illarion.compile.Compiler', + 'Permissions': 'all-permissions', + 'Codebase': 'illarion.org', + 'Application-Name': 'Illarion Compiler', + 'Application-Library-Allowable-Codebase': 'illarion.org', + 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), + 'Built-By': System.getProperty('user.name'), + 'Built-JDK': System.getProperty('java.version'), + 'Implementation-Title': 'Illarion Compiler', + 'Implementation-Vendor': 'Illarion e.V.', + 'Implementation-Version': project.ext.fullVersion + ) } - - configuration new File(project.projectDir, "compiler.pro") - - libraryjars files("${System.getProperty('java.home')}/lib/jce.jar") - libraryjars files("${System.getProperty('java.home')}/lib/rt.jar") - - outjars new File(project.buildDir, "compiler.jar") } - if (project.hasProperty('compilerDir')) { - task publishBundle(type: Copy, dependsOn: 'proguard') { + task publishBundle(type: Copy) { from new File(project.buildDir, "compiler.jar").absolutePath into file(project.compilerDir) } task publish(dependsOn: "publishBundle") {} } -build.dependsOn("proguard") +build diff --git a/illacompiler/compiler.pro b/illacompiler/compiler.pro deleted file mode 100644 index e98c15a1c..000000000 --- a/illacompiler/compiler.pro +++ /dev/null @@ -1,72 +0,0 @@ --target 1.8 - --dontoptimize --optimizationpasses 10 --allowaccessmodification --mergeinterfacesaggressively --optimizations !code/allocation/variable - --dontobfuscate - --renamesourcefileattribute SourceFile --keepattributes SourceFile, LineNumberTable --keepattributes *Annotation* - --allowaccessmodification - --keep public class illarion.compile.Compiler { - public static void main(java.lang.String[]); -} - --keepclassmembers class * { - @illarion.common.util.CalledByReflection *; -} - --keepclassmembers class * implements java.io.Serializable { - static final long serialVersionUID; - static final java.io.ObjectStreamField[] serialPersistentFields; - private void writeObject(java.io.ObjectOutputStream); - private void readObject(java.io.ObjectInputStream); - java.lang.Object writeReplace(); - java.lang.Object readResolve(); -} - --keep enum illarion.easynpc.data.* - --keepclassmembers enum illarion.easynpc.data.* { - public static **[] values(); -} - --keep class ch.qos.logback.core.ConsoleAppender { *; } --keep class ch.qos.logback.classic.LoggerContext { *; } --keep class ch.qos.logback.classic.encoder.PatternLayoutEncoder { *; } --keep class ch.qos.logback.classic.filter.LevelFilter { *; } - --keep public class ch.qos.logback.core.spi.FilterReply { - public static **[] values(); -} --keep public class ch.qos.logback.classic.Level { - public static *; -} --keep public class ch.qos.logback.classic.spi.** { *; } - --keep class org.xmlpull.mxp1.MXParserFactory - --keep class org.slf4j.impl.** - --dontwarn com.sun.** --dontwarn javax.servlet.** --dontwarn javax.mail.** --dontwarn javax.jms.** --dontwarn javax.xml.** --dontwarn org.pushingpixels.** --dontwarn org.apache.commons.** --dontwarn org.apache.axis.** --dontwarn org.mantisbt.** --dontwarn org.osgi.service.** --dontnote javax.xml.** --dontwarn ch.qos.logback.classic.** --dontwarn ch.qos.logback.core.joran.conditional.PropertyEvalScriptBuilder --dontwarn org.codehaus.janino.** --dontwarn org.apache.log4j.** --dontwarn org.slf4j.impl.** diff --git a/illadownload/build.gradle b/illadownload/build.gradle index 50abb710f..aca0cff07 100644 --- a/illadownload/build.gradle +++ b/illadownload/build.gradle @@ -15,10 +15,13 @@ */ import com.install4j.gradle.Install4jTask +plugins { + id 'application' + id 'org.openjfx.javafxplugin' version '0.0.8' +} + apply plugin: 'java' -apply plugin: 'application' apply plugin: 'maven-publish' -apply from: '../javafx.plugin' apply from: '../versions.gradle' apply plugin: 'install4j' @@ -30,37 +33,41 @@ archivesBaseName = 'illarion_download' mainClassName = 'illarion.download.Application' dependencies { - compile project(':common') - compile group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'jul-to-slf4j', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'log4j-over-slf4j', version: project.ext.slf4jVersion - compile group: 'ch.qos.logback', name: 'logback-classic', version: project.ext.logbackVersion - compile group: 'org.ogce', name: 'xpp3', version: '1.1.6' - compile group: 'org.bushe', name: 'eventbus', version: '1.4' - compile group: 'com.google.guava', name: 'guava', version: '21.0' - compile group: 'org.eclipse.aether', name: 'aether-api', version: '1.1.0' - compile group: 'org.eclipse.aether', name: 'aether-connector-basic', version: '1.1.0' - compile group: 'org.eclipse.aether', name: 'aether-transport-http', version: '1.1.0' - compile group: 'org.apache.maven', name: 'maven-aether-provider', version: '3.3.9' + implementation project(':common') + implementation group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'jul-to-slf4j', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'log4j-over-slf4j', version: project.ext.slf4jVersion + implementation group: 'ch.qos.logback', name: 'logback-classic', version: project.ext.logbackVersion + implementation group: 'org.ogce', name: 'xpp3', version: '1.1.6' + implementation group: 'org.bushe', name: 'eventbus', version: '1.4' + implementation group: 'com.google.guava', name: 'guava', version: '30.0-jre' + implementation group: 'org.eclipse.aether', name: 'aether-api', version: '1.1.0' + implementation group: 'org.eclipse.aether', name: 'aether-connector-basic', version: '1.1.0' + implementation group: 'org.eclipse.aether', name: 'aether-transport-http', version: '1.1.0' + implementation group: 'org.apache.maven', name: 'maven-aether-provider', version: '3.3.9' } jar { dependsOn { gitVersion } manifest { - attributes \ - 'Main-Class': 'illarion.download.gui.GuiApplication', \ - 'JavaFX-Feature-Proxy': 'None', \ - 'Permissions': 'all-permissions', \ - 'Codebase': 'illarion.org', \ - 'Application-Name': 'Illarion Launcher', \ - 'Application-Library-Allowable-Codebase': 'illarion.org', \ - 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), \ - 'Built-By': System.getProperty('user.name'), \ - 'Built-JDK': System.getProperty('java.version'), \ - 'Implementation-Title': 'Illarion Launcher', \ - 'Implementation-Vendor': 'Illarion e.V.',\ - 'Implementation-Version': project.ext.fullVersion + attributes( + 'Main-Class': 'illarion.download.Application', + 'JavaFX-Feature-Proxy': 'None', + 'Permissions': 'all-permissions', + 'Codebase': 'illarion.org', + 'Application-Name': 'Illarion Launcher', + 'Application-Library-Allowable-Codebase': 'illarion.org', + 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), + 'Built-By': System.getProperty('user.name'), + 'Built-JDK': System.getProperty('java.version'), + 'Implementation-Title': 'Illarion Launcher', + 'Implementation-Vendor': 'Illarion e.V.', + 'Implementation-Version': project.ext.fullVersion + ) + } + from { + configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } } @@ -77,55 +84,8 @@ if (hasInstall4jTargetDir) { } } -startScripts.dependsOn { - jfxJar -} - javafx { - id 'IllaLauncher' - appID 'IllaLauncher' - appName 'Illarion-Launcher' - mainClass project.mainClassName - - embedLauncher = true - - category = 'Games' - copyright = 'Copyright (c) 2013 Illarion e.V.' - description = 'This is the downloader and launcher of Illarion.' - licenseType = 'AGPLv3' - vendor = 'Illarion e.V.' - installSystemWide = false - menu = true - shortcut = true - - if (project.hasProperty('keyFile')) { - apply from: project.keyFile - releaseKey { - alias = project.ext.storealias - keyStore = project.ext.keystore - storePass = project.ext.storepass - storeType = project.ext.storetype - } - signingMode 'release' - } - packaging 'none' - - profiles { - windows { - javaRuntime = '' - } - macosx { - javaRuntime = '' - } - linux { - javaRuntime = '' - } - } - - width = 620 - height = 410 - embedJNLP = true - codebase = 'https://illarion.org/media/java/launcher' + modules = [ 'javafx.controls', 'javafx.fxml' ] } if (hasTargetDistDir) { diff --git a/illadownload/src/main/java/illarion/download/gui/controller/ApplicationController.java b/illadownload/src/main/java/illarion/download/gui/controller/ApplicationController.java index 872ab8d00..59ee52bf6 100644 --- a/illadownload/src/main/java/illarion/download/gui/controller/ApplicationController.java +++ b/illadownload/src/main/java/illarion/download/gui/controller/ApplicationController.java @@ -48,21 +48,19 @@ public void initialize(URL location, ResourceBundle resources) { @Override public void setModel(@Nonnull GuiModel model) { super.setModel(model); - if (getModel().getHostServices().getWebContext() == null) { - rootPane.setOnMousePressed(me -> { - if (me.getButton() != MouseButton.MIDDLE) { - initialX = me.getSceneX(); - initialY = me.getSceneY(); - } - }); + rootPane.setOnMousePressed(me -> { + if (me.getButton() != MouseButton.MIDDLE) { + initialX = me.getSceneX(); + initialY = me.getSceneY(); + } + }); - rootPane.setOnMouseDragged(me -> { - if (me.getButton() != MouseButton.MIDDLE) { - getModel().getStage().setX(me.getScreenX() - initialX); - getModel().getStage().setY(me.getScreenY() - initialY); - } - }); - } + rootPane.setOnMouseDragged(me -> { + if (me.getButton() != MouseButton.MIDDLE) { + getModel().getStage().setX(me.getScreenX() - initialX); + getModel().getStage().setY(me.getScreenY() - initialY); + } + }); } @FXML diff --git a/illadownload/src/main/java/illarion/download/gui/view/ApplicationView.java b/illadownload/src/main/java/illarion/download/gui/view/ApplicationView.java index 213f28a7f..d0b74a6c0 100644 --- a/illadownload/src/main/java/illarion/download/gui/view/ApplicationView.java +++ b/illadownload/src/main/java/illarion/download/gui/view/ApplicationView.java @@ -35,21 +35,9 @@ class ApplicationView extends AnchorPane implements SceneUpdater { private static final Logger log = LoggerFactory.getLogger(ApplicationView.class); ApplicationView(@Nonnull GuiModel model) throws IOException { - boolean isApplet; - try { - isApplet = model.getHostServices().getWebContext() != null; - } catch (Exception e) { - isApplet = false; - } - Parent root = Util.loadFXML("applicationFrame.fxml", model, Util.loadResourceBundle("applicationFrame")); - if (isApplet) { - root.getStyleClass().add("applet"); - getHeader().setVisible(false); - } else { - root.getStyleClass().add("application"); - } + root.getStyleClass().add("application"); getChildren().add(root); maximizeOnAnchorPane(root); @@ -74,11 +62,6 @@ private Pane getFooterPane() { return (Pane) lookupRequiredNode("#footer"); } - @Nonnull - private Node getHeader() { - return lookupRequiredNode("#header"); - } - final void setContent(@Nonnull Node content, @Nonnull Node footer) { getContentPane().getChildren().add(content); getFooterPane().getChildren().add(footer); diff --git a/illadownload/src/main/java/illarion/download/launcher/JavaLauncher.java b/illadownload/src/main/java/illarion/download/launcher/JavaLauncher.java index 5b18eefc1..b1a610b46 100644 --- a/illadownload/src/main/java/illarion/download/launcher/JavaLauncher.java +++ b/illadownload/src/main/java/illarion/download/launcher/JavaLauncher.java @@ -111,9 +111,9 @@ private static boolean isJavaExecutableWorking(@Nonnull Path executable) { try (BufferedReader reader = new BufferedReader( new InputStreamReader(process.getInputStream(), Charset.defaultCharset()))) { - Pattern versionRegex = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)_(\\d+)"); + Pattern versionRegex = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)"); Optional versionMatcher = reader.lines() - .filter(s -> s.startsWith("java version")) + .filter(s -> s.contains("version")) .map(versionRegex::matcher) .filter(Matcher::find) .findFirst(); @@ -123,12 +123,10 @@ private static boolean isJavaExecutableWorking(@Nonnull Path executable) { int mainVersion = Integer.parseInt(matcher.group(1)); int majorVersion = Integer.parseInt(matcher.group(2)); int minorVersion = Integer.parseInt(matcher.group(3)); - int buildNumber = Integer.parseInt(matcher.group(4)); - log.info("Matched Java version to {}.{}.{}_b{}", - mainVersion, majorVersion, minorVersion, buildNumber); + log.info("Matched Java version to {}.{}.{}", mainVersion, majorVersion, minorVersion); - return (mainVersion >= 1) && (majorVersion >= 8) && (buildNumber >= 0); + return (mainVersion >= 14) && (majorVersion >= 0); } } finally { process.destroy(); diff --git a/illadownload/src/main/java/illarion/download/launcher/MacOsXJavaExecutableIterable.java b/illadownload/src/main/java/illarion/download/launcher/MacOsXJavaExecutableIterable.java index 213ce2b58..8f83bf7e5 100644 --- a/illadownload/src/main/java/illarion/download/launcher/MacOsXJavaExecutableIterable.java +++ b/illadownload/src/main/java/illarion/download/launcher/MacOsXJavaExecutableIterable.java @@ -144,7 +144,7 @@ private Path getJavaHomeDirectory() { javaHomeDirectoryFetched = true; LOGGER.warn("Platform independent locating tries for java executable failed. Entering MacOS mode."); try { - ProcessBuilder processBuilder = new ProcessBuilder("/usr/libexec/java_home", "-v", "1.7"); + ProcessBuilder processBuilder = new ProcessBuilder("/usr/libexec/java_home", "-v", "14"); processBuilder.redirectErrorStream(true); Process process = processBuilder.start(); //noinspection resource diff --git a/illadownload/src/main/java/illarion/download/maven/MavenDownloader.java b/illadownload/src/main/java/illarion/download/maven/MavenDownloader.java index 9df94dce5..a52debbea 100644 --- a/illadownload/src/main/java/illarion/download/maven/MavenDownloader.java +++ b/illadownload/src/main/java/illarion/download/maven/MavenDownloader.java @@ -272,7 +272,7 @@ public Collection downloadArtifact( } private void setupRepositories() { - repositories.add(setupRepository("central", "http://repo1.maven.org/maven2/", + repositories.add(setupRepository("central", "https://repo1.maven.org/maven2/", setupRepository("ibiblio.org", "http://mirrors.ibiblio.org/maven2/"), setupRepository("antelink", ".com/content/repositories/central/"), setupRepository("exist", "http://repo.exist.com/maven2/"), diff --git a/illaeasynpc/build.gradle b/illaeasynpc/build.gradle index ed5705785..b54a9cd13 100644 --- a/illaeasynpc/build.gradle +++ b/illaeasynpc/build.gradle @@ -42,22 +42,22 @@ configurations { } dependencies { - compile project(':common') - compile group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'jul-to-slf4j', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'log4j-over-slf4j', version: project.ext.slf4jVersion - compile group: 'ch.qos.logback', name: 'logback-classic', version: project.ext.logbackVersion - compile group: 'org.bushe', name: 'eventbus', version: '1.4' - compile group: 'com.github.insubstantial', name: 'substance', version: project.ext.insubstantialVersion - compile group: 'com.github.insubstantial', name: 'substance-flamingo', version: project.ext.insubstantialVersion - compile group: 'com.fifesoft', name: 'rsyntaxtextarea', version: '2.6.1' - compile group: 'com.fifesoft', name: 'autocomplete', version: '2.6.1' - compile group: 'org.antlr', name: 'antlr4-runtime', version: '4.7' - - antlr4 group: 'org.antlr', name: 'antlr4', version: '4.7' - - runtime group: 'org.illarion', name: 'rsc_tables', version: project.ext.illarionResourcesVersion + implementation project(':common') + implementation group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'jul-to-slf4j', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'log4j-over-slf4j', version: project.ext.slf4jVersion + implementation group: 'ch.qos.logback', name: 'logback-classic', version: project.ext.logbackVersion + implementation group: 'org.bushe', name: 'eventbus', version: '1.4' + implementation group: 'com.github.insubstantial', name: 'substance', version: project.ext.insubstantialVersion + implementation group: 'com.github.insubstantial', name: 'substance-flamingo', version: project.ext.insubstantialVersion + implementation group: 'com.fifesoft', name: 'rsyntaxtextarea', version: '3.1.0' + implementation group: 'com.fifesoft', name: 'autocomplete', version: '3.1.0' + implementation group: 'org.antlr', name: 'antlr4-runtime', version: '4.9' + + antlr4 group: 'org.antlr', name: 'antlr4', version: '4.9' + + runtimeOnly group: 'org.illarion', name: 'rsc_tables', version: project.ext.illarionResourcesVersion } task antlrOutputDir { @@ -83,11 +83,6 @@ task generateGrammarSource(dependsOn: antlrOutputDir, type: JavaExec) { } -tasks.withType(FindBugs) { - exclude '**/illarion/easynpc/grammar/*' - excludeFilter = file("$projectDir/findbugs-exclude.xml") -} - tasks.withType(Pmd) { exclude '**/illarion/easynpc/grammar/*' } @@ -100,18 +95,19 @@ compileJava { jar { dependsOn { gitVersion } manifest { - attributes \ - 'Main-Class': 'illarion.easynpc.gui.MainFrame', \ - 'Permissions': 'all-permissions', \ - 'Codebase': 'illarion.org', \ - 'Application-Name': 'Illarion easyNPC editor', \ - 'Application-Library-Allowable-Codebase': 'illarion.org', \ - 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), \ - 'Built-By': System.getProperty('user.name'), \ - 'Built-JDK': System.getProperty('java.version'), \ - 'Implementation-Title': 'Illarion easyNPC Editor', \ - 'Implementation-Vendor': 'Illarion e.V.', \ + attributes( + 'Main-Class': 'illarion.easynpc.gui.MainFrame', + 'Permissions': 'all-permissions', + 'Codebase': 'illarion.org', + 'Application-Name': 'Illarion easyNPC editor', + 'Application-Library-Allowable-Codebase': 'illarion.org', + 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), + 'Built-By': System.getProperty('user.name'), + 'Built-JDK': System.getProperty('java.version'), + 'Implementation-Title': 'Illarion easyNPC Editor', + 'Implementation-Vendor': 'Illarion e.V.', 'Implementation-Version': project.ext.fullVersion + ) } } diff --git a/illaeasyquest/build.gradle b/illaeasyquest/build.gradle index a5e819fcf..fad7a189f 100644 --- a/illaeasyquest/build.gradle +++ b/illaeasyquest/build.gradle @@ -23,16 +23,16 @@ archivesBaseName = 'illarion_easyquest' mainClassName = 'illarion.easyquest.gui.MainFrame' dependencies { - compile project(':common') - compile group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'jul-to-slf4j', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'log4j-over-slf4j', version: project.ext.slf4jVersion - compile group: 'ch.qos.logback', name: 'logback-classic', version: project.ext.logbackVersion - compile group: 'org.bushe', name: 'eventbus', version: '1.4' - compile group: 'com.github.insubstantial', name: 'substance', version: project.ext.insubstantialVersion - compile group: 'com.github.insubstantial', name: 'substance-flamingo', version: project.ext.insubstantialVersion - compile group: 'org.tinyjee.jgraphx', name: 'jgraphx', version: '3.4.1.3' + implementation project(':common') + implementation group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'jul-to-slf4j', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'log4j-over-slf4j', version: project.ext.slf4jVersion + implementation group: 'ch.qos.logback', name: 'logback-classic', version: project.ext.logbackVersion + implementation group: 'org.bushe', name: 'eventbus', version: '1.4' + implementation group: 'com.github.insubstantial', name: 'substance', version: project.ext.insubstantialVersion + implementation group: 'com.github.insubstantial', name: 'substance-flamingo', version: project.ext.insubstantialVersion + implementation group: 'org.tinyjee.jgraphx', name: 'jgraphx', version: '3.4.1.3' } processResources.dependsOn { @@ -59,18 +59,19 @@ task createFileLists { jar { dependsOn { gitVersion } manifest { - attributes \ - 'Main-Class': 'illarion.easyquest.gui.MainFrame', \ - 'Permissions': 'all-permissions', \ - 'Codebase': 'illarion.org', \ - 'Application-Name': 'Illarion easyQuest editor', \ - 'Application-Library-Allowable-Codebase': 'illarion.org', \ - 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), \ - 'Built-By': System.getProperty('user.name'), \ - 'Built-JDK': System.getProperty('java.version'), \ - 'Implementation-Title': 'Illarion easyQuest Editor', \ - 'Implementation-Vendor': 'Illarion e.V.', \ + attributes( + 'Main-Class': 'illarion.easyquest.gui.MainFrame', + 'Permissions': 'all-permissions', + 'Codebase': 'illarion.org', + 'Application-Name': 'Illarion easyQuest editor', + 'Application-Library-Allowable-Codebase': 'illarion.org', + 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), + 'Built-By': System.getProperty('user.name'), + 'Built-JDK': System.getProperty('java.version'), + 'Implementation-Title': 'Illarion easyQuest Editor', + 'Implementation-Vendor': 'Illarion e.V.', 'Implementation-Version': project.ext.fullVersion + ) } } diff --git a/illagameengine-libgdx/build.gradle b/illagameengine-libgdx/build.gradle index bc3bd2fcc..66567e351 100644 --- a/illagameengine-libgdx/build.gradle +++ b/illagameengine-libgdx/build.gradle @@ -13,30 +13,32 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -apply plugin: 'java' +apply plugin: 'java-library' apply plugin: 'maven-publish' +apply from: '../versions.gradle' archivesBaseName = 'illarion_engine_libgdx' dependencies { - compile project(':engine') - compile group: 'com.badlogicgames.gdx', name: 'gdx', version: '1.9.10' - compile group: 'com.badlogicgames.gdx', name: 'gdx-backend-lwjgl', version: '1.9.10' - runtime group: 'com.badlogicgames.gdx', name: 'gdx-platform', version: '1.9.10', classifier: 'natives-desktop' + api project(':engine') + api group: 'com.badlogicgames.gdx', name: 'gdx', version: '1.9.12' + api group: 'com.badlogicgames.gdx', name: 'gdx-backend-lwjgl', version: '1.9.12' + runtimeOnly group: 'com.badlogicgames.gdx', name: 'gdx-platform', version: '1.9.12', classifier: 'natives-desktop' } jar { dependsOn { gitVersion } manifest { - attributes \ - 'Permissions': 'all-permissions', \ - 'Codebase': 'illarion.org', \ - 'Trusted-Library': true, \ - 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), \ - 'Built-By': System.getProperty('user.name'), \ - 'Built-JDK': System.getProperty('java.version'), \ - 'Implementation-Title': 'Illarion Game Engine - libGDX Backend', \ - 'Implementation-Vendor': 'Illarion e.V.', \ - 'Implementation-Version': project.ext.fullVersion + attributes( + 'Permissions': 'all-permissions', + 'Codebase': 'illarion.org', + 'Trusted-Library': true, + 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), + 'Built-By': System.getProperty('user.name'), + 'Built-JDK': System.getProperty('java.version'), + 'Implementation-Title': 'Illarion Game Engine - libGDX Backend', + 'Implementation-Vendor': 'Illarion e.V.', + 'Implementation-Version': project.ext.fullVersion + ) } } diff --git a/illagameengine-nifty/build.gradle b/illagameengine-nifty/build.gradle index c87190639..babb74790 100644 --- a/illagameengine-nifty/build.gradle +++ b/illagameengine-nifty/build.gradle @@ -13,31 +13,32 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -apply plugin: 'java' +apply plugin: 'java-library' apply plugin: 'maven-publish' apply from: '../versions.gradle' archivesBaseName = 'illarion_engine_nifty' dependencies { - compile project(':common') - compile project(':engine') - compile group: 'com.github.nifty-gui', name: 'nifty', version: project.ext.niftyGuiVersion + api project(':common') + api project(':engine') + api group: 'com.github.nifty-gui', name: 'nifty', version: project.ext.niftyGuiVersion } jar { dependsOn { gitVersion } manifest { - attributes \ - 'Permissions': 'all-permissions', \ - 'Codebase': 'illarion.org', \ - 'Trusted-Library': true, \ - 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), \ - 'Built-By': System.getProperty('user.name'), \ - 'Built-JDK': System.getProperty('java.version'), \ - 'Implementation-Title': 'Illarion Game Engine - Nifty-GUI Implementation', \ - 'Implementation-Vendor': 'Illarion e.V.', \ - 'Implementation-Version': project.ext.fullVersion + attributes( + 'Permissions': 'all-permissions', + 'Codebase': 'illarion.org', + 'Trusted-Library': true, + 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), + 'Built-By': System.getProperty('user.name'), + 'Built-JDK': System.getProperty('java.version'), + 'Implementation-Title': 'Illarion Game Engine - Nifty-GUI Implementation', + 'Implementation-Vendor': 'Illarion e.V.', + 'Implementation-Version': project.ext.fullVersion + ) } } diff --git a/illagameengine/build.gradle b/illagameengine/build.gradle index 7f7060ca2..38aa11fac 100644 --- a/illagameengine/build.gradle +++ b/illagameengine/build.gradle @@ -13,27 +13,29 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -apply plugin: 'java' +apply plugin: 'java-library' apply plugin: 'maven-publish' archivesBaseName = 'illarion_engine' dependencies { - compile project(':common') + api project(':common') + implementation group: 'xmlpull', name: 'xmlpull', version: '1.1.3.1' } jar { dependsOn { gitVersion } manifest { - attributes \ - 'Permissions': 'all-permissions', \ - 'Codebase': 'illarion.org', \ - 'Trusted-Library': true, \ - 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), \ - 'Built-By': System.getProperty('user.name'), \ - 'Built-JDK': System.getProperty('java.version'), \ - 'Implementation-Title': 'Illarion Game Engine', \ - 'Implementation-Vendor': 'Illarion e.V.', \ - 'Implementation-Version': project.ext.fullVersion + attributes( + 'Permissions': 'all-permissions', + 'Codebase': 'illarion.org', + 'Trusted-Library': true, + 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), + 'Built-By': System.getProperty('user.name'), + 'Built-JDK': System.getProperty('java.version'), + 'Implementation-Title': 'Illarion Game Engine', + 'Implementation-Vendor': 'Illarion e.V.', + 'Implementation-Version': project.ext.fullVersion + ) } } diff --git a/illamapedit/build.gradle b/illamapedit/build.gradle index 1f67f43f9..2116abb6d 100644 --- a/illamapedit/build.gradle +++ b/illamapedit/build.gradle @@ -23,40 +23,41 @@ archivesBaseName = 'illarion_mapedit' mainClassName = 'illarion.mapedit.MapEditor' dependencies { - compile project(':common') - compile project(':engine') - compile group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'jul-to-slf4j', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion - compile group: 'org.slf4j', name: 'log4j-over-slf4j', version: project.ext.slf4jVersion - compile group: 'ch.qos.logback', name: 'logback-classic', version: project.ext.logbackVersion - compile group: 'net.sf.trove4j', name: 'trove4j', version: '3.0.3' - compile group: 'org.bushe', name: 'eventbus', version: '1.4' - compile group: 'com.googlecode.soundlibs', name: 'vorbisspi', version: '1.0.3.3' - compile group: 'com.github.insubstantial', name: 'substance', version: project.ext.insubstantialVersion - compile group: 'com.github.insubstantial', name: 'substance-flamingo', version: project.ext.insubstantialVersion - compile group: 'com.github.insubstantial', name: 'substance-swingx', version: project.ext.insubstantialVersion - runtime group: 'org.illarion', name: 'rsc_items', version: project.ext.illarionResourcesVersion - runtime group: 'org.illarion', name: 'rsc_music', version: project.ext.illarionResourcesVersion - runtime group: 'org.illarion', name: 'rsc_tables', version: project.ext.illarionResourcesVersion - runtime group: 'org.illarion', name: 'rsc_tiles', version: project.ext.illarionResourcesVersion + implementation project(':common') + implementation project(':engine') + implementation group: 'org.slf4j', name: 'slf4j-api', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'jul-to-slf4j', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: project.ext.slf4jVersion + implementation group: 'org.slf4j', name: 'log4j-over-slf4j', version: project.ext.slf4jVersion + implementation group: 'ch.qos.logback', name: 'logback-classic', version: project.ext.logbackVersion + implementation group: 'net.sf.trove4j', name: 'trove4j', version: '3.0.3' + implementation group: 'org.bushe', name: 'eventbus', version: '1.4' + implementation group: 'com.googlecode.soundlibs', name: 'vorbisspi', version: '1.0.3.3' + implementation group: 'com.github.insubstantial', name: 'substance', version: project.ext.insubstantialVersion + implementation group: 'com.github.insubstantial', name: 'substance-flamingo', version: project.ext.insubstantialVersion + implementation group: 'com.github.insubstantial', name: 'substance-swingx', version: project.ext.insubstantialVersion + runtimeOnly group: 'org.illarion', name: 'rsc_items', version: project.ext.illarionResourcesVersion + runtimeOnly group: 'org.illarion', name: 'rsc_music', version: project.ext.illarionResourcesVersion + runtimeOnly group: 'org.illarion', name: 'rsc_tables', version: project.ext.illarionResourcesVersion + runtimeOnly group: 'org.illarion', name: 'rsc_tiles', version: project.ext.illarionResourcesVersion } jar { dependsOn { gitVersion } manifest { - attributes \ - 'Main-Class': 'illarion.mapedit.MapEditor', \ - 'Permissions': 'all-permissions', \ - 'Codebase': 'illarion.org', \ - 'Application-Name': 'Illarion Mapeditor', \ - 'Application-Library-Allowable-Codebase': 'illarion.org', \ - 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), \ - 'Built-By': System.getProperty('user.name'), \ - 'Built-JDK': System.getProperty('java.version'), \ - 'Implementation-Title': 'Illarion Mapeditor', \ - 'Implementation-Vendor': 'Illarion e.V.', \ - 'Implementation-Version': project.ext.fullVersion + attributes( + 'Main-Class': 'illarion.mapedit.MapEditor', + 'Permissions': 'all-permissions', + 'Codebase': 'illarion.org', + 'Application-Name': 'Illarion Mapeditor', + 'Application-Library-Allowable-Codebase': 'illarion.org', + 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), + 'Built-By': System.getProperty('user.name'), + 'Built-JDK': System.getProperty('java.version'), + 'Implementation-Title': 'Illarion Mapeditor', + 'Implementation-Vendor': 'Illarion e.V.', + 'Implementation-Version': project.ext.fullVersion + ) } } diff --git a/javafx.plugin b/javafx.plugin deleted file mode 100644 index 9f747c4f4..000000000 --- a/javafx.plugin +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Bootstrap script for the Gradle JavaFX Plugin. - * (based on http://plugins.jasoft.fi/vaadin.plugin) - * - * The script will add the latest version of the plugin to the build script - * dependencies and apply the plugin to the project. If you do not want - * this behavior you can copy and paste the below configuration into your - * own build script and define your own repository and version for the plugin. - */ - -import org.gradle.api.GradleException; - - - -buildscript { - repositories { - mavenLocal() - maven { - name = 'BinTray' - url = 'http://dl.bintray.com/content/shemnon/javafx-gradle/' - } - maven { - name = 'CloudBees Snapshot' - url = 'http://repository-javafx-gradle-plugin.forge.cloudbees.com/snapshot' - } - ivy { - url = 'http://repository-javafx-gradle-plugin.forge.cloudbees.com/snapshot' - } - mavenCentral() - } - dependencies { - try { - assert (jfxrtDir != null) - } catch (RuntimeException re) { - ext.jfxrtDir = "." - } - - ext.searchFile = {Map places, List searchPaths, String searchID -> - File result = null; - places.each { k, v -> - if (result != null) return; - project.logger.debug("Looking for $searchID in $k") - def dir = v() - if (dir == null) { - project.logger.debug("$k not set") - } else { - project.logger.debug("$k is $dir") - searchPaths.each { s -> - if (result != null) return; - File f = new File(dir, s); - project.logger.debug("Trying $f.path") - if (f.exists() && f.file) { - project.logger.debug("found $searchID as $result") - result = f; - } - } - } - } - if (!result?.file) { - throw new GradleException("Could not find $searchID, please set one of ${places.keySet()}"); - } else { - project.logger.info("$searchID: ${result}") - return result - } - } - ext.findJFXJar = { - return searchFile([ - 'jfxrtDir in Gradle Properties': {jfxrtDir}, - 'JFXRT_HOME in System Environment': {System.env['JFXRT_HOME']}, - 'JAVA_HOME in System Environment': {System.env['JAVA_HOME']}, - 'java.home in JVM properties': {System.properties['java.home']} - ], - ['jfxrt.jar', 'lib/jfxrt.jar', 'lib/ext/jfxrt.jar', 'jre/lib/jfxrt.jar', 'jre/lib/ext/jfxrt.jar'], - 'JavaFX Runtime Jar') - } - - ext.findAntJavaFXJar = { - return searchFile([ - 'jfxrtDir in Gradle Properties': {jfxrtDir}, - 'JFXRT_HOME in System Environment': {System.env['JFXRT_HOME']}, - 'JAVA_HOME in System Environment': {System.env['JAVA_HOME']}, - 'java.home in JVM properties': {System.properties['java.home']} - ], - ['ant-javafx.jar', 'lib/ant-javafx.jar', '../lib/ant-javafx.jar'], - 'JavaFX Packager Tools') - } - - - classpath 'org.bitbucket.shemnon.javafxplugin:gradle-javafx-plugin:8.1.1' - classpath project.files(findAntJavaFXJar()) - classpath project.files(findJFXJar()) - } -} - -if (!project.plugins.findPlugin(org.bitbucket.shemnon.javafxplugin.JavaFXPlugin)) { - project.apply(plugin: org.bitbucket.shemnon.javafxplugin.JavaFXPlugin) -} \ No newline at end of file diff --git a/nifty-controls-illarion/build.gradle b/nifty-controls-illarion/build.gradle index d733a56a8..67697d54b 100644 --- a/nifty-controls-illarion/build.gradle +++ b/nifty-controls-illarion/build.gradle @@ -13,7 +13,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -apply plugin: 'java' +apply plugin: 'java-library' apply plugin: 'maven-publish' apply from: '../versions.gradle' @@ -21,24 +21,25 @@ apply from: '../versions.gradle' archivesBaseName = 'nifty-controls-illarion' dependencies { - compile project(':common') - compile group: 'com.github.nifty-gui', name: 'nifty', version: project.ext.niftyGuiVersion - compile group: 'com.github.nifty-gui', name: 'nifty-default-controls', version: project.ext.niftyGuiVersion + api project(':common') + api group: 'com.github.nifty-gui', name: 'nifty', version: project.ext.niftyGuiVersion + api group: 'com.github.nifty-gui', name: 'nifty-default-controls', version: project.ext.niftyGuiVersion } jar { dependsOn { gitVersion } manifest { - attributes \ - 'Permissions': 'all-permissions', \ - 'Codebase': 'illarion.org', \ - 'Trusted-Library': true, \ - 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), \ - 'Built-By': System.getProperty('user.name'), \ - 'Built-JDK': System.getProperty('java.version'), \ - 'Implementation-Title': 'Illarion Nifty-GUI Controls', \ - 'Implementation-Vendor': 'Illarion e.V.', \ - 'Implementation-Version': project.ext.fullVersion + attributes( + 'Permissions': 'all-permissions', + 'Codebase': 'illarion.org', + 'Trusted-Library': true, + 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), + 'Built-By': System.getProperty('user.name'), + 'Built-JDK': System.getProperty('java.version'), + 'Implementation-Title': 'Illarion Nifty-GUI Controls', + 'Implementation-Vendor': 'Illarion e.V.', + 'Implementation-Version': project.ext.fullVersion + ) } } diff --git a/nifty-controls-illarion/src/main/java/org/illarion/nifty/controls/dialog/message/builder/DialogMessageBuilder.java b/nifty-controls-illarion/src/main/java/org/illarion/nifty/controls/dialog/message/builder/DialogMessageBuilder.java index cad472ca4..4d692079e 100644 --- a/nifty-controls-illarion/src/main/java/org/illarion/nifty/controls/dialog/message/builder/DialogMessageBuilder.java +++ b/nifty-controls-illarion/src/main/java/org/illarion/nifty/controls/dialog/message/builder/DialogMessageBuilder.java @@ -16,6 +16,7 @@ package org.illarion.nifty.controls.dialog.message.builder; import de.lessvoid.nifty.builder.ControlBuilder; +import de.lessvoid.nifty.builder.ElementBuilder; import javax.annotation.Nonnull; @@ -47,8 +48,9 @@ public DialogMessageBuilder(@Nonnull String id, @Nonnull String title) { * @param text the text displayed in this dialog */ @Override - public void text(@Nonnull String text) { + public ElementBuilder text(@Nonnull String text) { set("text", text); + return this; } /** diff --git a/nifty-style-illarion/build.gradle b/nifty-style-illarion/build.gradle index 8f943a4fa..25d5aa951 100644 --- a/nifty-style-illarion/build.gradle +++ b/nifty-style-illarion/build.gradle @@ -21,16 +21,17 @@ archivesBaseName = 'nifty-style-illarion' jar { dependsOn { gitVersion } manifest { - attributes \ - 'Permissions': 'all-permissions', \ - 'Codebase': 'illarion.org', \ - 'Trusted-Library': true, \ - 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), \ - 'Built-By': System.getProperty('user.name'), \ - 'Built-JDK': System.getProperty('java.version'), \ - 'Implementation-Title': 'Illarion Nifty-GUI Style', \ - 'Implementation-Vendor': 'Illarion e.V.', \ - 'Implementation-Version': project.ext.fullVersion + attributes( + 'Permissions': 'all-permissions', + 'Codebase': 'illarion.org', + 'Trusted-Library': true, + 'Built-Date': new Date().format('yyyy-MM-dd HH:mm:ssZ'), + 'Built-By': System.getProperty('user.name'), + 'Built-JDK': System.getProperty('java.version'), + 'Implementation-Title': 'Illarion Nifty-GUI Style', + 'Implementation-Vendor': 'Illarion e.V.', + 'Implementation-Version': project.ext.fullVersion + ) } } diff --git a/pmd.xml b/pmd.xml index b2cb82e0c..e9f3ececd 100644 --- a/pmd.xml +++ b/pmd.xml @@ -14,36 +14,32 @@ ~ GNU General Public License for more details. --> - - This is the PMD ruleset for Illarion. - + xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" + xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> + This is the PMD ruleset for Illarion. - - - - - - - - - - - - - - - - - - - + + .*/ant/java/EncodingTestClass.java + .*/net/sourceforge/pmd/cpd/badandgood/BadFile.java - - - - - + + .*/net/sourceforge/pmd/lang/java/ast/jdkversiontests/assert_test5.java + .*/net/sourceforge/pmd/lang/java/ast/jdkversiontests/assert_test5_a.java + .*/net/sourceforge/pmd/lang/java/ast/jdkversiontests/assert_test7.java + .*/net/sourceforge/pmd/lang/java/ast/jdkversiontests/jdk14_enum.java + .*/net/sourceforge/pmd/lang/java/ast/jdkversiontests/jdk9_invalid_identifier.java + .*/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java10/LocalVariableTypeInference_varAsAnnotationName.java + .*/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java10/LocalVariableTypeInference_varAsEnumName.java + .*/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java10/LocalVariableTypeInference_varAsTypeIdentifier.java + + + + + + + + + diff --git a/settings.gradle b/settings.gradle index 06989665e..a6e8d84b3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -31,43 +31,43 @@ rootProject.name = "illarion" rootProject.children.each { switch (it.name) { case "illabuild": - it.name = "build"; - break; + it.name = "build" + break case "illaclient": - it.name = "client"; - break; + it.name = "client" + break case "illacommon": - it.name = "common"; - break; + it.name = "common" + break case "illacompiler": - it.name = "compiler"; - break; + it.name = "compiler" + break case "illadownload": - it.name = "download"; - break; + it.name = "download" + break case "illaeasynpc": - it.name = "easynpc"; - break; + it.name = "easynpc" + break case "illaeasyquest": - it.name = "easyquest"; - break; + it.name = "easyquest" + break case "illagameengine": - it.name = "engine"; - break; + it.name = "engine" + break case "illagameengine-libgdx": - it.name = "engine-libgdx"; - break; + it.name = "engine-libgdx" + break case "illagameengine-nifty": - it.name = "engine-nifty"; - break; + it.name = "engine-nifty" + break case "illamapedit": - it.name = "mapeditor"; - break; + it.name = "mapeditor" + break case "nifty-controls-illarion": - it.name = "nifty-controls"; - break; + it.name = "nifty-controls" + break case "nifty-style-illarion": - it.name = "nifty-style"; - break; + it.name = "nifty-style" + break } } \ No newline at end of file diff --git a/versions.gradle b/versions.gradle index 4ce1a48ee..69b8720f9 100644 --- a/versions.gradle +++ b/versions.gradle @@ -14,10 +14,10 @@ * GNU General Public License for more details. */ ext { - slf4jVersion = '1.7.25' - logbackVersion = '1.2.2' - janinoVersion = '3.0.7' + slf4jVersion = '1.7.30' + logbackVersion = '1.2.3' + janinoVersion = '3.1.2' illarionResourcesVersion = '2.1.25.13-SNAPSHOT' - niftyGuiVersion = '1.4.2' + niftyGuiVersion = '1.4.3' insubstantialVersion = '7.3' }