From ed2be8becf443fb1fd9b4bd2896deb55b3539d27 Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Wed, 14 Feb 2024 16:32:41 -0800 Subject: [PATCH 1/2] Add `haxelib run lime setup` to COMPILING.md --- docs/COMPILING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/COMPILING.md b/docs/COMPILING.md index 7f9c0cdb8..6d5b5b365 100644 --- a/docs/COMPILING.md +++ b/docs/COMPILING.md @@ -7,7 +7,8 @@ - If you accidentally cloned without the `assets` submodule (aka didn't follow the step above), you can run `git submodule update --init --recursive` to get the assets in a foolproof way. 2. Install `hmm` (run `haxelib --global install hmm` and then `haxelib --global run hmm setup`) 3. Install all haxelibs of the current branch by running `hmm install` -4. Platform setup +4. Setup lime: `haxelib run lime setup` +5. Platform setup - For Windows, download the [Visual Studio Build Tools](https://aka.ms/vs/17/release/vs_BuildTools.exe) - When prompted, select "Individual Components" and make sure to download the following: - MSVC v143 VS 2022 C++ x64/x86 build tools @@ -15,5 +16,5 @@ - Mac: [`lime setup mac` Documentation](https://lime.openfl.org/docs/advanced-setup/macos/) - Linux: [`lime setup linux` Documentation](https://lime.openfl.org/docs/advanced-setup/linux/) - HTML5: Compiles without any extra setup -5. If you are targeting for native, you likely need to run `lime rebuild PLATFORM` and `lime rebuild PLATFORM -debug` -6. `lime test PLATFORM` ! +6. If you are targeting for native, you likely need to run `lime rebuild PLATFORM` and `lime rebuild PLATFORM -debug` +7. `lime test PLATFORM` ! From 91ab1cb52078ea60cfc0713fc48f9954d76b123f Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Thu, 15 Feb 2024 00:15:21 -0800 Subject: [PATCH 2/2] Remove `hmm` dependency to fix HTML5 target Remove the `hmm` haxelib dependency from the build. Linking to `hmm` caused `utest` to be transitively linked, which eventually caused OpenFL to act strangely and instatiate the application twice on the HTML5 target. `hmm` was only used for `HaxelibVersions.getLibraryVersions` macro call. Instead, manually parse the `hmm.json` ourselves to avoid the dependency. This fixes the HTML5 target. `hmm` is still used for package management, but no longer linked in to the build itself. --- Project.xml | 1 - hmm.json | 5 --- source/funkin/util/macro/HaxelibVersions.hx | 45 ++++++++------------- 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/Project.xml b/Project.xml index 0a8d31b86..c58153575 100644 --- a/Project.xml +++ b/Project.xml @@ -113,7 +113,6 @@ - diff --git a/hmm.json b/hmm.json index ca9654291..26cb0d0b4 100644 --- a/hmm.json +++ b/hmm.json @@ -64,11 +64,6 @@ "ref": "e9f880522e27134b29df4067f82df7d7e5237b70", "url": "https://github.com/haxeui/haxeui-flixel" }, - { - "name": "hmm", - "type": "haxelib", - "version": "3.1.0" - }, { "name": "hscript", "type": "haxelib", diff --git a/source/funkin/util/macro/HaxelibVersions.hx b/source/funkin/util/macro/HaxelibVersions.hx index 1a4699bba..08ec3a7c4 100644 --- a/source/funkin/util/macro/HaxelibVersions.hx +++ b/source/funkin/util/macro/HaxelibVersions.hx @@ -7,7 +7,7 @@ class HaxelibVersions public static macro function getLibraryVersions():haxe.macro.Expr.ExprOf> { #if !display - return macro $v{formatHmmData(readHmmData())}; + return macro $v{formatHmmData()}; #else // `#if display` is used for code completion. In this case returning an // empty string is good enough; We don't want to call functions on every hint. @@ -17,44 +17,33 @@ class HaxelibVersions } #if (macro) - static function readHmmData():hmm.HmmConfig - { - return hmm.HmmConfig.HmmConfigs.readHmmJsonOrThrow(); - } - - static function formatHmmData(hmmData:hmm.HmmConfig):Array + @SuppressWarnings('checkstyle:Dynamic') + static function formatHmmData():Array { var result:Array = []; - for (library in hmmData.dependencies) + var hmmData:Dynamic = haxe.Json.parse(sys.io.File.getContent('hmm.json')); + var dependencies:Array = cast hmmData.dependencies; + for (library in dependencies) { - switch (library) + switch (library.type) { - case Haxelib(name, version): - result.push('${name} haxelib(${o(version)})'); - case Git(name, url, ref, dir): - result.push('${name} git(${url}/${o(dir, '')}:${o(ref)})'); - case Mercurial(name, url, ref, dir): - result.push('${name} mercurial(${url}/${o(dir, '')}:${o(ref)})'); - case Dev(name, path): - result.push('${name} dev(${path})'); + case 'haxelib': + result.push('${library.name} haxelib(${library.version ?? 'None'})'); + case 'git': + result.push('${library.name} git(${library.url}/${library.dir ?? ''}:${library.ref ?? 'None'}'); + case 'mercurial': + result.push('${library.name} mercurial(${library.url}/${library.dir ?? ''}:${library.ref ?? 'None'})'); + case 'dev': + result.push('${library.name} dev(${library.path})'); + case ty: + throw 'Unhandled hmm library type ${ty}'; } } return result; } - static function o(option:haxe.ds.Option, defaultValue:String = 'None'):String - { - switch (option) - { - case Some(value): - return value; - case None: - return defaultValue; - } - } - static function readLibraryCurrentVersion(libraryName:String):String { var path = Path.join([Path.addTrailingSlash(Sys.getCwd()), '.haxelib', libraryName, '.current']);