1
0
mirror of https://github.com/kami-blue/client synced 2024-12-17 20:55:13 +00:00

[refactor] Updated Gradle and bunch of dependencies (#1664)

Co-authored-by: Dominika <sokolov.dominika@gmail.com>
This commit is contained in:
Xiaro 2020-12-08 11:24:21 -05:00 committed by GitHub
parent 3b32428a4a
commit 55008ea0ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 262 additions and 163 deletions

View File

@ -1,6 +1,6 @@
language: java
jdk:
- openjdk8
before_install:
- chmod +x gradlew
- "./gradlew setupDecompWorkspace"
- openjdk8
install:
- chmod +x gradlew
- "./gradlew --no-daemon compileJava"

View File

@ -1,57 +1,49 @@
buildscript {
repositories {
jcenter()
maven {
name = 'forge'
url = 'http://files.minecraftforge.net/maven'
}
maven {
name = 'SpongePowered'
url = 'http://repo.spongepowered.org/maven'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.3'
classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: "${kotlin_version}"
classpath 'net.minecraftforge.gradle:ForgeGradle:3.+'
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'kotlin'
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'com.github.johnrengelman.shadow'
version project.modVersion
group project.modGroup
sourceSets {
main.java.srcDirs += 'src/main/cape-api'
main.java.srcDirs += 'src/main/commons'
sourceSets.main.java {
srcDirs += 'src/main/cape-api'
srcDirs += 'src/main/commons'
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
kotlinOptions.jvmTarget = "1.8"
}
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = project.forgeVersion
runDir = 'run'
mappings = project.mcpVersion
coreMod = 'me.zeroeightsix.kami.mixin.MixinLoaderForge'
makeObfSourceJar = false
options.encoding = 'UTF-8'
}
repositories {
@ -75,105 +67,129 @@ repositories {
jcenter()
}
minecraft {
mappings channel: 'stable', version: '39-1.12'
runs {
client {
workingDirectory project.file('run')
property 'fml.coreMods.load', 'me.zeroeightsix.kami.mixin.MixinLoaderForge'
property 'mixin.env.disableRefMap', 'true' // Disable refmap so we don't get trolled by Baritone
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
}
}
}
configurations {
jarLibs
}
dependencies {
compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") { // do NOT update this to 8.0 or above, it breaks compatibility with future client
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
// Forge
minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2854'
jarLibs('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
exclude module: 'commons-io'
exclude module: 'gson'
exclude module: 'guava'
exclude module: 'launchwrapper'
exclude module: 'log4j-core' // we want to exclude this as well because 0.7.11 includes it too new for MC
}
compile(group: 'org.reflections', name: 'reflections', version: '0.9.12') {
exclude group: 'com.google.guava', module: 'guava'
// Hacky way to get mixin work
annotationProcessor('org.spongepowered:mixin:0.8.2:processor') {
exclude module: 'gson'
}
compile 'club.minnced:java-discord-rpc:2.0.2'
compile 'com.github.kevinsawicki:http-request:http-request-6.0'
compile 'com.github.MrPowerGamerBR:TemmieWebhook:-SNAPSHOT'
jarLibs('org.reflections:reflections:0.9.12') {
exclude module: 'gson'
exclude module: 'guava'
}
compile 'com.github.cabaletta:baritone:1.2.14'
compile 'cabaletta:baritone-api:1.2'
jarLibs('club.minnced:java-discord-rpc:2.0.2') {
exclude module: 'jna'
}
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: kotlin_version
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk7", version: kotlin_version
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: kotlin_version
compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: kotlin_version
jarLibs('com.github.MrPowerGamerBR:TemmieWebhook:-SNAPSHOT') {
exclude module: 'gson'
}
compile group: "org.jetbrains", name: "annotations", version: annotations_version
jarLibs 'com.github.kevinsawicki:http-request:6.0'
// Kotlin libs
// kotlin-stdlib-common and annotations aren't required at runtime
jarLibs("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}
jarLibs("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}
jarLibs("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}
jarLibs("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}
// Add them back to compileOnly (provided)
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
compileOnly 'org.jetbrains:annotations:13.0'
// This Baritone will NOT be included in the jar
implementation 'com.github.cabaletta:baritone:1.2.14'
// This Baritone WILL be included in the jar
jarLibs 'cabaletta:baritone-api:1.2'
// Add everything in jarLibs to implementation (compile)
implementation configurations.jarLibs
}
mixin {
defaultObfuscationEnv 'searge'
add sourceSets.main, 'mixins.kami.refmap.json'
}
processResources {
inputs.property 'version', project.version
inputs.property 'mcversion', project.minecraft.version
exclude '**/rawimagefiles'
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': project.version, 'mcversion': project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
rename '(.+_at.cfg)', 'META-INF/$1'
}
shadowJar {
dependencies {
include(dependency('cabaletta:baritone-api'))
include(dependency('club.minnced:java-discord-rpc'))
include(dependency('com.github.kevinsawicki:http-request'))
include(dependency('com.github.MrPowerGamerBR:TemmieWebhook'))
include(dependency("org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}"))
include(dependency("org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"))
include(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"))
include(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"))
include(dependency('org.javassist:javassist'))
include(dependency('org.reflections:reflections'))
include(dependency('org.spongepowered:mixin'))
}
exclude 'dummyThing' // can someone explain why this is here
classifier = 'release'
}
mixin {
defaultObfuscationEnv searge
add sourceSets.main, 'mixins.kami.refmap.json'
}
reobf {
shadowJar {
mappingType = 'SEARGE'
classpath = sourceSets.main.compileClasspath
expand 'version': project.version
}
}
// Don't put baritone mixin here please c:
jar {
manifest {
attributes(
'MixinConfigs': 'mixins.kami.json',
'tweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
'TweakOrder': 0,
'FMLCorePluginContainsFMLMod': 'true',
'FMLCorePlugin': 'me.zeroeightsix.kami.mixin.MixinLoaderForge',
'ForceLoadAsMod': 'true',
'FMLAT': 'kami_at.cfg'
)
}
}
manifest.attributes(
'Manifest-Version': 1.0,
'MixinConfigs': 'mixins.kami.json',
'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
'TweakOrder': 0,
'FMLCorePluginContainsFMLMod': 'true',
'FMLCorePlugin': 'me.zeroeightsix.kami.mixin.MixinLoaderForge',
'ForceLoadAsMod': 'true',
'Main-Class': 'me.zeroeightsix.installer.Installer'
)
jar {
manifest {
attributes(
'Main-Class': 'me.zeroeightsix.installer.Installer'
)
// Copy needed libs to jar
from {
configurations.jarLibs.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
build.dependsOn(shadowJar)
}

View File

@ -1,8 +1,4 @@
org.gradle.jvmargs=-Xmx3G
modGroup=me.zeroeightsix
modVersion=1.12.xx-dev
modBaseName=kamiblue
forgeVersion=1.12.2-14.23.5.2847
mcpVersion=stable_39
kotlin_version=1.3.72
annotations_version=16.0.3
kotlin_version=1.4.20

Binary file not shown.

View File

@ -1,6 +1,5 @@
#Thu Mar 26 18:02:24 EDT 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

51
scripts/buildJarSafe.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
# Created by l1ving on 17/02/20
#
# ONLY USED IN AUTOMATED BUILDS
#
# Usage: "./buildJarSafe.sh"
__d="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source ~/.profile
source "$__d/utils.sh"
check_var "JDK_11_HOME" "$JDK_11_HOME" || exit $?
check_var "JDK_8_HOME" "$JDK_8_HOME" || exit $?
if [ -z "$KAMI_DIR" ]; then
echo "[buildJarSafe] Environment variable KAMI_DIR is not set, exiting." >&2
exit 1
fi
cd "$KAMI_DIR" || exit $?
rm -rf build/libs/ || {
echo "[buildJarSafe] Failed to remove 'build/libs/', exiting." >&2
exit 1
}
export JAVA_HOME="$JDK_8_HOME"
sudo archlinux-java set java-8-openjdk || exit $?
chmod +x gradlew
./gradlew --no-daemon build &>/dev/null || {
echo "[buildJarSafe] Gradle build failed, exiting." >&2
exit 1
}
cd build/libs/ || exit $?
__named="$(find . -maxdepth 1 -name "*.jar" | head -n 1 | sed "s/^\.\///g")"
# shellcheck disable=SC2001
__bad_named="$(echo "$__named" | sed "s/\.jar$/-release.jar/g")"
mv "$__named" "$__bad_named" # rename it to include release
# Build release jar with the name without -release
export JAVA_HOME="$JDK_11_HOME"
sudo archlinux-java set java-11-openjdk || exit $?
java -jar "$__d/jar-shrink/jar-shrink.jar" "$__bad_named" -out "$__named" -n -keep "me.zeroeightsix" -keep "baritone" -keep "org.kamiblue" -keep "org.spongepowered"
rm "$__bad_named" # remove the un-shrunk jar with -release
echo "$__named" # echo the shrunk jar, without -release

View File

@ -1,42 +0,0 @@
#!/bin/bash
# Created by l1ving on 17/02/20
#
# ONLY USED IN AUTOMATED BUILDS
#
# Usage: "./buildNamed.sh"
__d="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source ~/.profile
if [ -z "$KAMI_DIR" ]; then
echo "[buildNamed] Environment variable KAMI_DIR is not set, exiting." >&2
exit 1
fi
cd "$KAMI_DIR" || exit $?
rm -rf build/libs/* || {
echo "[buildNamed] Failed to remove existing files in 'build/libs/', exiting." >&2
exit 1
}
chmod +x gradlew
./gradlew build &>/dev/null || {
echo "[buildNamed] Gradle build failed, exiting." >&2
exit 1
}
cd build/libs/ || exit $?
__named="$(find . -maxdepth 1 -not -name "*release*" | tail -n +2 | sed "s/^\.\///g")"
__bad_named="$(find . -maxdepth 1 -name "*release*")"
rm "$__named" # remove the one without -release
# Build release jar with the name without -release
java -jar "$__d/jar-shrink/jar-shrink.jar" "$__bad_named" -out "$__named" -n -keep "me.zeroeightsix" -keep "baritone" -keep "org.kamiblue" -keep "org.spongepowered"
rm "$__bad_named" # remove the un-shrunk jar with -release
echo "$__named" # echo the shrunk jar, without -release

View File

@ -21,7 +21,6 @@ sed -i "s/modVersion=.*/modVersion=$VERSION_DEV/" gradle.properties
sed -i "s/VERSION = \".*\";/VERSION = \"$VERSION_DEV\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/VERSION_SIMPLE = \".*\";/VERSION_SIMPLE = \"$VERSION_DEV\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/VERSION_MAJOR = \".*\";/VERSION_MAJOR = \"$VERSION\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/\"version\": \".*\",/\"version\": \"$VERSION_DEV\",/" src/main/resources/mcmod.info
git commit -am "[bump] Release Major $VERSION"
echo "[bumpMajor] Created commit for version '$VERSION', remember to push!"

View File

@ -33,4 +33,3 @@ sed -i "s/VERSION = \".*\";/VERSION = \"$VERSION\";/" src/main/java/me/zeroeight
sed -i "s/VERSION_SIMPLE = \".*\";/VERSION_SIMPLE = \"$VERSION_SIMPLE\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/VERSION_MAJOR = \".*\";/VERSION_MAJOR = \"$VERSION_MAJOR\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/BUILD_NUMBER = .*;/BUILD_NUMBER = $BUILD_NUMBER;/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/\"version\": \".*\",/\"version\": \"$VERSION\",/" src/main/resources/mcmod.info

View File

@ -42,7 +42,7 @@ CHANGELOG="$("$_d"/scripts/changelog.sh "$OLD_COMMIT")" || exit $?
VERSION="$("$_d"/scripts/version.sh "$1")" || exit $?
VERSION_MAJOR="$("$_d"/scripts/version.sh "major")" || exit $?
"$_d"/scripts/bumpVersion.sh "$1" || exit $?
JAR_NAME="$("$_d"/scripts/buildNamed.sh)" || exit $?
JAR_NAME="$("$_d"/scripts/buildJarSafe.sh)" || exit $?
"$_d"/scripts/uploadRelease.sh "$1" "$HEAD" "$VERSION" "$JAR_NAME" "$CHANGELOG" || exit $?
"$_d"/scripts/bumpWebsite.sh "$JAR_NAME" "$VERSION" "$VERSION_MAJOR" || exit $?

59
scripts/setupWorkspace.sh Executable file
View File

@ -0,0 +1,59 @@
#!/bin/sh
# Created by l1ving on 17/02/20
#
# Used to setup workspace on unix and fix building
#
# Usage: "./setupWorkspace.sh"
__dir="$(cd "$(dirname "$0")" && pwd)"
#
echo "[$(date +"%H:%M:%S")] Found script in dir '$__dir', trying to cd into KAMI Blue folder"
cd "$__dir" || exit $?
cd ../ || exit $?
#
echo "[$(date +"%H:%M:%S")] Checking if git is installed..."
if [ -z "$(which git)" ]; then
echo "[$(date +"%H:%M:%S")] ERROR: Git is not installed, please make sure you install the CLI version of git, not some desktop wrapper for it" >&2
exit 1
fi
echo "[$(date +"%H:%M:%S")] Git is installed!"
#
echo "[$(date +"%H:%M:%S")] Checking for .git dir..."
if [ ! -d ".git" ]; then
echo "[$(date +"%H:%M:%S")] ERROR: Could not detect git repository, exiting" >&2
exit 1
fi
echo "[$(date +"%H:%M:%S")] Found git repository!"
#
echo "[$(date +"%H:%M:%S")] Downloading git submodules..."
git submodule update --init --recursive || {
echo "[$(date +"%H:%M:%S")] ERROR: Failed to init git submodules"
exit 1
}
echo "[$(date +"%H:%M:%S")] Downloaded git submodules!"
#
echo "[$(date +"%H:%M:%S")] Running gradlew build without daemon..."
./gradlew --no-daemon build || {
echo "[$(date +"%H:%M:%S")] ERROR: Running gradlew build failed! Run './gradlew --no-daemon build' manually"
exit 1
}
#
cat src/main/resources/ascii.txt 2>/dev/null
echo "=========================================================================="
echo ""
echo "[$(date +"%H:%M:%S")] Build succeeded! All checks passed, you can build normally now!"
echo ""
echo "=========================================================================="

View File

@ -8,7 +8,7 @@ import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.Vec3d;
import org.spongepowered.asm.lib.Opcodes;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;

View File

@ -6,7 +6,7 @@ import net.minecraft.client.gui.inventory.GuiEditSign;
import net.minecraft.client.renderer.tileentity.TileEntitySignRenderer;
import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.text.ITextComponent;
import org.spongepowered.asm.lib.Opcodes;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

View File

@ -0,0 +1,20 @@
@@@@@@@@@@@@@@@@@@@@@@@@***@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@(*********************&@@@@@@@@@@@@@
@@@@@@@@@@******************************/@@@@@@@@@
@@@@@@@@***********************************@@@@@@@
@@@@@****************************************/@@@@
@@@@*******************************************@@@
@@@******* ******************** *******@@
@@******** *********************. @
@** *********************** **
@********* ****** ********** .**********
********* ****** *********** ***
@******* ******* ********************** ****
@***** ******** ********* *************
@@** **** .**, ********, **@
@@@ ****** ********************* @@
@@@@*******************************************@@@
@@@@@/***************************************%@@@@
@@@@@@@@***********************************@@@@@@@
@@@@@@@@@@/*****************************%@@@@@@@@@
@@@@@@@@@@@@@@&*********************@@@@@@@@@@@@@@

View File

@ -3,14 +3,16 @@
"modid": "kamiblue",
"name": "KAMI Blue",
"description": "カミブル \nA Minecraft utility mod for anarchy servers \nWritten by 086 and continued by l1ving\n",
"version": "1.12.xx-dev",
"version": "${version}",
"mcversion": "1.12.2",
"logoFile": "kami.png",
"url": "https://github.com/kami-blue/client",
"updateUrl": "",
"authorList": [
"086",
"l1ving"
],
"credits": "Thank you 086 for the original KAMI\nThanks to all contributors for your help and time <3\n"
"credits": "Thank you 086 for the original KAMI\nThanks to all contributors for your help and time <3\n",
"logoFile": "kami.png",
"dependencies": []
}
]