diff --git a/.gitignore b/.gitignore index 3c07035453..64777364ad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,44 +1,25 @@ -.gradle/ -.settings/ -.metadata/ -bin/ -build/ -run/ -eclipse/ - +# eclipse +bin +*.launch +.settings +.metadata .classpath .project -1.10_Client.launch -1.10_Server.launch -1.10_Client 2.launch -sonarqube.sh - -GoreCore_ClientUUIDCache.txt -/config -logs/ -options.txt -saves/ -usercache.json -usernamecache.json -screenshots/ - -crash-reports/ -resourcepacks/ - -docs/.sass-cache -docs/styles.css.map -Client.launch -Client 2.launch -Server.launch - -**/.sass-cache -**/.sass-cache/* -.idea/ -code.iml -out/ +# idea +out +classes *.ipr *.iws *.iml +.idea + +# gradle +build +.gradle -**/Thumbs.db +# other +eclipse +run +ignore* +secrets.properties \ No newline at end of file diff --git a/README.md b/README.md index 1d0c6d7ecb..c6ae796614 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,6 @@ adds content from [*Avatar: The Last Airbender*](https://en.wikipedia.org/wiki/A The mod already has all four major types of bending; many unique, multipurpose Abilities; and mobs and animals from the Avatar world. More information is available at the [wiki](http://projectkorra.wikia.com/wiki/Av2). -Important: Looking for developer --------------------------------- - -We are currently looking for a new lead developer to carry on the mod. More information is available here: - -[Looking for lead developer to take over Avatar Mod 2](http://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/modification-development/2876693-looking-for-lead-developer-to-take-over-avatar-mod) - -Thank you! :) - End Users --------- diff --git a/build unix.sh b/build unix.sh index 018762bea4..b34c1a304e 100644 --- a/build unix.sh +++ b/build unix.sh @@ -1,3 +1,3 @@ #!/bin/sh -./gradlew clean build +./gradlew cleanBuild read -n 1 -s -r -p "Press any key to continue" diff --git a/build windows.bat b/build windows.bat index 5a09e1e4d3..00e7ab1a8a 100644 --- a/build windows.bat +++ b/build windows.bat @@ -1,3 +1,3 @@ @echo off -call gradlew clean build +call gradlew cleanBuild pause diff --git a/build.gradle b/build.gradle index ccd1ce8b3a..36f4d3f39f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,102 +1,255 @@ // For those who want the bleeding edge buildscript { - repositories { - jcenter() - maven { - url "https://plugins.gradle.org/m2/" - } - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' - classpath "com.github.jengelman.gradle.plugins:shadow:2.0.4" - classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2" - } -} -plugins { - id "org.sonarqube" version "2.6.2" -} - -apply plugin: 'net.minecraftforge.gradle.forge' -apply plugin: 'com.github.johnrengelman.shadow' - -// Needs this for IntelliJ to recognize assets folder -idea { - module { - inheritOutputDirs = true - } + repositories { + mavenCentral() + jcenter() + maven { + url = "https://plugins.gradle.org/m2/" + } + maven { + name = "forge" + url = "http://files.minecraftforge.net/maven/" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + maven { + name = "amuzil" + url = "http://repo.amuzil.com/repository/public/" + } + + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' + classpath "com.github.jengelman.gradle.plugins:shadow:4.0.3" + classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7" + } } -ext.configFile = file('build.properties') -ext.config = parseConfig(configFile) +apply plugin: "java" +apply plugin: "idea" +apply plugin: "net.minecraftforge.gradle.forge" +apply plugin: "com.github.johnrengelman.shadow" +apply plugin: "org.sonarqube" +apply plugin: "maven-publish" + +ext.config = parseConfig(file("build.properties")) +ext.dependenciesConfig = parseConfig(file("dependencies.properties")) +ext.secrets = parseConfig(file("secrets.properties")) -group = "com.crowsofwar.avatarmod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = "avatarmod" +version = config.version +group = config.group +archivesBaseName = config.archivesBaseName +// Need this here so Eclipse tasks generates correctly sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 +compileJava { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +// This makes IDEA recognize the assets folder +idea { + module { + inheritOutputDirs = true + } +} + +repositories { + maven { + name = "amuzil" + url = "http://repo.amuzil.com/repository/public/" + } +} + +configurations { + shadow + compile.extendsFrom provided + provided.extendsFrom shadow +} + +task useDeobfDependencies { + dependenciesConfig.obfuscated = false +} + +tasks.runClient.dependsOn tasks.useDeobfDependencies +tasks.runServer.dependsOn tasks.useDeobfDependencies dependencies { - //todo:Update dependencies - compile files("libs/joml/joml-1.8.1.jar") - compile files("libs/yaml/snakeyaml-1.16.jar"); + provided fileTree(dir: dependenciesConfig.libraries + (dependenciesConfig.obfuscated ? "" : "Deobf"), include: ["*.jar"]) + + // Forge Mods + if (dependenciesConfig.obfuscated) { + } else { + } + + // Other Stuff + shadow "org.joml:joml:1.9.12" + shadow "org.yaml:snakeyaml:1.23" } minecraft { - version = config.forge - mappings = config.mappings - - runDir = "run" - - replaceIn 'src/main/java/com/crowsofwar/avatar/AvatarInfo.java' - replace '@VERSION@', project.version -} + version = config.forge + mappings = config.mappings -processResources { - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version + runDir = "run" - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' + replaceIn "src/main/java/com/crowsofwar/avatar/AvatarInfo.java" + replace "@version@", config.version + replace "@modid@", config.modid + replace "@mcversion@", project.minecraft.version + replace "@name@", config.name +} - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } +jar { + manifest { - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } + } + from("./") { + include "*.md" + } } -jar.classifier = "thin" -shadowJar.classifier = "" +shadowJar { + // Overwrite the default file + classifier = null + configurations = [project.configurations.shadow] + + from(sourceSets.main.allJava) { + include "*" + } + from("./") { + include "*.md" + } + + relocate "org.joml", "com.crowsofwar.avatar.joml" + relocate "org.yaml.snakeyaml", "com.crowsofwar.avatar.snakeyaml" +} -reobf { shadowJar { mappingType = "SEARGE" } } +reobf { + shadowJar { + mappingType = "SEARGE" + } +} tasks.reobfShadowJar.mustRunAfter shadowJar -task sourceZip(type: Zip, dependsOn: 'classes') { - classifier "src" - from projectDir - include "src/**/*" +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} - destinationDir(new File(buildDir, "/libs")) +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir } -shadowJar { - configurations = [project.configurations.compile] +artifacts { + archives sourcesJar + // TODO Fix + // archives javadocJar +} + +import org.apache.tools.ant.filters.ReplaceTokens + +processResources { + // This will ensure that this task is redone when the versions change + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // Replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include "mcmod.info" + filter ReplaceTokens, tokens: [version: config.version, mcversion: project.minecraft.version, modid: config.modid, name: config.name] + } + + // Copy everything else + from(sourceSets.main.resources.srcDirs) { + exclude "mcmod.info" + } } -def parseConfig(File config) { - config.withReader { - def prop = new Properties() - prop.load(it) - return (new ConfigSlurper().parse(prop)) - } +static def parseConfig(File config) { + config.withReader { + def prop = new Properties() + prop.load(it) + return (new ConfigSlurper().parse(prop)) + } } + +def startBuildMessage = "Starting build...\n\nName: ${project.name}\nVersion: ${project.version}" +def finishBuildMessage = "Successfully finished building ${project.name} version ${project.version}\n\nYour build is located in:\nbuild/libs" +def fancyBorder = "" + +task buildInformation { + doFirst { + def lines = startBuildMessage.readLines(); + lines.addAll(finishBuildMessage.readLines()) + def maxLength = 0 + for (String line : lines) + maxLength = Math.max(line.length(), maxLength) + if (maxLength % 2 != 0) maxLength++ + for (def i = 0; i < maxLength; i++) { + fancyBorder += i % 2 == 0 ? "=" : "--" + } + } +} + +task startBuild { + doFirst { + println """ +${fancyBorder} + +${startBuildMessage} + +${fancyBorder} +""" + } +} + +task finishBuild { + doLast { + println """ +${fancyBorder} + +${finishBuildMessage} + +${fancyBorder} +""" + } +} + +task cleanBuild(dependsOn: ["buildInformation", "startBuild", "clean", "build", "finishBuild"]) { + group "build" + tasks.startBuild.mustRunAfter tasks.buildInformation + tasks.clean.mustRunAfter tasks.startBuild + tasks.build.mustRunAfter tasks.clean + tasks.finishBuild.mustRunAfter tasks.build +} + +publishing { + publications { + shadowPublication(MavenPublication) { + project.shadow.component(it) + afterEvaluate { + artifact sourcesJar + // TODO artifact javadocJar + } + } + } + repositories { + maven { + url = "http://repo.amuzil.com/repository/public/" + credentials { + username = secrets.repo.username + password = secrets.repo.password + } + } + } +} + +task release(dependsOn: ["cleanBuild", "publish"]) { + group "build" + tasks.publish.mustRunAfter cleanBuild +} \ No newline at end of file diff --git a/build.properties b/build.properties index ccf2b5bdf4..84c7be8748 100644 --- a/build.properties +++ b/build.properties @@ -1,3 +1,7 @@ -version=a5.9 -mappings=snapshot_20171003 -forge=1.12.2-14.23.5.2768 \ No newline at end of file +version = 1.5.10-alpha +modid = avatarmod +name = Avatar Mod: Out of the Iceberg +group = com.crowsofwar.avatar +archivesBaseName = avatarmod +mappings = snapshot_20171003 +forge = 1.12.2-14.23.5.2768 \ No newline at end of file diff --git a/builds/a5.3/avatarmod-a5.3-sources.jar b/builds/a5.3/avatarmod-a5.3-sources.jar deleted file mode 100644 index ef2e536320..0000000000 Binary files a/builds/a5.3/avatarmod-a5.3-sources.jar and /dev/null differ diff --git a/builds/a5.3/avatarmod-a5.3-thin.jar b/builds/a5.3/avatarmod-a5.3-thin.jar deleted file mode 100644 index 1ddaf25f60..0000000000 Binary files a/builds/a5.3/avatarmod-a5.3-thin.jar and /dev/null differ diff --git a/builds/a5.3/avatarmod-a5.3.jar b/builds/a5.3/avatarmod-a5.3.jar deleted file mode 100644 index af49cc3e8f..0000000000 Binary files a/builds/a5.3/avatarmod-a5.3.jar and /dev/null differ diff --git a/dependencies.properties b/dependencies.properties new file mode 100644 index 0000000000..f847daf653 --- /dev/null +++ b/dependencies.properties @@ -0,0 +1,4 @@ +# Whether to use the obfuscated dependencies +obfuscated = true +# Directory to look in for libraries. Deobf is added to the end of it if build (above) is false +libraries = libs \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index e9b9fd5ac1..2a30d090d9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. # This is required to provide enough memory for the Minecraft decompilation process. -org.gradle.jvmargs=-Xmx3G +org.gradle.jvmargs = -Xmx3G \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 073dafec98..31950774ad 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Sun Sep 23 20:07:31 CEST 2018 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip +distributionBase = GRADLE_USER_HOME +distributionPath = wrapper/dists +zipStoreBase = GRADLE_USER_HOME +zipStorePath = wrapper/dists +distributionUrl = https\://services.gradle.org/distributions/gradle-4.10.3-all.zip diff --git a/libs/joml/joml-1.8.1-sources.zip b/libs/joml/joml-1.8.1-sources.zip deleted file mode 100755 index 122405737c..0000000000 Binary files a/libs/joml/joml-1.8.1-sources.zip and /dev/null differ diff --git a/libs/joml/joml-1.8.1.jar b/libs/joml/joml-1.8.1.jar deleted file mode 100755 index f4186e779b..0000000000 Binary files a/libs/joml/joml-1.8.1.jar and /dev/null differ diff --git a/libs/snakeyaml-1.16.zip b/libs/snakeyaml-1.16.zip deleted file mode 100644 index e7d1b54de9..0000000000 Binary files a/libs/snakeyaml-1.16.zip and /dev/null differ diff --git a/libs/yaml/snakeyaml-1.16-src.zip b/libs/yaml/snakeyaml-1.16-src.zip deleted file mode 100755 index e7d1b54de9..0000000000 Binary files a/libs/yaml/snakeyaml-1.16-src.zip and /dev/null differ diff --git a/libs/yaml/snakeyaml-1.16.jar b/libs/yaml/snakeyaml-1.16.jar deleted file mode 100755 index af144fa4c8..0000000000 Binary files a/libs/yaml/snakeyaml-1.16.jar and /dev/null differ diff --git a/secrets.properties b/secrets.properties new file mode 100644 index 0000000000..999ec99a91 --- /dev/null +++ b/secrets.properties @@ -0,0 +1,2 @@ +repo.username = +repo.password = \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000000..432ec9caaa --- /dev/null +++ b/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = "avatarmod" +enableFeaturePreview('STABLE_PUBLISHING') \ No newline at end of file diff --git a/src/main/java/com/crowsofwar/avatar/AvatarInfo.java b/src/main/java/com/crowsofwar/avatar/AvatarInfo.java index eba7b76d1b..58f58d3763 100644 --- a/src/main/java/com/crowsofwar/avatar/AvatarInfo.java +++ b/src/main/java/com/crowsofwar/avatar/AvatarInfo.java @@ -17,9 +17,10 @@ package com.crowsofwar.avatar; +import com.crowsofwar.avatar.common.util.SemanticVersion; + /** - * Not using semantic versioning. This isn't an API, and I'm too lazy to be - * backwards-compatible. + * Not using semantic versioning. This isn't an API, and I'm too lazy to be backwards-compatible. *
* Versioning scheme: AV{DEV_STAGE}{UPDATE}.{PATCH}{DEV_BUILD} *
@@ -32,54 +33,17 @@ * @author CrowsOfWar */ public class AvatarInfo { - - // Things that are adjustable - - /** - * Incremented for every major update. - */ - public static final int VERSION_UPDATE = 5; - /** - * Incremented for minor bug fixes. - */ - public static final int VERSION_PATCH = 3; - /** - * "a" for alpha. - *
- * "b" for beta. - *
- * "" for full release. - */ - public static final String DEV_STAGE = "a"; - public static final String MOD_ID = "avatarmod"; - - // Not adjustable / automatically calculated - public static final String MOD_NAME = "Avatar Mod: Out of the Iceberg"; - public static final String MC_VERSION = "1.12.2"; - /** - * Type of version; 0 for production; 1 for development; 2 for preview 1; 3 - * for preview 2, etc - *
- * Accessed via {@link #IS_PRODUCTION}, {@link #IS_PREVIEW},
- * {@link #IS_DEVELOPMENT}
- */
- private static final int VERSION_TYPE = 0;
- public static final boolean IS_PRODUCTION = VERSION_TYPE == 0;
- public static final boolean IS_DEVELOPMENT = VERSION_TYPE == 1;
- public static final boolean IS_PREVIEW = VERSION_TYPE >= 2;
- /**
+ /*
* Automatically updated when the mod is build
*/
- public static final String PRODUCTION_VERSION = "@VERSION@";
- public static final String VERSION = IS_PRODUCTION ? PRODUCTION_VERSION : DEV_STAGE + VERSION_UPDATE + "." + VERSION_PATCH
- + (IS_PREVIEW ? "_preview" + (VERSION_TYPE - 1) : "_dev");
-
- public enum VersionType {
-
- PRODUCTION,
- PREVIEW,
- DEVELOPMENT
+ public static final String MOD_ID = "@modid@";
+ public static final String MOD_NAME = "@name@";
+ public static final String MC_VERSION = "@mcversion@";
+ public static final String VERSION = "@version@";
+ public static final SemanticVersion SEMANTIC_VERSION = SemanticVersion.of(VERSION);
- }
+ public static final boolean IS_PREVIEW = SEMANTIC_VERSION.isPreRelease();
-}
+ public static boolean DEBUG = false;
+ public static final boolean IS_DEVELOPMENT = IS_PREVIEW || DEBUG;
+}
\ No newline at end of file
diff --git a/src/main/java/com/crowsofwar/avatar/common/util/SemanticVersion.java b/src/main/java/com/crowsofwar/avatar/common/util/SemanticVersion.java
new file mode 100644
index 0000000000..0fce6a155f
--- /dev/null
+++ b/src/main/java/com/crowsofwar/avatar/common/util/SemanticVersion.java
@@ -0,0 +1,185 @@
+package com.crowsofwar.avatar.common.util;
+
+import java.util.Objects;
+import java.util.regex.Pattern;
+
+/**
+ * A class representing a semantic version. It is specified as the following:
+ * major.minor.patch-state.pre (1) OR major.minor.patch-pre.pre (2). State is alpha or beta, major
+ * is the (API) version, minor is the feature version, and patch is the bugfix version. pre is the
+ * pre-release version. If the version state is full, then the second (2) version template will be
+ * used.
+ *
+ * @author Mahtaran
+ */
+public class SemanticVersion implements Comparable