feat: Agnostify launcher references

Signed-off-by: txtsd <code@ihavea.quest>
This commit is contained in:
txtsd 2022-10-20 13:21:55 +05:30
parent 16d110d713
commit fb056cdac1
No known key found for this signature in database
GPG Key ID: 6AF185AB2001A97E
16 changed files with 68 additions and 68 deletions

View File

@ -6,6 +6,6 @@ caches/
__pycache__/ __pycache__/
public/ public/
prismlauncher/ launcher/
upstream/ upstream/
config/ config/

2
.gitignore vendored
View File

@ -6,5 +6,5 @@ caches/
!caches/*/.keep !caches/*/.keep
__pycache__ __pycache__
config_local.sh config_local.sh
prismlauncher launcher
upstream upstream

View File

@ -8,7 +8,7 @@ It is recommended to use Docker to deploy the environment.
- Make sure it's writable by the container later: `chown -R 1337:1337 .` - Make sure it's writable by the container later: `chown -R 1337:1337 .`
- Configure `config/config_local.sh` - Configure `config/config_local.sh`
- The defaults should be fine (apart from committer email and name perhaps) - The defaults should be fine (apart from committer email and name perhaps)
- Put your SSH key (which has push access to meta-upstream and meta-prismlauncher) at `config/deploy.key` - Put your SSH key (which has push access to meta-upstream and meta-launcher) at `config/deploy.key`
- Pull meta- repos: `bash clone.sh` - Pull meta- repos: `bash clone.sh`
- Customize docker-compose.yaml - Customize docker-compose.yaml
- Run `docker-compose up -d --build` - Run `docker-compose up -d --build`

View File

@ -15,6 +15,6 @@ if [ ! -d "${UPSTREAM_DIR}" ]; then
git clone "${UPSTREAM_REPO}" "${UPSTREAM_DIR}" git clone "${UPSTREAM_REPO}" "${UPSTREAM_DIR}"
fi fi
if [ ! -d "${PL_DIR}" ]; then if [ ! -d "${LAUNCHER_DIR}" ]; then
git clone "${PL_REPO}" "${PL_DIR}" git clone "${LAUNCHER_REPO}" "${LAUNCHER_DIR}"
fi fi

View File

@ -1,7 +1,7 @@
export UPSTREAM_DIR=upstream export UPSTREAM_DIR=upstream
export UPSTREAM_REPO=git@github.com:PrismLauncher/meta-upstream.git export UPSTREAM_REPO=git@github.com:PrismLauncher/meta-upstream.git
export PL_DIR=prismlauncher export LAUNCHER_DIR=launcher
export PL_REPO=git@github.com:PrismLauncher/meta-prismlauncher.git export LAUNCHER_REPO=git@github.com:PrismLauncher/meta-launcher.git
export BRANCH_master=master export BRANCH_master=master
export BRANCH_develop=develop export BRANCH_develop=develop
export DEPLOY_TO_S3=false export DEPLOY_TO_S3=false

View File

@ -7,7 +7,7 @@ services:
volumes: volumes:
- "./caches:/app/caches" - "./caches:/app/caches"
- "./upstream:/app/upstream" - "./upstream:/app/upstream"
- "./prismlauncher:/app/prismlauncher" - "./launcher:/app/launcher"
- "./public:/app/public" - "./public:/app/public"
- "./config:/app/config" - "./config:/app/config"
restart: unless-stopped restart: unless-stopped

View File

