use libs.xml instead of hmm.json

This commit is contained in:
lunarcleint
2023-06-25 18:19:07 -07:00
parent 32c8eab86e
commit 2db6d38d24
3 changed files with 28 additions and 87 deletions
+27 -9
View File
@@ -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<String>) {
// 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<Library> = [];
var libsXML:Access = new Access(Xml.parse(File.getContent('./libs.xml')).firstElement());
var json:Array<Library> = 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;
}
-77
View File
@@ -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
}
]
}
+1 -1
View File
@@ -8,12 +8,12 @@
<git name="hscript-improved" url="https://www.github.com/FNF-CNE-Devs/hscript-improved" ref="custom-classes" />
<git name="discord-rpc" url="https://github.com/Aidan63/linc_discord-rpc"/>
<git name="flxanimate" url="https://github.com/FNF-CNE-Devs/flxanimate/" />
<!-- <git name="hxCodec" url="https://github.com/polybiusproxy/hxCodec"/> -->
<!-- Documentation and other features -->
<lib name="dox"/>
<lib name="away3d" />
<lib name="format" />
<lib name="hxCodec" version="2.5.1" />
<lib name="markdown" />
<lib name="hxcpp-debug-server" />