mirror of
https://github.com/unmojang/meta.git
synced 2025-09-23 11:10:53 -04:00
chore: reformat using black
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
7dbe008e41
commit
1c838d992e
@ -1,8 +1,19 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
from meta.common import ensure_component_dir, launcher_path, upstream_path, transform_maven_key
|
||||
from meta.common.fabric import JARS_DIR, INSTALLER_INFO_DIR, META_DIR, INTERMEDIARY_COMPONENT, LOADER_COMPONENT
|
||||
from meta.common import (
|
||||
ensure_component_dir,
|
||||
launcher_path,
|
||||
upstream_path,
|
||||
transform_maven_key,
|
||||
)
|
||||
from meta.common.fabric import (
|
||||
JARS_DIR,
|
||||
INSTALLER_INFO_DIR,
|
||||
META_DIR,
|
||||
INTERMEDIARY_COMPONENT,
|
||||
LOADER_COMPONENT,
|
||||
)
|
||||
from meta.model import MetaVersion, Dependency, Library, MetaPackage, GradleSpecifier
|
||||
from meta.model.fabric import FabricJarInfo, FabricInstallerDataV1, FabricMainClasses
|
||||
|
||||
@ -14,20 +25,26 @@ ensure_component_dir(INTERMEDIARY_COMPONENT)
|
||||
|
||||
|
||||
def load_jar_info(artifact_key) -> FabricJarInfo:
|
||||
return FabricJarInfo.parse_file(os.path.join(UPSTREAM_DIR, JARS_DIR, f"{artifact_key}.json"))
|
||||
return FabricJarInfo.parse_file(
|
||||
os.path.join(UPSTREAM_DIR, JARS_DIR, f"{artifact_key}.json")
|
||||
)
|
||||
|
||||
|
||||
def load_installer_info(version) -> FabricInstallerDataV1:
|
||||
return FabricInstallerDataV1.parse_file(os.path.join(UPSTREAM_DIR, INSTALLER_INFO_DIR, f"{version}.json"))
|
||||
return FabricInstallerDataV1.parse_file(
|
||||
os.path.join(UPSTREAM_DIR, INSTALLER_INFO_DIR, f"{version}.json")
|
||||
)
|
||||
|
||||
|
||||
def process_loader_version(entry) -> MetaVersion:
|
||||
jar_info = load_jar_info(transform_maven_key(entry["maven"]))
|
||||
installer_info = load_installer_info(entry["version"])
|
||||
|
||||
v = MetaVersion(name="Fabric Loader", uid="net.fabricmc.fabric-loader", version=entry["version"])
|
||||
v = MetaVersion(
|
||||
name="Fabric Loader", uid="net.fabricmc.fabric-loader", version=entry["version"]
|
||||
)
|
||||
v.release_time = jar_info.release_time
|
||||
v.requires = [Dependency(uid='net.fabricmc.intermediary')]
|
||||
v.requires = [Dependency(uid="net.fabricmc.intermediary")]
|
||||
v.order = 10
|
||||
v.type = "release"
|
||||
if isinstance(installer_info.main_class, FabricMainClasses):
|
||||
@ -37,7 +54,10 @@ def process_loader_version(entry) -> MetaVersion:
|
||||
v.libraries = []
|
||||
v.libraries.extend(installer_info.libraries.common)
|
||||
v.libraries.extend(installer_info.libraries.client)
|
||||
loader_lib = Library(name=GradleSpecifier.from_string(entry["maven"]), url="https://maven.fabricmc.net")
|
||||
loader_lib = Library(
|
||||
name=GradleSpecifier.from_string(entry["maven"]),
|
||||
url="https://maven.fabricmc.net",
|
||||
)
|
||||
v.libraries.append(loader_lib)
|
||||
return v
|
||||
|
||||
@ -45,14 +65,21 @@ def process_loader_version(entry) -> MetaVersion:
|
||||
def process_intermediary_version(entry) -> MetaVersion:
|
||||
jar_info = load_jar_info(transform_maven_key(entry["maven"]))
|
||||
|
||||
v = MetaVersion(name="Intermediary Mappings", uid="net.fabricmc.intermediary", version=entry["version"])
|
||||
v = MetaVersion(
|
||||
name="Intermediary Mappings",
|
||||
uid="net.fabricmc.intermediary",
|
||||
version=entry["version"],
|
||||
)
|
||||
v.release_time = jar_info.release_time
|
||||
v.requires = [Dependency(uid='net.minecraft', equals=entry["version"])]
|
||||
v.requires = [Dependency(uid="net.minecraft", equals=entry["version"])]
|
||||
v.order = 11
|
||||
v.type = "release"
|
||||
v.libraries = []
|
||||
v.volatile = True
|
||||
intermediary_lib = Library(name=GradleSpecifier.from_string(entry["maven"]), url="https://maven.fabricmc.net")
|
||||
intermediary_lib = Library(
|
||||
name=GradleSpecifier.from_string(entry["maven"]),
|
||||
url="https://maven.fabricmc.net",
|
||||
)
|
||||
v.libraries.append(intermediary_lib)
|
||||
return v
|
||||
|
||||
@ -61,7 +88,9 @@ def main():
|
||||
recommended_loader_versions = []
|
||||
recommended_intermediary_versions = []
|
||||
|
||||
with open(os.path.join(UPSTREAM_DIR, META_DIR, "loader.json"), 'r', encoding='utf-8') as f:
|
||||
with open(
|
||||
os.path.join(UPSTREAM_DIR, META_DIR, "loader.json"), "r", encoding="utf-8"
|
||||
) as f:
|
||||
loader_version_index = json.load(f)
|
||||
for entry in loader_version_index:
|
||||
version = entry["version"]
|
||||
@ -75,7 +104,9 @@ def main():
|
||||
|
||||
v.write(os.path.join(LAUNCHER_DIR, LOADER_COMPONENT, f"{v.version}.json"))
|
||||
|
||||
with open(os.path.join(UPSTREAM_DIR, META_DIR, "intermediary.json"), 'r', encoding='utf-8') as f:
|
||||
with open(
|
||||
os.path.join(UPSTREAM_DIR, META_DIR, "intermediary.json"), "r", encoding="utf-8"
|
||||
) as f:
|
||||
intermediary_version_index = json.load(f)
|
||||
for entry in intermediary_version_index:
|
||||
version = entry["version"]
|
||||
@ -83,18 +114,24 @@ def main():
|
||||
|
||||
v = process_intermediary_version(entry)
|
||||
|
||||
recommended_intermediary_versions.append(version) # all intermediaries are recommended
|
||||
recommended_intermediary_versions.append(
|
||||
version
|
||||
) # all intermediaries are recommended
|
||||
|
||||
v.write(os.path.join(LAUNCHER_DIR, INTERMEDIARY_COMPONENT, f"{v.version}.json"))
|
||||
v.write(
|
||||
os.path.join(LAUNCHER_DIR, INTERMEDIARY_COMPONENT, f"{v.version}.json")
|
||||
)
|
||||
|
||||
package = MetaPackage(uid=LOADER_COMPONENT, name='Fabric Loader')
|
||||
package = MetaPackage(uid=LOADER_COMPONENT, name="Fabric Loader")
|
||||
package.recommended = recommended_loader_versions
|
||||
package.description = "Fabric Loader is a tool to load Fabric-compatible mods in game environments."
|
||||
package.description = (
|
||||
"Fabric Loader is a tool to load Fabric-compatible mods in game environments."
|
||||
)
|
||||
package.project_url = "https://fabricmc.net"
|
||||
package.authors = ["Fabric Developers"]
|
||||
package.write(os.path.join(LAUNCHER_DIR, LOADER_COMPONENT, "package.json"))
|
||||
|
||||
package = MetaPackage(uid=INTERMEDIARY_COMPONENT, name='Intermediary Mappings')
|
||||
package = MetaPackage(uid=INTERMEDIARY_COMPONENT, name="Intermediary Mappings")
|
||||
package.recommended = recommended_intermediary_versions
|
||||
package.description = "Intermediary mappings allow using Fabric Loader with mods for Minecraft in a more compatible manner."
|
||||
package.project_url = "https://fabricmc.net"
|
||||
@ -102,5 +139,5 @@ def main():
|
||||
package.write(os.path.join(LAUNCHER_DIR, INTERMEDIARY_COMPONENT, "package.json"))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
213
generateForge.py
213
generateForge.py
@ -6,13 +6,36 @@ from operator import attrgetter
|
||||
from typing import Collection
|
||||
|
||||
from meta.common import ensure_component_dir, launcher_path, upstream_path, static_path
|
||||
from meta.common.forge import FORGE_COMPONENT, INSTALLER_MANIFEST_DIR, VERSION_MANIFEST_DIR, DERIVED_INDEX_FILE, \
|
||||
STATIC_LEGACYINFO_FILE, INSTALLER_INFO_DIR, BAD_VERSIONS, FORGEWRAPPER_MAVEN
|
||||
from meta.common.forge import (
|
||||
FORGE_COMPONENT,
|
||||
INSTALLER_MANIFEST_DIR,
|
||||
VERSION_MANIFEST_DIR,
|
||||
DERIVED_INDEX_FILE,
|
||||
STATIC_LEGACYINFO_FILE,
|
||||
INSTALLER_INFO_DIR,
|
||||
BAD_VERSIONS,
|
||||
FORGEWRAPPER_MAVEN,
|
||||
)
|
||||
from meta.common.mojang import MINECRAFT_COMPONENT
|
||||
from meta.model import MetaVersion, Dependency, Library, GradleSpecifier, MojangLibraryDownloads, MojangArtifact, \
|
||||
MetaPackage
|
||||
from meta.model.forge import ForgeVersion, ForgeInstallerProfile, ForgeLegacyInfo, fml_libs_for_version, \
|
||||
ForgeInstallerProfileV2, InstallerInfo, DerivedForgeIndex, ForgeLegacyInfoList
|
||||
from meta.model import (
|
||||
MetaVersion,
|
||||
Dependency,
|
||||
Library,
|
||||
GradleSpecifier,
|
||||
MojangLibraryDownloads,
|
||||
MojangArtifact,
|
||||
MetaPackage,
|
||||
)
|
||||
from meta.model.forge import (
|
||||
ForgeVersion,
|
||||
ForgeInstallerProfile,
|
||||
ForgeLegacyInfo,
|
||||
fml_libs_for_version,
|
||||
ForgeInstallerProfileV2,
|
||||
InstallerInfo,
|
||||
DerivedForgeIndex,
|
||||
ForgeLegacyInfoList,
|
||||
)
|
||||
from meta.model.mojang import MojangVersion
|
||||
|
||||
LAUNCHER_DIR = launcher_path()
|
||||
@ -33,22 +56,28 @@ mc_version_cache = {}
|
||||
def load_mc_version_filter(version: str):
|
||||
if version in mc_version_cache:
|
||||
return mc_version_cache[version]
|
||||
v = MetaVersion.parse_file(os.path.join(LAUNCHER_DIR, MINECRAFT_COMPONENT, f"{version}.json"))
|
||||
v = MetaVersion.parse_file(
|
||||
os.path.join(LAUNCHER_DIR, MINECRAFT_COMPONENT, f"{version}.json")
|
||||
)
|
||||
libs = set(map(attrgetter("name"), v.libraries))
|
||||
mc_version_cache[version] = libs
|
||||
return libs
|
||||
|
||||
|
||||
'''
|
||||
"""
|
||||
Match a library coordinate to a set of library coordinates.
|
||||
* Block those that pass completely.
|
||||
* For others, block those with lower versions than in the set.
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
def should_ignore_artifact(libs: Collection[GradleSpecifier], match: GradleSpecifier):
|
||||
for ver in libs:
|
||||
if ver.group == match.group and ver.artifact == match.artifact and ver.classifier == match.classifier:
|
||||
if (
|
||||
ver.group == match.group
|
||||
and ver.artifact == match.artifact
|
||||
and ver.classifier == match.classifier
|
||||
):
|
||||
if ver.version == match.version:
|
||||
# Everything is matched perfectly - this one will be ignored
|
||||
return True
|
||||
@ -61,7 +90,9 @@ def should_ignore_artifact(libs: Collection[GradleSpecifier], match: GradleSpeci
|
||||
return False
|
||||
|
||||
|
||||
def version_from_profile(profile: ForgeInstallerProfile, version: ForgeVersion) -> MetaVersion:
|
||||
def version_from_profile(
|
||||
profile: ForgeInstallerProfile, version: ForgeVersion
|
||||
) -> MetaVersion:
|
||||
v = MetaVersion(name="Forge", version=version.rawVersion, uid=FORGE_COMPONENT)
|
||||
mc_version = profile.install.minecraft
|
||||
v.requires = [Dependency(uid=MINECRAFT_COMPONENT, equals=mc_version)]
|
||||
@ -74,7 +105,7 @@ def version_from_profile(profile: ForgeInstallerProfile, version: ForgeVersion)
|
||||
match = expression.search(args)
|
||||
while match is not None:
|
||||
tweakers.append(match.group(1))
|
||||
args = args[:match.start()] + args[match.end():]
|
||||
args = args[: match.start()] + args[match.end() :]
|
||||
match = expression.search(args)
|
||||
if len(tweakers) > 0:
|
||||
args = args.strip()
|
||||
@ -84,14 +115,21 @@ def version_from_profile(profile: ForgeInstallerProfile, version: ForgeVersion)
|
||||
v.libraries = []
|
||||
mc_filter = load_mc_version_filter(mc_version)
|
||||
for forge_lib in profile.version_info.libraries:
|
||||
if forge_lib.name.is_lwjgl() or forge_lib.name.is_log4j() or should_ignore_artifact(mc_filter, forge_lib.name):
|
||||
if (
|
||||
forge_lib.name.is_lwjgl()
|
||||
or forge_lib.name.is_log4j()
|
||||
or should_ignore_artifact(mc_filter, forge_lib.name)
|
||||
):
|
||||
continue
|
||||
|
||||
overridden_name = forge_lib.name
|
||||
if overridden_name.group == "net.minecraftforge":
|
||||
if overridden_name.artifact == "minecraftforge":
|
||||
overridden_name.artifact = "forge"
|
||||
overridden_name.version = "%s-%s" % (mc_version, overridden_name.version)
|
||||
overridden_name.version = "%s-%s" % (
|
||||
mc_version,
|
||||
overridden_name.version,
|
||||
)
|
||||
|
||||
overridden_name.classifier = "universal"
|
||||
elif overridden_name.artifact == "forge":
|
||||
@ -110,7 +148,9 @@ def version_from_profile(profile: ForgeInstallerProfile, version: ForgeVersion)
|
||||
return v
|
||||
|
||||
|
||||
def version_from_modernized_installer(installer: MojangVersion, version: ForgeVersion) -> MetaVersion:
|
||||
def version_from_modernized_installer(
|
||||
installer: MojangVersion, version: ForgeVersion
|
||||
) -> MetaVersion:
|
||||
v = MetaVersion(name="Forge", version=version.rawVersion, uid=FORGE_COMPONENT)
|
||||
mc_version = version.mc_version
|
||||
v.requires = [Dependency(uid=MINECRAFT_COMPONENT, equals=mc_version)]
|
||||
@ -123,7 +163,7 @@ def version_from_modernized_installer(installer: MojangVersion, version: ForgeVe
|
||||
match = expression.search(args)
|
||||
while match is not None:
|
||||
tweakers.append(match.group(1))
|
||||
args = args[:match.start()] + args[match.end():]
|
||||
args = args[: match.start()] + args[match.end() :]
|
||||
match = expression.search(args)
|
||||
if len(tweakers) > 0:
|
||||
args = args.strip()
|
||||
@ -134,8 +174,14 @@ def version_from_modernized_installer(installer: MojangVersion, version: ForgeVe
|
||||
|
||||
mc_filter = load_mc_version_filter(mc_version)
|
||||
for upstream_lib in installer.libraries:
|
||||
forge_lib = Library.parse_obj(upstream_lib.dict()) # "cast" MojangLibrary to Library
|
||||
if forge_lib.name.is_lwjgl() or forge_lib.name.is_log4j() or should_ignore_artifact(mc_filter, forge_lib.name):
|
||||
forge_lib = Library.parse_obj(
|
||||
upstream_lib.dict()
|
||||
) # "cast" MojangLibrary to Library
|
||||
if (
|
||||
forge_lib.name.is_lwjgl()
|
||||
or forge_lib.name.is_log4j()
|
||||
or should_ignore_artifact(mc_filter, forge_lib.name)
|
||||
):
|
||||
continue
|
||||
|
||||
if forge_lib.name.group == "net.minecraftforge":
|
||||
@ -143,16 +189,23 @@ def version_from_modernized_installer(installer: MojangVersion, version: ForgeVe
|
||||
overridden_name = forge_lib.name
|
||||
overridden_name.classifier = "universal"
|
||||
forge_lib.downloads.artifact.path = overridden_name.path()
|
||||
forge_lib.downloads.artifact.url = "https://maven.minecraftforge.net/%s" % overridden_name.path()
|
||||
forge_lib.downloads.artifact.url = (
|
||||
"https://maven.minecraftforge.net/%s" % overridden_name.path()
|
||||
)
|
||||
forge_lib.name = overridden_name
|
||||
|
||||
elif forge_lib.name.artifact == "minecraftforge":
|
||||
overridden_name = forge_lib.name
|
||||
overridden_name.artifact = "forge"
|
||||
overridden_name.classifier = "universal"
|
||||
overridden_name.version = "%s-%s" % (mc_version, overridden_name.version)
|
||||
overridden_name.version = "%s-%s" % (
|
||||
mc_version,
|
||||
overridden_name.version,
|
||||
)
|
||||
forge_lib.downloads.artifact.path = overridden_name.path()
|
||||
forge_lib.downloads.artifact.url = "https://maven.minecraftforge.net/%s" % overridden_name.path()
|
||||
forge_lib.downloads.artifact.url = (
|
||||
"https://maven.minecraftforge.net/%s" % overridden_name.path()
|
||||
)
|
||||
forge_lib.name = overridden_name
|
||||
|
||||
v.libraries.append(forge_lib)
|
||||
@ -167,23 +220,32 @@ def version_from_legacy(info: ForgeLegacyInfo, version: ForgeVersion) -> MetaVer
|
||||
v.requires = [Dependency(uid=MINECRAFT_COMPONENT, equals=mc_version)]
|
||||
v.release_time = info.release_time
|
||||
v.order = 5
|
||||
if fml_libs_for_version(mc_version): # WHY, WHY DID I WASTE MY TIME REWRITING FMLLIBSMAPPING
|
||||
if fml_libs_for_version(
|
||||
mc_version
|
||||
): # WHY, WHY DID I WASTE MY TIME REWRITING FMLLIBSMAPPING
|
||||
v.additional_traits = ["legacyFML"]
|
||||
|
||||
classifier = "client"
|
||||
if "universal" in version.url():
|
||||
classifier = "universal"
|
||||
|
||||
main_mod = Library(name=GradleSpecifier("net.minecraftforge", "forge", version.long_version, classifier))
|
||||
main_mod = Library(
|
||||
name=GradleSpecifier(
|
||||
"net.minecraftforge", "forge", version.long_version, classifier
|
||||
)
|
||||
)
|
||||
main_mod.downloads = MojangLibraryDownloads()
|
||||
main_mod.downloads.artifact = MojangArtifact(url=version.url(), sha1=info.sha1, size=info.size)
|
||||
main_mod.downloads.artifact = MojangArtifact(
|
||||
url=version.url(), sha1=info.sha1, size=info.size
|
||||
)
|
||||
main_mod.downloads.artifact.path = None
|
||||
v.jar_mods = [main_mod]
|
||||
return v
|
||||
|
||||
|
||||
def version_from_build_system_installer(installer: MojangVersion, profile: ForgeInstallerProfileV2,
|
||||
version: ForgeVersion) -> MetaVersion:
|
||||
def version_from_build_system_installer(
|
||||
installer: MojangVersion, profile: ForgeInstallerProfileV2, version: ForgeVersion
|
||||
) -> MetaVersion:
|
||||
v = MetaVersion(name="Forge", version=version.rawVersion, uid=FORGE_COMPONENT)
|
||||
v.requires = [Dependency(uid=MINECRAFT_COMPONENT, equals=version.mc_version_sane)]
|
||||
v.main_class = "io.github.zekerzhayard.forgewrapper.installer.Main"
|
||||
@ -193,14 +255,19 @@ def version_from_build_system_installer(installer: MojangVersion, profile: Forge
|
||||
|
||||
# load the locally cached installer file info and use it to add the installer entry in the json
|
||||
info = InstallerInfo.parse_file(
|
||||
os.path.join(UPSTREAM_DIR, INSTALLER_INFO_DIR, f"{version.long_version}.json"))
|
||||
os.path.join(UPSTREAM_DIR, INSTALLER_INFO_DIR, f"{version.long_version}.json")
|
||||
)
|
||||
installer_lib = Library(
|
||||
name=GradleSpecifier("net.minecraftforge", "forge", version.long_version, "installer"))
|
||||
name=GradleSpecifier(
|
||||
"net.minecraftforge", "forge", version.long_version, "installer"
|
||||
)
|
||||
)
|
||||
installer_lib.downloads = MojangLibraryDownloads()
|
||||
installer_lib.downloads.artifact = MojangArtifact(
|
||||
url="https://maven.minecraftforge.net/%s" % (installer_lib.name.path()),
|
||||
sha1=info.sha1hash,
|
||||
size=info.size)
|
||||
size=info.size,
|
||||
)
|
||||
v.maven_files.append(installer_lib)
|
||||
|
||||
for upstream_lib in profile.libraries:
|
||||
@ -208,18 +275,27 @@ def version_from_build_system_installer(installer: MojangVersion, profile: Forge
|
||||
if forge_lib.name.is_log4j():
|
||||
continue
|
||||
|
||||
if forge_lib.name.group == "net.minecraftforge" and forge_lib.name.artifact == "forge" \
|
||||
and forge_lib.name.classifier == "universal":
|
||||
forge_lib.downloads.artifact.url = "https://maven.minecraftforge.net/%s" % forge_lib.name.path()
|
||||
if (
|
||||
forge_lib.name.group == "net.minecraftforge"
|
||||
and forge_lib.name.artifact == "forge"
|
||||
and forge_lib.name.classifier == "universal"
|
||||
):
|
||||
forge_lib.downloads.artifact.url = (
|
||||
"https://maven.minecraftforge.net/%s" % forge_lib.name.path()
|
||||
)
|
||||
v.maven_files.append(forge_lib)
|
||||
|
||||
v.libraries = []
|
||||
|
||||
wrapper_lib = Library(name=GradleSpecifier("io.github.zekerzhayard", "ForgeWrapper", "mmc2"))
|
||||
wrapper_lib = Library(
|
||||
name=GradleSpecifier("io.github.zekerzhayard", "ForgeWrapper", "mmc2")
|
||||
)
|
||||
wrapper_lib.downloads = MojangLibraryDownloads()
|
||||
wrapper_lib.downloads.artifact = MojangArtifact(url=FORGEWRAPPER_MAVEN % (wrapper_lib.name.path()),
|
||||
sha1="4ee5f25cc9c7efbf54aff4c695da1054c1a1d7a3",
|
||||
size=34444)
|
||||
wrapper_lib.downloads.artifact = MojangArtifact(
|
||||
url=FORGEWRAPPER_MAVEN % (wrapper_lib.name.path()),
|
||||
sha1="4ee5f25cc9c7efbf54aff4c695da1054c1a1d7a3",
|
||||
size=34444,
|
||||
)
|
||||
v.libraries.append(wrapper_lib)
|
||||
|
||||
for upstream_lib in installer.libraries:
|
||||
@ -231,15 +307,19 @@ def version_from_build_system_installer(installer: MojangVersion, profile: Forge
|
||||
if forge_lib.name.artifact == "forge":
|
||||
forge_lib.name.classifier = "launcher"
|
||||
forge_lib.downloads.artifact.path = forge_lib.name.path()
|
||||
forge_lib.downloads.artifact.url = "https://maven.minecraftforge.net/%s" % forge_lib.name.path()
|
||||
forge_lib.downloads.artifact.url = (
|
||||
"https://maven.minecraftforge.net/%s" % forge_lib.name.path()
|
||||
)
|
||||
forge_lib.name = forge_lib.name
|
||||
v.libraries.append(forge_lib)
|
||||
|
||||
v.release_time = installer.release_time
|
||||
v.order = 5
|
||||
mc_args = "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} " \
|
||||
"--assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} " \
|
||||
"--accessToken ${auth_access_token} --userType ${user_type} --versionType ${version_type}"
|
||||
mc_args = (
|
||||
"--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} "
|
||||
"--assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} "
|
||||
"--accessToken ${auth_access_token} --userType ${user_type} --versionType ${version_type}"
|
||||
)
|
||||
for arg in installer.arguments.game:
|
||||
mc_args += f" {arg}"
|
||||
v.minecraft_arguments = mc_args
|
||||
@ -248,10 +328,14 @@ def version_from_build_system_installer(installer: MojangVersion, profile: Forge
|
||||
|
||||
def main():
|
||||
# load the locally cached version list
|
||||
remote_versions = DerivedForgeIndex.parse_file(os.path.join(UPSTREAM_DIR, DERIVED_INDEX_FILE))
|
||||
remote_versions = DerivedForgeIndex.parse_file(
|
||||
os.path.join(UPSTREAM_DIR, DERIVED_INDEX_FILE)
|
||||
)
|
||||
recommended_versions = []
|
||||
|
||||
legacy_info_list = ForgeLegacyInfoList.parse_file(os.path.join(STATIC_DIR, STATIC_LEGACYINFO_FILE))
|
||||
legacy_info_list = ForgeLegacyInfoList.parse_file(
|
||||
os.path.join(STATIC_DIR, STATIC_LEGACYINFO_FILE)
|
||||
)
|
||||
legacy_versions = [
|
||||
"1.1",
|
||||
"1.2.3",
|
||||
@ -307,27 +391,41 @@ def main():
|
||||
eprint("Skipping %s with no valid files" % key)
|
||||
continue
|
||||
eprint("Processing Forge %s" % version.rawVersion)
|
||||
version_elements = version.rawVersion.split('.')
|
||||
version_elements = version.rawVersion.split(".")
|
||||
if len(version_elements) < 1:
|
||||
eprint("Skipping version %s with not enough version elements" % key)
|
||||
continue
|
||||
|
||||
major_version_str = version_elements[0]
|
||||
if not major_version_str.isnumeric():
|
||||
eprint("Skipping version %s with non-numeric major version %s" % (key, major_version_str))
|
||||
eprint(
|
||||
"Skipping version %s with non-numeric major version %s"
|
||||
% (key, major_version_str)
|
||||
)
|
||||
continue
|
||||
|
||||
if entry.recommended:
|
||||
recommended_versions.append(version.rawVersion)
|
||||
|
||||
# If we do not have the corresponding Minecraft version, we ignore it
|
||||
if not os.path.isfile(os.path.join(LAUNCHER_DIR, MINECRAFT_COMPONENT, f"{version.mc_version_sane}.json")):
|
||||
eprint("Skipping %s with no corresponding Minecraft version %s" % (key, version.mc_version_sane))
|
||||
if not os.path.isfile(
|
||||
os.path.join(
|
||||
LAUNCHER_DIR, MINECRAFT_COMPONENT, f"{version.mc_version_sane}.json"
|
||||
)
|
||||
):
|
||||
eprint(
|
||||
"Skipping %s with no corresponding Minecraft version %s"
|
||||
% (key, version.mc_version_sane)
|
||||
)
|
||||
continue
|
||||
|
||||
# Path for new-style build system based installers
|
||||
installer_version_filepath = os.path.join(UPSTREAM_DIR, VERSION_MANIFEST_DIR, f"{version.long_version}.json")
|
||||
profile_filepath = os.path.join(UPSTREAM_DIR, INSTALLER_MANIFEST_DIR, f"{version.long_version}.json")
|
||||
installer_version_filepath = os.path.join(
|
||||
UPSTREAM_DIR, VERSION_MANIFEST_DIR, f"{version.long_version}.json"
|
||||
)
|
||||
profile_filepath = os.path.join(
|
||||
UPSTREAM_DIR, INSTALLER_MANIFEST_DIR, f"{version.long_version}.json"
|
||||
)
|
||||
|
||||
eprint(installer_version_filepath)
|
||||
if os.path.isfile(installer_version_filepath):
|
||||
@ -351,8 +449,13 @@ def main():
|
||||
if version.mc_version_sane == "1.6.1":
|
||||
continue
|
||||
build = version.build
|
||||
if not str(build).encode('utf-8').decode('utf8') in legacy_info_list.number:
|
||||
eprint("Legacy build %d is missing in legacy info. Ignoring." % build)
|
||||
if (
|
||||
str(build).encode("utf-8").decode("utf8")
|
||||
not in legacy_info_list.number
|
||||
):
|
||||
eprint(
|
||||
"Legacy build %d is missing in legacy info. Ignoring." % build
|
||||
)
|
||||
continue
|
||||
|
||||
v = version_from_legacy(legacy_info_list.number[str(build)], version)
|
||||
@ -361,12 +464,16 @@ def main():
|
||||
|
||||
recommended_versions.sort()
|
||||
|
||||
print('Recommended versions:', recommended_versions)
|
||||
print("Recommended versions:", recommended_versions)
|
||||
|
||||
package = MetaPackage(uid=FORGE_COMPONENT, name="Forge", project_url="https://www.minecraftforge.net/forum/")
|
||||
package = MetaPackage(
|
||||
uid=FORGE_COMPONENT,
|
||||
name="Forge",
|
||||
project_url="https://www.minecraftforge.net/forum/",
|
||||
)
|
||||
package.recommended = recommended_versions
|
||||
package.write(os.path.join(LAUNCHER_DIR, FORGE_COMPONENT, "package.json"))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -14,14 +14,15 @@ UPSTREAM_DIR = upstream_path()
|
||||
ensure_component_dir(LITELOADER_COMPONENT)
|
||||
|
||||
|
||||
def process_artefacts(mc_version: str, artefacts: Dict[str, LiteloaderArtefact], is_snapshot: bool) \
|
||||
-> Tuple[List[MetaVersion], Optional[MetaVersion]]:
|
||||
def process_artefacts(
|
||||
mc_version: str, artefacts: Dict[str, LiteloaderArtefact], is_snapshot: bool
|
||||
) -> Tuple[List[MetaVersion], Optional[MetaVersion]]:
|
||||
versions: List[MetaVersion] = []
|
||||
lookup: Dict[str, MetaVersion] = {}
|
||||
latest_version = None
|
||||
latest = None
|
||||
for x, artefact in artefacts.items():
|
||||
if x == 'latest':
|
||||
if x == "latest":
|
||||
latest_version = artefact.version
|
||||
continue
|
||||
v = MetaVersion(
|
||||
@ -34,7 +35,8 @@ def process_artefacts(mc_version: str, artefacts: Dict[str, LiteloaderArtefact],
|
||||
main_class="net.minecraft.launchwrapper.Launch",
|
||||
order=10,
|
||||
libraries=artefact.libraries,
|
||||
type="release")
|
||||
type="release",
|
||||
)
|
||||
|
||||
if is_snapshot:
|
||||
v.type = "snapshot"
|
||||
@ -48,7 +50,7 @@ def process_artefacts(mc_version: str, artefacts: Dict[str, LiteloaderArtefact],
|
||||
|
||||
liteloader_lib = Library(
|
||||
name=GradleSpecifier("com.mumfrey", "liteloader", v.version),
|
||||
url="http://dl.liteloader.com/versions/"
|
||||
url="http://dl.liteloader.com/versions/",
|
||||
)
|
||||
if is_snapshot:
|
||||
liteloader_lib.mmcHint = "always-stale"
|
||||
@ -72,10 +74,14 @@ def process_versions(index: LiteloaderIndex) -> Tuple[List[MetaVersion], List[st
|
||||
|
||||
latest_release = None
|
||||
if versionObject.artefacts:
|
||||
versions, latest_release = process_artefacts(mcVersion, versionObject.artefacts.liteloader, False)
|
||||
versions, latest_release = process_artefacts(
|
||||
mcVersion, versionObject.artefacts.liteloader, False
|
||||
)
|
||||
all_versions.extend(versions)
|
||||
if versionObject.snapshots:
|
||||
versions, latest_snapshot = process_artefacts(mcVersion, versionObject.snapshots.liteloader, True)
|
||||
versions, latest_snapshot = process_artefacts(
|
||||
mcVersion, versionObject.snapshots.liteloader, True
|
||||
)
|
||||
all_versions.extend(versions)
|
||||
|
||||
if latest_release:
|
||||
@ -93,16 +99,20 @@ def main():
|
||||
all_versions, recommended = process_versions(index)
|
||||
|
||||
for version in all_versions:
|
||||
version.write(os.path.join(LAUNCHER_DIR, LITELOADER_COMPONENT, f"{version.version}.json"))
|
||||
version.write(
|
||||
os.path.join(LAUNCHER_DIR, LITELOADER_COMPONENT, f"{version.version}.json")
|
||||
)
|
||||
|
||||
package = MetaPackage(uid=LITELOADER_COMPONENT,
|
||||
name='LiteLoader',
|
||||
description=index.meta.description,
|
||||
project_url=index.meta.url,
|
||||
authors=[index.meta.authors],
|
||||
recommended=recommended)
|
||||
package = MetaPackage(
|
||||
uid=LITELOADER_COMPONENT,
|
||||
name="LiteLoader",
|
||||
description=index.meta.description,
|
||||
project_url=index.meta.url,
|
||||
authors=[index.meta.authors],
|
||||
recommended=recommended,
|
||||
)
|
||||
package.write(os.path.join(LAUNCHER_DIR, LITELOADER_COMPONENT, "package.json"))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -8,11 +8,32 @@ from packaging import version as pversion
|
||||
from typing import Optional, List
|
||||
|
||||
from meta.common import ensure_component_dir, launcher_path, upstream_path, static_path
|
||||
from meta.common.mojang import VERSION_MANIFEST_FILE, MINECRAFT_COMPONENT, LWJGL3_COMPONENT, LWJGL_COMPONENT, \
|
||||
STATIC_OVERRIDES_FILE, VERSIONS_DIR, LIBRARY_PATCHES_FILE
|
||||
from meta.model import MetaVersion, Library, GradleSpecifier, MojangLibraryDownloads, MojangArtifact, Dependency, \
|
||||
MetaPackage, MojangRules
|
||||
from meta.model.mojang import MojangIndexWrap, MojangIndex, MojangVersion, LegacyOverrideIndex, LibraryPatches
|
||||
from meta.common.mojang import (
|
||||
VERSION_MANIFEST_FILE,
|
||||
MINECRAFT_COMPONENT,
|
||||
LWJGL3_COMPONENT,
|
||||
LWJGL_COMPONENT,
|
||||
STATIC_OVERRIDES_FILE,
|
||||
VERSIONS_DIR,
|
||||
LIBRARY_PATCHES_FILE,
|
||||
)
|
||||
from meta.model import (
|
||||
MetaVersion,
|
||||
Library,
|
||||
GradleSpecifier,
|
||||
MojangLibraryDownloads,
|
||||
MojangArtifact,
|
||||
Dependency,
|
||||
MetaPackage,
|
||||
MojangRules,
|
||||
)
|
||||
from meta.model.mojang import (
|
||||
MojangIndexWrap,
|
||||
MojangIndex,
|
||||
MojangVersion,
|
||||
LegacyOverrideIndex,
|
||||
LibraryPatches,
|
||||
)
|
||||
|
||||
APPLY_SPLIT_NATIVES_WORKAROUND = True
|
||||
|
||||
@ -30,7 +51,10 @@ def map_log4j_artifact(version):
|
||||
if x <= pversion.parse("2.0"):
|
||||
return "2.0-beta9-fixed", "https://files.prismlauncher.org/maven/%s"
|
||||
if x <= pversion.parse("2.17.1"):
|
||||
return "2.17.1", "https://repo1.maven.org/maven2/%s" # This is the only version that's patched (as of 2022/02/19)
|
||||
return (
|
||||
"2.17.1",
|
||||
"https://repo1.maven.org/maven2/%s",
|
||||
) # This is the only version that's patched (as of 2022/02/19)
|
||||
return None, None
|
||||
|
||||
|
||||
@ -38,27 +62,27 @@ LOG4J_HASHES = {
|
||||
"2.0-beta9-fixed": {
|
||||
"log4j-api": {
|
||||
"sha1": "b61eaf2e64d8b0277e188262a8b771bbfa1502b3",
|
||||
"size": 107347
|
||||
"size": 107347,
|
||||
},
|
||||
"log4j-core": {
|
||||
"sha1": "677991ea2d7426f76309a73739cecf609679492c",
|
||||
"size": 677588
|
||||
}
|
||||
"size": 677588,
|
||||
},
|
||||
},
|
||||
"2.17.1": {
|
||||
"log4j-api": {
|
||||
"sha1": "d771af8e336e372fb5399c99edabe0919aeaf5b2",
|
||||
"size": 301872
|
||||
"size": 301872,
|
||||
},
|
||||
"log4j-core": {
|
||||
"sha1": "779f60f3844dadc3ef597976fcb1e5127b1f343d",
|
||||
"size": 1790452
|
||||
"size": 1790452,
|
||||
},
|
||||
"log4j-slf4j18-impl": {
|
||||
"sha1": "ca499d751f4ddd8afb016ef698c30be0da1d09f7",
|
||||
"size": 21268
|
||||
}
|
||||
}
|
||||
"size": 21268,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
# We want versions that contain natives for all platforms. If there are multiple, pick the latest one
|
||||
@ -116,7 +140,7 @@ def sort_libs_by_name(library):
|
||||
return library.name
|
||||
|
||||
|
||||
LWJGLEntry = namedtuple('LWJGLEntry', ('version', 'sha1'))
|
||||
LWJGLEntry = namedtuple("LWJGLEntry", ("version", "sha1"))
|
||||
|
||||
lwjglVersionVariants = defaultdict(list)
|
||||
|
||||
@ -154,19 +178,19 @@ def adapt_new_style_arguments(arguments):
|
||||
# grab the strings, log the complex stuff
|
||||
for arg in arguments.game:
|
||||
if isinstance(arg, str):
|
||||
if arg == '--clientId':
|
||||
if arg == "--clientId":
|
||||
continue
|
||||
if arg == '${clientid}':
|
||||
if arg == "${clientid}":
|
||||
continue
|
||||
if arg == '--xuid':
|
||||
if arg == "--xuid":
|
||||
continue
|
||||
if arg == '${auth_xuid}':
|
||||
if arg == "${auth_xuid}":
|
||||
continue
|
||||
foo.append(arg)
|
||||
else:
|
||||
print("!!! Unrecognized structure in Minecraft game arguments:")
|
||||
pprint(arg)
|
||||
return ' '.join(foo)
|
||||
return " ".join(foo)
|
||||
|
||||
|
||||
def is_macos_only(rules: Optional[MojangRules]):
|
||||
@ -214,21 +238,23 @@ def process_single_variant(lwjgl_variant: MetaVersion, patches: LibraryPatches):
|
||||
new_libraries += patch_library(lib, patches)
|
||||
v.libraries += list(dict.fromkeys(new_libraries))
|
||||
|
||||
if lwjgl_version[0] == '2':
|
||||
if lwjgl_version[0] == "2":
|
||||
filename = os.path.join(LAUNCHER_DIR, LWJGL_COMPONENT, f"{lwjgl_version}.json")
|
||||
|
||||
v.name = 'LWJGL 2'
|
||||
v.name = "LWJGL 2"
|
||||
v.uid = LWJGL_COMPONENT
|
||||
v.conflicts = [Dependency(uid=LWJGL3_COMPONENT)]
|
||||
elif lwjgl_version[0] == '3':
|
||||
elif lwjgl_version[0] == "3":
|
||||
filename = os.path.join(LAUNCHER_DIR, LWJGL3_COMPONENT, f"{lwjgl_version}.json")
|
||||
|
||||
v.name = 'LWJGL 3'
|
||||
v.name = "LWJGL 3"
|
||||
v.uid = LWJGL3_COMPONENT
|
||||
v.conflicts = [Dependency(uid=LWJGL_COMPONENT)]
|
||||
# remove jutils and jinput from LWJGL 3
|
||||
# this is a dependency that Mojang kept in, but doesn't belong there anymore
|
||||
filtered_libraries = list(filter(lambda l: l.name.artifact not in ["jutils", "jinput"], v.libraries))
|
||||
filtered_libraries = list(
|
||||
filter(lambda l: l.name.artifact not in ["jutils", "jinput"], v.libraries)
|
||||
)
|
||||
v.libraries = filtered_libraries
|
||||
else:
|
||||
raise Exception("LWJGL version not recognized: %s" % v.version)
|
||||
@ -240,7 +266,7 @@ def process_single_variant(lwjgl_variant: MetaVersion, patches: LibraryPatches):
|
||||
# skip libraries without natives or that we patched
|
||||
if not lib.natives or lib in new_libraries:
|
||||
continue
|
||||
checked_dict = {'linux', 'windows', 'osx'}
|
||||
checked_dict = {"linux", "windows", "osx"}
|
||||
if not checked_dict.issubset(lib.natives.keys()):
|
||||
print("Missing system classifier!", v.version, lib.name, lib.natives.keys())
|
||||
good = False
|
||||
@ -249,8 +275,13 @@ def process_single_variant(lwjgl_variant: MetaVersion, patches: LibraryPatches):
|
||||
for entry in checked_dict:
|
||||
baked_entry = lib.natives[entry]
|
||||
if baked_entry not in lib.downloads.classifiers:
|
||||
print("Missing download for classifier!", v.version, lib.name, baked_entry,
|
||||
lib.downloads.classifiers.keys())
|
||||
print(
|
||||
"Missing download for classifier!",
|
||||
v.version,
|
||||
lib.name,
|
||||
baked_entry,
|
||||
lib.downloads.classifiers.keys(),
|
||||
)
|
||||
good = False
|
||||
break
|
||||
if good:
|
||||
@ -274,8 +305,12 @@ def version_has_split_natives(v: MojangVersion) -> bool:
|
||||
|
||||
def main():
|
||||
# get the local version list
|
||||
override_index = LegacyOverrideIndex.parse_file(os.path.join(STATIC_DIR, STATIC_OVERRIDES_FILE))
|
||||
library_patches = LibraryPatches.parse_file(os.path.join(STATIC_DIR, LIBRARY_PATCHES_FILE))
|
||||
override_index = LegacyOverrideIndex.parse_file(
|
||||
os.path.join(STATIC_DIR, STATIC_OVERRIDES_FILE)
|
||||
)
|
||||
library_patches = LibraryPatches.parse_file(
|
||||
os.path.join(STATIC_DIR, LIBRARY_PATCHES_FILE)
|
||||
)
|
||||
|
||||
found_any_lwjgl3 = False
|
||||
|
||||
@ -286,7 +321,9 @@ def main():
|
||||
continue
|
||||
print("Processing", filename)
|
||||
mojang_version = MojangVersion.parse_file(input_file)
|
||||
v = mojang_version.to_meta_version("Minecraft", MINECRAFT_COMPONENT, mojang_version.id)
|
||||
v = mojang_version.to_meta_version(
|
||||
"Minecraft", MINECRAFT_COMPONENT, mojang_version.id
|
||||
)
|
||||
|
||||
libs_minecraft = []
|
||||
new_libs_minecraft = []
|
||||
@ -321,10 +358,17 @@ def main():
|
||||
rules = lib.rules
|
||||
lib.rules = None
|
||||
if is_macos_only(rules):
|
||||
print("Candidate library ", specifier, " is only for macOS and is therefore ignored.")
|
||||
print(
|
||||
"Candidate library ",
|
||||
specifier,
|
||||
" is only for macOS and is therefore ignored.",
|
||||
)
|
||||
continue
|
||||
bucket = add_or_get_bucket(buckets, rules)
|
||||
if specifier.group == "org.lwjgl.lwjgl" and specifier.artifact == "lwjgl":
|
||||
if (
|
||||
specifier.group == "org.lwjgl.lwjgl"
|
||||
and specifier.artifact == "lwjgl"
|
||||
):
|
||||
bucket.version = specifier.version
|
||||
if specifier.group == "org.lwjgl" and specifier.artifact == "lwjgl":
|
||||
is_lwjgl_3 = True
|
||||
@ -340,22 +384,31 @@ def main():
|
||||
|
||||
if version_override and maven_override:
|
||||
if version_override not in LOG4J_HASHES:
|
||||
raise Exception("ERROR: unhandled log4j version (overriden) %s!" % version_override)
|
||||
raise Exception(
|
||||
"ERROR: unhandled log4j version (overriden) %s!"
|
||||
% version_override
|
||||
)
|
||||
|
||||
if lib.name.artifact not in LOG4J_HASHES[version_override]:
|
||||
raise Exception("ERROR: unhandled log4j artifact %s!" % lib.name.artifact)
|
||||
raise Exception(
|
||||
"ERROR: unhandled log4j artifact %s!" % lib.name.artifact
|
||||
)
|
||||
|
||||
replacement_name = GradleSpecifier("org.apache.logging.log4j", lib.name.artifact, version_override)
|
||||
replacement_name = GradleSpecifier(
|
||||
"org.apache.logging.log4j", lib.name.artifact, version_override
|
||||
)
|
||||
artifact = MojangArtifact(
|
||||
url=maven_override % (replacement_name.path()),
|
||||
sha1=LOG4J_HASHES[version_override][lib.name.artifact]["sha1"],
|
||||
size=LOG4J_HASHES[version_override][lib.name.artifact]["size"]
|
||||
size=LOG4J_HASHES[version_override][lib.name.artifact]["size"],
|
||||
)
|
||||
|
||||
libs_minecraft.append(Library(
|
||||
name=replacement_name,
|
||||
downloads=MojangLibraryDownloads(artifact=artifact)
|
||||
))
|
||||
libs_minecraft.append(
|
||||
Library(
|
||||
name=replacement_name,
|
||||
downloads=MojangLibraryDownloads(artifact=artifact),
|
||||
)
|
||||
)
|
||||
else:
|
||||
libs_minecraft.append(lib)
|
||||
else:
|
||||
@ -374,9 +427,12 @@ def main():
|
||||
continue
|
||||
lwjgl = buckets[key]
|
||||
if None in buckets:
|
||||
lwjgl.libraries = sorted(lwjgl.libraries + buckets[None].libraries, key=attrgetter("name"))
|
||||
lwjgl.libraries = sorted(
|
||||
lwjgl.libraries + buckets[None].libraries,
|
||||
key=attrgetter("name"),
|
||||
)
|
||||
else:
|
||||
lwjgl.libraries = sorted(lwjgl.libraries, key=attrgetter('name'))
|
||||
lwjgl.libraries = sorted(lwjgl.libraries, key=attrgetter("name"))
|
||||
add_lwjgl_version(lwjglVersionVariants, lwjgl)
|
||||
print("Found candidate LWJGL", lwjgl.version, key)
|
||||
# remove the common bucket...
|
||||
@ -393,9 +449,9 @@ def main():
|
||||
if is_lwjgl_3:
|
||||
lwjgl_dependency.suggests = suggested_version
|
||||
else:
|
||||
lwjgl_dependency.suggests = '2.9.4-nightly-20150209'
|
||||
lwjgl_dependency.suggests = "2.9.4-nightly-20150209"
|
||||
else:
|
||||
bad_versions = {'3.1.6', '3.2.1'}
|
||||
bad_versions = {"3.1.6", "3.2.1"}
|
||||
our_versions = set()
|
||||
|
||||
for lwjgl in iter(buckets.values()):
|
||||
@ -403,10 +459,13 @@ def main():
|
||||
|
||||
if our_versions == bad_versions:
|
||||
print("Found broken 3.1.6/3.2.1 combo, forcing LWJGL to 3.2.1")
|
||||
suggested_version = '3.2.1'
|
||||
suggested_version = "3.2.1"
|
||||
lwjgl_dependency.suggests = suggested_version
|
||||
else:
|
||||
raise Exception("ERROR: cannot determine single suggested LWJGL version in %s" % mojang_version.id)
|
||||
raise Exception(
|
||||
"ERROR: cannot determine single suggested LWJGL version in %s"
|
||||
% mojang_version.id
|
||||
)
|
||||
|
||||
# if it uses LWJGL 3, add the trait that enables starting on first thread on macOS
|
||||
if is_lwjgl_3:
|
||||
@ -418,7 +477,9 @@ def main():
|
||||
# process 1.13 arguments into previous version
|
||||
if not mojang_version.minecraft_arguments and mojang_version.arguments:
|
||||
v.minecraft_arguments = adapt_new_style_arguments(mojang_version.arguments)
|
||||
out_filename = os.path.join(LAUNCHER_DIR, MINECRAFT_COMPONENT, f"{v.version}.json")
|
||||
out_filename = os.path.join(
|
||||
LAUNCHER_DIR, MINECRAFT_COMPONENT, f"{v.version}.json"
|
||||
)
|
||||
if v.version in override_index.versions:
|
||||
override = override_index.versions[v.version]
|
||||
override.apply_onto_meta_version(v)
|
||||
@ -428,7 +489,10 @@ def main():
|
||||
decided_variant = None
|
||||
passed_variants = 0
|
||||
unknown_variants = 0
|
||||
print("%d variant(s) for LWJGL %s:" % (len(lwjglVersionVariants[lwjglVersionVariant]), lwjglVersionVariant))
|
||||
print(
|
||||
"%d variant(s) for LWJGL %s:"
|
||||
% (len(lwjglVersionVariants[lwjglVersionVariant]), lwjglVersionVariant)
|
||||
)
|
||||
|
||||
for variant in lwjglVersionVariants[lwjglVersionVariant]:
|
||||
if variant.sha1 in BAD_VARIANTS:
|
||||
@ -440,32 +504,46 @@ def main():
|
||||
passed_variants += 1
|
||||
continue
|
||||
# print natives classifiers to decide which variant to use
|
||||
n = [x.natives.keys() for x in variant.version.libraries if x.natives is not None]
|
||||
n = [
|
||||
x.natives.keys()
|
||||
for x in variant.version.libraries
|
||||
if x.natives is not None
|
||||
]
|
||||
print(n)
|
||||
|
||||
print(f" \"{variant.sha1}\", # {lwjglVersionVariant} ({variant.version.release_time})")
|
||||
print(
|
||||
f' "{variant.sha1}", # {lwjglVersionVariant} ({variant.version.release_time})'
|
||||
)
|
||||
unknown_variants += 1
|
||||
print("")
|
||||
|
||||
if decided_variant and passed_variants == 1 and unknown_variants == 0:
|
||||
process_single_variant(decided_variant.version, library_patches)
|
||||
else:
|
||||
raise Exception("No variant decided for version %s out of %d possible ones and %d unknown ones." % (
|
||||
lwjglVersionVariant, passed_variants, unknown_variants))
|
||||
raise Exception(
|
||||
"No variant decided for version %s out of %d possible ones and %d unknown ones."
|
||||
% (lwjglVersionVariant, passed_variants, unknown_variants)
|
||||
)
|
||||
|
||||
lwjgl_package = MetaPackage(uid=LWJGL_COMPONENT, name='LWJGL 2')
|
||||
lwjgl_package = MetaPackage(uid=LWJGL_COMPONENT, name="LWJGL 2")
|
||||
lwjgl_package.write(os.path.join(LAUNCHER_DIR, LWJGL_COMPONENT, "package.json"))
|
||||
|
||||
if found_any_lwjgl3:
|
||||
lwjgl_package = MetaPackage(uid=LWJGL3_COMPONENT, name='LWJGL 3')
|
||||
lwjgl_package.write(os.path.join(LAUNCHER_DIR, LWJGL3_COMPONENT, "package.json"))
|
||||
lwjgl_package = MetaPackage(uid=LWJGL3_COMPONENT, name="LWJGL 3")
|
||||
lwjgl_package.write(
|
||||
os.path.join(LAUNCHER_DIR, LWJGL3_COMPONENT, "package.json")
|
||||
)
|
||||
|
||||
mojang_index = MojangIndexWrap(MojangIndex.parse_file(os.path.join(UPSTREAM_DIR, VERSION_MANIFEST_FILE)))
|
||||
mojang_index = MojangIndexWrap(
|
||||
MojangIndex.parse_file(os.path.join(UPSTREAM_DIR, VERSION_MANIFEST_FILE))
|
||||
)
|
||||
|
||||
minecraft_package = MetaPackage(uid=MINECRAFT_COMPONENT, name='Minecraft')
|
||||
minecraft_package = MetaPackage(uid=MINECRAFT_COMPONENT, name="Minecraft")
|
||||
minecraft_package.recommended = [mojang_index.latest.release]
|
||||
minecraft_package.write(os.path.join(LAUNCHER_DIR, MINECRAFT_COMPONENT, "package.json"))
|
||||
minecraft_package.write(
|
||||
os.path.join(LAUNCHER_DIR, MINECRAFT_COMPONENT, "package.json")
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -1,9 +1,20 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
from meta.common import ensure_component_dir, launcher_path, upstream_path, transform_maven_key
|
||||
from meta.common.quilt import JARS_DIR, INSTALLER_INFO_DIR, META_DIR, INTERMEDIARY_COMPONENT, LOADER_COMPONENT, \
|
||||
USE_QUILT_MAPPINGS
|
||||
from meta.common import (
|
||||
ensure_component_dir,
|
||||
launcher_path,
|
||||
upstream_path,
|
||||
transform_maven_key,
|
||||
)
|
||||
from meta.common.quilt import (
|
||||
JARS_DIR,
|
||||
INSTALLER_INFO_DIR,
|
||||
META_DIR,
|
||||
INTERMEDIARY_COMPONENT,
|
||||
LOADER_COMPONENT,
|
||||
USE_QUILT_MAPPINGS,
|
||||
)
|
||||
from meta.model import MetaVersion, Dependency, Library, MetaPackage, GradleSpecifier
|
||||
from meta.model.fabric import FabricJarInfo, FabricInstallerDataV1, FabricMainClasses
|
||||
|
||||
@ -15,15 +26,21 @@ ensure_component_dir(INTERMEDIARY_COMPONENT)
|
||||
|
||||
|
||||
def load_jar_info(artifact_key) -> FabricJarInfo:
|
||||
return FabricJarInfo.parse_file(os.path.join(UPSTREAM_DIR, JARS_DIR, f"{artifact_key}.json"))
|
||||
return FabricJarInfo.parse_file(
|
||||
os.path.join(UPSTREAM_DIR, JARS_DIR, f"{artifact_key}.json")
|
||||
)
|
||||
|
||||
|
||||
def load_installer_info(version) -> FabricInstallerDataV1:
|
||||
return FabricInstallerDataV1.parse_file(os.path.join(UPSTREAM_DIR, INSTALLER_INFO_DIR, f"{version}.json"))
|
||||
return FabricInstallerDataV1.parse_file(
|
||||
os.path.join(UPSTREAM_DIR, INSTALLER_INFO_DIR, f"{version}.json")
|
||||
)
|
||||
|
||||
|
||||
def process_loader_version(entry) -> (MetaVersion, bool):
|
||||
should_recommend = "-" not in entry["version"] # Don't recommend pre releases as per SemVer
|
||||
should_recommend = (
|
||||
"-" not in entry["version"]
|
||||
) # Don't recommend pre releases as per SemVer
|
||||
|
||||
jar_info = load_jar_info(transform_maven_key(entry["maven"]))
|
||||
installer_info = load_installer_info(entry["version"])
|
||||
@ -40,8 +57,10 @@ def process_loader_version(entry) -> (MetaVersion, bool):
|
||||
v.libraries = []
|
||||
v.libraries.extend(installer_info.libraries.common)
|
||||
v.libraries.extend(installer_info.libraries.client)
|
||||
loader_lib = Library(name=GradleSpecifier.from_string(entry["maven"]),
|
||||
url="https://maven.quiltmc.org/repository/release")
|
||||
loader_lib = Library(
|
||||
name=GradleSpecifier.from_string(entry["maven"]),
|
||||
url="https://maven.quiltmc.org/repository/release",
|
||||
)
|
||||
v.libraries.append(loader_lib)
|
||||
return v, should_recommend
|
||||
|
||||
@ -49,15 +68,21 @@ def process_loader_version(entry) -> (MetaVersion, bool):
|
||||
def process_intermediary_version(entry) -> MetaVersion:
|
||||
jar_info = load_jar_info(transform_maven_key(entry["maven"]))
|
||||
|
||||
v = MetaVersion(name="Quilt Intermediary Mappings", uid=INTERMEDIARY_COMPONENT, version=entry["version"])
|
||||
v = MetaVersion(
|
||||
name="Quilt Intermediary Mappings",
|
||||
uid=INTERMEDIARY_COMPONENT,
|
||||
version=entry["version"],
|
||||
)
|
||||
v.release_time = jar_info.release_time
|
||||
v.requires = [Dependency(uid='net.minecraft', equals=entry["version"])]
|
||||
v.requires = [Dependency(uid="net.minecraft", equals=entry["version"])]
|
||||
v.order = 11
|
||||
v.type = "release"
|
||||
v.libraries = []
|
||||
v.volatile = True
|
||||
intermediary_lib = Library(name=GradleSpecifier.from_string(entry["maven"]),
|
||||
url="https://maven.quiltmc.org/repository/release")
|
||||
intermediary_lib = Library(
|
||||
name=GradleSpecifier.from_string(entry["maven"]),
|
||||
url="https://maven.quiltmc.org/repository/release",
|
||||
)
|
||||
v.libraries.append(intermediary_lib)
|
||||
return v
|
||||
|
||||
@ -66,7 +91,9 @@ def main():
|
||||
recommended_loader_versions = []
|
||||
recommended_intermediary_versions = []
|
||||
|
||||
with open(os.path.join(UPSTREAM_DIR, META_DIR, "loader.json"), 'r', encoding='utf-8') as f:
|
||||
with open(
|
||||
os.path.join(UPSTREAM_DIR, META_DIR, "loader.json"), "r", encoding="utf-8"
|
||||
) as f:
|
||||
loader_version_index = json.load(f)
|
||||
for entry in loader_version_index:
|
||||
version = entry["version"]
|
||||
@ -74,13 +101,17 @@ def main():
|
||||
|
||||
v, should_recommend = process_loader_version(entry)
|
||||
|
||||
if not recommended_loader_versions and should_recommend: # newest stable loader is recommended
|
||||
if (
|
||||
not recommended_loader_versions and should_recommend
|
||||
): # newest stable loader is recommended
|
||||
recommended_loader_versions.append(version)
|
||||
|
||||
v.write(os.path.join(LAUNCHER_DIR, LOADER_COMPONENT, f"{v.version}.json"))
|
||||
|
||||
if USE_QUILT_MAPPINGS:
|
||||
with open(os.path.join(UPSTREAM_DIR, META_DIR, "hashed.json"), 'r', encoding='utf-8') as f:
|
||||
with open(
|
||||
os.path.join(UPSTREAM_DIR, META_DIR, "hashed.json"), "r", encoding="utf-8"
|
||||
) as f:
|
||||
intermediary_version_index = json.load(f)
|
||||
for entry in intermediary_version_index:
|
||||
version = entry["version"]
|
||||
@ -88,11 +119,17 @@ def main():
|
||||
|
||||
v = process_intermediary_version(entry)
|
||||
|
||||
recommended_intermediary_versions.append(version) # all intermediaries are recommended
|
||||
recommended_intermediary_versions.append(
|
||||
version
|
||||
) # all intermediaries are recommended
|
||||
|
||||
v.write(os.path.join(LAUNCHER_DIR, INTERMEDIARY_COMPONENT, f"{v.version}.json"))
|
||||
v.write(
|
||||
os.path.join(
|
||||
LAUNCHER_DIR, INTERMEDIARY_COMPONENT, f"{v.version}.json"
|
||||
)
|
||||
)
|
||||
|
||||
package = MetaPackage(uid=LOADER_COMPONENT, name='Quilt Loader')
|
||||
package = MetaPackage(uid=LOADER_COMPONENT, name="Quilt Loader")
|
||||
package.recommended = recommended_loader_versions
|
||||
package.description = "The Quilt project is an open, community-driven modding toolchain designed primarily for Minecraft."
|
||||
package.project_url = "https://quiltmc.org/"
|
||||
@ -100,13 +137,17 @@ def main():
|
||||
package.write(os.path.join(LAUNCHER_DIR, LOADER_COMPONENT, "package.json"))
|
||||
|
||||
if USE_QUILT_MAPPINGS:
|
||||
package = MetaPackage(uid=INTERMEDIARY_COMPONENT, name='Quilt Intermediary Mappings')
|
||||
package = MetaPackage(
|
||||
uid=INTERMEDIARY_COMPONENT, name="Quilt Intermediary Mappings"
|
||||
)
|
||||
package.recommended = recommended_intermediary_versions
|
||||
package.description = "Intermediary mappings allow using Quilt Loader with mods for Minecraft in a more compatible manner."
|
||||
package.project_url = "https://quiltmc.org/"
|
||||
package.authors = ["Quilt Project"]
|
||||
package.write(os.path.join(LAUNCHER_DIR, INTERMEDIARY_COMPONENT, "package.json"))
|
||||
package.write(
|
||||
os.path.join(LAUNCHER_DIR, INTERMEDIARY_COMPONENT, "package.json")
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
23
index.py
23
index.py
@ -4,7 +4,12 @@ from operator import attrgetter
|
||||
|
||||
from meta.common import launcher_path
|
||||
from meta.model import MetaVersion, MetaPackage
|
||||
from meta.model.index import MetaPackageIndex, MetaVersionIndex, MetaVersionIndexEntry, MetaPackageIndexEntry
|
||||
from meta.model.index import (
|
||||
MetaPackageIndex,
|
||||
MetaVersionIndex,
|
||||
MetaVersionIndexEntry,
|
||||
MetaPackageIndexEntry,
|
||||
)
|
||||
|
||||
LAUNCHER_DIR = launcher_path()
|
||||
|
||||
@ -29,7 +34,9 @@ for package in sorted(os.listdir(LAUNCHER_DIR)):
|
||||
if package in ignore:
|
||||
continue
|
||||
|
||||
sharedData = MetaPackage.parse_file(os.path.join(LAUNCHER_DIR, package, "package.json"))
|
||||
sharedData = MetaPackage.parse_file(
|
||||
os.path.join(LAUNCHER_DIR, package, "package.json")
|
||||
)
|
||||
recommendedVersions = set()
|
||||
if sharedData.recommended:
|
||||
recommendedVersions = set(sharedData.recommended)
|
||||
@ -48,12 +55,16 @@ for package in sorted(os.listdir(LAUNCHER_DIR)):
|
||||
versionFile = MetaVersion.parse_file(filepath)
|
||||
is_recommended = versionFile.version in recommendedVersions
|
||||
|
||||
versionEntry = MetaVersionIndexEntry.from_meta_version(versionFile, is_recommended, filehash)
|
||||
versionEntry = MetaVersionIndexEntry.from_meta_version(
|
||||
versionFile, is_recommended, filehash
|
||||
)
|
||||
|
||||
versionList.versions.append(versionEntry)
|
||||
|
||||
# sort the versions in descending order by time of release
|
||||
versionList.versions = sorted(versionList.versions, key=attrgetter('release_time'), reverse=True)
|
||||
versionList.versions = sorted(
|
||||
versionList.versions, key=attrgetter("release_time"), reverse=True
|
||||
)
|
||||
|
||||
# write the version index for the package
|
||||
outFilePath = LAUNCHER_DIR + "/%s/index.json" % package
|
||||
@ -61,9 +72,7 @@ for package in sorted(os.listdir(LAUNCHER_DIR)):
|
||||
|
||||
# insert entry into the package index
|
||||
packageEntry = MetaPackageIndexEntry(
|
||||
uid=package,
|
||||
name=sharedData.name,
|
||||
sha256=hash_file(hashlib.sha256, outFilePath)
|
||||
uid=package, name=sharedData.name, sha256=hash_file(hashlib.sha256, outFilePath)
|
||||
)
|
||||
packages.packages.append(packageEntry)
|
||||
|
||||
|
@ -76,10 +76,9 @@ def merge_dict(base: dict, overlay: dict):
|
||||
|
||||
|
||||
def default_session():
|
||||
forever_cache = FileCache('caches/http_cache', forever=True)
|
||||
forever_cache = FileCache("caches/http_cache", forever=True)
|
||||
sess = CacheControl(requests.Session(), forever_cache)
|
||||
|
||||
sess.headers.update({"User-Agent": "PrismLauncherMeta/1.0"})
|
||||
|
||||
return sess
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
def download_binary_file(sess, path, url):
|
||||
with open(path, 'wb') as f:
|
||||
with open(path, "wb") as f:
|
||||
r = sess.get(url)
|
||||
r.raise_for_status()
|
||||
for chunk in r.iter_content(chunk_size=128):
|
||||
|
@ -5,21 +5,32 @@ from typing import Optional, List, Dict, Any, Iterator
|
||||
import pydantic
|
||||
from pydantic import Field, validator
|
||||
|
||||
from ..common import serialize_datetime, replace_old_launchermeta_url, get_all_bases, merge_dict
|
||||
from ..common import (
|
||||
serialize_datetime,
|
||||
replace_old_launchermeta_url,
|
||||
get_all_bases,
|
||||
merge_dict,
|
||||
)
|
||||
|
||||
META_FORMAT_VERSION = 1
|
||||
|
||||
|
||||
class GradleSpecifier:
|
||||
"""
|
||||
A gradle specifier - a maven coordinate. Like one of these:
|
||||
"org.lwjgl.lwjgl:lwjgl:2.9.0"
|
||||
"net.java.jinput:jinput:2.0.5"
|
||||
"net.minecraft:launchwrapper:1.5"
|
||||
A gradle specifier - a maven coordinate. Like one of these:
|
||||
"org.lwjgl.lwjgl:lwjgl:2.9.0"
|
||||
"net.java.jinput:jinput:2.0.5"
|
||||
"net.minecraft:launchwrapper:1.5"
|
||||
"""
|
||||
|
||||
def __init__(self, group: str, artifact: str, version: str, classifier: Optional[str] = None,
|
||||
extension: Optional[str] = None):
|
||||
def __init__(
|
||||
self,
|
||||
group: str,
|
||||
artifact: str,
|
||||
version: str,
|
||||
classifier: Optional[str] = None,
|
||||
extension: Optional[str] = None,
|
||||
):
|
||||
if extension is None:
|
||||
extension = "jar"
|
||||
self.group = group
|
||||
@ -29,22 +40,33 @@ class GradleSpecifier:
|
||||
self.extension = extension
|
||||
|
||||
def __str__(self):
|
||||
ext = ''
|
||||
if self.extension != 'jar':
|
||||
ext = ""
|
||||
if self.extension != "jar":
|
||||
ext = "@%s" % self.extension
|
||||
if self.classifier:
|
||||
return "%s:%s:%s:%s%s" % (self.group, self.artifact, self.version, self.classifier, ext)
|
||||
return "%s:%s:%s:%s%s" % (
|
||||
self.group,
|
||||
self.artifact,
|
||||
self.version,
|
||||
self.classifier,
|
||||
ext,
|
||||
)
|
||||
else:
|
||||
return "%s:%s:%s%s" % (self.group, self.artifact, self.version, ext)
|
||||
|
||||
def filename(self):
|
||||
if self.classifier:
|
||||
return "%s-%s-%s.%s" % (self.artifact, self.version, self.classifier, self.extension)
|
||||
return "%s-%s-%s.%s" % (
|
||||
self.artifact,
|
||||
self.version,
|
||||
self.classifier,
|
||||
self.extension,
|
||||
)
|
||||
else:
|
||||
return "%s-%s.%s" % (self.artifact, self.version, self.extension)
|
||||
|
||||
def base(self):
|
||||
return "%s/%s/%s/" % (self.group.replace('.', '/'), self.artifact, self.version)
|
||||
return "%s/%s/%s/" % (self.group.replace(".", "/"), self.artifact, self.version)
|
||||
|
||||
def path(self):
|
||||
return self.base() + self.filename()
|
||||
@ -53,7 +75,12 @@ class GradleSpecifier:
|
||||
return f"GradleSpecifier('{self}')"
|
||||
|
||||
def is_lwjgl(self):
|
||||
return self.group in ("org.lwjgl", "org.lwjgl.lwjgl", "net.java.jinput", "net.java.jutils")
|
||||
return self.group in (
|
||||
"org.lwjgl",
|
||||
"org.lwjgl.lwjgl",
|
||||
"net.java.jinput",
|
||||
"net.java.jutils",
|
||||
)
|
||||
|
||||
def is_log4j(self):
|
||||
return self.group == "org.apache.logging.log4j"
|
||||
@ -76,9 +103,9 @@ class GradleSpecifier:
|
||||
|
||||
@classmethod
|
||||
def from_string(cls, v: str):
|
||||
ext_split = v.split('@')
|
||||
ext_split = v.split("@")
|
||||
|
||||
components = ext_split[0].split(':')
|
||||
components = ext_split[0].split(":")
|
||||
group = components[0]
|
||||
artifact = components[1]
|
||||
version = components[2]
|
||||
@ -114,7 +141,9 @@ class MetaBase(pydantic.BaseModel):
|
||||
if k in kwargs:
|
||||
del kwargs[k]
|
||||
|
||||
return super(MetaBase, self).json(exclude_none=True, sort_keys=True, by_alias=True, indent=4, **kwargs)
|
||||
return super(MetaBase, self).json(
|
||||
exclude_none=True, sort_keys=True, by_alias=True, indent=4, **kwargs
|
||||
)
|
||||
|
||||
def write(self, file_path):
|
||||
with open(file_path, "w") as f:
|
||||
@ -157,10 +186,7 @@ class MetaBase(pydantic.BaseModel):
|
||||
class Config:
|
||||
allow_population_by_field_name = True
|
||||
|
||||
json_encoders = {
|
||||
datetime: serialize_datetime,
|
||||
GradleSpecifier: str
|
||||
}
|
||||
json_encoders = {datetime: serialize_datetime, GradleSpecifier: str}
|
||||
|
||||
|
||||
class Versioned(MetaBase):
|
||||
@ -193,18 +219,19 @@ class MojangArtifact(MojangArtifactBase):
|
||||
|
||||
class MojangLibraryExtractRules(MetaBase):
|
||||
"""
|
||||
"rules": [
|
||||
{
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"action": "disallow",
|
||||
"os": {
|
||||
"name": "osx"
|
||||
}
|
||||
}
|
||||
]
|
||||
"rules": [
|
||||
{
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"action": "disallow",
|
||||
"os": {
|
||||
"name": "osx"
|
||||
}
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
exclude: List[str] # TODO maybe drop this completely?
|
||||
|
||||
|
||||
@ -216,7 +243,15 @@ class MojangLibraryDownloads(MetaBase):
|
||||
class OSRule(MetaBase):
|
||||
@validator("name")
|
||||
def name_must_be_os(cls, v):
|
||||
assert v in ["osx", "linux", "windows", "windows-arm64", "osx-arm64", "linux-arm64", "linux-arm32"]
|
||||
assert v in [
|
||||
"osx",
|
||||
"linux",
|
||||
"windows",
|
||||
"windows-arm64",
|
||||
"osx-arm64",
|
||||
"linux-arm64",
|
||||
"linux-arm32",
|
||||
]
|
||||
return v
|
||||
|
||||
name: str
|
||||
|
@ -17,7 +17,9 @@ class ForgeFile(MetaBase):
|
||||
|
||||
def url(self, long_version):
|
||||
return "https://maven.minecraftforge.net/net/minecraftforge/forge/%s/%s" % (
|
||||
long_version, self.filename(long_version))
|
||||
long_version,
|
||||
self.filename(long_version),
|
||||
)
|
||||
|
||||
|
||||
class ForgeEntry(MetaBase):
|
||||
@ -42,7 +44,9 @@ class DerivedForgeIndex(MetaBase):
|
||||
by_mc_version: Dict[str, ForgeMCVersionInfo] = Field({}, alias="by_mcversion")
|
||||
|
||||
|
||||
class FMLLib(MetaBase): # old ugly stuff. Maybe merge this with Library or MojangLibrary later
|
||||
class FMLLib(
|
||||
MetaBase
|
||||
): # old ugly stuff. Maybe merge this with Library or MojangLibrary later
|
||||
filename: str
|
||||
checksum: str
|
||||
ours: bool
|
||||
@ -74,6 +78,7 @@ class ForgeInstallerProfileInstallSection(MetaBase):
|
||||
"modList":"none"
|
||||
},
|
||||
"""
|
||||
|
||||
profile_name: str = Field(alias="profileName")
|
||||
target: str
|
||||
path: GradleSpecifier
|
||||
@ -116,6 +121,7 @@ class ForgeOptional(MetaBase):
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
name: Optional[str]
|
||||
client: Optional[bool]
|
||||
server: Optional[bool]
|
||||
@ -206,7 +212,9 @@ class ForgeVersion:
|
||||
if (classifier == "installer") and (extension == "jar"):
|
||||
self.installer_filename = filename
|
||||
self.installer_url = url
|
||||
if (classifier == "universal" or classifier == "client") and (extension == "jar" or extension == "zip"):
|
||||
if (classifier == "universal" or classifier == "client") and (
|
||||
extension == "jar" or extension == "zip"
|
||||
):
|
||||
self.universal_filename = filename
|
||||
self.universal_url = url
|
||||
if (classifier == "changelog") and (extension == "txt"):
|
||||
@ -236,7 +244,7 @@ class ForgeVersion:
|
||||
if self.url() is None:
|
||||
return False
|
||||
|
||||
foo = self.rawVersion.split('.')
|
||||
foo = self.rawVersion.split(".")
|
||||
if len(foo) < 1:
|
||||
return False
|
||||
|
||||
@ -252,55 +260,106 @@ class ForgeVersion:
|
||||
|
||||
|
||||
def fml_libs_for_version(mc_version: str) -> List[FMLLib]:
|
||||
argo_2_25 = FMLLib(filename="argo-2.25.jar",
|
||||
checksum="bb672829fde76cb163004752b86b0484bd0a7f4b",
|
||||
ours=False)
|
||||
argo_small_3_2 = FMLLib(filename="argo-small-3.2.jar",
|
||||
checksum="58912ea2858d168c50781f956fa5b59f0f7c6b51",
|
||||
ours=False)
|
||||
guava_12_0_1 = FMLLib(filename="guava-12.0.1.jar",
|
||||
checksum="b8e78b9af7bf45900e14c6f958486b6ca682195f",
|
||||
ours=False)
|
||||
guava_14_0_rc3 = FMLLib(filename="guava-14.0-rc3.jar",
|
||||
checksum="931ae21fa8014c3ce686aaa621eae565fefb1a6a",
|
||||
ours=False)
|
||||
asm_all_4_0 = FMLLib(filename="asm-all-4.0.jar",
|
||||
checksum="98308890597acb64047f7e896638e0d98753ae82",
|
||||
ours=False)
|
||||
asm_all_4_1 = FMLLib(filename="asm-all-4.1.jar",
|
||||
checksum="054986e962b88d8660ae4566475658469595ef58",
|
||||
ours=False)
|
||||
bcprov_jdk15on_147 = FMLLib(filename="bcprov-jdk15on-147.jar",
|
||||
checksum="b6f5d9926b0afbde9f4dbe3db88c5247be7794bb",
|
||||
ours=False)
|
||||
bcprov_jdk15on_148 = FMLLib(filename="bcprov-jdk15on-148.jar",
|
||||
checksum="960dea7c9181ba0b17e8bab0c06a43f0a5f04e65",
|
||||
ours=True)
|
||||
scala_library = FMLLib(filename="scala-library.jar",
|
||||
checksum="458d046151ad179c85429ed7420ffb1eaf6ddf85",
|
||||
ours=True)
|
||||
argo_2_25 = FMLLib(
|
||||
filename="argo-2.25.jar",
|
||||
checksum="bb672829fde76cb163004752b86b0484bd0a7f4b",
|
||||
ours=False,
|
||||
)
|
||||
argo_small_3_2 = FMLLib(
|
||||
filename="argo-small-3.2.jar",
|
||||
checksum="58912ea2858d168c50781f956fa5b59f0f7c6b51",
|
||||
ours=False,
|
||||
)
|
||||
guava_12_0_1 = FMLLib(
|
||||
filename="guava-12.0.1.jar",
|
||||
checksum="b8e78b9af7bf45900e14c6f958486b6ca682195f",
|
||||
ours=False,
|
||||
)
|
||||
guava_14_0_rc3 = FMLLib(
|
||||
filename="guava-14.0-rc3.jar",
|
||||
checksum="931ae21fa8014c3ce686aaa621eae565fefb1a6a",
|
||||
ours=False,
|
||||
)
|
||||
asm_all_4_0 = FMLLib(
|
||||
filename="asm-all-4.0.jar",
|
||||
checksum="98308890597acb64047f7e896638e0d98753ae82",
|
||||
ours=False,
|
||||
)
|
||||
asm_all_4_1 = FMLLib(
|
||||
filename="asm-all-4.1.jar",
|
||||
checksum="054986e962b88d8660ae4566475658469595ef58",
|
||||
ours=False,
|
||||
)
|
||||
bcprov_jdk15on_147 = FMLLib(
|
||||
filename="bcprov-jdk15on-147.jar",
|
||||
checksum="b6f5d9926b0afbde9f4dbe3db88c5247be7794bb",
|
||||
ours=False,
|
||||
)
|
||||
bcprov_jdk15on_148 = FMLLib(
|
||||
filename="bcprov-jdk15on-148.jar",
|
||||
checksum="960dea7c9181ba0b17e8bab0c06a43f0a5f04e65",
|
||||
ours=True,
|
||||
)
|
||||
scala_library = FMLLib(
|
||||
filename="scala-library.jar",
|
||||
checksum="458d046151ad179c85429ed7420ffb1eaf6ddf85",
|
||||
ours=True,
|
||||
)
|
||||
|
||||
deobfuscation_data_1_5 = FMLLib(filename="deobfuscation_data_1.5.zip",
|
||||
checksum="5f7c142d53776f16304c0bbe10542014abad6af8",
|
||||
ours=False)
|
||||
deobfuscation_data_1_5 = FMLLib(
|
||||
filename="deobfuscation_data_1.5.zip",
|
||||
checksum="5f7c142d53776f16304c0bbe10542014abad6af8",
|
||||
ours=False,
|
||||
)
|
||||
|
||||
deobfuscation_data_1_5_1 = FMLLib(filename="deobfuscation_data_1.5.1.zip",
|
||||
checksum="22e221a0d89516c1f721d6cab056a7e37471d0a6",
|
||||
ours=False)
|
||||
deobfuscation_data_1_5_2 = FMLLib(filename="deobfuscation_data_1.5.2.zip",
|
||||
checksum="446e55cd986582c70fcf12cb27bc00114c5adfd9",
|
||||
ours=False)
|
||||
deobfuscation_data_1_5_1 = FMLLib(
|
||||
filename="deobfuscation_data_1.5.1.zip",
|
||||
checksum="22e221a0d89516c1f721d6cab056a7e37471d0a6",
|
||||
ours=False,
|
||||
)
|
||||
deobfuscation_data_1_5_2 = FMLLib(
|
||||
filename="deobfuscation_data_1.5.2.zip",
|
||||
checksum="446e55cd986582c70fcf12cb27bc00114c5adfd9",
|
||||
ours=False,
|
||||
)
|
||||
if mc_version == "1.3.2":
|
||||
return [argo_2_25, guava_12_0_1, asm_all_4_0]
|
||||
elif mc_version in ["1.4", "1.4.1", "1.4.2", "1.4.3", "1.4.4", "1.4.5", "1.4.6", "1.4.7"]:
|
||||
elif mc_version in [
|
||||
"1.4",
|
||||
"1.4.1",
|
||||
"1.4.2",
|
||||
"1.4.3",
|
||||
"1.4.4",
|
||||
"1.4.5",
|
||||
"1.4.6",
|
||||
"1.4.7",
|
||||
]:
|
||||
return [argo_2_25, guava_12_0_1, asm_all_4_0, bcprov_jdk15on_147]
|
||||
elif mc_version == "1.5":
|
||||
return [argo_small_3_2, guava_14_0_rc3, asm_all_4_1, bcprov_jdk15on_148, deobfuscation_data_1_5,
|
||||
scala_library]
|
||||
return [
|
||||
argo_small_3_2,
|
||||
guava_14_0_rc3,
|
||||
asm_all_4_1,
|
||||
bcprov_jdk15on_148,
|
||||
deobfuscation_data_1_5,
|
||||
scala_library,
|
||||
]
|
||||
elif mc_version == "1.5.1":
|
||||
return [argo_small_3_2, guava_14_0_rc3, asm_all_4_1, bcprov_jdk15on_148, deobfuscation_data_1_5_1,
|
||||
scala_library]
|
||||
return [
|
||||
argo_small_3_2,
|
||||
guava_14_0_rc3,
|
||||
asm_all_4_1,
|
||||
bcprov_jdk15on_148,
|
||||
deobfuscation_data_1_5_1,
|
||||
scala_library,
|
||||
]
|
||||
elif mc_version == "1.5.2":
|
||||
return [argo_small_3_2, guava_14_0_rc3, asm_all_4_1, bcprov_jdk15on_148, deobfuscation_data_1_5_2,
|
||||
scala_library]
|
||||
return [
|
||||
argo_small_3_2,
|
||||
guava_14_0_rc3,
|
||||
asm_all_4_1,
|
||||
bcprov_jdk15on_148,
|
||||
deobfuscation_data_1_5_2,
|
||||
scala_library,
|
||||
]
|
||||
return []
|
||||
|
@ -26,7 +26,7 @@ class MetaVersionIndexEntry(MetaBase):
|
||||
conflicts=v.conflicts,
|
||||
recommended=recommended,
|
||||
volatile=v.volatile,
|
||||
sha256=sha256
|
||||
sha256=sha256,
|
||||
)
|
||||
|
||||
|
||||
|
@ -14,13 +14,14 @@ class LiteloaderDev(MetaBase):
|
||||
|
||||
class LiteloaderRepo(MetaBase):
|
||||
"""
|
||||
"repo":{
|
||||
"stream":"RELEASE",
|
||||
"type":"m2",
|
||||
"url":"http://dl.liteloader.com/repo/",
|
||||
"classifier":""
|
||||
},
|
||||
"repo":{
|
||||
"stream":"RELEASE",
|
||||
"type":"m2",
|
||||
"url":"http://dl.liteloader.com/repo/",
|
||||
"classifier":""
|
||||
},
|
||||
"""
|
||||
|
||||
stream: str
|
||||
type: str
|
||||
url: str
|
||||
@ -29,26 +30,27 @@ class LiteloaderRepo(MetaBase):
|
||||
|
||||
class LiteloaderArtefact(MetaBase):
|
||||
"""
|
||||
"53639d52340479ccf206a04f5e16606f":{
|
||||
"tweakClass":"com.mumfrey.liteloader.launch.LiteLoaderTweaker",
|
||||
"libraries":[
|
||||
{
|
||||
"name":"net.minecraft:launchwrapper:1.5"
|
||||
},
|
||||
{
|
||||
"name":"net.sf.jopt-simple:jopt-simple:4.5"
|
||||
},
|
||||
{
|
||||
"name":"org.ow2.asm:asm-all:4.1"
|
||||
}
|
||||
],
|
||||
"stream":"RELEASE",
|
||||
"file":"liteloader-1.5.2_01.jar",
|
||||
"version":"1.5.2_01",
|
||||
"md5":"53639d52340479ccf206a04f5e16606f",
|
||||
"timestamp":"1367366420"
|
||||
},
|
||||
"53639d52340479ccf206a04f5e16606f":{
|
||||
"tweakClass":"com.mumfrey.liteloader.launch.LiteLoaderTweaker",
|
||||
"libraries":[
|
||||
{
|
||||
"name":"net.minecraft:launchwrapper:1.5"
|
||||
},
|
||||
{
|
||||
"name":"net.sf.jopt-simple:jopt-simple:4.5"
|
||||
},
|
||||
{
|
||||
"name":"org.ow2.asm:asm-all:4.1"
|
||||
}
|
||||
],
|
||||
"stream":"RELEASE",
|
||||
"file":"liteloader-1.5.2_01.jar",
|
||||
"version":"1.5.2_01",
|
||||
"md5":"53639d52340479ccf206a04f5e16606f",
|
||||
"timestamp":"1367366420"
|
||||
},
|
||||
"""
|
||||
|
||||
tweakClass: str
|
||||
libraries: List[Library]
|
||||
stream: str
|
||||
@ -69,17 +71,18 @@ class LiteloaderArtefacts(MetaBase):
|
||||
|
||||
class LiteloaderEntry(MetaBase):
|
||||
"""
|
||||
"1.10.2":{
|
||||
"dev": { ... },
|
||||
"repo":{ ... },
|
||||
"artefacts":{
|
||||
"com.mumfrey:liteloader":{ },
|
||||
...
|
||||
},
|
||||
"snapshots":{
|
||||
...
|
||||
}
|
||||
"1.10.2":{
|
||||
"dev": { ... },
|
||||
"repo":{ ... },
|
||||
"artefacts":{
|
||||
"com.mumfrey:liteloader":{ },
|
||||
...
|
||||
},
|
||||
"snapshots":{
|
||||
...
|
||||
}
|
||||
"""
|
||||
|
||||
dev: Optional[LiteloaderDev]
|
||||
repo: LiteloaderRepo
|
||||
artefacts: Optional[LiteloaderArtefacts]
|
||||
@ -88,14 +91,15 @@ class LiteloaderEntry(MetaBase):
|
||||
|
||||
class LiteloaderMeta(MetaBase):
|
||||
"""
|
||||
"meta":{
|
||||
"description":"LiteLoader is a lightweight mod bootstrap designed to provide basic loader functionality for mods which don't need to modify game mechanics.",
|
||||
"authors":"Mumfrey",
|
||||
"url":"http://dl.liteloader.com",
|
||||
"updated":"2017-02-22T11:34:07+00:00",
|
||||
"updatedTime":1487763247
|
||||
},
|
||||
"meta":{
|
||||
"description":"LiteLoader is a lightweight mod bootstrap designed to provide basic loader functionality for mods which don't need to modify game mechanics.",
|
||||
"authors":"Mumfrey",
|
||||
"url":"http://dl.liteloader.com",
|
||||
"updated":"2017-02-22T11:34:07+00:00",
|
||||
"updatedTime":1487763247
|
||||
},
|
||||
"""
|
||||
|
||||
description: str
|
||||
authors: str
|
||||
url: str
|
||||
|
@ -3,17 +3,24 @@ from typing import Optional, List, Dict, Any, Iterator
|
||||
|
||||
from pydantic import validator, Field
|
||||
|
||||
from . import MetaBase, MojangArtifactBase, MojangAssets, MojangLibrary, MojangArtifact, MojangLibraryDownloads, \
|
||||
Library, MetaVersion, GradleSpecifier
|
||||
from . import (
|
||||
MetaBase,
|
||||
MojangArtifactBase,
|
||||
MojangAssets,
|
||||
MojangLibrary,
|
||||
MojangArtifact,
|
||||
MojangLibraryDownloads,
|
||||
Library,
|
||||
MetaVersion,
|
||||
GradleSpecifier,
|
||||
)
|
||||
|
||||
SUPPORTED_LAUNCHER_VERSION = 21
|
||||
SUPPORTED_COMPLIANCE_LEVEL = 1
|
||||
DEFAULT_JAVA_MAJOR = 8 # By default, we should recommend Java 8 if we don't know better
|
||||
COMPATIBLE_JAVA_MAPPINGS = {
|
||||
16: [17]
|
||||
}
|
||||
COMPATIBLE_JAVA_MAPPINGS = {16: [17]}
|
||||
|
||||
'''
|
||||
"""
|
||||
Mojang index files look like this:
|
||||
{
|
||||
"latest": {
|
||||
@ -32,7 +39,7 @@ Mojang index files look like this:
|
||||
...
|
||||
]
|
||||
}
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
class MojangLatestVersion(MetaBase):
|
||||
@ -75,7 +82,9 @@ class ExperimentIndex(MetaBase):
|
||||
class ExperimentIndexWrap:
|
||||
def __init__(self, index: ExperimentIndex):
|
||||
self.index: ExperimentIndex = index
|
||||
self.versions: Dict[str, ExperimentEntry] = dict((x.id, x) for x in index.experiments)
|
||||
self.versions: Dict[str, ExperimentEntry] = dict(
|
||||
(x.id, x) for x in index.experiments
|
||||
)
|
||||
|
||||
|
||||
class OldSnapshotEntry(MetaBase):
|
||||
@ -94,7 +103,9 @@ class OldSnapshotIndex(MetaBase):
|
||||
class OldSnapshotIndexWrap:
|
||||
def __init__(self, index: OldSnapshotIndex):
|
||||
self.index: OldSnapshotIndex = index
|
||||
self.versions: Dict[str, OldSnapshotEntry] = dict((x.id, x) for x in index.old_snapshots)
|
||||
self.versions: Dict[str, OldSnapshotEntry] = dict(
|
||||
(x.id, x) for x in index.old_snapshots
|
||||
)
|
||||
|
||||
|
||||
class LegacyOverrideEntry(MetaBase):
|
||||
@ -200,8 +211,7 @@ class MojangVersion(MetaBase):
|
||||
applet_class: Optional[str] = Field(alias="appletClass")
|
||||
processArguments: Optional[str]
|
||||
minecraft_arguments: Optional[str] = Field(alias="minecraftArguments")
|
||||
minimum_launcher_version: Optional[int] = Field(
|
||||
alias="minimumLauncherVersion")
|
||||
minimum_launcher_version: Optional[int] = Field(alias="minimumLauncherVersion")
|
||||
release_time: Optional[datetime] = Field(alias="releaseTime")
|
||||
time: Optional[datetime]
|
||||
type: Optional[str]
|
||||
@ -216,10 +226,17 @@ class MojangVersion(MetaBase):
|
||||
new_type = self.type
|
||||
compatible_java_majors = None
|
||||
if self.id:
|
||||
client_download = self.downloads['client']
|
||||
artifact = MojangArtifact(url=client_download.url, sha1=client_download.sha1, size=client_download.size)
|
||||
client_download = self.downloads["client"]
|
||||
artifact = MojangArtifact(
|
||||
url=client_download.url,
|
||||
sha1=client_download.sha1,
|
||||
size=client_download.size,
|
||||
)
|
||||
downloads = MojangLibraryDownloads(artifact=artifact)
|
||||
main_jar = Library(name=GradleSpecifier("com.mojang", "minecraft", self.id, "client"), downloads=downloads)
|
||||
main_jar = Library(
|
||||
name=GradleSpecifier("com.mojang", "minecraft", self.id, "client"),
|
||||
downloads=downloads,
|
||||
)
|
||||
|
||||
if not self.compliance_level: # both == 0 and is None
|
||||
pass
|
||||
@ -231,11 +248,15 @@ class MojangVersion(MetaBase):
|
||||
raise Exception(f"Unsupported compliance level {self.compliance_level}")
|
||||
|
||||
major = DEFAULT_JAVA_MAJOR
|
||||
if self.javaVersion is not None: # some versions don't have this. TODO: maybe maintain manual overrides
|
||||
if (
|
||||
self.javaVersion is not None
|
||||
): # some versions don't have this. TODO: maybe maintain manual overrides
|
||||
major = self.javaVersion.major_version
|
||||
|
||||
compatible_java_majors = [major]
|
||||
if major in COMPATIBLE_JAVA_MAPPINGS: # add more compatible Java versions, e.g. 16 and 17 both work for MC 1.17
|
||||
if (
|
||||
major in COMPATIBLE_JAVA_MAPPINGS
|
||||
): # add more compatible Java versions, e.g. 16 and 17 both work for MC 1.17
|
||||
compatible_java_majors += COMPATIBLE_JAVA_MAPPINGS[major]
|
||||
|
||||
if new_type == "pending": # experiments from upstream are type=pending
|
||||
@ -253,4 +274,5 @@ class MojangVersion(MetaBase):
|
||||
type=new_type,
|
||||
compatible_java_majors=compatible_java_majors,
|
||||
additional_traits=addn_traits,
|
||||
main_jar=main_jar)
|
||||
main_jar=main_jar,
|
||||
)
|
||||
|
@ -3,8 +3,18 @@ import os
|
||||
import zipfile
|
||||
from datetime import datetime
|
||||
|
||||
from meta.common import upstream_path, ensure_upstream_dir, transform_maven_key, default_session
|
||||
from meta.common.fabric import JARS_DIR, INSTALLER_INFO_DIR, META_DIR, DATETIME_FORMAT_HTTP
|
||||
from meta.common import (
|
||||
upstream_path,
|
||||
ensure_upstream_dir,
|
||||
transform_maven_key,
|
||||
default_session,
|
||||
)
|
||||
from meta.common.fabric import (
|
||||
JARS_DIR,
|
||||
INSTALLER_INFO_DIR,
|
||||
META_DIR,
|
||||
DATETIME_FORMAT_HTTP,
|
||||
)
|
||||
from meta.model.fabric import FabricJarInfo
|
||||
|
||||
UPSTREAM_DIR = upstream_path()
|
||||
@ -26,13 +36,15 @@ def filehash(filename, hashtype, blocksize=65536):
|
||||
|
||||
def get_maven_url(maven_key, server, ext):
|
||||
parts = maven_key.split(":", 3)
|
||||
maven_ver_url = server + parts[0].replace(".", "/") + "/" + parts[1] + "/" + parts[2] + "/"
|
||||
maven_ver_url = (
|
||||
server + parts[0].replace(".", "/") + "/" + parts[1] + "/" + parts[2] + "/"
|
||||
)
|
||||
maven_url = maven_ver_url + parts[1] + "-" + parts[2] + ext
|
||||
return maven_url
|
||||
|
||||
|
||||
def get_json_file(path, url):
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
r = sess.get(url)
|
||||
r.raise_for_status()
|
||||
version_json = r.json()
|
||||
@ -47,7 +59,7 @@ def head_file(url):
|
||||
|
||||
|
||||
def get_binary_file(path, url):
|
||||
with open(path, 'wb') as f:
|
||||
with open(path, "wb") as f:
|
||||
r = sess.get(url)
|
||||
r.raise_for_status()
|
||||
for chunk in r.iter_content(chunk_size=128):
|
||||
@ -82,21 +94,35 @@ def compute_jar_file(path, url):
|
||||
def main():
|
||||
# get the version list for each component we are interested in
|
||||
for component in ["intermediary", "loader"]:
|
||||
index = get_json_file(os.path.join(UPSTREAM_DIR, META_DIR, f"{component}.json"),
|
||||
"https://meta.fabricmc.net/v2/versions/" + component)
|
||||
index = get_json_file(
|
||||
os.path.join(UPSTREAM_DIR, META_DIR, f"{component}.json"),
|
||||
"https://meta.fabricmc.net/v2/versions/" + component,
|
||||
)
|
||||
for it in index:
|
||||
print(f"Processing {component} {it['version']} ")
|
||||
jar_maven_url = get_maven_url(it["maven"], "https://maven.fabricmc.net/", ".jar")
|
||||
compute_jar_file(os.path.join(UPSTREAM_DIR, JARS_DIR, transform_maven_key(it["maven"])), jar_maven_url)
|
||||
jar_maven_url = get_maven_url(
|
||||
it["maven"], "https://maven.fabricmc.net/", ".jar"
|
||||
)
|
||||
compute_jar_file(
|
||||
os.path.join(UPSTREAM_DIR, JARS_DIR, transform_maven_key(it["maven"])),
|
||||
jar_maven_url,
|
||||
)
|
||||
|
||||
# for each loader, download installer JSON file from maven
|
||||
with open(os.path.join(UPSTREAM_DIR, META_DIR, "loader.json"), 'r', encoding='utf-8') as loaderVersionIndexFile:
|
||||
with open(
|
||||
os.path.join(UPSTREAM_DIR, META_DIR, "loader.json"), "r", encoding="utf-8"
|
||||
) as loaderVersionIndexFile:
|
||||
loader_version_index = json.load(loaderVersionIndexFile)
|
||||
for it in loader_version_index:
|
||||
print(f"Downloading JAR info for loader {it['version']} ")
|
||||
maven_url = get_maven_url(it["maven"], "https://maven.fabricmc.net/", ".json")
|
||||
get_json_file(os.path.join(UPSTREAM_DIR, INSTALLER_INFO_DIR, f"{it['version']}.json"), maven_url)
|
||||
maven_url = get_maven_url(
|
||||
it["maven"], "https://maven.fabricmc.net/", ".json"
|
||||
)
|
||||
get_json_file(
|
||||
os.path.join(UPSTREAM_DIR, INSTALLER_INFO_DIR, f"{it['version']}.json"),
|
||||
maven_url,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
141
updateForge.py
141
updateForge.py
@ -16,11 +16,27 @@ from pprint import pprint
|
||||
from pydantic import ValidationError
|
||||
|
||||
from meta.common import upstream_path, ensure_upstream_dir, static_path, default_session
|
||||
from meta.common.forge import JARS_DIR, INSTALLER_INFO_DIR, INSTALLER_MANIFEST_DIR, VERSION_MANIFEST_DIR, \
|
||||
FILE_MANIFEST_DIR, BAD_VERSIONS, STATIC_LEGACYINFO_FILE
|
||||
from meta.model.forge import ForgeFile, ForgeEntry, ForgeMCVersionInfo, ForgeLegacyInfoList, DerivedForgeIndex, \
|
||||
ForgeVersion, ForgeInstallerProfile, ForgeInstallerProfileV2, InstallerInfo, \
|
||||
ForgeLegacyInfo
|
||||
from meta.common.forge import (
|
||||
JARS_DIR,
|
||||
INSTALLER_INFO_DIR,
|
||||
INSTALLER_MANIFEST_DIR,
|
||||
VERSION_MANIFEST_DIR,
|
||||
FILE_MANIFEST_DIR,
|
||||
BAD_VERSIONS,
|
||||
STATIC_LEGACYINFO_FILE,
|
||||
)
|
||||
from meta.model.forge import (
|
||||
ForgeFile,
|
||||
ForgeEntry,
|
||||
ForgeMCVersionInfo,
|
||||
ForgeLegacyInfoList,
|
||||
DerivedForgeIndex,
|
||||
ForgeVersion,
|
||||
ForgeInstallerProfile,
|
||||
ForgeInstallerProfileV2,
|
||||
InstallerInfo,
|
||||
ForgeLegacyInfo,
|
||||
)
|
||||
from meta.model.mojang import MojangVersion
|
||||
|
||||
UPSTREAM_DIR = upstream_path()
|
||||
@ -55,18 +71,21 @@ def get_single_forge_files_manifest(longversion):
|
||||
files_manifest_file = Path(path_thing)
|
||||
from_file = False
|
||||
if files_manifest_file.is_file():
|
||||
with open(path_thing, 'r') as f:
|
||||
with open(path_thing, "r") as f:
|
||||
files_json = json.load(f)
|
||||
from_file = True
|
||||
else:
|
||||
file_url = 'https://files.minecraftforge.net/net/minecraftforge/forge/%s/meta.json' % longversion
|
||||
file_url = (
|
||||
"https://files.minecraftforge.net/net/minecraftforge/forge/%s/meta.json"
|
||||
% longversion
|
||||
)
|
||||
r = sess.get(file_url)
|
||||
r.raise_for_status()
|
||||
files_json = r.json()
|
||||
|
||||
ret_dict = dict()
|
||||
|
||||
for classifier, extensionObj in files_json.get('classifiers').items():
|
||||
for classifier, extensionObj in files_json.get("classifiers").items():
|
||||
assert type(classifier) == str
|
||||
assert type(extensionObj) == dict
|
||||
|
||||
@ -82,33 +101,40 @@ def get_single_forge_files_manifest(longversion):
|
||||
if not type(hashtype) == str:
|
||||
pprint(classifier)
|
||||
pprint(extensionObj)
|
||||
print('%s: Skipping missing hash for extension %s:' % (longversion, extension))
|
||||
print(
|
||||
"%s: Skipping missing hash for extension %s:"
|
||||
% (longversion, extension)
|
||||
)
|
||||
index += 1
|
||||
continue
|
||||
assert type(classifier) == str
|
||||
processed_hash = re.sub(r"\W", "", hashtype)
|
||||
if not len(processed_hash) == 32:
|
||||
print('%s: Skipping invalid hash for extension %s:' % (longversion, extension))
|
||||
print(
|
||||
"%s: Skipping invalid hash for extension %s:"
|
||||
% (longversion, extension)
|
||||
)
|
||||
pprint(extensionObj)
|
||||
index += 1
|
||||
continue
|
||||
|
||||
file_obj = ForgeFile(
|
||||
classifier=classifier,
|
||||
hash=processed_hash,
|
||||
extension=extension
|
||||
classifier=classifier, hash=processed_hash, extension=extension
|
||||
)
|
||||
if count == 0:
|
||||
ret_dict[classifier] = file_obj
|
||||
index += 1
|
||||
count += 1
|
||||
else:
|
||||
print('%s: Multiple objects detected for classifier %s:' % (longversion, classifier))
|
||||
print(
|
||||
"%s: Multiple objects detected for classifier %s:"
|
||||
% (longversion, classifier)
|
||||
)
|
||||
pprint(extensionObj)
|
||||
assert False
|
||||
|
||||
if not from_file:
|
||||
with open(path_thing, 'w', encoding='utf-8') as f:
|
||||
with open(path_thing, "w", encoding="utf-8") as f:
|
||||
json.dump(files_json, f, sort_keys=True, indent=4)
|
||||
|
||||
return ret_dict
|
||||
@ -116,18 +142,23 @@ def get_single_forge_files_manifest(longversion):
|
||||
|
||||
def main():
|
||||
# get the remote version list fragments
|
||||
r = sess.get('https://files.minecraftforge.net/net/minecraftforge/forge/maven-metadata.json')
|
||||
r = sess.get(
|
||||
"https://files.minecraftforge.net/net/minecraftforge/forge/maven-metadata.json"
|
||||
)
|
||||
r.raise_for_status()
|
||||
main_json = r.json()
|
||||
assert type(main_json) == dict
|
||||
|
||||
r = sess.get('https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json')
|
||||
r = sess.get(
|
||||
"https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json"
|
||||
)
|
||||
r.raise_for_status()
|
||||
promotions_json = r.json()
|
||||
assert type(promotions_json) == dict
|
||||
|
||||
promoted_key_expression = re.compile(
|
||||
"(?P<mc>[^-]+)-(?P<promotion>(latest)|(recommended))(-(?P<branch>[a-zA-Z0-9\\.]+))?")
|
||||
"(?P<mc>[^-]+)-(?P<promotion>(latest)|(recommended))(-(?P<branch>[a-zA-Z0-9\\.]+))?"
|
||||
)
|
||||
|
||||
recommended_set = set()
|
||||
|
||||
@ -140,28 +171,31 @@ def main():
|
||||
# Therefore we only use the short version part for later identification and filter out the branch-specific
|
||||
# promotions (among other errors).
|
||||
print("Processing promotions:")
|
||||
for promoKey, shortversion in promotions_json.get('promos').items():
|
||||
for promoKey, shortversion in promotions_json.get("promos").items():
|
||||
match = promoted_key_expression.match(promoKey)
|
||||
if not match:
|
||||
print('Skipping promotion %s, the key did not parse:' % promoKey)
|
||||
print("Skipping promotion %s, the key did not parse:" % promoKey)
|
||||
pprint(promoKey)
|
||||
assert match
|
||||
if not match.group('mc'):
|
||||
print('Skipping promotion %s, because it has no Minecraft version.' % promoKey)
|
||||
if not match.group("mc"):
|
||||
print(
|
||||
"Skipping promotion %s, because it has no Minecraft version." % promoKey
|
||||
)
|
||||
continue
|
||||
if match.group('branch'):
|
||||
print('Skipping promotion %s, because it on a branch only.' % promoKey)
|
||||
if match.group("branch"):
|
||||
print("Skipping promotion %s, because it on a branch only." % promoKey)
|
||||
continue
|
||||
elif match.group('promotion') == 'recommended':
|
||||
elif match.group("promotion") == "recommended":
|
||||
recommended_set.add(shortversion)
|
||||
print('%s added to recommended set' % shortversion)
|
||||
elif match.group('promotion') == 'latest':
|
||||
print("%s added to recommended set" % shortversion)
|
||||
elif match.group("promotion") == "latest":
|
||||
pass
|
||||
else:
|
||||
assert False
|
||||
|
||||
version_expression = re.compile(
|
||||
"^(?P<mc>[0-9a-zA-Z_\\.]+)-(?P<ver>[0-9\\.]+\\.(?P<build>[0-9]+))(-(?P<branch>[a-zA-Z0-9\\.]+))?$")
|
||||
"^(?P<mc>[0-9a-zA-Z_\\.]+)-(?P<ver>[0-9\\.]+\\.(?P<build>[0-9]+))(-(?P<branch>[a-zA-Z0-9\\.]+))?$"
|
||||
)
|
||||
|
||||
print("")
|
||||
print("Processing versions:")
|
||||
@ -174,15 +208,15 @@ def main():
|
||||
if not match:
|
||||
pprint(long_version)
|
||||
assert match
|
||||
assert match.group('mc') == mc_version
|
||||
assert match.group("mc") == mc_version
|
||||
|
||||
files = get_single_forge_files_manifest(long_version)
|
||||
|
||||
build = int(match.group('build'))
|
||||
version = match.group('ver')
|
||||
branch = match.group('branch')
|
||||
build = int(match.group("build"))
|
||||
version = match.group("ver")
|
||||
branch = match.group("branch")
|
||||
|
||||
is_recommended = (version in recommended_set)
|
||||
is_recommended = version in recommended_set
|
||||
|
||||
entry = ForgeEntry(
|
||||
long_version=long_version,
|
||||
@ -193,7 +227,7 @@ def main():
|
||||
# NOTE: we add this later after the fact. The forge promotions file lies about these.
|
||||
latest=False,
|
||||
recommended=is_recommended,
|
||||
files=files
|
||||
files=files,
|
||||
)
|
||||
new_index.versions[long_version] = entry
|
||||
if not new_index.by_mc_version:
|
||||
@ -218,10 +252,10 @@ def main():
|
||||
print("")
|
||||
print("Dumping index files...")
|
||||
|
||||
with open(UPSTREAM_DIR + "/forge/maven-metadata.json", 'w', encoding='utf-8') as f:
|
||||
with open(UPSTREAM_DIR + "/forge/maven-metadata.json", "w", encoding="utf-8") as f:
|
||||
json.dump(main_json, f, sort_keys=True, indent=4)
|
||||
|
||||
with open(UPSTREAM_DIR + "/forge/promotions_slim.json", 'w', encoding='utf-8') as f:
|
||||
with open(UPSTREAM_DIR + "/forge/promotions_slim.json", "w", encoding="utf-8") as f:
|
||||
json.dump(promotions_json, f, sort_keys=True, indent=4)
|
||||
|
||||
new_index.write(UPSTREAM_DIR + "/forge/derived_index.json")
|
||||
@ -247,11 +281,20 @@ def main():
|
||||
jar_path = os.path.join(UPSTREAM_DIR, JARS_DIR, version.filename())
|
||||
|
||||
if version.uses_installer():
|
||||
installer_info_path = UPSTREAM_DIR + "/forge/installer_info/%s.json" % version.long_version
|
||||
profile_path = UPSTREAM_DIR + "/forge/installer_manifests/%s.json" % version.long_version
|
||||
version_file_path = UPSTREAM_DIR + "/forge/version_manifests/%s.json" % version.long_version
|
||||
installer_info_path = (
|
||||
UPSTREAM_DIR + "/forge/installer_info/%s.json" % version.long_version
|
||||
)
|
||||
profile_path = (
|
||||
UPSTREAM_DIR
|
||||
+ "/forge/installer_manifests/%s.json" % version.long_version
|
||||
)
|
||||
version_file_path = (
|
||||
UPSTREAM_DIR + "/forge/version_manifests/%s.json" % version.long_version
|
||||
)
|
||||
|
||||
installer_refresh_required = not os.path.isfile(profile_path) or not os.path.isfile(installer_info_path)
|
||||
installer_refresh_required = not os.path.isfile(
|
||||
profile_path
|
||||
) or not os.path.isfile(installer_info_path)
|
||||
|
||||
if installer_refresh_required:
|
||||
# grab the installer if it's not there
|
||||
@ -259,7 +302,7 @@ def main():
|
||||
eprint("Downloading %s" % version.url())
|
||||
rfile = sess.get(version.url(), stream=True)
|
||||
rfile.raise_for_status()
|
||||
with open(jar_path, 'wb') as f:
|
||||
with open(jar_path, "wb") as f:
|
||||
for chunk in rfile.iter_content(chunk_size=128):
|
||||
f.write(chunk)
|
||||
|
||||
@ -269,17 +312,17 @@ def main():
|
||||
print(jar_path)
|
||||
with zipfile.ZipFile(jar_path) as jar:
|
||||
with suppress(KeyError):
|
||||
with jar.open('version.json') as profile_zip_entry:
|
||||
with jar.open("version.json") as profile_zip_entry:
|
||||
version_data = profile_zip_entry.read()
|
||||
|
||||
# Process: does it parse?
|
||||
MojangVersion.parse_raw(version_data)
|
||||
|
||||
with open(version_file_path, 'wb') as versionJsonFile:
|
||||
with open(version_file_path, "wb") as versionJsonFile:
|
||||
versionJsonFile.write(version_data)
|
||||
versionJsonFile.close()
|
||||
|
||||
with jar.open('install_profile.json') as profile_zip_entry:
|
||||
with jar.open("install_profile.json") as profile_zip_entry:
|
||||
install_profile_data = profile_zip_entry.read()
|
||||
|
||||
# Process: does it parse?
|
||||
@ -301,9 +344,11 @@ def main():
|
||||
raise exception
|
||||
else:
|
||||
eprint(
|
||||
"Version %s is not supported and won't be generated later." % version.long_version)
|
||||
"Version %s is not supported and won't be generated later."
|
||||
% version.long_version
|
||||
)
|
||||
|
||||
with open(profile_path, 'wb') as profileFile:
|
||||
with open(profile_path, "wb") as profileFile:
|
||||
profileFile.write(install_profile_data)
|
||||
profileFile.close()
|
||||
|
||||
@ -326,7 +371,7 @@ def main():
|
||||
if not os.path.isfile(jar_path):
|
||||
rfile = sess.get(version.url(), stream=True)
|
||||
rfile.raise_for_status()
|
||||
with open(jar_path, 'wb') as f:
|
||||
with open(jar_path, "wb") as f:
|
||||
for chunk in rfile.iter_content(chunk_size=128):
|
||||
f.write(chunk)
|
||||
# find the latest timestamp in the zip file
|
||||
@ -348,5 +393,5 @@ def main():
|
||||
legacy_info_list.write(LEGACYINFO_PATH)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -14,7 +14,7 @@ sess = default_session()
|
||||
|
||||
def main():
|
||||
# get the remote version list
|
||||
r = sess.get('http://dl.liteloader.com/versions/versions.json')
|
||||
r = sess.get("http://dl.liteloader.com/versions/versions.json")
|
||||
r.raise_for_status()
|
||||
|
||||
# make sure it's JSON
|
||||
@ -33,5 +33,5 @@ def main():
|
||||
remote_versions.write(os.path.join(UPSTREAM_DIR, VERSIONS_FILE))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -4,10 +4,22 @@ import zipfile
|
||||
|
||||
from meta.common import upstream_path, ensure_upstream_dir, static_path, default_session
|
||||
from meta.common.http import download_binary_file
|
||||
from meta.common.mojang import BASE_DIR, VERSION_MANIFEST_FILE, VERSIONS_DIR, ASSETS_DIR, STATIC_EXPERIMENTS_FILE, \
|
||||
STATIC_OLD_SNAPSHOTS_FILE
|
||||
from meta.model.mojang import MojangIndexWrap, MojangIndex, ExperimentIndex, ExperimentIndexWrap, OldSnapshotIndexWrap, \
|
||||
OldSnapshotIndex
|
||||
from meta.common.mojang import (
|
||||
BASE_DIR,
|
||||
VERSION_MANIFEST_FILE,
|
||||
VERSIONS_DIR,
|
||||
ASSETS_DIR,
|
||||
STATIC_EXPERIMENTS_FILE,
|
||||
STATIC_OLD_SNAPSHOTS_FILE,
|
||||
)
|
||||
from meta.model.mojang import (
|
||||
MojangIndexWrap,
|
||||
MojangIndex,
|
||||
ExperimentIndex,
|
||||
ExperimentIndexWrap,
|
||||
OldSnapshotIndexWrap,
|
||||
OldSnapshotIndex,
|
||||
)
|
||||
|
||||
UPSTREAM_DIR = upstream_path()
|
||||
STATIC_DIR = static_path()
|
||||
@ -31,7 +43,7 @@ def fetch_zipped_version(path, url):
|
||||
|
||||
assert version_json
|
||||
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
json.dump(version_json, f, sort_keys=True, indent=4)
|
||||
|
||||
return version_json
|
||||
@ -45,16 +57,14 @@ def fetch_modified_version(path, version):
|
||||
version_json["releaseTime"] = version_json["releaseTime"] + "T00:00:00+02:00"
|
||||
version_json["time"] = version_json["releaseTime"]
|
||||
|
||||
downloads = {"client": {"url": version.jar,
|
||||
"sha1": version.sha1,
|
||||
"size": version.size
|
||||
}
|
||||
}
|
||||
downloads = {
|
||||
"client": {"url": version.jar, "sha1": version.sha1, "size": version.size}
|
||||
}
|
||||
|
||||
version_json["downloads"] = downloads
|
||||
version_json["type"] = "old_snapshot"
|
||||
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
json.dump(version_json, f, sort_keys=True, indent=4)
|
||||
|
||||
return version_json
|
||||
@ -65,7 +75,7 @@ def fetch_version(path, url):
|
||||
r.raise_for_status()
|
||||
version_json = r.json()
|
||||
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
json.dump(version_json, f, sort_keys=True, indent=4)
|
||||
|
||||
return version_json
|
||||
@ -73,7 +83,7 @@ def fetch_version(path, url):
|
||||
|
||||
def main():
|
||||
# get the remote version list
|
||||
r = sess.get('https://piston-meta.mojang.com/mc/game/version_manifest_v2.json')
|
||||
r = sess.get("https://piston-meta.mojang.com/mc/game/version_manifest_v2.json")
|
||||
r.raise_for_status()
|
||||
|
||||
remote_versions = MojangIndexWrap(MojangIndex(**r.json()))
|
||||
@ -83,7 +93,9 @@ def main():
|
||||
|
||||
if os.path.exists(version_manifest_path):
|
||||
# get the local version list
|
||||
current_versions = MojangIndexWrap(MojangIndex.parse_file(version_manifest_path))
|
||||
current_versions = MojangIndexWrap(
|
||||
MojangIndex.parse_file(version_manifest_path)
|
||||
)
|
||||
local_ids = set(current_versions.versions.keys())
|
||||
|
||||
# versions not present locally but present remotely are new
|
||||
@ -99,13 +111,22 @@ def main():
|
||||
|
||||
for x in pending_ids:
|
||||
version = remote_versions.versions[x]
|
||||
print("Updating " + version.id + " to timestamp " + version.release_time.strftime('%s'))
|
||||
fetch_version(os.path.join(UPSTREAM_DIR, VERSIONS_DIR, f"{x}.json"), version.url)
|
||||
print(
|
||||
"Updating "
|
||||
+ version.id
|
||||
+ " to timestamp "
|
||||
+ version.release_time.strftime("%s")
|
||||
)
|
||||
fetch_version(
|
||||
os.path.join(UPSTREAM_DIR, VERSIONS_DIR, f"{x}.json"), version.url
|
||||
)
|
||||
|
||||
# deal with experimental snapshots separately
|
||||
static_experiments_path = os.path.join(STATIC_DIR, STATIC_EXPERIMENTS_FILE)
|
||||
if os.path.exists(static_experiments_path):
|
||||
experiments = ExperimentIndexWrap(ExperimentIndex.parse_file(static_experiments_path))
|
||||
experiments = ExperimentIndexWrap(
|
||||
ExperimentIndex.parse_file(static_experiments_path)
|
||||
)
|
||||
experiment_ids = set(experiments.versions.keys())
|
||||
|
||||
for x in experiment_ids:
|
||||
@ -122,7 +143,9 @@ def main():
|
||||
|
||||
# deal with old snapshots
|
||||
if os.path.exists(static_old_snapshots_path):
|
||||
old_snapshots = OldSnapshotIndexWrap(OldSnapshotIndex.parse_file(static_old_snapshots_path))
|
||||
old_snapshots = OldSnapshotIndexWrap(
|
||||
OldSnapshotIndex.parse_file(static_old_snapshots_path)
|
||||
)
|
||||
old_snapshots_ids = set(old_snapshots.versions.keys())
|
||||
|
||||
for x in old_snapshots_ids:
|
||||
@ -138,5 +161,5 @@ def main():
|
||||
remote_versions.index.write(version_manifest_path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -5,7 +5,12 @@ from datetime import datetime
|
||||
|
||||
import requests
|
||||
|
||||
from meta.common import upstream_path, ensure_upstream_dir, transform_maven_key, default_session
|
||||
from meta.common import (
|
||||
upstream_path,
|
||||
ensure_upstream_dir,
|
||||
transform_maven_key,
|
||||
default_session,
|
||||
)
|
||||
from meta.common.quilt import JARS_DIR, INSTALLER_INFO_DIR, META_DIR, USE_QUILT_MAPPINGS
|
||||
from meta.common.fabric import DATETIME_FORMAT_HTTP
|
||||
from meta.model.fabric import FabricJarInfo
|
||||
@ -29,13 +34,15 @@ def filehash(filename, hashtype, blocksize=65536):
|
||||
|
||||
def get_maven_url(maven_key, server, ext):
|
||||
parts = maven_key.split(":", 3)
|
||||
maven_ver_url = server + parts[0].replace(".", "/") + "/" + parts[1] + "/" + parts[2] + "/"
|
||||
maven_ver_url = (
|
||||
server + parts[0].replace(".", "/") + "/" + parts[1] + "/" + parts[2] + "/"
|
||||
)
|
||||
maven_url = maven_ver_url + parts[1] + "-" + parts[2] + ext
|
||||
return maven_url
|
||||
|
||||
|
||||
def get_json_file(path, url):
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
r = sess.get(url)
|
||||
r.raise_for_status()
|
||||
version_json = r.json()
|
||||
@ -50,7 +57,7 @@ def head_file(url):
|
||||
|
||||
|
||||
def get_binary_file(path, url):
|
||||
with open(path, 'wb') as f:
|
||||
with open(path, "wb") as f:
|
||||
r = sess.get(url)
|
||||
r.raise_for_status()
|
||||
for chunk in r.iter_content(chunk_size=128):
|
||||
@ -88,21 +95,35 @@ def main():
|
||||
if USE_QUILT_MAPPINGS:
|
||||
components.append("hashed")
|
||||
for component in components:
|
||||
index = get_json_file(os.path.join(UPSTREAM_DIR, META_DIR, f"{component}.json"),
|
||||
"https://meta.quiltmc.org/v3/versions/" + component)
|
||||
index = get_json_file(
|
||||
os.path.join(UPSTREAM_DIR, META_DIR, f"{component}.json"),
|
||||
"https://meta.quiltmc.org/v3/versions/" + component,
|
||||
)
|
||||
for it in index:
|
||||
print(f"Processing {component} {it['version']} ")
|
||||
jar_maven_url = get_maven_url(it["maven"], "https://maven.quiltmc.org/repository/release/", ".jar")
|
||||
compute_jar_file(os.path.join(UPSTREAM_DIR, JARS_DIR, transform_maven_key(it["maven"])), jar_maven_url)
|
||||
jar_maven_url = get_maven_url(
|
||||
it["maven"], "https://maven.quiltmc.org/repository/release/", ".jar"
|
||||
)
|
||||
compute_jar_file(
|
||||
os.path.join(UPSTREAM_DIR, JARS_DIR, transform_maven_key(it["maven"])),
|
||||
jar_maven_url,
|
||||
)
|
||||
|
||||
# for each loader, download installer JSON file from maven
|
||||
with open(os.path.join(UPSTREAM_DIR, META_DIR, "loader.json"), 'r', encoding='utf-8') as loaderVersionIndexFile:
|
||||
with open(
|
||||
os.path.join(UPSTREAM_DIR, META_DIR, "loader.json"), "r", encoding="utf-8"
|
||||
) as loaderVersionIndexFile:
|
||||
loader_version_index = json.load(loaderVersionIndexFile)
|
||||
for it in loader_version_index:
|
||||
print(f"Downloading JAR info for loader {it['version']} ")
|
||||
maven_url = get_maven_url(it["maven"], "https://maven.quiltmc.org/repository/release/", ".json")
|
||||
get_json_file(os.path.join(UPSTREAM_DIR, INSTALLER_INFO_DIR, f"{it['version']}.json"), maven_url)
|
||||
maven_url = get_maven_url(
|
||||
it["maven"], "https://maven.quiltmc.org/repository/release/", ".json"
|
||||
)
|
||||
get_json_file(
|
||||
os.path.join(UPSTREAM_DIR, INSTALLER_INFO_DIR, f"{it['version']}.json"),
|
||||
maven_url,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user