@ -1,12 +1,12 @@
import json import json
import os import os
from meta.common import ensure_component_dir, prismlauncher_path, upstream_path, transform_maven_key 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.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 import MetaVersion, Dependency, Library, MetaPackage, GradleSpecifier
from meta.model.fabric import FabricJarInfo, FabricInstallerDataV1, FabricMainClasses from meta.model.fabric import FabricJarInfo, FabricInstallerDataV1, FabricMainClasses
PL_DIR = prismlauncher_path() LAUNCHER_DIR = launcher_path()
UPSTREAM_DIR = upstream_path() UPSTREAM_DIR = upstream_path()
ensure_component_dir(LOADER_COMPONENT) ensure_component_dir(LOADER_COMPONENT)
@ -72,7 +72,7 @@ def main():
if not recommended_loader_versions: # first (newest) loader is recommended if not recommended_loader_versions: # first (newest) loader is recommended
recommended_loader_versions.append(version) recommended_loader_versions.append(version)
v.write(os.path.join(PL_DIR, LOADER_COMPONENT, f"{v.version}.json")) 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) intermediary_version_index = json.load(f)
@ -84,21 +84,21 @@ def main():
recommended_intermediary_versions.append(version) # all intermediaries are recommended recommended_intermediary_versions.append(version) # all intermediaries are recommended
v.write(os.path.join(PL_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.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.project_url = "https://fabricmc.net"
package.authors = ["Fabric Developers"] package.authors = ["Fabric Developers"]
package.write(os.path.join(PL_DIR, LOADER_COMPONENT, "package.json")) 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.recommended = recommended_intermediary_versions
package.description = "Intermediary mappings allow using Fabric Loader with mods for Minecraft in a more compatible manner." package.description = "Intermediary mappings allow using Fabric Loader with mods for Minecraft in a more compatible manner."
package.project_url = "https://fabricmc.net" package.project_url = "https://fabricmc.net"
package.authors = ["Fabric Developers"] package.authors = ["Fabric Developers"]
package.write(os.path.join(PL_DIR, INTERMEDIARY_COMPONENT, "package.json")) package.write(os.path.join(LAUNCHER_DIR, INTERMEDIARY_COMPONENT, "package.json"))
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -5,7 +5,7 @@ from distutils.version import LooseVersion
from operator import attrgetter from operator import attrgetter
from typing import Collection from typing import Collection
from meta.common import ensure_component_dir, prismlauncher_path, upstream_path, static_path 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, \ 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 STATIC_LEGACYINFO_FILE, INSTALLER_INFO_DIR, BAD_VERSIONS, FORGEWRAPPER_MAVEN
from meta.common.mojang import MINECRAFT_COMPONENT from meta.common.mojang import MINECRAFT_COMPONENT
@ -15,7 +15,7 @@ from meta.model.forge import ForgeVersion, ForgeInstallerProfile, ForgeLegacyInf
ForgeInstallerProfileV2, InstallerInfo, DerivedForgeIndex, ForgeLegacyInfoList ForgeInstallerProfileV2, InstallerInfo, DerivedForgeIndex, ForgeLegacyInfoList
from meta.model.mojang import MojangVersion from meta.model.mojang import MojangVersion
PL_DIR = prismlauncher_path() LAUNCHER_DIR = launcher_path()
UPSTREAM_DIR = upstream_path() UPSTREAM_DIR = upstream_path()
STATIC_DIR = static_path() STATIC_DIR = static_path()
@ -33,7 +33,7 @@ mc_version_cache = {}
def load_mc_version_filter(version: str): def load_mc_version_filter(version: str):
if version in mc_version_cache: if version in mc_version_cache:
return mc_version_cache[version] return mc_version_cache[version]
v = MetaVersion.parse_file(os.path.join(PL_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)) libs = set(map(attrgetter("name"), v.libraries))
mc_version_cache[version] = libs mc_version_cache[version] = libs
return libs return libs
@ -321,7 +321,7 @@ def main():
recommended_versions.append(version.rawVersion) recommended_versions.append(version.rawVersion)
# If we do not have the corresponding Minecraft version, we ignore it # If we do not have the corresponding Minecraft version, we ignore it
if not os.path.isfile(os.path.join(PL_DIR, MINECRAFT_COMPONENT, f"{version.mc_version_sane}.json")): 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)) eprint("Skipping %s with no corresponding Minecraft version %s" % (key, version.mc_version_sane))
continue continue
@ -357,7 +357,7 @@ def main():
v = version_from_legacy(legacy_info_list.number[str(build)], version) v = version_from_legacy(legacy_info_list.number[str(build)], version)
v.write(os.path.join(PL_DIR, FORGE_COMPONENT, f"{v.version}.json")) v.write(os.path.join(LAUNCHER_DIR, FORGE_COMPONENT, f"{v.version}.json"))
recommended_versions.sort() recommended_versions.sort()
@ -365,7 +365,7 @@ def main():
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.recommended = recommended_versions
package.write(os.path.join(PL_DIR, FORGE_COMPONENT, "package.json")) package.write(os.path.join(LAUNCHER_DIR, FORGE_COMPONENT, "package.json"))
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -2,13 +2,13 @@ import os
from datetime import datetime from datetime import datetime
from typing import List, Tuple, Dict, Optional from typing import List, Tuple, Dict, Optional
from meta.common import ensure_component_dir, prismlauncher_path, upstream_path from meta.common import ensure_component_dir, launcher_path, upstream_path
from meta.common.liteloader import LITELOADER_COMPONENT, VERSIONS_FILE from meta.common.liteloader import LITELOADER_COMPONENT, VERSIONS_FILE
from meta.common.mojang import MINECRAFT_COMPONENT from meta.common.mojang import MINECRAFT_COMPONENT
from meta.model import MetaVersion, GradleSpecifier, Library, MetaPackage, Dependency from meta.model import MetaVersion, GradleSpecifier, Library, MetaPackage, Dependency
from meta.model.liteloader import LiteloaderIndex, LiteloaderArtefact from meta.model.liteloader import LiteloaderIndex, LiteloaderArtefact
PL_DIR = prismlauncher_path() LAUNCHER_DIR = launcher_path()
UPSTREAM_DIR = upstream_path() UPSTREAM_DIR = upstream_path()
ensure_component_dir(LITELOADER_COMPONENT) ensure_component_dir(LITELOADER_COMPONENT)
@ -93,7 +93,7 @@ def main():
all_versions, recommended = process_versions(index) all_versions, recommended = process_versions(index)
for version in all_versions: for version in all_versions:
version.write(os.path.join(PL_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, package = MetaPackage(uid=LITELOADER_COMPONENT,
name='LiteLoader', name='LiteLoader',
@ -101,7 +101,7 @@ def main():
project_url=index.meta.url, project_url=index.meta.url,
authors=[index.meta.authors], authors=[index.meta.authors],
recommended=recommended) recommended=recommended)
package.write(os.path.join(PL_DIR, LITELOADER_COMPONENT, "package.json")) package.write(os.path.join(LAUNCHER_DIR, LITELOADER_COMPONENT, "package.json"))
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -6,7 +6,7 @@ from operator import attrgetter
from pprint import pprint from pprint import pprint
from typing import Optional, List from typing import Optional, List
from meta.common import ensure_component_dir, prismlauncher_path, upstream_path, static_path 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, \ from meta.common.mojang import VERSION_MANIFEST_FILE, MINECRAFT_COMPONENT, LWJGL3_COMPONENT, LWJGL_COMPONENT, \
STATIC_OVERRIDES_FILE, VERSIONS_DIR, LIBRARY_PATCHES_FILE STATIC_OVERRIDES_FILE, VERSIONS_DIR, LIBRARY_PATCHES_FILE
from meta.model import MetaVersion, Library, GradleSpecifier, MojangLibraryDownloads, MojangArtifact, Dependency, \ from meta.model import MetaVersion, Library, GradleSpecifier, MojangLibraryDownloads, MojangArtifact, Dependency, \
@ -15,7 +15,7 @@ from meta.model.mojang import MojangIndexWrap, MojangIndex, MojangVersion, Legac
APPLY_SPLIT_NATIVES_WORKAROUND = True APPLY_SPLIT_NATIVES_WORKAROUND = True
PL_DIR = prismlauncher_path() LAUNCHER_DIR = launcher_path()
UPSTREAM_DIR = upstream_path() UPSTREAM_DIR = upstream_path()
STATIC_DIR = static_path() STATIC_DIR = static_path()
@ -26,7 +26,7 @@ ensure_component_dir(LWJGL3_COMPONENT)
def map_log4j_artifact(version): def map_log4j_artifact(version):
if version == "2.0-beta9": if version == "2.0-beta9":
return "2.0-beta9-fixed", "https://files.prismlauncher.org/maven/%s" return "2.0-beta9-fixed", "https://files.launcher.org/maven/%s"
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)
@ -211,13 +211,13 @@ def process_single_variant(lwjgl_variant: MetaVersion, patches: LibraryPatches):
v.libraries += list(dict.fromkeys(new_libraries)) v.libraries += list(dict.fromkeys(new_libraries))
if lwjgl_version[0] == '2': if lwjgl_version[0] == '2':
filename = os.path.join(PL_DIR, LWJGL_COMPONENT, f"{lwjgl_version}.json") 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.uid = LWJGL_COMPONENT
v.conflicts = [Dependency(uid=LWJGL3_COMPONENT)] v.conflicts = [Dependency(uid=LWJGL3_COMPONENT)]
elif lwjgl_version[0] == '3': elif lwjgl_version[0] == '3':
filename = os.path.join(PL_DIR, LWJGL3_COMPONENT, f"{lwjgl_version}.json") 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.uid = LWJGL3_COMPONENT
@ -411,7 +411,7 @@ def main():
# process 1.13 arguments into previous version # process 1.13 arguments into previous version
if not mojang_version.minecraft_arguments and mojang_version.arguments: if not mojang_version.minecraft_arguments and mojang_version.arguments:
v.minecraft_arguments = adapt_new_style_arguments(mojang_version.arguments) v.minecraft_arguments = adapt_new_style_arguments(mojang_version.arguments)
out_filename = os.path.join(PL_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: if v.version in override_index.versions:
override = override_index.versions[v.version] override = override_index.versions[v.version]
override.apply_onto_meta_version(v) override.apply_onto_meta_version(v)
@ -448,18 +448,18 @@ def main():
lwjgl_package = MetaPackage(uid=LWJGL_COMPONENT, name='LWJGL 2') lwjgl_package = MetaPackage(uid=LWJGL_COMPONENT, name='LWJGL 2')
lwjgl_package.recommended = ['2.9.4-nightly-20150209'] lwjgl_package.recommended = ['2.9.4-nightly-20150209']
lwjgl_package.write(os.path.join(PL_DIR, LWJGL_COMPONENT, "package.json")) lwjgl_package.write(os.path.join(LAUNCHER_DIR, LWJGL_COMPONENT, "package.json"))
if found_any_lwjgl3: if found_any_lwjgl3:
lwjgl_package = MetaPackage(uid=LWJGL3_COMPONENT, name='LWJGL 3') lwjgl_package = MetaPackage(uid=LWJGL3_COMPONENT, name='LWJGL 3')
lwjgl_package.recommended = ['3.1.2'] lwjgl_package.recommended = ['3.1.2']
lwjgl_package.write(os.path.join(PL_DIR, LWJGL3_COMPONENT, "package.json")) 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.recommended = [mojang_index.latest.release]
minecraft_package.write(os.path.join(PL_DIR, MINECRAFT_COMPONENT, "package.json")) minecraft_package.write(os.path.join(LAUNCHER_DIR, MINECRAFT_COMPONENT, "package.json"))
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -1,13 +1,13 @@
import json import json
import os import os
from meta.common import ensure_component_dir, prismlauncher_path, upstream_path, transform_maven_key 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, \ from meta.common.quilt import JARS_DIR, INSTALLER_INFO_DIR, META_DIR, INTERMEDIARY_COMPONENT, LOADER_COMPONENT, \
USE_QUILT_MAPPINGS USE_QUILT_MAPPINGS
from meta.model import MetaVersion, Dependency, Library, MetaPackage, GradleSpecifier from meta.model import MetaVersion, Dependency, Library, MetaPackage, GradleSpecifier
from meta.model.fabric import FabricJarInfo, FabricInstallerDataV1, FabricMainClasses from meta.model.fabric import FabricJarInfo, FabricInstallerDataV1, FabricMainClasses
PL_DIR = prismlauncher_path() LAUNCHER_DIR = launcher_path()
UPSTREAM_DIR = upstream_path() UPSTREAM_DIR = upstream_path()
ensure_component_dir(LOADER_COMPONENT) ensure_component_dir(LOADER_COMPONENT)
@ -77,7 +77,7 @@ def main():
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) recommended_loader_versions.append(version)
v.write(os.path.join(PL_DIR, LOADER_COMPONENT, f"{v.version}.json")) v.write(os.path.join(LAUNCHER_DIR, LOADER_COMPONENT, f"{v.version}.json"))
if USE_QUILT_MAPPINGS: 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:
@ -90,14 +90,14 @@ def main():
recommended_intermediary_versions.append(version) # all intermediaries are recommended recommended_intermediary_versions.append(version) # all intermediaries are recommended
v.write(os.path.join(PL_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.recommended = recommended_loader_versions
package.description = "The Quilt project is an open, community-driven modding toolchain designed primarily for Minecraft." package.description = "The Quilt project is an open, community-driven modding toolchain designed primarily for Minecraft."
package.project_url = "https://quiltmc.org/" package.project_url = "https://quiltmc.org/"
package.authors = ["Quilt Project"] package.authors = ["Quilt Project"]
package.write(os.path.join(PL_DIR, LOADER_COMPONENT, "package.json")) package.write(os.path.join(LAUNCHER_DIR, LOADER_COMPONENT, "package.json"))
if USE_QUILT_MAPPINGS: if USE_QUILT_MAPPINGS:
package = MetaPackage(uid=INTERMEDIARY_COMPONENT, name='Quilt Intermediary Mappings') package = MetaPackage(uid=INTERMEDIARY_COMPONENT, name='Quilt Intermediary Mappings')
@ -105,7 +105,7 @@ def main():
package.description = "Intermediary mappings allow using Quilt Loader with mods for Minecraft in a more compatible manner." package.description = "Intermediary mappings allow using Quilt Loader with mods for Minecraft in a more compatible manner."
package.project_url = "https://quiltmc.org/" package.project_url = "https://quiltmc.org/"
package.authors = ["Quilt Project"] package.authors = ["Quilt Project"]
package.write(os.path.join(PL_DIR, INTERMEDIARY_COMPONENT, "package.json")) package.write(os.path.join(LAUNCHER_DIR, INTERMEDIARY_COMPONENT, "package.json"))
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -2,11 +2,11 @@ import hashlib
import os import os
from operator import attrgetter from operator import attrgetter
from meta.common import prismlauncher_path from meta.common import launcher_path
from meta.model import MetaVersion, MetaPackage from meta.model import MetaVersion, MetaPackage
from meta.model.index import MetaPackageIndex, MetaVersionIndex, MetaVersionIndexEntry, MetaPackageIndexEntry from meta.model.index import MetaPackageIndex, MetaVersionIndex, MetaVersionIndexEntry, MetaPackageIndexEntry
PL_DIR = prismlauncher_path() LAUNCHER_DIR = launcher_path()
# take the hash type (like hashlib.md5) and filename, return hex string of hash # take the hash type (like hashlib.md5) and filename, return hex string of hash
@ -25,11 +25,11 @@ ignore = {"index.json", "package.json", ".git", ".github"}
packages = MetaPackageIndex() packages = MetaPackageIndex()
# walk through all the package folders # walk through all the package folders
for package in sorted(os.listdir(PL_DIR)): for package in sorted(os.listdir(LAUNCHER_DIR)):
if package in ignore: if package in ignore:
continue continue
sharedData = MetaPackage.parse_file(os.path.join(PL_DIR, package, "package.json")) sharedData = MetaPackage.parse_file(os.path.join(LAUNCHER_DIR, package, "package.json"))
recommendedVersions = set() recommendedVersions = set()
if sharedData.recommended: if sharedData.recommended:
recommendedVersions = set(sharedData.recommended) recommendedVersions = set(sharedData.recommended)
@ -38,12 +38,12 @@ for package in sorted(os.listdir(PL_DIR)):
versionList = MetaVersionIndex(uid=package, name=sharedData.name) versionList = MetaVersionIndex(uid=package, name=sharedData.name)
# walk through all the versions of the package # walk through all the versions of the package
for filename in os.listdir(PL_DIR + "/%s" % package): for filename in os.listdir(LAUNCHER_DIR + "/%s" % package):
if filename in ignore: if filename in ignore:
continue continue
# parse and hash the version file # parse and hash the version file
filepath = PL_DIR + "/%s/%s" % (package, filename) filepath = LAUNCHER_DIR + "/%s/%s" % (package, filename)
filehash = hash_file(hashlib.sha256, filepath) filehash = hash_file(hashlib.sha256, filepath)
versionFile = MetaVersion.parse_file(filepath) versionFile = MetaVersion.parse_file(filepath)
is_recommended = versionFile.version in recommendedVersions is_recommended = versionFile.version in recommendedVersions
@ -56,7 +56,7 @@ for package in sorted(os.listdir(PL_DIR)):
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 # write the version index for the package
outFilePath = PL_DIR + "/%s/index.json" % package outFilePath = LAUNCHER_DIR + "/%s/index.json" % package
versionList.write(outFilePath) versionList.write(outFilePath)
# insert entry into the package index # insert entry into the package index
@ -67,4 +67,4 @@ for package in sorted(os.listdir(PL_DIR)):
) )
packages.packages.append(packageEntry) packages.packages.append(packageEntry)
packages.write(os.path.join(PL_DIR, "index.json")) packages.write(os.path.join(LAUNCHER_DIR, "index.json"))

