Skip versions without server jar
This commit is contained in:
parent
8aa106d5bc
commit
3bd942d471
19
build.py
19
build.py
@ -39,10 +39,10 @@ class DownloadInfo(TypedDict):
|
|||||||
|
|
||||||
|
|
||||||
class VersionDownloads(TypedDict):
|
class VersionDownloads(TypedDict):
|
||||||
client: DownloadInfo
|
client: NotRequired[DownloadInfo]
|
||||||
client_mappings: DownloadInfo
|
client_mappings: NotRequired[DownloadInfo]
|
||||||
server: DownloadInfo
|
server: NotRequired[DownloadInfo]
|
||||||
server_mappings: DownloadInfo
|
server_mappings: NotRequired[DownloadInfo]
|
||||||
|
|
||||||
|
|
||||||
class VersionManifestFull(TypedDict):
|
class VersionManifestFull(TypedDict):
|
||||||
@ -152,6 +152,9 @@ default_java_version: JavaVersion = {
|
|||||||
"majorVersion": 8
|
"majorVersion": 8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class NoServerException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
def build_version(manifest: VersionManifest, version_id: str, repository: str = "hub.cnml.de/minecraft"):
|
def build_version(manifest: VersionManifest, version_id: str, repository: str = "hub.cnml.de/minecraft"):
|
||||||
matching_version = list(
|
matching_version = list(
|
||||||
filter(lambda v: v["id"] == version_id, manifest["versions"]))
|
filter(lambda v: v["id"] == version_id, manifest["versions"]))
|
||||||
@ -162,7 +165,10 @@ def build_version(manifest: VersionManifest, version_id: str, repository: str =
|
|||||||
print(
|
print(
|
||||||
f"Version [{version['type']}] {version['id']} requires java version {java_version['majorVersion']} ({java_version['component']})")
|
f"Version [{version['type']}] {version['id']} requires java version {java_version['majorVersion']} ({java_version['component']})")
|
||||||
server_jar_file = Path("versions") / version['id'] / "server.jar"
|
server_jar_file = Path("versions") / version['id'] / "server.jar"
|
||||||
server_jar = version["downloads"]["server"]
|
server_jar = version["downloads"].get("server")
|
||||||
|
if server_jar is None:
|
||||||
|
raise NoServerException(f"No server build exists for {version['id']} (Java {java_version['majorVersion']})")
|
||||||
|
|
||||||
download_file(server_jar, server_jar_file)
|
download_file(server_jar, server_jar_file)
|
||||||
|
|
||||||
build_args: DockerfileBuildArgs = {
|
build_args: DockerfileBuildArgs = {
|
||||||
@ -204,8 +210,11 @@ if __name__ == "__main__":
|
|||||||
versions: list[str] = list(version["id"] for version in manifest["versions"]
|
versions: list[str] = list(version["id"] for version in manifest["versions"]
|
||||||
if version["type"] == "release") if args.all else args.versions
|
if version["type"] == "release") if args.all else args.versions
|
||||||
for version_id in versions:
|
for version_id in versions:
|
||||||
|
print()
|
||||||
try:
|
try:
|
||||||
build_version(manifest, version_id)
|
build_version(manifest, version_id)
|
||||||
|
except NoServerException as e:
|
||||||
|
print(e)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Failed building images for version {version_id}")
|
print(f"Failed building images for version {version_id}")
|
||||||
if args.force:
|
if args.force:
|
||||||
|
Loading…
Reference in New Issue
Block a user