fix running of assets properties generator

This commit is contained in:
Bixilon 2022-10-23 19:06:48 +02:00
parent 01a6d97046
commit e9dd66696d
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 12 additions and 17 deletions

View File

@ -382,7 +382,7 @@ fun loadGit() {
} }
if (project.version != nextVersion) { if (project.version != nextVersion) {
project.version = nextVersion project.version = nextVersion
println("Version changed to ${project.version}") logger.info("Version changed to ${project.version}")
} }
} }
loadGit() loadGit()
@ -447,3 +447,11 @@ val fatJar = task("fatJar", type = Jar::class) {
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) }) from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
with(tasks["jar"] as CopySpec) 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")
}

View File

@ -34,9 +34,10 @@
# This software is not affiliated with Mojang AB, the original developer of Minecraft. # This software is not affiliated with Mojang AB, the original developer of Minecraft.
import subprocess import subprocess
import ujson
import urllib.request import urllib.request
import ujson
print("Minosoft assets properties generator") print("Minosoft assets properties generator")
DOWNLOAD_UNTIL_VERSION = "17w45b" 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")) 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")) 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): 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() exit_code = process.wait()
if exit_code != 0: if exit_code != 0:
print(process.stdout.read().decode('utf-8')) 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 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): def generate_version(version):
if version["id"] in SKIP_VERSIONS: if version["id"] in SKIP_VERSIONS:
print("Force skipping %s" % version["id"]) print("Force skipping %s" % version["id"])
@ -113,8 +102,6 @@ def generate_version(version):
def main(): def main():
if not SKIP_COMPILE:
compile_minosoft()
for version in VERSION_MANIFEST["versions"]: for version in VERSION_MANIFEST["versions"]:
if version["id"] == DOWNLOAD_UNTIL_VERSION: if version["id"] == DOWNLOAD_UNTIL_VERSION:
break break