View File

@ -10,10 +10,10 @@ def serialize_datetime(dt: datetime.datetime):
return dt.isoformat() return dt.isoformat()
def prismlauncher_path(): def launcher_path():
if "PL_DIR" in os.environ: if "LAUNCHER_DIR" in os.environ:
return os.environ["PL_DIR"] return os.environ["LAUNCHER_DIR"]
return "prismlauncher" return "launcher"
def upstream_path(): def upstream_path():
@ -35,7 +35,7 @@ def ensure_upstream_dir(path):
def ensure_component_dir(component_id): def ensure_component_dir(component_id):
path = os.path.join(prismlauncher_path(), component_id) path = os.path.join(launcher_path(), component_id)
if not os.path.exists(path): if not os.path.exists(path):
os.makedirs(path) os.makedirs(path)

View File

@ -13,5 +13,5 @@ STATIC_LEGACYINFO_FILE = join(BASE_DIR, "forge-legacyinfo.json")
FORGE_COMPONENT = "net.minecraftforge" FORGE_COMPONENT = "net.minecraftforge"
FORGEWRAPPER_MAVEN = "https://files.prismlauncher.org/maven/%s" FORGEWRAPPER_MAVEN = "https://files.launcher.org/maven/%s"
BAD_VERSIONS = ["1.12.2-14.23.5.2851"] BAD_VERSIONS = ["1.12.2-14.23.5.2851"]

