diff --git a/.circleci/config.yml b/.circleci/config.yml index b789826c2..a11f3524e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: build: docker: # specify the version you desire here - - image: circleci/openjdk:8-jdk + - image: cimg/openjdk:17.0.1 # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images @@ -24,7 +24,7 @@ jobs: steps: - checkout: path: ~/repo - + # Download and cache dependencies - restore_cache: keys: @@ -44,4 +44,4 @@ jobs: # report tests results - run: ./gradlew jacocoTestReport coveralls - + diff --git a/de.peeeq.wurstscript/build.gradle b/de.peeeq.wurstscript/build.gradle index c4f8824d6..ea09d0f7b 100644 --- a/de.peeeq.wurstscript/build.gradle +++ b/de.peeeq.wurstscript/build.gradle @@ -16,6 +16,7 @@ plugins { id 'eclipse' id 'idea' id 'application' + id 'org.beryx.jlink' version '2.24.4' } import de.undercouch.gradle.tasks.download.Download @@ -32,12 +33,12 @@ version = "1.8.1.0" java { toolchain { - languageVersion.set(JavaLanguageVersion.of(8)) + languageVersion.set(JavaLanguageVersion.of(17)) } } jacoco { - toolVersion = "0.8.5" + toolVersion = "0.8.7" } jacocoTestReport { @@ -103,13 +104,22 @@ dependencies { implementation group: 'net.sourceforge.jchardet', name: 'jchardet', version: '1.0' // Crigges' jmpq - implementation 'com.github.inwc3:jmpq3:0aaca2373d' + implementation 'com.github.inwc3:jmpq3:1.9.5' // Water's wc3 libs - implementation 'com.github.inwc3:wc3libs:7ece74aecc' + implementation 'com.github.inwc3:wc3libs:1.1.2' // The setup tool for wurst.build handling - implementation 'com.github.wurstscript:wurstsetup:4c65824b40' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.4' + implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.4' + implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.12.4' + implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.32' + implementation 'io.github.microutils:kotlin-logging:1.6.26' + + + implementation 'javax.servlet:javax.servlet-api:3.0.1' + + testImplementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '5.12.0.202106070339-r' implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3' @@ -201,7 +211,6 @@ gen.dependsOn generateGrammarSource compileJava.dependsOn gen - test { // set minimal heap size required to run tests: jvmArgs = ['-Xms256m'] @@ -230,3 +239,47 @@ task downloadAndUnzipFile(dependsOn: downloadZipFile, type: Copy) { } apply from: 'deploy.gradle' + +jlink { + options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'] + launcher{ + name = 'de.peeeq.wurstio.Main' + jvmArgs = [] + } +} + +ext.moduleName = 'de.peeeq.wurstscript' +application.mainModule = 'de.peeeq.wurstscript' + +compileJava { + inputs.property('moduleName', moduleName) + doFirst { + options.compilerArgs = [ + '--module-path', classpath.asPath + ] + classpath = files() + } +} + +jlink { + + targetPlatform("linux_x64") { + jdkHome = jdkDownload("https://corretto.aws/downloads/latest/amazon-corretto-17-x64-linux-jdk.tar.gz") + } + + targetPlatform("linux_aarch64") { + jdkHome = jdkDownload("https://corretto.aws/downloads/latest/amazon-corretto-17-aarch64-linux-jdk.tar.gz") + } + + targetPlatform("win") { + jdkHome = jdkDownload("https://corretto.aws/downloads/latest/amazon-corretto-17-x64-windows-jdk.zip") + } + + targetPlatform("mac_x64") { + jdkHome = jdkDownload("https://corretto.aws/downloads/latest/amazon-corretto-17-x64-macos-jdk.tar.gz") + } + + targetPlatform("mac_aarch64") { + jdkHome = jdkDownload("https://corretto.aws/downloads/latest/amazon-corretto-17-aarch64-macos-jdk.tar.gz") + } +} \ No newline at end of file diff --git a/de.peeeq.wurstscript/gradle/wrapper/gradle-wrapper.properties b/de.peeeq.wurstscript/gradle/wrapper/gradle-wrapper.properties index 05679dc3c..84d1f85fd 100644 --- a/de.peeeq.wurstscript/gradle/wrapper/gradle-wrapper.properties +++ b/de.peeeq.wurstscript/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/de.peeeq.wurstscript/gradlew b/de.peeeq.wurstscript/gradlew index 744e882ed..1b6c78733 100755 --- a/de.peeeq.wurstscript/gradlew +++ b/de.peeeq.wurstscript/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${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" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MSYS* | MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # 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 - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg 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" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# 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" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/CompilationProcess.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/CompilationProcess.java index a4d7af24a..4fb5c6308 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/CompilationProcess.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/CompilationProcess.java @@ -1,6 +1,8 @@ package de.peeeq.wurstio; -import config.WurstProjectConfigData; +import de.peeeq.wurstscript.project.config.WurstProjectBuildMapData; +import de.peeeq.wurstscript.project.config.WurstProjectConfig; +import de.peeeq.wurstscript.project.config.WurstProjectConfigData; import de.peeeq.wurstio.languageserver.requests.RunTests; import de.peeeq.wurstio.mpq.MpqEditor; import de.peeeq.wurstio.utils.FileUtils; @@ -15,10 +17,12 @@ import de.peeeq.wurstscript.translation.imtranslation.ImTranslator; import de.peeeq.wurstscript.utils.Utils; import org.eclipse.jdt.annotation.Nullable; +import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.IOException; import java.io.PrintStream; +import java.util.ArrayList; import java.util.Optional; import java.util.function.Supplier; @@ -85,7 +89,11 @@ public CompilationProcess(WurstGui gui, RunArgs runArgs) { () -> runTests(compiler.getImTranslator(), compiler, runArgs.getTestTimeout())); } - timeTaker.measure("Run compiletime functions", () ->compiler.runCompiletime(new WurstProjectConfigData(), isProd)); + WurstProjectConfigData projectConfigData = loadProjectConfig(projectFolder); + + timeTaker.measure("Run compiletime functions", () -> { + compiler.runCompiletime(projectConfigData, isProd); + }); JassProg jassProg = timeTaker.measure("Transform program to Jass", compiler::transformProgToJass); @@ -116,6 +124,21 @@ public CompilationProcess(WurstGui gui, RunArgs runArgs) { return mapScript; } + @NotNull + private WurstProjectConfigData loadProjectConfig(@org.jetbrains.annotations.Nullable File projectFolder) throws IOException { + WurstProjectConfigData projectConfigData = null; + if (projectFolder != null) { + projectConfigData = WurstProjectConfig.INSTANCE.loadProject(projectFolder.toPath().resolve("wurst.build")); + } + if (projectConfigData == null) { + projectConfigData = new WurstProjectConfigData( + "", + new ArrayList<>(), + new WurstProjectBuildMapData()); + } + return projectConfigData; + } + private boolean runPjass(File outputMapscript) { File commonJ = new File(outputMapscript.getParent(), "common.j"); File blizzJ = new File(outputMapscript.getParent(), "blizzard.j"); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/CompiletimeFunctionRunner.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/CompiletimeFunctionRunner.java index bffe0013a..55fa90ee5 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/CompiletimeFunctionRunner.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/CompiletimeFunctionRunner.java @@ -4,7 +4,7 @@ import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import config.WurstProjectConfigData; +import de.peeeq.wurstscript.project.config.WurstProjectConfigData; import de.peeeq.wurstio.intermediateLang.interpreter.CompiletimeNatives; import de.peeeq.wurstio.intermediateLang.interpreter.ProgramStateIO; import de.peeeq.wurstio.jassinterpreter.InterpreterException; diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/Main.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/Main.java index 031af11f0..5c759c0e0 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/Main.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/Main.java @@ -2,8 +2,6 @@ import com.google.common.base.Charsets; import com.google.common.io.Files; -import config.WurstProjectConfig; -import config.WurstProjectConfigData; import de.peeeq.wurstio.compilationserver.WurstServer; import de.peeeq.wurstio.gui.AboutDialog; import de.peeeq.wurstio.gui.WurstGuiImpl; @@ -19,6 +17,8 @@ import de.peeeq.wurstscript.attributes.CompileError; import de.peeeq.wurstscript.gui.WurstGui; import de.peeeq.wurstscript.gui.WurstGuiCliImpl; +import de.peeeq.wurstscript.project.config.WurstProjectConfig; +import de.peeeq.wurstscript.project.config.WurstProjectConfigData; import de.peeeq.wurstscript.utils.Utils; import org.eclipse.jdt.annotation.Nullable; diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/WurstCompilerJassImpl.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/WurstCompilerJassImpl.java index 368cc4f5d..c08fe9e0a 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/WurstCompilerJassImpl.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/WurstCompilerJassImpl.java @@ -4,7 +4,7 @@ import com.google.common.base.Preconditions; import com.google.common.collect.*; import com.google.common.io.Files; -import config.WurstProjectConfigData; +import de.peeeq.wurstscript.project.config.WurstProjectConfigData; import de.peeeq.wurstio.languageserver.requests.RequestFailedException; import de.peeeq.wurstio.map.importer.ImportFile; import de.peeeq.wurstio.mpq.MpqEditor; diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/intermediateLang/interpreter/CompiletimeNatives.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/intermediateLang/interpreter/CompiletimeNatives.java index 937c4af6a..6bf48abc6 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/intermediateLang/interpreter/CompiletimeNatives.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/intermediateLang/interpreter/CompiletimeNatives.java @@ -1,7 +1,7 @@ package de.peeeq.wurstio.intermediateLang.interpreter; -import config.WurstProjectConfigData; +import de.peeeq.wurstscript.project.config.WurstProjectConfigData; import de.peeeq.wurstio.jassinterpreter.InterpreterException; import de.peeeq.wurstio.jassinterpreter.ReflectionBasedNativeProvider; import de.peeeq.wurstio.objectreader.*; @@ -10,10 +10,8 @@ import de.peeeq.wurstscript.intermediatelang.interpreter.ProgramState; import de.peeeq.wurstscript.intermediatelang.interpreter.VariableType; -import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; -import java.time.temporal.TemporalUnit; @SuppressWarnings("ucd") // ignore unused code detector warnings, because this class uses reflection public class CompiletimeNatives extends ReflectionBasedNativeProvider implements NativesProvider { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ProjectConfigBuilder.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ProjectConfigBuilder.java index d80e0d16b..2396a3267 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ProjectConfigBuilder.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ProjectConfigBuilder.java @@ -1,7 +1,13 @@ package de.peeeq.wurstio.languageserver; import com.google.common.io.Files; -import config.*; +import de.peeeq.wurstscript.project.config.WurstProjectBuildForce; +import de.peeeq.wurstscript.project.config.WurstProjectBuildLoadingScreenData; +import de.peeeq.wurstscript.project.config.WurstProjectBuildMapData; +import de.peeeq.wurstscript.project.config.WurstProjectBuildOptionFlagsData; +import de.peeeq.wurstscript.project.config.WurstProjectBuildPlayer; +import de.peeeq.wurstscript.project.config.WurstProjectBuildScenarioData; +import de.peeeq.wurstscript.project.config.WurstProjectConfigData; import de.peeeq.wurstio.Pjass; import de.peeeq.wurstio.languageserver.requests.RequestFailedException; import de.peeeq.wurstio.mpq.MpqEditor; @@ -32,7 +38,7 @@ public class ProjectConfigBuilder { public static final String FILE_NAME = "wurst.build"; public static void apply(WurstProjectConfigData projectConfig, File targetMap, File compiledScript, File buildDir, - RunArgs runArgs, W3InstallationData w3data) throws IOException { + RunArgs runArgs, W3InstallationData w3data) throws IOException { if (projectConfig.getProjectName().isEmpty()) { throw new RequestFailedException(MessageType.Error, "wurst.build is missing projectName."); } @@ -174,7 +180,7 @@ private static void applyForces(WurstProjectConfigData projectConfig, W3I w3I) { private static void applyPlayers(WurstProjectConfigData projectConfig, W3I w3I) { List existing = new ArrayList<>(w3I.getPlayers()); w3I.getPlayers().clear(); - ArrayList players = projectConfig.getBuildMapData().getPlayers(); + List players = projectConfig.getBuildMapData().getPlayers(); for (WurstProjectBuildPlayer wplayer : players) { Optional old = existing.stream().filter(player -> player.getNum() == wplayer.getId()).findFirst(); W3I.Player player = new Player(); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/BuildMap.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/BuildMap.java index 48bd63c9e..cb6e9b500 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/BuildMap.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/BuildMap.java @@ -1,7 +1,7 @@ package de.peeeq.wurstio.languageserver.requests; -import config.WurstProjectConfig; -import config.WurstProjectConfigData; +import de.peeeq.wurstscript.project.config.WurstProjectConfig; +import de.peeeq.wurstscript.project.config.WurstProjectConfigData; import de.peeeq.wurstio.gui.WurstGuiImpl; import de.peeeq.wurstio.languageserver.ConfigProvider; import de.peeeq.wurstio.languageserver.ModelManager; diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java index c69d673ed..f2717dda0 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java @@ -2,7 +2,7 @@ import com.google.common.base.Charsets; import com.google.common.io.Files; -import config.WurstProjectConfigData; +import de.peeeq.wurstscript.project.config.WurstProjectConfigData; import de.peeeq.wurstio.Pjass; import de.peeeq.wurstio.UtilsIO; import de.peeeq.wurstio.WurstCompilerJassImpl; diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/RunMap.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/RunMap.java index 7d63934d9..752c43705 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/RunMap.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/RunMap.java @@ -2,8 +2,8 @@ import com.google.common.collect.Lists; import com.google.common.io.Files; -import config.WurstProjectConfig; -import config.WurstProjectConfigData; +import de.peeeq.wurstscript.project.config.WurstProjectConfig; +import de.peeeq.wurstscript.project.config.WurstProjectConfigData; import de.peeeq.wurstio.gui.WurstGuiImpl; import de.peeeq.wurstio.languageserver.ConfigProvider; import de.peeeq.wurstio.languageserver.ModelManager; diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/RunTests.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/RunTests.java index 929a4a699..6758fb436 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/RunTests.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/RunTests.java @@ -2,7 +2,8 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Lists; -import config.WurstProjectConfigData; +import de.peeeq.wurstscript.project.config.WurstProjectBuildMapData; +import de.peeeq.wurstscript.project.config.WurstProjectConfigData; import de.peeeq.wurstio.CompiletimeFunctionRunner; import de.peeeq.wurstio.jassinterpreter.InterpreterException; import de.peeeq.wurstio.jassinterpreter.ReflectionNativeProvider; @@ -27,6 +28,7 @@ import org.eclipse.lsp4j.MessageType; import java.io.*; +import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.concurrent.*; @@ -147,8 +149,9 @@ public int getTotalTests() { public TestResult runTests(ImTranslator translator, ImProg imProg, Optional funcToTest, Optional cu) { WurstGui gui = new TestGui(); + WurstProjectConfigData projectConfigData = new WurstProjectConfigData("", new ArrayList<>(), new WurstProjectBuildMapData()); CompiletimeFunctionRunner cfr = new CompiletimeFunctionRunner(translator, imProg, Optional.empty(), null, gui, - CompiletimeFunctions, new WurstProjectConfigData(), false); + CompiletimeFunctions, projectConfigData, false); ILInterpreter interpreter = cfr.getInterpreter(); ProgramState globalState = cfr.getGlobalState(); if (globalState == null) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/WurstCompiler.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/WurstCompiler.java index 3ca511aa1..31d79af25 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/WurstCompiler.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/WurstCompiler.java @@ -1,6 +1,6 @@ package de.peeeq.wurstscript; -import config.WurstProjectConfigData; +import de.peeeq.wurstscript.project.config.WurstProjectConfigData; import de.peeeq.wurstscript.ast.WurstModel; import org.eclipse.jdt.annotation.Nullable; diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/Controller.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/Controller.java new file mode 100644 index 000000000..8b961202c --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/Controller.java @@ -0,0 +1,8 @@ +package de.peeeq.wurstscript.project.config; + +import kotlin.Metadata; + +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000\f\n\002\030\002\n\002\020\020\n\002\b\006\b\001\030\0002\b\022\004\022\0020\0000\001B\007\b\002\006\002\020\002j\002\b\003j\002\b\004j\002\b\005j\002\b\006\006\007"}, d2 = {"Lde/peeeq/wurstscript/project/config/Controller;", "", "(Ljava/lang/String;I)V", "USER", "COMPUTER", "NEUTRAL", "RESCUABLE", "wurstscript"}) +public enum Controller { + USER, COMPUTER, NEUTRAL, RESCUABLE; +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/DAOsKt.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/DAOsKt.java new file mode 100644 index 000000000..d983230d7 --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/DAOsKt.java @@ -0,0 +1,10 @@ +package de.peeeq.wurstscript.project.config; + +import kotlin.Metadata; +import org.jetbrains.annotations.NotNull; + +@Metadata(mv = {1, 6, 0}, k = 2, xi = 48, d1 = {"\000\b\n\000\n\002\020\016\n\000\"\016\020\000\032\0020\001X\006\002\n\000\006\002"}, d2 = {"CONFIG_FILE_NAME", "", "wurstscript"}) +public final class DAOsKt { + @NotNull + public static final String CONFIG_FILE_NAME = "wurst.build"; +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/Race.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/Race.java new file mode 100644 index 000000000..c3b78b20c --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/Race.java @@ -0,0 +1,8 @@ +package de.peeeq.wurstscript.project.config; + +import kotlin.Metadata; + +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000\f\n\002\030\002\n\002\020\020\n\002\b\007\b\001\030\0002\b\022\004\022\0020\0000\001B\007\b\002\006\002\020\002j\002\b\003j\002\b\004j\002\b\005j\002\b\006j\002\b\007\006\b"}, d2 = {"Lde/peeeq/wurstscript/project/config/Race;", "", "(Ljava/lang/String;I)V", "HUMAN", "ORC", "UNDEAD", "NIGHT_ELF", "SELECTABLE", "wurstscript"}) +public enum Race { + HUMAN, ORC, UNDEAD, NIGHT_ELF, SELECTABLE; +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildForce.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildForce.java new file mode 100644 index 000000000..cf0a5f43f --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildForce.java @@ -0,0 +1,98 @@ +package de.peeeq.wurstscript.project.config; + +import com.fasterxml.jackson.annotation.JsonInclude; +import kotlin.Metadata; +import kotlin.jvm.internal.Intrinsics; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Arrays; + +@JsonInclude(JsonInclude.Include.NON_DEFAULT) +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000.\n\002\030\002\n\002\020\000\n\000\n\002\020\016\n\000\n\002\030\002\n\000\n\002\020\025\n\002\b\f\n\002\020\013\n\002\b\002\n\002\020\b\n\002\b\002\b\b\030\0002\0020\001B#\022\b\b\002\020\002\032\0020\003\022\b\b\002\020\004\032\0020\005\022\b\b\002\020\006\032\0020\007\006\002\020\bJ\t\020\017\032\0020\003H\003J\t\020\020\032\0020\005H\003J\t\020\021\032\0020\007H\003J'\020\022\032\0020\0002\b\b\002\020\002\032\0020\0032\b\b\002\020\004\032\0020\0052\b\b\002\020\006\032\0020\007H\001J\023\020\023\032\0020\0242\b\020\025\032\004\030\0010\001H\002J\b\020\026\032\0020\027H\026J\t\020\030\032\0020\003H\001R\021\020\004\032\0020\005\006\b\n\000\032\004\b\t\020\nR\021\020\002\032\0020\003\006\b\n\000\032\004\b\013\020\fR\021\020\006\032\0020\007\006\b\n\000\032\004\b\r\020\016\006\031"}, d2 = {"Lde/peeeq/wurstscript/project/config/WurstProjectBuildForce;", "", "name", "", "flags", "Lde/peeeq/wurstscript/project/config/WurstProjectBuildForceFlags;", "playerIds", "", "(Ljava/lang/String;Lde/peeeq/wurstscript/project/config/WurstProjectBuildForceFlags;[I)V", "getFlags", "()Lde/peeeq/wurstscript/project/config/WurstProjectBuildForceFlags;", "getName", "()Ljava/lang/String;", "getPlayerIds", "()[I", "component1", "component2", "component3", "copy", "equals", "", "other", "hashCode", "", "toString", "wurstscript"}) +public final class WurstProjectBuildForce { + @NotNull + private final String name; + + @NotNull + private final WurstProjectBuildForceFlags flags; + + @NotNull + private final int[] playerIds; + + public WurstProjectBuildForce(@NotNull String name, @NotNull WurstProjectBuildForceFlags flags, @NotNull int[] playerIds) { + this.name = name; + this.flags = flags; + this.playerIds = playerIds; + } + + public WurstProjectBuildForce(@NotNull String name) { + this(null, null, null); + } + + @NotNull + public final String getName() { + return this.name; + } + + @NotNull + public final WurstProjectBuildForceFlags getFlags() { + return this.flags; + } + + @NotNull + public final int[] getPlayerIds() { + return this.playerIds; + } + + public boolean equals(@Nullable Object other) { + if (this == other) + return true; + if (!Intrinsics.areEqual(other, (other == null) ? null : other.getClass())) + return false; + if (other == null) + throw new NullPointerException("null cannot be cast to non-null type de.peeeq.wurstscript.project.config.WurstProjectBuildForce"); + if (!Intrinsics.areEqual(this.name, ((WurstProjectBuildForce) other).name)) + return false; + if (!Intrinsics.areEqual(this.flags, ((WurstProjectBuildForce) other).flags)) + return false; + if (!Arrays.equals(this.playerIds, ((WurstProjectBuildForce) other).playerIds)) + return false; + return true; + } + + public int hashCode() { + int result = this.name.hashCode(); + result = 31 * result + this.flags.hashCode(); + result = 31 * result + Arrays.hashCode(this.playerIds); + return result; + } + + @NotNull + public final String component1() { + return this.name; + } + + @NotNull + public final WurstProjectBuildForceFlags component2() { + return this.flags; + } + + @NotNull + public final int[] component3() { + return this.playerIds; + } + + @NotNull + public final WurstProjectBuildForce copy(@NotNull String name, @NotNull WurstProjectBuildForceFlags flags, @NotNull int[] playerIds) { + Intrinsics.checkNotNullParameter(name, "name"); + Intrinsics.checkNotNullParameter(flags, "flags"); + Intrinsics.checkNotNullParameter(playerIds, "playerIds"); + return new WurstProjectBuildForce(name, flags, playerIds); + } + + @NotNull + public String toString() { + return "WurstProjectBuildForce(name=" + this.name + ", flags=" + this.flags + ", playerIds=" + Arrays.toString(this.playerIds) + ")"; + } +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildForceFlags.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildForceFlags.java new file mode 100644 index 000000000..f4bebdc18 --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildForceFlags.java @@ -0,0 +1,104 @@ +package de.peeeq.wurstscript.project.config; + +import com.fasterxml.jackson.annotation.JsonInclude; +import kotlin.Metadata; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_DEFAULT) +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000\036\n\002\030\002\n\002\020\000\n\000\n\002\020\013\n\002\b\024\n\002\020\b\n\000\n\002\020\016\n\000\b\b\030\0002\0020\001B7\022\b\b\002\020\002\032\0020\003\022\b\b\002\020\004\032\0020\003\022\b\b\002\020\005\032\0020\003\022\b\b\002\020\006\032\0020\003\022\b\b\002\020\007\032\0020\003\006\002\020\bJ\t\020\017\032\0020\003H\003J\t\020\020\032\0020\003H\003J\t\020\021\032\0020\003H\003J\t\020\022\032\0020\003H\003J\t\020\023\032\0020\003H\003J;\020\024\032\0020\0002\b\b\002\020\002\032\0020\0032\b\b\002\020\004\032\0020\0032\b\b\002\020\005\032\0020\0032\b\b\002\020\006\032\0020\0032\b\b\002\020\007\032\0020\003H\001J\023\020\025\032\0020\0032\b\020\026\032\004\030\0010\001H\003J\t\020\027\032\0020\030H\001J\t\020\031\032\0020\032H\001R\021\020\002\032\0020\003\006\b\n\000\032\004\b\t\020\nR\021\020\004\032\0020\003\006\b\n\000\032\004\b\013\020\nR\021\020\006\032\0020\003\006\b\n\000\032\004\b\f\020\nR\021\020\007\032\0020\003\006\b\n\000\032\004\b\r\020\nR\021\020\005\032\0020\003\006\b\n\000\032\004\b\016\020\n\006\033"}, d2 = {"Lde/peeeq/wurstscript/project/config/WurstProjectBuildForceFlags;", "", "allied", "", "alliedVictory", "sharedVision", "sharedControl", "sharedControlAdvanced", "(ZZZZZ)V", "getAllied", "()Z", "getAlliedVictory", "getSharedControl", "getSharedControlAdvanced", "getSharedVision", "component1", "component2", "component3", "component4", "component5", "copy", "equals", "other", "hashCode", "", "toString", "", "wurstscript"}) +public final class WurstProjectBuildForceFlags { + private final boolean allied; + + private final boolean alliedVictory; + + private final boolean sharedVision; + + private final boolean sharedControl; + + private final boolean sharedControlAdvanced; + + public WurstProjectBuildForceFlags(boolean allied, boolean alliedVictory, boolean sharedVision, boolean sharedControl, boolean sharedControlAdvanced) { + this.allied = allied; + this.alliedVictory = alliedVictory; + this.sharedVision = sharedVision; + this.sharedControl = sharedControl; + this.sharedControlAdvanced = sharedControlAdvanced; + } + + public WurstProjectBuildForceFlags() { + this(false, false, false, false, false); + } + + public final boolean getAllied() { + return this.allied; + } + + public final boolean getAlliedVictory() { + return this.alliedVictory; + } + + public final boolean getSharedVision() { + return this.sharedVision; + } + + public final boolean getSharedControl() { + return this.sharedControl; + } + + public final boolean getSharedControlAdvanced() { + return this.sharedControlAdvanced; + } + + public final boolean component1() { + return this.allied; + } + + public final boolean component2() { + return this.alliedVictory; + } + + public final boolean component3() { + return this.sharedVision; + } + + public final boolean component4() { + return this.sharedControl; + } + + public final boolean component5() { + return this.sharedControlAdvanced; + } + + @NotNull + public final WurstProjectBuildForceFlags copy(boolean allied, boolean alliedVictory, boolean sharedVision, boolean sharedControl, boolean sharedControlAdvanced) { + return new WurstProjectBuildForceFlags(allied, alliedVictory, sharedVision, sharedControl, sharedControlAdvanced); + } + + @NotNull + public String toString() { + return "WurstProjectBuildForceFlags(allied=" + this.allied + ", alliedVictory=" + this.alliedVictory + ", sharedVision=" + this.sharedVision + ", sharedControl=" + this.sharedControl + ", sharedControlAdvanced=" + this.sharedControlAdvanced + ")"; + } + + public int hashCode() { + if (this.allied) ; + int result = 1; + if (this.alliedVictory) ; + result = result * 31 + 1; + if (this.sharedVision) ; + result = result * 31 + 1; + if (this.sharedControl) ; + result = result * 31 + 1; + if (this.sharedControlAdvanced) ; + return result * 31 + 1; + } + + public boolean equals(@Nullable Object other) { + if (this == other) + return true; + if (!(other instanceof WurstProjectBuildForceFlags)) + return false; + WurstProjectBuildForceFlags wurstProjectBuildForceFlags = (WurstProjectBuildForceFlags) other; + return (this.allied != wurstProjectBuildForceFlags.allied) ? false : ((this.alliedVictory != wurstProjectBuildForceFlags.alliedVictory) ? false : ((this.sharedVision != wurstProjectBuildForceFlags.sharedVision) ? false : ((this.sharedControl != wurstProjectBuildForceFlags.sharedControl) ? false : (!(this.sharedControlAdvanced != wurstProjectBuildForceFlags.sharedControlAdvanced))))); + } +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildJob.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildJob.java new file mode 100644 index 000000000..7d39f9c67 --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildJob.java @@ -0,0 +1,74 @@ +package de.peeeq.wurstscript.project.config; + +import com.fasterxml.jackson.annotation.JsonInclude; +import kotlin.Metadata; +import kotlin.jvm.internal.Intrinsics; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; + +@JsonInclude(JsonInclude.Include.NON_DEFAULT) +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000,\n\002\030\002\n\002\020\000\n\000\n\002\020\016\n\000\n\002\030\002\n\002\030\002\n\002\b\t\n\002\020\013\n\002\b\002\n\002\020\b\n\002\b\002\b\b\030\0002\0020\001B)\022\b\b\002\020\002\032\0020\003\022\030\b\002\020\004\032\022\022\004\022\0020\0030\005j\b\022\004\022\0020\003`\006\006\002\020\007J\t\020\f\032\0020\003H\003J\031\020\r\032\022\022\004\022\0020\0030\005j\b\022\004\022\0020\003`\006H\003J-\020\016\032\0020\0002\b\b\002\020\002\032\0020\0032\030\b\002\020\004\032\022\022\004\022\0020\0030\005j\b\022\004\022\0020\003`\006H\001J\023\020\017\032\0020\0202\b\020\021\032\004\030\0010\001H\003J\t\020\022\032\0020\023H\001J\t\020\024\032\0020\003H\001R!\020\004\032\022\022\004\022\0020\0030\005j\b\022\004\022\0020\003`\006\006\b\n\000\032\004\b\b\020\tR\021\020\002\032\0020\003\006\b\n\000\032\004\b\n\020\013\006\025"}, d2 = {"Lde/peeeq/wurstscript/project/config/WurstProjectBuildJob;", "", "name", "", "args", "Ljava/util/ArrayList;", "Lkotlin/collections/ArrayList;", "(Ljava/lang/String;Ljava/util/ArrayList;)V", "getArgs", "()Ljava/util/ArrayList;", "getName", "()Ljava/lang/String;", "component1", "component2", "copy", "equals", "", "other", "hashCode", "", "toString", "wurstscript"}) +public final class WurstProjectBuildJob { + @NotNull + private final String name; + + @NotNull + private final ArrayList args; + + public WurstProjectBuildJob(@NotNull String name, @NotNull ArrayList args) { + this.name = name; + this.args = args; + } + + public WurstProjectBuildJob() { + this(null, null); + } + + @NotNull + public final String getName() { + return this.name; + } + + @NotNull + public final ArrayList getArgs() { + return this.args; + } + + @NotNull + public final String component1() { + return this.name; + } + + @NotNull + public final ArrayList component2() { + return this.args; + } + + @NotNull + public final WurstProjectBuildJob copy(@NotNull String name, @NotNull ArrayList args) { + Intrinsics.checkNotNullParameter(name, "name"); + Intrinsics.checkNotNullParameter(args, "args"); + return new WurstProjectBuildJob(name, args); + } + + @NotNull + public String toString() { + return "WurstProjectBuildJob(name=" + this.name + ", args=" + this.args + ")"; + } + + public int hashCode() { + int result = this.name.hashCode(); + return result * 31 + this.args.hashCode(); + } + + public boolean equals(@Nullable Object other) { + if (this == other) + return true; + if (!(other instanceof WurstProjectBuildJob)) + return false; + WurstProjectBuildJob wurstProjectBuildJob = (WurstProjectBuildJob) other; + return !Intrinsics.areEqual(this.name, wurstProjectBuildJob.name) ? false : (!!Intrinsics.areEqual(this.args, wurstProjectBuildJob.args)); + } +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildLoadingScreenData.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildLoadingScreenData.java new file mode 100644 index 000000000..e6eb5767e --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildLoadingScreenData.java @@ -0,0 +1,120 @@ +package de.peeeq.wurstscript.project.config; + +import com.fasterxml.jackson.annotation.JsonInclude; +import kotlin.Metadata; +import kotlin.jvm.internal.Intrinsics; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_DEFAULT) +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000\"\n\002\030\002\n\002\020\000\n\000\n\002\020\016\n\002\b\022\n\002\020\013\n\002\b\002\n\002\020\b\n\002\b\002\b\b\030\0002\0020\001B7\022\b\b\002\020\002\032\0020\003\022\b\b\002\020\004\032\0020\003\022\b\b\002\020\005\032\0020\003\022\b\b\002\020\006\032\0020\003\022\b\b\002\020\007\032\0020\003\006\002\020\bJ\t\020\017\032\0020\003H\003J\t\020\020\032\0020\003H\003J\t\020\021\032\0020\003H\003J\t\020\022\032\0020\003H\003J\t\020\023\032\0020\003H\003J;\020\024\032\0020\0002\b\b\002\020\002\032\0020\0032\b\b\002\020\004\032\0020\0032\b\b\002\020\005\032\0020\0032\b\b\002\020\006\032\0020\0032\b\b\002\020\007\032\0020\003H\001J\023\020\025\032\0020\0262\b\020\027\032\004\030\0010\001H\003J\t\020\030\032\0020\031H\001J\t\020\032\032\0020\003H\001R\021\020\004\032\0020\003\006\b\n\000\032\004\b\t\020\nR\021\020\002\032\0020\003\006\b\n\000\032\004\b\013\020\nR\021\020\006\032\0020\003\006\b\n\000\032\004\b\f\020\nR\021\020\007\032\0020\003\006\b\n\000\032\004\b\r\020\nR\021\020\005\032\0020\003\006\b\n\000\032\004\b\016\020\n\006\033"}, d2 = {"Lde/peeeq/wurstscript/project/config/WurstProjectBuildLoadingScreenData;", "", "model", "", "background", "title", "subTitle", "text", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", "getBackground", "()Ljava/lang/String;", "getModel", "getSubTitle", "getText", "getTitle", "component1", "component2", "component3", "component4", "component5", "copy", "equals", "", "other", "hashCode", "", "toString", "wurstscript"}) +public final class WurstProjectBuildLoadingScreenData { + @NotNull + private final String model; + + @NotNull + private final String background; + + @NotNull + private final String title; + + @NotNull + private final String subTitle; + + @NotNull + private final String text; + + public WurstProjectBuildLoadingScreenData(@NotNull String model, @NotNull String background, @NotNull String title, @NotNull String subTitle, @NotNull String text) { + this.model = model; + this.background = background; + this.title = title; + this.subTitle = subTitle; + this.text = text; + } + + public WurstProjectBuildLoadingScreenData() { + this(null, null, null, null, null); + } + + @NotNull + public final String getModel() { + return this.model; + } + + @NotNull + public final String getBackground() { + return this.background; + } + + @NotNull + public final String getTitle() { + return this.title; + } + + @NotNull + public final String getSubTitle() { + return this.subTitle; + } + + @NotNull + public final String getText() { + return this.text; + } + + @NotNull + public final String component1() { + return this.model; + } + + @NotNull + public final String component2() { + return this.background; + } + + @NotNull + public final String component3() { + return this.title; + } + + @NotNull + public final String component4() { + return this.subTitle; + } + + @NotNull + public final String component5() { + return this.text; + } + + @NotNull + public final WurstProjectBuildLoadingScreenData copy(@NotNull String model, @NotNull String background, @NotNull String title, @NotNull String subTitle, @NotNull String text) { + Intrinsics.checkNotNullParameter(model, "model"); + Intrinsics.checkNotNullParameter(background, "background"); + Intrinsics.checkNotNullParameter(title, "title"); + Intrinsics.checkNotNullParameter(subTitle, "subTitle"); + Intrinsics.checkNotNullParameter(text, "text"); + return new WurstProjectBuildLoadingScreenData(model, background, title, subTitle, text); + } + + @NotNull + public String toString() { + return "WurstProjectBuildLoadingScreenData(model=" + this.model + ", background=" + this.background + ", title=" + this.title + ", subTitle=" + this.subTitle + ", text=" + this.text + ")"; + } + + public int hashCode() { + int result = this.model.hashCode(); + result = result * 31 + this.background.hashCode(); + result = result * 31 + this.title.hashCode(); + result = result * 31 + this.subTitle.hashCode(); + return result * 31 + this.text.hashCode(); + } + + public boolean equals(@Nullable Object other) { + if (this == other) + return true; + if (!(other instanceof WurstProjectBuildLoadingScreenData)) + return false; + WurstProjectBuildLoadingScreenData wurstProjectBuildLoadingScreenData = (WurstProjectBuildLoadingScreenData) other; + return !Intrinsics.areEqual(this.model, wurstProjectBuildLoadingScreenData.model) ? false : (!Intrinsics.areEqual(this.background, wurstProjectBuildLoadingScreenData.background) ? false : (!Intrinsics.areEqual(this.title, wurstProjectBuildLoadingScreenData.title) ? false : (!Intrinsics.areEqual(this.subTitle, wurstProjectBuildLoadingScreenData.subTitle) ? false : (!!Intrinsics.areEqual(this.text, wurstProjectBuildLoadingScreenData.text))))); + } +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildMapData.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildMapData.java new file mode 100644 index 000000000..8547fe45e --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildMapData.java @@ -0,0 +1,160 @@ +package de.peeeq.wurstscript.project.config; + +import com.fasterxml.jackson.annotation.JsonInclude; +import kotlin.Metadata; +import kotlin.jvm.internal.Intrinsics; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; + +@JsonInclude(JsonInclude.Include.NON_DEFAULT) +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000D\n\002\030\002\n\002\020\000\n\000\n\002\020\016\n\002\b\003\n\002\030\002\n\000\n\002\030\002\n\000\n\002\030\002\n\002\030\002\n\002\030\002\n\000\n\002\030\002\n\002\b\025\n\002\020\013\n\002\b\002\n\002\020\b\n\002\b\002\b\b\030\0002\0020\001Bk\022\b\b\002\020\002\032\0020\003\022\b\b\002\020\004\032\0020\003\022\b\b\002\020\005\032\0020\003\022\b\b\002\020\006\032\0020\007\022\b\b\002\020\b\032\0020\t\022\030\b\002\020\n\032\022\022\004\022\0020\f0\013j\b\022\004\022\0020\f`\r\022\030\b\002\020\016\032\022\022\004\022\0020\0170\013j\b\022\004\022\0020\017`\r\006\002\020\020J\t\020\034\032\0020\003H\003J\t\020\035\032\0020\003H\003J\t\020\036\032\0020\003H\003J\t\020\037\032\0020\007H\003J\t\020 \032\0020\tH\003J\031\020!\032\022\022\004\022\0020\f0\013j\b\022\004\022\0020\f`\rH\003J\031\020\"\032\022\022\004\022\0020\0170\013j\b\022\004\022\0020\017`\rH\003Jo\020#\032\0020\0002\b\b\002\020\002\032\0020\0032\b\b\002\020\004\032\0020\0032\b\b\002\020\005\032\0020\0032\b\b\002\020\006\032\0020\0072\b\b\002\020\b\032\0020\t2\030\b\002\020\n\032\022\022\004\022\0020\f0\013j\b\022\004\022\0020\f`\r2\030\b\002\020\016\032\022\022\004\022\0020\0170\013j\b\022\004\022\0020\017`\rH\001J\023\020$\032\0020%2\b\020&\032\004\030\0010\001H\003J\t\020'\032\0020(H\001J\t\020)\032\0020\003H\001R\021\020\005\032\0020\003\006\b\n\000\032\004\b\021\020\022R\021\020\004\032\0020\003\006\b\n\000\032\004\b\023\020\022R!\020\016\032\022\022\004\022\0020\0170\013j\b\022\004\022\0020\017`\r\006\b\n\000\032\004\b\024\020\025R\021\020\002\032\0020\003\006\b\n\000\032\004\b\026\020\022R\021\020\b\032\0020\t\006\b\n\000\032\004\b\027\020\030R!\020\n\032\022\022\004\022\0020\f0\013j\b\022\004\022\0020\f`\r\006\b\n\000\032\004\b\031\020\025R\021\020\006\032\0020\007\006\b\n\000\032\004\b\032\020\033\006*"}, d2 = {"Lde/peeeq/wurstscript/project/config/WurstProjectBuildMapData;", "", "name", "", "fileName", "author", "scenarioData", "Lde/peeeq/wurstscript/project/config/WurstProjectBuildScenarioData;", "optionsFlags", "Lde/peeeq/wurstscript/project/config/WurstProjectBuildOptionFlagsData;", "players", "Ljava/util/ArrayList;", "Lde/peeeq/wurstscript/project/config/WurstProjectBuildPlayer;", "Lkotlin/collections/ArrayList;", "forces", "Lde/peeeq/wurstscript/project/config/WurstProjectBuildForce;", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lde/peeeq/wurstscript/project/config/WurstProjectBuildScenarioData;Lde/peeeq/wurstscript/project/config/WurstProjectBuildOptionFlagsData;Ljava/util/ArrayList;Ljava/util/ArrayList;)V", "getAuthor", "()Ljava/lang/String;", "getFileName", "getForces", "()Ljava/util/ArrayList;", "getName", "getOptionsFlags", "()Lde/peeeq/wurstscript/project/config/WurstProjectBuildOptionFlagsData;", "getPlayers", "getScenarioData", "()Lde/peeeq/wurstscript/project/config/WurstProjectBuildScenarioData;", "component1", "component2", "component3", "component4", "component5", "component6", "component7", "copy", "equals", "", "other", "hashCode", "", "toString", "wurstscript"}) +public final class WurstProjectBuildMapData { + @NotNull + private final String name; + + @NotNull + private final String fileName; + + @NotNull + private final String author; + + @NotNull + private final WurstProjectBuildScenarioData scenarioData; + + @NotNull + private final WurstProjectBuildOptionFlagsData optionsFlags; + + @NotNull + private final ArrayList players; + + @NotNull + private final ArrayList forces; + + public WurstProjectBuildMapData(@NotNull String name, @NotNull String fileName, @NotNull String author, @NotNull WurstProjectBuildScenarioData scenarioData, @NotNull WurstProjectBuildOptionFlagsData optionsFlags, @NotNull ArrayList players, @NotNull ArrayList forces) { + this.name = name; + this.fileName = fileName; + this.author = author; + this.scenarioData = scenarioData; + this.optionsFlags = optionsFlags; + this.players = players; + this.forces = forces; + } + + public WurstProjectBuildMapData() { + this.name = null; + this.fileName = null; + this.author = null; + this.scenarioData = null; + this.optionsFlags = null; + this.players = null; + this.forces = null; + } + + @NotNull + public final String getName() { + return this.name; + } + + @NotNull + public final String getFileName() { + return this.fileName; + } + + @NotNull + public final String getAuthor() { + return this.author; + } + + @NotNull + public final WurstProjectBuildScenarioData getScenarioData() { + return this.scenarioData; + } + + @NotNull + public final WurstProjectBuildOptionFlagsData getOptionsFlags() { + return this.optionsFlags; + } + + @NotNull + public final ArrayList getPlayers() { + return this.players; + } + + @NotNull + public final ArrayList getForces() { + return this.forces; + } + + @NotNull + public final String component1() { + return this.name; + } + + @NotNull + public final String component2() { + return this.fileName; + } + + @NotNull + public final String component3() { + return this.author; + } + + @NotNull + public final WurstProjectBuildScenarioData component4() { + return this.scenarioData; + } + + @NotNull + public final WurstProjectBuildOptionFlagsData component5() { + return this.optionsFlags; + } + + @NotNull + public final ArrayList component6() { + return this.players; + } + + @NotNull + public final ArrayList component7() { + return this.forces; + } + + @NotNull + public final WurstProjectBuildMapData copy(@NotNull String name, @NotNull String fileName, @NotNull String author, @NotNull WurstProjectBuildScenarioData scenarioData, @NotNull WurstProjectBuildOptionFlagsData optionsFlags, @NotNull ArrayList players, @NotNull ArrayList forces) { + Intrinsics.checkNotNullParameter(name, "name"); + Intrinsics.checkNotNullParameter(fileName, "fileName"); + Intrinsics.checkNotNullParameter(author, "author"); + Intrinsics.checkNotNullParameter(scenarioData, "scenarioData"); + Intrinsics.checkNotNullParameter(optionsFlags, "optionsFlags"); + Intrinsics.checkNotNullParameter(players, "players"); + Intrinsics.checkNotNullParameter(forces, "forces"); + return new WurstProjectBuildMapData(name, fileName, author, scenarioData, optionsFlags, players, forces); + } + + @NotNull + public String toString() { + return "WurstProjectBuildMapData(name=" + this.name + ", fileName=" + this.fileName + ", author=" + this.author + ", scenarioData=" + this.scenarioData + ", optionsFlags=" + this.optionsFlags + ", players=" + this.players + ", forces=" + this.forces + ")"; + } + + public int hashCode() { + int result = this.name.hashCode(); + result = result * 31 + this.fileName.hashCode(); + result = result * 31 + this.author.hashCode(); + result = result * 31 + this.scenarioData.hashCode(); + result = result * 31 + this.optionsFlags.hashCode(); + result = result * 31 + this.players.hashCode(); + return result * 31 + this.forces.hashCode(); + } + + public boolean equals(@Nullable Object other) { + if (this == other) + return true; + if (!(other instanceof WurstProjectBuildMapData)) + return false; + WurstProjectBuildMapData wurstProjectBuildMapData = (WurstProjectBuildMapData) other; + return !Intrinsics.areEqual(this.name, wurstProjectBuildMapData.name) ? false : (!Intrinsics.areEqual(this.fileName, wurstProjectBuildMapData.fileName) ? false : (!Intrinsics.areEqual(this.author, wurstProjectBuildMapData.author) ? false : (!Intrinsics.areEqual(this.scenarioData, wurstProjectBuildMapData.scenarioData) ? false : (!Intrinsics.areEqual(this.optionsFlags, wurstProjectBuildMapData.optionsFlags) ? false : (!Intrinsics.areEqual(this.players, wurstProjectBuildMapData.players) ? false : (!!Intrinsics.areEqual(this.forces, wurstProjectBuildMapData.forces))))))); + } +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildOptionFlagsData.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildOptionFlagsData.java new file mode 100644 index 000000000..e915ec1a1 --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildOptionFlagsData.java @@ -0,0 +1,119 @@ +package de.peeeq.wurstscript.project.config; + +import com.fasterxml.jackson.annotation.JsonInclude; +import kotlin.Metadata; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_DEFAULT) +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000\036\n\002\030\002\n\002\020\000\n\000\n\002\020\013\n\002\b\027\n\002\020\b\n\000\n\002\020\016\n\000\b\b\030\0002\0020\001BA\022\b\b\002\020\002\032\0020\003\022\b\b\002\020\004\032\0020\003\022\b\b\002\020\005\032\0020\003\022\b\b\002\020\006\032\0020\003\022\b\b\002\020\007\032\0020\003\022\b\b\002\020\b\032\0020\003\006\002\020\tJ\t\020\021\032\0020\003H\003J\t\020\022\032\0020\003H\003J\t\020\023\032\0020\003H\003J\t\020\024\032\0020\003H\003J\t\020\025\032\0020\003H\003J\t\020\026\032\0020\003H\003JE\020\027\032\0020\0002\b\b\002\020\002\032\0020\0032\b\b\002\020\004\032\0020\0032\b\b\002\020\005\032\0020\0032\b\b\002\020\006\032\0020\0032\b\b\002\020\007\032\0020\0032\b\b\002\020\b\032\0020\003H\001J\023\020\030\032\0020\0032\b\020\031\032\004\030\0010\001H\003J\t\020\032\032\0020\033H\001J\t\020\034\032\0020\035H\001R\021\020\004\032\0020\003\006\b\n\000\032\004\b\n\020\013R\021\020\002\032\0020\003\006\b\n\000\032\004\b\f\020\013R\021\020\005\032\0020\003\006\b\n\000\032\004\b\r\020\013R\021\020\006\032\0020\003\006\b\n\000\032\004\b\016\020\013R\021\020\007\032\0020\003\006\b\n\000\032\004\b\017\020\013R\021\020\b\032\0020\003\006\b\n\000\032\004\b\020\020\013\006\036"}, d2 = {"Lde/peeeq/wurstscript/project/config/WurstProjectBuildOptionFlagsData;", "", "hideMinimapPreview", "", "forcesFixed", "maskedAreasPartiallyVisible", "showWavesOnCliffShores", "showWavesOnRollingShores", "useItemClassificationSystem", "(ZZZZZZ)V", "getForcesFixed", "()Z", "getHideMinimapPreview", "getMaskedAreasPartiallyVisible", "getShowWavesOnCliffShores", "getShowWavesOnRollingShores", "getUseItemClassificationSystem", "component1", "component2", "component3", "component4", "component5", "component6", "copy", "equals", "other", "hashCode", "", "toString", "", "wurstscript"}) +public final class WurstProjectBuildOptionFlagsData { + private final boolean hideMinimapPreview; + + private final boolean forcesFixed; + + private final boolean maskedAreasPartiallyVisible; + + private final boolean showWavesOnCliffShores; + + private final boolean showWavesOnRollingShores; + + private final boolean useItemClassificationSystem; + + public WurstProjectBuildOptionFlagsData(boolean hideMinimapPreview, boolean forcesFixed, boolean maskedAreasPartiallyVisible, boolean showWavesOnCliffShores, boolean showWavesOnRollingShores, boolean useItemClassificationSystem) { + this.hideMinimapPreview = hideMinimapPreview; + this.forcesFixed = forcesFixed; + this.maskedAreasPartiallyVisible = maskedAreasPartiallyVisible; + this.showWavesOnCliffShores = showWavesOnCliffShores; + this.showWavesOnRollingShores = showWavesOnRollingShores; + this.useItemClassificationSystem = useItemClassificationSystem; + } + + public WurstProjectBuildOptionFlagsData() { + this(false, false, false, false, false, false); + } + + public final boolean getHideMinimapPreview() { + return this.hideMinimapPreview; + } + + public final boolean getForcesFixed() { + return this.forcesFixed; + } + + public final boolean getMaskedAreasPartiallyVisible() { + return this.maskedAreasPartiallyVisible; + } + + public final boolean getShowWavesOnCliffShores() { + return this.showWavesOnCliffShores; + } + + public final boolean getShowWavesOnRollingShores() { + return this.showWavesOnRollingShores; + } + + public final boolean getUseItemClassificationSystem() { + return this.useItemClassificationSystem; + } + + public final boolean component1() { + return this.hideMinimapPreview; + } + + public final boolean component2() { + return this.forcesFixed; + } + + public final boolean component3() { + return this.maskedAreasPartiallyVisible; + } + + public final boolean component4() { + return this.showWavesOnCliffShores; + } + + public final boolean component5() { + return this.showWavesOnRollingShores; + } + + public final boolean component6() { + return this.useItemClassificationSystem; + } + + @NotNull + public final WurstProjectBuildOptionFlagsData copy(boolean hideMinimapPreview, boolean forcesFixed, boolean maskedAreasPartiallyVisible, boolean showWavesOnCliffShores, boolean showWavesOnRollingShores, boolean useItemClassificationSystem) { + return new WurstProjectBuildOptionFlagsData(hideMinimapPreview, forcesFixed, maskedAreasPartiallyVisible, showWavesOnCliffShores, showWavesOnRollingShores, useItemClassificationSystem); + } + + @NotNull + public String toString() { + return "WurstProjectBuildOptionFlagsData(hideMinimapPreview=" + this.hideMinimapPreview + ", forcesFixed=" + this.forcesFixed + ", maskedAreasPartiallyVisible=" + this.maskedAreasPartiallyVisible + ", showWavesOnCliffShores=" + this.showWavesOnCliffShores + ", showWavesOnRollingShores=" + this.showWavesOnRollingShores + ", useItemClassificationSystem=" + this.useItemClassificationSystem + ")"; + } + + public int hashCode() { + int result = 0; + if (this.hideMinimapPreview) + result = 1; + if (this.forcesFixed) + result = result * 31 + 1; + if (this.maskedAreasPartiallyVisible) + result = result * 31 + 1; + if (this.showWavesOnCliffShores) + result = result * 31 + 1; + if (this.showWavesOnRollingShores) + result = result * 31 + 1; + if (this.useItemClassificationSystem) + result = result * 31 + 1; + return result; + } + + public boolean equals(@Nullable Object other) { + if (this == other) + return true; + if (!(other instanceof WurstProjectBuildOptionFlagsData)) + return false; + WurstProjectBuildOptionFlagsData wurstProjectBuildOptionFlagsData = (WurstProjectBuildOptionFlagsData) other; + return (this.hideMinimapPreview != wurstProjectBuildOptionFlagsData.hideMinimapPreview) ? false : ((this.forcesFixed != wurstProjectBuildOptionFlagsData.forcesFixed) ? false : ((this.maskedAreasPartiallyVisible != wurstProjectBuildOptionFlagsData.maskedAreasPartiallyVisible) ? false : ((this.showWavesOnCliffShores != wurstProjectBuildOptionFlagsData.showWavesOnCliffShores) ? false : ((this.showWavesOnRollingShores != wurstProjectBuildOptionFlagsData.showWavesOnRollingShores) ? false : (!(this.useItemClassificationSystem != wurstProjectBuildOptionFlagsData.useItemClassificationSystem)))))); + } +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildPlayer.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildPlayer.java new file mode 100644 index 000000000..e3a5ad18d --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildPlayer.java @@ -0,0 +1,108 @@ +package de.peeeq.wurstscript.project.config; + +import com.fasterxml.jackson.annotation.JsonInclude; +import kotlin.Metadata; +import kotlin.jvm.internal.Intrinsics; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000*\n\002\030\002\n\002\020\000\n\000\n\002\020\b\n\000\n\002\020\016\n\000\n\002\030\002\n\000\n\002\030\002\n\000\n\002\020\013\n\002\b\030\b\b\030\0002\0020\001B5\022\006\020\002\032\0020\003\022\b\020\004\032\004\030\0010\005\022\b\020\006\032\004\030\0010\007\022\b\020\b\032\004\030\0010\t\022\b\020\n\032\004\030\0010\013\006\002\020\fJ\t\020\030\032\0020\003H\003J\013\020\031\032\004\030\0010\005H\003J\013\020\032\032\004\030\0010\007H\003J\013\020\033\032\004\030\0010\tH\003J\020\020\034\032\004\030\0010\013H\003\006\002\020\020JH\020\035\032\0020\0002\b\b\002\020\002\032\0020\0032\n\b\002\020\004\032\004\030\0010\0052\n\b\002\020\006\032\004\030\0010\0072\n\b\002\020\b\032\004\030\0010\t2\n\b\002\020\n\032\004\030\0010\013H\001\006\002\020\036J\023\020\037\032\0020\0132\b\020 \032\004\030\0010\001H\003J\t\020!\032\0020\003H\001J\t\020\"\032\0020\005H\001R\023\020\b\032\004\030\0010\t\006\b\n\000\032\004\b\r\020\016R\025\020\n\032\004\030\0010\013\006\n\n\002\020\021\032\004\b\017\020\020R\021\020\002\032\0020\003\006\b\n\000\032\004\b\022\020\023R\023\020\004\032\004\030\0010\005\006\b\n\000\032\004\b\024\020\025R\023\020\006\032\004\030\0010\007\006\b\n\000\032\004\b\026\020\027\006#"}, d2 = {"Lde/peeeq/wurstscript/project/config/WurstProjectBuildPlayer;", "", "id", "", "name", "", "race", "Lde/peeeq/wurstscript/project/config/Race;", "controller", "Lde/peeeq/wurstscript/project/config/Controller;", "fixedStartLoc", "", "(ILjava/lang/String;Lde/peeeq/wurstscript/project/config/Race;Lde/peeeq/wurstscript/project/config/Controller;Ljava/lang/Boolean;)V", "getController", "()Lde/peeeq/wurstscript/project/config/Controller;", "getFixedStartLoc", "()Ljava/lang/Boolean;", "Ljava/lang/Boolean;", "getId", "()I", "getName", "()Ljava/lang/String;", "getRace", "()Lde/peeeq/wurstscript/project/config/Race;", "component1", "component2", "component3", "component4", "component5", "copy", "(ILjava/lang/String;Lde/peeeq/wurstscript/project/config/Race;Lde/peeeq/wurstscript/project/config/Controller;Ljava/lang/Boolean;)Lde/peeeq/wurstscript/project/config/WurstProjectBuildPlayer;", "equals", "other", "hashCode", "toString", "wurstscript"}) +public final class WurstProjectBuildPlayer { + private final int id; + + @Nullable + private final String name; + + @Nullable + private final Race race; + + @Nullable + private final Controller controller; + + @Nullable + private final Boolean fixedStartLoc; + + public WurstProjectBuildPlayer(int id, @Nullable String name, @Nullable Race race, @Nullable Controller controller, @Nullable Boolean fixedStartLoc) { + this.id = id; + this.name = name; + this.race = race; + this.controller = controller; + this.fixedStartLoc = fixedStartLoc; + } + + public final int getId() { + return this.id; + } + + @Nullable + public final String getName() { + return this.name; + } + + @Nullable + public final Race getRace() { + return this.race; + } + + @Nullable + public final Controller getController() { + return this.controller; + } + + @Nullable + public final Boolean getFixedStartLoc() { + return this.fixedStartLoc; + } + + public final int component1() { + return this.id; + } + + @Nullable + public final String component2() { + return this.name; + } + + @Nullable + public final Race component3() { + return this.race; + } + + @Nullable + public final Controller component4() { + return this.controller; + } + + @Nullable + public final Boolean component5() { + return this.fixedStartLoc; + } + + @NotNull + public final WurstProjectBuildPlayer copy(int id, @Nullable String name, @Nullable Race race, @Nullable Controller controller, @Nullable Boolean fixedStartLoc) { + return new WurstProjectBuildPlayer(id, name, race, controller, fixedStartLoc); + } + + @NotNull + public String toString() { + return "WurstProjectBuildPlayer(id=" + this.id + ", name=" + this.name + ", race=" + this.race + ", controller=" + this.controller + ", fixedStartLoc=" + this.fixedStartLoc + ")"; + } + + public int hashCode() { + int result = Integer.hashCode(this.id); + result = result * 31 + ((this.name == null) ? 0 : this.name.hashCode()); + result = result * 31 + ((this.race == null) ? 0 : this.race.hashCode()); + result = result * 31 + ((this.controller == null) ? 0 : this.controller.hashCode()); + return result * 31 + ((this.fixedStartLoc == null) ? 0 : this.fixedStartLoc.hashCode()); + } + + public boolean equals(@Nullable Object other) { + if (this == other) + return true; + if (!(other instanceof WurstProjectBuildPlayer)) + return false; + WurstProjectBuildPlayer wurstProjectBuildPlayer = (WurstProjectBuildPlayer) other; + return (this.id != wurstProjectBuildPlayer.id) ? false : (!Intrinsics.areEqual(this.name, wurstProjectBuildPlayer.name) ? false : ((this.race != wurstProjectBuildPlayer.race) ? false : ((this.controller != wurstProjectBuildPlayer.controller) ? false : (!!Intrinsics.areEqual(this.fixedStartLoc, wurstProjectBuildPlayer.fixedStartLoc))))); + } +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildScenarioData.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildScenarioData.java new file mode 100644 index 000000000..f05026ecc --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectBuildScenarioData.java @@ -0,0 +1,87 @@ +package de.peeeq.wurstscript.project.config; + +import com.fasterxml.jackson.annotation.JsonInclude; +import kotlin.Metadata; +import kotlin.jvm.internal.Intrinsics; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@JsonInclude(JsonInclude.Include.NON_DEFAULT) +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000*\n\002\030\002\n\002\020\000\n\000\n\002\020\016\n\002\b\002\n\002\030\002\n\002\b\r\n\002\020\013\n\002\b\002\n\002\020\b\n\002\b\002\b\b\030\0002\0020\001B#\022\b\b\002\020\002\032\0020\003\022\b\b\002\020\004\032\0020\003\022\b\020\005\032\004\030\0010\006\006\002\020\007J\t\020\017\032\0020\003H\003J\t\020\020\032\0020\003H\003J\013\020\021\032\004\030\0010\006H\003J)\020\022\032\0020\0002\b\b\002\020\002\032\0020\0032\b\b\002\020\004\032\0020\0032\n\b\002\020\005\032\004\030\0010\006H\001J\023\020\023\032\0020\0242\b\020\025\032\004\030\0010\001H\003J\t\020\026\032\0020\027H\001J\t\020\030\032\0020\003H\001R\021\020\002\032\0020\003\006\b\n\000\032\004\b\b\020\tR\034\020\005\032\004\030\0010\006X\016\006\016\n\000\032\004\b\n\020\013\"\004\b\f\020\rR\021\020\004\032\0020\003\006\b\n\000\032\004\b\016\020\t\006\031"}, d2 = {"Lde/peeeq/wurstscript/project/config/WurstProjectBuildScenarioData;", "", "description", "", "suggestedPlayers", "loadingScreen", "Lde/peeeq/wurstscript/project/config/WurstProjectBuildLoadingScreenData;", "(Ljava/lang/String;Ljava/lang/String;Lde/peeeq/wurstscript/project/config/WurstProjectBuildLoadingScreenData;)V", "getDescription", "()Ljava/lang/String;", "getLoadingScreen", "()Lde/peeeq/wurstscript/project/config/WurstProjectBuildLoadingScreenData;", "setLoadingScreen", "(Lde/peeeq/wurstscript/project/config/WurstProjectBuildLoadingScreenData;)V", "getSuggestedPlayers", "component1", "component2", "component3", "copy", "equals", "", "other", "hashCode", "", "toString", "wurstscript"}) +public final class WurstProjectBuildScenarioData { + @NotNull + private final String description; + + @NotNull + private final String suggestedPlayers; + + @Nullable + private WurstProjectBuildLoadingScreenData loadingScreen; + + public WurstProjectBuildScenarioData(@NotNull String description, @NotNull String suggestedPlayers, @Nullable WurstProjectBuildLoadingScreenData loadingScreen) { + this.description = description; + this.suggestedPlayers = suggestedPlayers; + this.loadingScreen = loadingScreen; + } + + @NotNull + public final String getDescription() { + return this.description; + } + + @NotNull + public final String getSuggestedPlayers() { + return this.suggestedPlayers; + } + + @Nullable + public final WurstProjectBuildLoadingScreenData getLoadingScreen() { + return this.loadingScreen; + } + + public final void setLoadingScreen(@Nullable WurstProjectBuildLoadingScreenData data) { + this.loadingScreen = data; + } + + @NotNull + public final String component1() { + return this.description; + } + + @NotNull + public final String component2() { + return this.suggestedPlayers; + } + + @Nullable + public final WurstProjectBuildLoadingScreenData component3() { + return this.loadingScreen; + } + + @NotNull + public final WurstProjectBuildScenarioData copy(@NotNull String description, @NotNull String suggestedPlayers, @Nullable WurstProjectBuildLoadingScreenData loadingScreen) { + Intrinsics.checkNotNullParameter(description, "description"); + Intrinsics.checkNotNullParameter(suggestedPlayers, "suggestedPlayers"); + return new WurstProjectBuildScenarioData(description, suggestedPlayers, loadingScreen); + } + + @NotNull + public String toString() { + return "WurstProjectBuildScenarioData(description=" + this.description + ", suggestedPlayers=" + this.suggestedPlayers + ", loadingScreen=" + this.loadingScreen + ")"; + } + + public int hashCode() { + int result = this.description.hashCode(); + result = result * 31 + this.suggestedPlayers.hashCode(); + return result * 31 + ((this.loadingScreen == null) ? 0 : this.loadingScreen.hashCode()); + } + + public boolean equals(@Nullable Object other) { + if (this == other) + return true; + if (!(other instanceof WurstProjectBuildScenarioData)) + return false; + WurstProjectBuildScenarioData wurstProjectBuildScenarioData = (WurstProjectBuildScenarioData) other; + return !Intrinsics.areEqual(this.description, wurstProjectBuildScenarioData.description) ? false : (!Intrinsics.areEqual(this.suggestedPlayers, wurstProjectBuildScenarioData.suggestedPlayers) ? false : (!!Intrinsics.areEqual(this.loadingScreen, wurstProjectBuildScenarioData.loadingScreen))); + } +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectConfig.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectConfig.java new file mode 100644 index 000000000..49bbb5c01 --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectConfig.java @@ -0,0 +1,31 @@ +package de.peeeq.wurstscript.project.config; + +import kotlin.Metadata; +import kotlin.jvm.internal.Intrinsics; +import kotlin.text.StringsKt; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000\030\n\002\030\002\n\002\020\000\n\002\b\002\n\002\030\002\n\000\n\002\030\002\n\000\b\002\030\0002\0020\001B\007\b\002\006\002\020\002J\020\020\003\032\004\030\0010\0042\006\020\005\032\0020\006\006\007"}, d2 = {"Lde/peeeq/wurstscript/project/config/WurstProjectConfig;", "", "()V", "loadProject", "Lde/peeeq/wurstscript/project/config/WurstProjectConfigData;", "buildFile", "Ljava/nio/file/Path;", "wurstscript"}) +public final class WurstProjectConfig { + @NotNull + public static final WurstProjectConfig INSTANCE = new WurstProjectConfig(); + + @Nullable + public final WurstProjectConfigData loadProject(@NotNull Path buildFile) throws IOException { + Intrinsics.checkNotNullParameter(buildFile, "buildFile"); + if (Files.exists(buildFile) && StringsKt.equals(buildFile.getFileName().toString(), "wurst.build", true)) { + WurstProjectConfigData config = YamlHelper.INSTANCE.loadProjectConfig(buildFile); + Path projectRoot = buildFile.getParent(); + if ((((CharSequence) config.getProjectName()).length() == 0)) { + config.setProjectName(String.valueOf((projectRoot == null) ? null : projectRoot.getFileName())); + } + return config; + } + return null; + } +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectConfigData.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectConfigData.java new file mode 100644 index 000000000..1b65914de --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/WurstProjectConfigData.java @@ -0,0 +1,88 @@ +package de.peeeq.wurstscript.project.config; + +import com.fasterxml.jackson.annotation.JsonInclude; +import kotlin.Metadata; +import kotlin.jvm.internal.Intrinsics; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\0002\n\002\030\002\n\002\020\000\n\000\n\002\020\016\n\000\n\002\030\002\n\002\030\002\n\000\n\002\030\002\n\002\b\016\n\002\020\013\n\002\b\002\n\002\020\b\n\002\b\002\b\b\030\0002\0020\001B1\022\006\020\002\032\0020\003\022\030\b\002\020\004\032\022\022\004\022\0020\0030\005j\b\022\004\022\0020\003`\006\022\b\b\002\020\007\032\0020\b\006\002\020\tJ\t\020\022\032\0020\003H\003J\031\020\023\032\022\022\004\022\0020\0030\005j\b\022\004\022\0020\003`\006H\003J\t\020\024\032\0020\bH\003J7\020\025\032\0020\0002\b\b\002\020\002\032\0020\0032\030\b\002\020\004\032\022\022\004\022\0020\0030\005j\b\022\004\022\0020\003`\0062\b\b\002\020\007\032\0020\bH\001J\023\020\026\032\0020\0272\b\020\030\032\004\030\0010\001H\003J\t\020\031\032\0020\032H\001J\t\020\033\032\0020\003H\001R\021\020\007\032\0020\b\006\b\n\000\032\004\b\n\020\013R!\020\004\032\022\022\004\022\0020\0030\005j\b\022\004\022\0020\003`\006\006\b\n\000\032\004\b\f\020\rR\032\020\002\032\0020\003X\016\006\016\n\000\032\004\b\016\020\017\"\004\b\020\020\021\006\034"}, d2 = {"Lde/peeeq/wurstscript/project/config/WurstProjectConfigData;", "", "projectName", "", "dependencies", "Ljava/util/ArrayList;", "Lkotlin/collections/ArrayList;", "buildMapData", "Lde/peeeq/wurstscript/project/config/WurstProjectBuildMapData;", "(Ljava/lang/String;Ljava/util/ArrayList;Lde/peeeq/wurstscript/project/config/WurstProjectBuildMapData;)V", "getBuildMapData", "()Lde/peeeq/wurstscript/project/config/WurstProjectBuildMapData;", "getDependencies", "()Ljava/util/ArrayList;", "getProjectName", "()Ljava/lang/String;", "setProjectName", "(Ljava/lang/String;)V", "component1", "component2", "component3", "copy", "equals", "", "other", "hashCode", "", "toString", "wurstscript"}) +public final class WurstProjectConfigData { + @NotNull + private final ArrayList dependencies; + @NotNull + private final WurstProjectBuildMapData buildMapData; + @NotNull + private String projectName; + + public WurstProjectConfigData(@NotNull String projectName, @NotNull ArrayList dependencies, @NotNull WurstProjectBuildMapData buildMapData) { + this.projectName = projectName; + this.dependencies = dependencies; + this.buildMapData = buildMapData; + } + + @NotNull + public final String getProjectName() { + return this.projectName; + } + + public final void setProjectName(@NotNull String name) { + this.projectName = name; + } + + @NotNull + public final ArrayList getDependencies() { + return this.dependencies; + } + + @NotNull + public final WurstProjectBuildMapData getBuildMapData() { + return this.buildMapData; + } + + @NotNull + public final String component1() { + return this.projectName; + } + + @NotNull + public final ArrayList component2() { + return this.dependencies; + } + + @NotNull + public final WurstProjectBuildMapData component3() { + return this.buildMapData; + } + + @NotNull + public final WurstProjectConfigData copy(@NotNull String projectName, @NotNull ArrayList dependencies, @NotNull WurstProjectBuildMapData buildMapData) { + Intrinsics.checkNotNullParameter(projectName, "projectName"); + Intrinsics.checkNotNullParameter(dependencies, "dependencies"); + Intrinsics.checkNotNullParameter(buildMapData, "buildMapData"); + return new WurstProjectConfigData(projectName, dependencies, buildMapData); + } + + @NotNull + public String toString() { + return "WurstProjectConfigData(projectName=" + this.projectName + ", dependencies=" + this.dependencies + ", buildMapData=" + this.buildMapData + ")"; + } + + public int hashCode() { + int result = this.projectName.hashCode(); + result = result * 31 + this.dependencies.hashCode(); + return result * 31 + this.buildMapData.hashCode(); + } + + public boolean equals(@Nullable Object other) { + if (this == other) + return true; + if (!(other instanceof WurstProjectConfigData)) + return false; + WurstProjectConfigData wurstProjectConfigData = (WurstProjectConfigData) other; + return !Intrinsics.areEqual(this.projectName, wurstProjectConfigData.projectName) ? false : (!Intrinsics.areEqual(this.dependencies, wurstProjectConfigData.dependencies) ? false : (!!Intrinsics.areEqual(this.buildMapData, wurstProjectConfigData.buildMapData))); + } +} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/YamlHelper.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/YamlHelper.java new file mode 100644 index 000000000..48293d4fc --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/project/config/YamlHelper.java @@ -0,0 +1,71 @@ +package de.peeeq.wurstscript.project.config; + +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.Module; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; +import com.fasterxml.jackson.module.kotlin.KotlinModule; +import kotlin.Metadata; +import kotlin.Unit; +import kotlin.io.CloseableKt; +import kotlin.jvm.functions.Function0; +import kotlin.jvm.internal.Intrinsics; +import kotlin.jvm.internal.Lambda; +import org.jetbrains.annotations.NotNull; + +import java.io.BufferedReader; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +@Metadata(mv = {1, 6, 0}, k = 1, xi = 48, d1 = {"\000.\n\002\030\002\n\002\020\000\n\002\b\002\n\002\030\002\n\000\n\002\030\002\n\000\n\002\020\016\n\000\n\002\030\002\n\002\b\002\n\002\030\002\n\002\b\002\b\002\030\0002\0020\001:\001\016B\007\b\002\006\002\020\002J\016\020\007\032\0020\b2\006\020\t\032\0020\nJ\016\020\013\032\0020\n2\006\020\f\032\0020\rR\016\020\003\032\0020\004X\004\006\002\n\000R\016\020\005\032\0020\006X\016\006\002\n\000\006\017"}, d2 = {"Lde/peeeq/wurstscript/project/config/YamlHelper;", "", "()V", "log", "Lmu/KLogger;", "mapper", "Lcom/fasterxml/jackson/databind/ObjectMapper;", "dumpProjectConfig", "", "configData", "Lde/peeeq/wurstscript/project/config/WurstProjectConfigData;", "loadProjectConfig", "path", "Ljava/nio/file/Path;", "YamlException", "wurstscript"}) +public final class YamlHelper { + @NotNull + public static final YamlHelper INSTANCE = new YamlHelper(); + @NotNull + private static ObjectMapper mapper; + + static { + YAMLFactory yamlFactory = new YAMLFactory(); + yamlFactory.enable(YAMLGenerator.Feature.MINIMIZE_QUOTES); + yamlFactory.enable(JsonParser.Feature.ALLOW_MISSING_VALUES); + mapper = new ObjectMapper((JsonFactory) yamlFactory); + mapper.registerModule((Module) new KotlinModule(0, false, false, false, null, false)); + mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + } + + @NotNull + public final WurstProjectConfigData loadProjectConfig(@NotNull Path path) throws IOException { + BufferedReader bufferedReader2; + Intrinsics.checkNotNullParameter(path, "path"); + BufferedReader bufferedReader1 = Files.newBufferedReader(path); + try (var it = Files.newBufferedReader(path)) { + return mapper.readValue(it, WurstProjectConfigData.class); + } catch (Exception e) { + throw new YamlException("The project's wurst.build file could not be read. Input malformed or corrupt."); + } + } + + @NotNull + public final String dumpProjectConfig(@NotNull WurstProjectConfigData configData) throws JsonProcessingException { + Intrinsics.checkNotNullParameter(configData, "configData"); + String str = mapper.writeValueAsString(configData); + Intrinsics.checkNotNullExpressionValue(str, "mapper.writeValueAsString(configData)"); + return str; + } + + public static class YamlException extends RuntimeException { + + public YamlException(String s) { + super(s); + } + } + +} diff --git a/de.peeeq.wurstscript/src/main/java/module-info.java b/de.peeeq.wurstscript/src/main/java/module-info.java new file mode 100644 index 000000000..294131121 --- /dev/null +++ b/de.peeeq.wurstscript/src/main/java/module-info.java @@ -0,0 +1,29 @@ +module de.peeeq.wurstscript { + requires annotations; + requires com.google.common; + requires com.google.gson; + requires commons.lang; + requires io.vavr; + requires java.desktop; + requires java.logging; + requires java.management; + requires jchardet; + requires jmpq3; + requires jsr305; + requires logback.classic; + requires logback.core; + requires org.antlr.antlr4.runtime; + requires org.eclipse.jdt.annotation; + requires org.eclipse.lsp4j.jsonrpc; + requires org.eclipse.lsp4j; + requires org.slf4j; + requires velocity; + requires wc3libs; + requires com.fasterxml.jackson.core; + requires kotlin.stdlib; + requires com.fasterxml.jackson.databind; + requires com.fasterxml.jackson.dataformat.yaml; + requires com.fasterxml.jackson.kotlin; + + +} diff --git a/de.peeeq.wurstscript/src/main/resources/wbschema.json b/de.peeeq.wurstscript/src/main/resources/wbschema.json new file mode 100644 index 000000000..7728093df --- /dev/null +++ b/de.peeeq.wurstscript/src/main/resources/wbschema.json @@ -0,0 +1,201 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://example.com/product.schema.json", + "title": "Wurst Build File", + "description": "Exposes dependency and map configuration", + "type": "object", + "properties": { + "projectName": { + "description": "The name of this wurst project", + "type": "string" + }, + "dependencies": { + "description": "Git repository urls of this project's dependencies", + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "buildMapData": { + "description": "Map configuration for the build map command", + "type": "object", + "properties": { + "name": { + "description": "The name that will be displayed ingame", + "type": "string" + }, + "fileName": { + "description": "The name of the output file", + "type": "string" + }, + "author": { + "description": "The name of the map's author", + "type": "string" + }, + "scenarioData": { + "description": "The scenario options", + "type": "object", + "properties": { + "description": { + "description": "The map's description", + "type": "string" + }, + "suggestedPlayers": { + "description": "The map's suggested player amount", + "type": "string" + }, + "loadingScreen": { + "description": "The loading screen options", + "type": "object", + "properties": { + "model": { + "description": "The path to a custom loading screen model", + "type": "string" + }, + "background": { + "description": "The name of an existing loading screen, e.g. Generic", + "type": "string" + }, + "title": { + "description": "The loading screen title", + "type": "string" + }, + "subTitle": { + "description": "The loading screen subtitle", + "type": "string" + }, + "text": { + "description": "The loading screen text", + "type": "string" + } + } + } + } + }, + "optionsFlags": { + "description": "The map option flags", + "type": "object", + "properties": { + "hideMinimapPreview": { + "description": "Whether or not to hide the minimap preview", + "type": "boolean" + }, + "forcesFixed": { + "description": "Whether or not the force assignments are fixed", + "type": "boolean" + }, + "maskedAreasPartiallyVisible": { + "description": "Whether or not to makes areas with black mask partially visible", + "type": "boolean" + }, + "showWavesOnCliffShores": { + "description": "Whether or not to show water waves on cliff shores", + "type": "boolean" + }, + "showWavesOnRollingShores": { + "description": "Whether or not to show water waves on rolling shores", + "type": "boolean" + }, + "useItemClassificationSystem": { + "description": "Whether or not to use the item classification system", + "type": "boolean" + } + } + }, + "players": { + "description": "The available player slots", + "type": "array", + "items": { + "$ref": "#/definitions/player" + } + }, + "forces": { + "description": "The available player forces", + "type": "array", + "items": { + "$ref": "#/definitions/force" + } + } + } + } + }, + "definitions": { + "player": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "description": "The ID of the player" + }, + "name": { + "type": "string", + "description": "The name of the player" + }, + "race": { + "type": "string", + "description": "The race of this player", + "enum": ["NIGHT_ELF", "HUMAN", "ORC", "SELECTABLE", "UNDEAD"] + }, + "controller": { + "type": "string", + "description": "The controller of this player", + "enum": ["USER", "RESCUABLE", "NEUTRAL", "COMPUTER"] + }, + "fixedStartLoc": { + "type": "boolean", + "description": "Whether or not the startposition is fixed" + } + } + }, + "force": { + "type": "object", + "required": [ + "name", + "playerIds" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the player" + }, + "playerIds": { + "type": "array", + "description": "The player ids in this force", + "items": { + "type": "integer" + } + }, + "flags": { + "type": "object", + "description": "The controller of this player", + "properties": { + "allied": { + "type": "boolean", + "description": "Whether or not players in this force are allied" + }, + "alliedVictory": { + "type": "boolean", + "description": "Whether or not players in this force will win together" + }, + "sharedVision": { + "type": "boolean", + "description": "Whether or not players in this force share map vision" + }, + "sharedControl": { + "type": "boolean", + "description": "Whether or not players in this force share unit control" + }, + "sharedControlAdvanced": { + "type": "boolean", + "description": "Whether or not players in this force share advanced unit control (building, hero skilling, etc.)" + } + } + } + } + } + } +} diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/StdLib.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/StdLib.java index 315cc154a..5a34ec40c 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/StdLib.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/StdLib.java @@ -45,7 +45,11 @@ public synchronized static boolean downloadStandardlib() { try { if (!stdLibFolder.exists()) { - tempFolder.mkdirs(); + System.out.println("Downloading standard library " + gitRepo + " to " + stdLibFolder); + boolean foldersCreated = tempFolder.mkdirs(); + if (!foldersCreated) { + throw new IOException("Could not create folder " + tempFolder); + } try (Git git = Git .cloneRepository() .setDirectory(stdLibFolder) @@ -53,6 +57,8 @@ public synchronized static boolean downloadStandardlib() { .call()) { git.checkout().setName(Constants.MASTER).call(); }; + } else { + System.out.println("Standard library " + gitRepo + " already exists in " + stdLibFolder); } try (Git git = Git.open(stdLibFolder)) { @@ -72,6 +78,8 @@ public synchronized static boolean downloadStandardlib() { isInitialized = true; } catch (IOException | GitAPIException e) { + System.out.println("Could not download standard library: " + e); + e.printStackTrace(System.out); WLogger.severe(e.getStackTrace().toString()); return false; } diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/WurstScriptTest.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/WurstScriptTest.java index 2a4b901f0..128c90696 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/WurstScriptTest.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/WurstScriptTest.java @@ -2,7 +2,8 @@ import com.google.common.base.Charsets; import com.google.common.io.Files; -import config.WurstProjectConfigData; +import de.peeeq.wurstscript.project.config.WurstProjectBuildMapData; +import de.peeeq.wurstscript.project.config.WurstProjectConfigData; import de.peeeq.wurstio.Pjass; import de.peeeq.wurstio.Pjass.Result; import de.peeeq.wurstio.UtilsIO; @@ -26,6 +27,7 @@ import de.peeeq.wurstscript.luaAst.LuaCompilationUnit; import de.peeeq.wurstscript.translation.imtranslation.ImTranslator; import de.peeeq.wurstscript.utils.Utils; +import org.jetbrains.annotations.NotNull; import org.testng.Assert; import java.io.*; @@ -393,7 +395,7 @@ private void translateAndTestLua(String name, boolean executeProg, WurstGui gui, compiler.translateProgToIm(model); - compiler.runCompiletime(new WurstProjectConfigData(), false); + compiler.runCompiletime(defaultWurstProjectConfig(), false); LuaCompilationUnit luaCode = compiler.transformProgToLua(); StringBuilder sb = new StringBuilder(); @@ -455,6 +457,15 @@ private void translateAndTestLua(String name, boolean executeProg, WurstGui gui, } + @NotNull + private WurstProjectConfigData defaultWurstProjectConfig() { + WurstProjectConfigData projectConfigData = new WurstProjectConfigData( + "", + new ArrayList<>(), + new WurstProjectBuildMapData()); + return projectConfigData; + } + private void translateAndTest(String name, boolean executeProg, boolean executeTests, WurstGui gui, WurstCompilerJassImpl compiler, WurstModel model, boolean executeProgOnlyAfterTransforms) throws Error { @@ -477,7 +488,8 @@ private void translateAndTest(String name, boolean executeProg, } } - compiler.runCompiletime(new WurstProjectConfigData(), false); + + compiler.runCompiletime(defaultWurstProjectConfig(), false); JassProg prog = compiler.transformProgToJass(); writeJassImProg(name, gui, imProg); if (gui.getErrorCount() > 0) {