From 2db6d38d24b8b2705e12ec5c43d45e3d993f2894 Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Sun, 25 Jun 2023 18:19:07 -0700 Subject: [PATCH] use libs.xml instead of hmm.json --- commandline/commands/Update.hx | 36 ++++++++++++---- hmm.json | 77 ---------------------------------- libs.xml | 2 +- 3 files changed, 28 insertions(+), 87 deletions(-) delete mode 100644 hmm.json diff --git a/commandline/commands/Update.hx b/commandline/commands/Update.hx index 42c29a61..6404ab35 100644 --- a/commandline/commands/Update.hx +++ b/commandline/commands/Update.hx @@ -1,5 +1,6 @@ package commands; +import haxe.xml.Access; import haxe.Json; import sys.io.File; import sys.io.Process; @@ -7,16 +8,34 @@ import sys.FileSystem; class Update { public static function main(args:Array) { - // to prevent messing with currently installed libs + prettyPrint("Preparing installation..."); + + // to prevent messing with currently installed libs if (!FileSystem.exists('.haxelib')) FileSystem.createDirectory('.haxelib'); + + var libs:Array = []; + var libsXML:Access = new Access(Xml.parse(File.getContent('./libs.xml')).firstElement()); - var json:Array = Json.parse(File.getContent('./hmm.json')).dependencies; - prettyPrint("Preparing installation..."); - for(lib in json) { + for (libNode in libsXML.elements) { + var lib:Library = { + name: libNode.att.name, + type: libNode.name + }; + switch (lib.type) { + case "lib": + if (libNode.has.version) lib.version = libNode.att.version; + case "git": + if (libNode.has.url) lib.url = libNode.att.url; + if (libNode.has.ref) lib.ref = libNode.att.ref; + } + libs.push(lib); + } + + for(lib in libs) { // install libs switch(lib.type) { - case "haxelib": + case "lib": prettyPrint('Installing "${lib.name}"...'); Sys.command('haxelib install ${lib.name} ${lib.version != null ? " " + lib.version : " "}'); case "git": @@ -71,8 +90,7 @@ class Update { typedef Library = { var name:String; var type:String; - var version:String; - var dir:String; - var ref:String; - var url:String; + var ?version:String; + var ?ref:String; + var ?url:String; } \ No newline at end of file diff --git a/hmm.json b/hmm.json deleted file mode 100644 index 91b86175..00000000 --- a/hmm.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "dependencies": [ - { - "name": "hxCodec", - "type": "git", - "url": "https://github.com/polybiusproxy/hxCodec" - }, - { - "name": "away3d", - "type": "haxelib", - "version": null - }, - { - "name": "dox", - "type": "haxelib", - "version": null - }, - { - "name": "flixel", - "type": "git", - "ref": "dev", - "url": "https://www.github.com/FNF-CNE-Devs/flixel" - }, - { - "name": "flixel-addons", - "type": "git", - "ref": "dev", - "url": "https://www.github.com/FNF-CNE-Devs/flixel-addons" - }, - { - "name": "flxanimate", - "type": "git", - "dir": "flxanimate", - "ref": "master", - "url": "https://github.com/FNF-CNE-Devs/flxanimate/" - }, - { - "name": "format", - "type": "haxelib", - "version": null - }, - { - "name": "hscript-improved", - "type": "git", - "dir": "hscript-improved", - "ref": "custom-classes", - "url": "https://www.github.com/FNF-CNE-Devs/hscript-improved" - }, - { - "name": "hxcpp-debug-server", - "type": "haxelib", - "version": null - }, - { - "name": "lime", - "type": "haxelib", - "version": null - }, - { - "name": "linc_discord-rpc", - "type": "git", - "dir": "linc_discord-rpc", - "ref": "master", - "url": "https://github.com/Aidan63/linc_discord-rpc" - }, - { - "name": "markdown", - "type": "haxelib", - "version": null - }, - { - "name": "openfl", - "type": "haxelib", - "version": null - } - ] -} \ No newline at end of file diff --git a/libs.xml b/libs.xml index 721e0c90..09365b04 100644 --- a/libs.xml +++ b/libs.xml @@ -8,12 +8,12 @@ + -