View File

@ -14,7 +14,7 @@ echo
echo "PrismLauncher:" echo "PrismLauncher:"
pushd "${PL_DIR}" || exit 1 pushd "${LAUNCHER_DIR}" || exit 1
git status git status
popd || exit 1 popd || exit 1
echo echo

View File

@ -22,7 +22,7 @@ function fail_in {
} }
function fail_out { function fail_out {
prismlauncher_git reset --hard HEAD launcher_git reset --hard HEAD
exit 1 exit 1
} }
@ -30,8 +30,8 @@ function upstream_git {
git -C "${BASEDIR}/${UPSTREAM_DIR}" "$@" git -C "${BASEDIR}/${UPSTREAM_DIR}" "$@"
} }
function prismlauncher_git { function launcher_git {
git -C "${BASEDIR}/${PL_DIR}" "$@" git -C "${BASEDIR}/${LAUNCHER_DIR}" "$@"
} }
# make sure we *could* push to our repo # make sure we *could* push to our repo
@ -59,8 +59,8 @@ if [ "${DEPLOY_TO_GIT}" = true ] ; then
fi fi
fi fi
prismlauncher_git reset --hard HEAD || exit 1 launcher_git reset --hard HEAD || exit 1
prismlauncher_git checkout "${BRANCH}" || exit 1 launcher_git checkout "${BRANCH}" || exit 1
python generateMojang.py || fail_out python generateMojang.py || fail_out
python generateForge.py || fail_out python generateForge.py || fail_out
@ -70,15 +70,15 @@ python generateLiteloader.py || fail_out
python index.py || fail_out python index.py || fail_out
if [ "${DEPLOY_TO_GIT}" = true ] ; then if [ "${DEPLOY_TO_GIT}" = true ] ; then
prismlauncher_git add index.json org.lwjgl/* org.lwjgl3/* net.minecraft/* || fail_out launcher_git add index.json org.lwjgl/* org.lwjgl3/* net.minecraft/* || fail_out
prismlauncher_git add net.minecraftforge/* || fail_out launcher_git add net.minecraftforge/* || fail_out
prismlauncher_git add net.fabricmc.fabric-loader/* net.fabricmc.intermediary/* || fail_out launcher_git add net.fabricmc.fabric-loader/* net.fabricmc.intermediary/* || fail_out
prismlauncher_git add org.quiltmc.quilt-loader/* || fail_out # TODO: add Quilt hashed, once it is actually used launcher_git add org.quiltmc.quilt-loader/* || fail_out # TODO: add Quilt hashed, once it is actually used
prismlauncher_git add com.mumfrey.liteloader/* || fail_out launcher_git add com.mumfrey.liteloader/* || fail_out
if ! prismlauncher_git diff --cached --exit-code ; then if ! launcher_git diff --cached --exit-code ; then
prismlauncher_git commit -a -m "Update ${currentDate}" || fail_out launcher_git commit -a -m "Update ${currentDate}" || fail_out
prismlauncher_git push || exit 1 launcher_git push || exit 1
fi fi
fi fi
@ -86,7 +86,7 @@ if [ "${DEPLOY_TO_FOLDER}" = true ] ; then
DEPLOY_FOLDER_var="DEPLOY_FOLDER_$MODE" DEPLOY_FOLDER_var="DEPLOY_FOLDER_$MODE"
DEPLOY_FOLDER="${!DEPLOY_FOLDER_var}" DEPLOY_FOLDER="${!DEPLOY_FOLDER_var}"
echo "Deploying to ${DEPLOY_FOLDER}" echo "Deploying to ${DEPLOY_FOLDER}"
rsync -rvog --chown="${DEPLOY_FOLDER_USER}:${DEPLOY_FOLDER_GROUP}" --exclude=.git "${BASEDIR}/${PL_DIR}/" "${DEPLOY_FOLDER}" rsync -rvog --chown="${DEPLOY_FOLDER_USER}:${DEPLOY_FOLDER_GROUP}" --exclude=.git "${BASEDIR}/${LAUNCHER_DIR}/" "${DEPLOY_FOLDER}"
fi fi
exit 0 exit 0