From 8828501f21d902fdea7679d4d36d59da6bbc04e2 Mon Sep 17 00:00:00 2001 From: Ben McAllister Date: Fri, 26 Jun 2020 18:44:23 -0400 Subject: [PATCH] Updated build settings, reverted to java 1.8 --- .idea/DungeonBoard.iml | 2 + .idea/compiler.xml | 6 ++ .idea/gradle.xml | 7 +- .idea/inspectionProfiles/Project_Default.xml | 7 ++ .idea/misc.xml | 2 +- README.md | 6 +- build.gradle | 44 ---------- build.gradle.kts | 87 ++++++++++++++++++++ gradlew | 51 +++++++----- gradlew.bat | 18 +++- settings.gradle | 1 - settings.gradle.kts | 1 + 12 files changed, 158 insertions(+), 74 deletions(-) create mode 100644 .idea/DungeonBoard.iml create mode 100644 .idea/compiler.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/.idea/DungeonBoard.iml b/.idea/DungeonBoard.iml new file mode 100644 index 0000000..78b2cc5 --- /dev/null +++ b/.idea/DungeonBoard.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 2c7ef55..632e15f 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,15 +4,16 @@ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..9029a53 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 588f4f9..38167d7 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/README.md b/README.md index 0b5d391..a24b8c9 100644 --- a/README.md +++ b/README.md @@ -64,15 +64,13 @@ The main use case is for the DM to show 'loading tips' to distract the players a ## Running Dungeon Board -[Download 2.5.1](https://github.com/McAJBen/DungeonBoard/releases/download/v2.5.1/Dungeon.Board.v2.5.1.jar) +[Download 3.0.1](https://github.com/McAJBen/DungeonBoard/releases/download/v3.0.1/Dungeon.Board.v3.0.1.jar) *Caution, web browsers do not like .jar files. They can be used to give viruses. Do your research before downloading (Don't take my word for it).* -**As of 2.5.0 Java 13 is a requirement to run this application.** - When you first run Dungeon Board it will create a folder next to the .jar file. Inside of this are 4 folders (Layer, Image, Paint, Loading). Simply place all of your images you want to display in these folders in the .png format. The next time you run Dungeon Board it will automatically load these on startup. If you want to run Dungeon Board with more memory allocated you have to run the .jar file from the command line. - java -jar -Xmx2000m "Dungeon Board v2.5.1.jar" + java -jar -Xmx2000m "Dungeon Board v3.0.1.jar" diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 1721250..0000000 --- a/build.gradle +++ /dev/null @@ -1,44 +0,0 @@ -plugins { - id 'org.jetbrains.kotlin.jvm' version '1.3.61' - id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.60' -} - -def isRelease = false -def resourcesDir = "${buildDir}/resources/main" - -group 'mcajben.dungeonboard' -version "3.0.0${isRelease ? "" : "-dev"}" - -repositories { - jcenter() - mavenCentral() -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" - implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.14.0" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3" -} - -compileKotlin { - kotlinOptions.jvmTarget = "1.8" -} - -jar { - manifest { - attributes 'Main-Class': 'main.MainKt' - } - from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } } -} - -task generateVersionProperties { - doLast { - def propertiesFile = file "$resourcesDir/version.properties" - propertiesFile.parentFile.mkdirs() - def properties = new Properties() - properties.setProperty("version", rootProject.version.toString()) - propertiesFile.withWriter { properties.store(it, null) } - } -} - -processResources.dependsOn generateVersionProperties diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..cb4a1f6 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,87 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import java.util.Properties + +plugins { + kotlin("jvm") version "1.3.61" + id("org.jetbrains.kotlin.plugin.serialization") version "1.3.60" +} + +group = "mcajben.dungeonboard" + +version = "dev" + +val releaseVersion = "3.0.1" + +val resourcesDir = File(buildDir, "resources/main") + +val jarDir = File(buildDir, "libs") + +val jarFile: File + get() = File(jarDir, "${rootProject.name}-$version.jar") + +val releaseFile: File + get() = File("${rootProject.name}-$releaseVersion.jar") + +repositories { + jcenter() + mavenCentral() +} + +dependencies { + implementation(kotlin("stdlib-jdk8")) + implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.14.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3") +} + +tasks.withType().configureEach { + kotlinOptions.jvmTarget = "1.8" +} + +val jar = tasks.named("jar") { + manifest { + attributes("Main-Class" to "main.MainKt") + } + + from( + configurations.compileClasspath.map { config -> + config.map { f -> + if (f.isDirectory) + f + else + zipTree(f) + } + } + ) +} + +val setReleaseVersion by tasks.registering { + version = releaseVersion +} + +val generateVersionProperties by tasks.registering { + doLast { + val propertiesFile = File(resourcesDir, "version.properties") + propertiesFile.parentFile.mkdirs() + + Properties().apply { + setProperty("version", version.toString()) + store(propertiesFile.bufferedWriter(), null) + println(this) + } + } +} + +tasks.named("processResources") { + dependsOn(generateVersionProperties) +} + +val buildRelease by tasks.registering { + dependsOn(setReleaseVersion) + dependsOn(generateVersionProperties) + dependsOn(jar) + doLast { + releaseFile.delete() + jarFile.copyTo(releaseFile) + jarFile.delete() + } +} diff --git a/gradlew b/gradlew index af6708f..2fe81a7 100644 --- 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,7 +44,7 @@ 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='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ 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"` @@ -138,19 +154,19 @@ 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 @@ -159,14 +175,9 @@ 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 6d57edc..9618d8d 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 @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @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="-Xmx64m" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index c25aa92..0000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'DungeonBoard' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..7d714c3 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "DungeonBoard"