From a8b6e8ed7264eb2d21392ab86ece8b5d24ece495 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Tue, 1 Oct 2024 02:17:35 +0200 Subject: [PATCH] Workflow changes --- .github/workflows/linux.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/windows.yml | 2 +- commandline/commands/Update.hx | 32 ++++++++++++++++++++++++++------ libs.xml | 2 +- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 63a036bb..1efcfcfa 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -31,7 +31,7 @@ jobs: sudo apt-get install libvlc-dev libvlccore-dev - name: Installing/Updating libraries run: | - haxe -cp commandline -D analyzer-optimize --run Main setup + haxe -cp commandline -D analyzer-optimize --run Main setup -s - name: Building the game run: | haxelib run lime build linux diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index fa75491a..cdd60670 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -28,7 +28,7 @@ jobs: cache-build-mac - name: Installing/Updating libraries run: | - haxe -cp commandline -D analyzer-optimize --run Main setup + haxe -cp commandline -D analyzer-optimize --run Main setup -s - name: Building the game run: | haxelib run lime build mac diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 702bedc5..60976678 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -28,7 +28,7 @@ jobs: cache-build-windows - name: Installing/Updating libraries run: | - haxe -cp commandline -D analyzer-optimize --run Main setup + haxe -cp commandline -D analyzer-optimize --run Main setup -s - name: Building the game run: | haxelib run lime build windows diff --git a/commandline/commands/Update.hx b/commandline/commands/Update.hx index 6ac0f0f3..102cf0cd 100644 --- a/commandline/commands/Update.hx +++ b/commandline/commands/Update.hx @@ -6,21 +6,40 @@ import sys.io.File; import sys.io.Process; import sys.FileSystem; +using StringTools; + class Update { public static function main(args:Array) { - prettyPrint("Preparing installation..."); - // to prevent messing with currently installed libs if (!FileSystem.exists('.haxelib')) FileSystem.createDirectory('.haxelib'); + var filename = "./libs.xml"; + var isSilent = false; + for(arg in args) { + if (arg.startsWith("--lib=")) { + filename = arg.substr("--lib=".length); + } + if (arg == "--silent" || arg == "-s") { + isSilent = true; + } + } + + if(!FileSystem.exists(filename)) { + prettyPrint('Cannot find libs.xml file at "$filename"'); + return; + } + + prettyPrint("Preparing installation..."); + var libs:Array = []; - var libsXML:Access = new Access(Xml.parse(File.getContent('./libs.xml')).firstElement()); + var libsXML:Access = new Access(Xml.parse(File.getContent(filename)).firstElement()); for (libNode in libsXML.elements) { var lib:Library = { name: libNode.att.name, - type: libNode.name + type: libNode.name, + skipDeps: libNode.has.skipDeps ? libNode.att.skipDeps == "true" : false }; if (libNode.has.global) lib.global = libNode.att.global; switch (lib.type) { @@ -38,10 +57,10 @@ class Update { switch(lib.type) { case "lib": prettyPrint((lib.global == "true" ? "Globally installing" : "Locally installing") + ' "${lib.name}"...'); - Sys.command('haxelib install ${lib.name} ${lib.version != null ? " " + lib.version : " "}${globalism != null ? ' $globalism' : ''} --always'); + Sys.command('haxelib install ${lib.name} ${lib.version != null ? " " + lib.version : " "}${globalism != null ? ' $globalism' : ''}${lib.skipDeps ? " --skip-dependencies" : ""} --always${isSilent ? " --quiet" : ""}'); case "git": prettyPrint((lib.global == "true" ? "Globally installing" : "Locally installing") + ' "${lib.name}" from git url "${lib.url}"'); - Sys.command('haxelib git ${lib.name} ${lib.url}${lib.ref != null ? ' ${lib.ref}' : ''}${globalism != null ? ' $globalism' : ''} --always'); + Sys.command('haxelib git ${lib.name} ${lib.url}${lib.ref != null ? ' ${lib.ref}' : ''}${globalism != null ? ' $globalism' : ''}${lib.skipDeps ? " --skip-dependencies" : ""} --always${isSilent ? " --quiet" : ""}'); default: prettyPrint('Cannot resolve library of type "${lib.type}"'); } @@ -123,6 +142,7 @@ class Update { typedef Library = { var name:String; var type:String; + var skipDeps:Bool; var ?global:String; var ?version:String; var ?ref:String; diff --git a/libs.xml b/libs.xml index cfdec718..4218feeb 100644 --- a/libs.xml +++ b/libs.xml @@ -12,7 +12,7 @@ - +