From e9dd66696d779f3d2ea5a995a908d1b5da6a830f Mon Sep 17 00:00:00 2001 From: Bixilon Date: Sun, 23 Oct 2022 19:06:48 +0200 Subject: [PATCH] fix running of assets properties generator --- build.gradle.kts | 10 +++++++++- util/assets_properties_generator.py | 19 +++---------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 77f4039c8..595138f5d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -382,7 +382,7 @@ fun loadGit() { } if (project.version != nextVersion) { project.version = nextVersion - println("Version changed to ${project.version}") + logger.info("Version changed to ${project.version}") } } loadGit() @@ -447,3 +447,11 @@ val fatJar = task("fatJar", type = Jar::class) { from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) }) with(tasks["jar"] as CopySpec) } + + +task("assetsProperties", type = JavaExec::class) { + dependsOn("processResources", "compileKotlin", "compileJava") + classpath(project.configurations.runtimeClasspath.get(), tasks["jar"]) + standardOutput = System.out + mainClass.set("de.bixilon.minosoft.assets.properties.version.generator.AssetsPropertiesGenerator") +} diff --git a/util/assets_properties_generator.py b/util/assets_properties_generator.py index 1345aee8e..1da61dafb 100644 --- a/util/assets_properties_generator.py +++ b/util/assets_properties_generator.py @@ -34,9 +34,10 @@ # This software is not affiliated with Mojang AB, the original developer of Minecraft. import subprocess -import ujson import urllib.request +import ujson + print("Minosoft assets properties generator") DOWNLOAD_UNTIL_VERSION = "17w45b" @@ -47,11 +48,9 @@ ASSETS_PROPERTIES = ujson.load(open(ASSETS_PROPERTIES_PATH)) VERSION_MANIFEST = ujson.loads(urllib.request.urlopen('https://launchermeta.mojang.com/mc/game/version_manifest.json').read().decode("utf-8")) PIXLYZER_INDEX = ujson.loads(urllib.request.urlopen('https://gitlab.bixilon.de/bixilon/pixlyzer-data/-/raw/master/mbf_index.min.json?inline=false').read().decode("utf-8")) -SKIP_COMPILE = True - def generate_jar_assets(version_id, assets_properties): - process = subprocess.Popen(r'mvn -e -q exec:java -Dexec.mainClass="de.bixilon.minosoft.assets.properties.version.generator.AssetsPropertiesGenerator" -Dexec.args="\"%s\" \"%s\""' % (version_id, assets_properties["client_jar_hash"]), shell=True, cwd='../', stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.Popen(r'./gradlew -q assetsProperties --args="\"%s\" \"%s\""' % (version_id, assets_properties["client_jar_hash"]), shell=True, cwd='../', stdout=subprocess.PIPE, stderr=subprocess.PIPE) exit_code = process.wait() if exit_code != 0: print(process.stdout.read().decode('utf-8')) @@ -64,16 +63,6 @@ def generate_jar_assets(version_id, assets_properties): assets_properties["jar_assets_tar_bytes"] = tar_bytes -def compile_minosoft(): - print("Compiling minosoft...") - compile_process = subprocess.Popen(r'mvn compile', shell=True, cwd='../', stdout=subprocess.PIPE, stderr=subprocess.PIPE) - exit_code = compile_process.wait() - if exit_code != 0: - print(compile_process.stdout.read().decode('utf-8')) - print(compile_process.stderr.read().decode('utf-8')) - print("Minosoft compiled!") - - def generate_version(version): if version["id"] in SKIP_VERSIONS: print("Force skipping %s" % version["id"]) @@ -113,8 +102,6 @@ def generate_version(version): def main(): - if not SKIP_COMPILE: - compile_minosoft() for version in VERSION_MANIFEST["versions"]: if version["id"] == DOWNLOAD_UNTIL_VERSION: break