From 06b368fa6d927b0000882874238175b68637cabc Mon Sep 17 00:00:00 2001 From: Hyper_ <40342021+NotHyper-474@users.noreply.github.com> Date: Fri, 15 May 2026 22:28:41 -0300 Subject: [PATCH] ci: Build Actions for Sample Projects --- .github/workflows/build-samples.yml | 86 ++++++++++++++++++ include.xml | 3 + polymod/Polymod.hx | 7 ++ polymod/backends/HEAPSBackend.hx | 13 ++- polymod/backends/LimeBackend.hx | 2 +- polymod/backends/NMEBackend.hx | 5 + polymod/backends/PolymodAssetLibrary.hx | 4 +- polymod/fs/MemoryZipFileSystem.hx | 4 +- polymod/hscript/_internal/HScriptableMacro.hx | 2 +- .../hscript/_internal/PolymodScriptClass.hx | 2 + samples/.gitignore | 2 + samples/flixel/hmm.json | 4 +- samples/flixel_zip/hmm.json | 21 ++++- samples/heaps/hmm.json | 26 +++++- samples/heaps/res/data/greeting.txt | 1 + samples/heaps/res/data/objects.json | 6 ++ samples/heaps/res/data/objects.xml | 6 ++ samples/heaps/res/img/a.png | Bin 0 -> 878 bytes samples/heaps/res/img/b.png | Bin 0 -> 900 bytes samples/heaps/res/img/c.png | Bin 0 -> 902 bytes samples/nme/hmm.json | 25 ++++- samples/openfl/hmm.json | 25 ++++- samples/openfl_firetongue/hmm.json | 23 ++++- samples/openfl_hscript/hmm.json | 23 ++++- samples/openfl_hscript_class/hmm.json | 23 ++++- samples/run.hxml | 3 + samples/scripts/SamplesBuild.hx | 74 +++++++++++++++ 27 files changed, 363 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/build-samples.yml create mode 100644 samples/.gitignore create mode 100644 samples/heaps/res/data/greeting.txt create mode 100644 samples/heaps/res/data/objects.json create mode 100644 samples/heaps/res/data/objects.xml create mode 100644 samples/heaps/res/img/a.png create mode 100644 samples/heaps/res/img/b.png create mode 100644 samples/heaps/res/img/c.png create mode 100644 samples/run.hxml create mode 100644 samples/scripts/SamplesBuild.hx diff --git a/.github/workflows/build-samples.yml b/.github/workflows/build-samples.yml new file mode 100644 index 00000000..b00ca9c9 --- /dev/null +++ b/.github/workflows/build-samples.yml @@ -0,0 +1,86 @@ +# Builds the sample projects on multiple targets to check for compiler errors. + +name: Build Samples + +on: + #push: + pull_request: + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + target: [cpp, html5, hl] + fail-fast: false + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v6.0.2 + + - name: Setup Haxe + uses: FunkinCrew/ci-haxe@v3 + with: + haxe-version: 4.3.7 + + - name: Setup HMM + run: | + haxelib --global --quiet --never update haxelib + haxelib --global fixrepo + haxelib --global --quiet install hmm + haxelib --global run hmm setup + + - name: Install sample dependencies + working-directory: ./samples + run: | + haxe run.hxml + hmm install --quiet + haxelib fixrepo + + - name: Build Flixel Sample + working-directory: ./samples/flixel + run: | + haxelib run lime build ${{ matrix.target }} --no-output + + - name: Build ZIP Flixel Sample + working-directory: ./samples/flixel_zip + run: | + haxelib run lime build ${{ matrix.target }} --no-output + + - name: Build Heaps Sample + if: matrix.target == 'hl' + working-directory: ./samples/heaps + run: | + haxe hl.hxml + + # - name: Build NME Sample + # if: matrix.target != 'hl' + # working-directory: ./samples/nme + # run: | + # hmm install --quiet + # haxelib update + # echo y | haxelib run nme build ${{ matrix.target }} + + - name: Build OpenFL Sample + working-directory: ./samples/openfl + run: | + haxelib run openfl build ${{ matrix.target }} --no-output + + - name: Build OpenFL (Firetongue) Sample + working-directory: ./samples/openfl_firetongue + run: | + haxelib run openfl build ${{ matrix.target }} --no-output + + - name: Build OpenFL (HScript) Sample + working-directory: ./samples/openfl_hscript + run: | + haxelib run openfl build ${{ matrix.target }} --no-output + + - name: Build OpenFL (HScript with Classes) Sample + working-directory: ./samples/openfl_hscript_class + run: | + haxelib run openfl build ${{ matrix.target }} --no-output + + diff --git a/include.xml b/include.xml index 16e21ce5..c244a948 100644 --- a/include.xml +++ b/include.xml @@ -1,6 +1,9 @@ + + + diff --git a/polymod/Polymod.hx b/polymod/Polymod.hx index a7891a3d..fd79b238 100644 --- a/polymod/Polymod.hx +++ b/polymod/Polymod.hx @@ -851,6 +851,7 @@ class Polymod } } + #if lime /** * Get a list of all the available scripted classes (`.hxc` files), interpret them asynchronously, and register any classes. * Called on platforms that don't support synchronous file access. @@ -889,6 +890,12 @@ class Polymod return futures; } + #else + public static function registerAllScriptClassesAsync() + { + throw 'Function not supported on current target'; + } + #end /** * Dispatch an error message with the severity `PolymodErrorType.ERROR`. diff --git a/polymod/backends/HEAPSBackend.hx b/polymod/backends/HEAPSBackend.hx index 8094207b..413aa127 100644 --- a/polymod/backends/HEAPSBackend.hx +++ b/polymod/backends/HEAPSBackend.hx @@ -102,6 +102,11 @@ class HEAPSBackend implements IBackend throw 'Function not implemented'; } + public function listLibraries():Array + { + throw 'Function not implemented'; + } + public function getPath(id:String):String { throw 'Function not implemented'; @@ -293,16 +298,16 @@ class ModFileEntry extends BytesFileEntry return super.getBytes(); } - override function readByte():Int + override function readBytes(out:Bytes, outPos:Int, pos:Int, len:Int):Int { initBytes(); - return super.readByte(); + return super.readBytes(out, outPos, pos, len); } - override function read(out:Bytes, pos:Int, size:Int) + override function readFull(bytes:Bytes, pos:Int, len:Int) { initBytes(); - return super.read(out, pos, size); + return super.readFull(bytes, pos, len); } override function loadBitmap(onLoaded:LoadedBitmap->Void):Void diff --git a/polymod/backends/LimeBackend.hx b/polymod/backends/LimeBackend.hx index 748d8f2c..e0b9624d 100644 --- a/polymod/backends/LimeBackend.hx +++ b/polymod/backends/LimeBackend.hx @@ -1,6 +1,5 @@ package polymod.backends; -import lime.system.ThreadPool; import polymod.backends.PolymodAssetLibrary; import polymod.backends.PolymodAssets.PolymodAssetType; import polymod.fs.PolymodFileSystem; @@ -18,6 +17,7 @@ import unifill.Unifill; import lime.app.Future; import lime.graphics.Image; import lime.net.HTTPRequest; +import lime.system.ThreadPool; import lime.text.Font; import lime.utils.Assets; import lime.utils.Bytes; diff --git a/polymod/backends/NMEBackend.hx b/polymod/backends/NMEBackend.hx index bc6e8202..0006d292 100644 --- a/polymod/backends/NMEBackend.hx +++ b/polymod/backends/NMEBackend.hx @@ -165,6 +165,11 @@ class NMEBackend implements IBackend throw 'Function not implemented'; } + public function listLibraries():Array + { + throw 'Function not implemented'; + } + public function getPath(id:String):String { throw 'Function not implemented'; diff --git a/polymod/backends/PolymodAssetLibrary.hx b/polymod/backends/PolymodAssetLibrary.hx index 2b198e9e..fecd1ec9 100644 --- a/polymod/backends/PolymodAssetLibrary.hx +++ b/polymod/backends/PolymodAssetLibrary.hx @@ -652,7 +652,7 @@ class PolymodAssetLibrary typeLibraries.get('default').push(f); } - #if openfl + #if (openfl && !nme) if (assetType == FONT) { var fontBytes = fileSystem.getFileBytes(file(f, d)); @@ -713,7 +713,7 @@ class PolymodAssetLibrary type.set(f, assetType); if (!typeLibraries.exists(libraryId)) typeLibraries.set(libraryId, []); typeLibraries.get(libraryId).push(f); - #if openfl + #if (openfl && !nme) if (assetType == FONT) { var fontBytes = fileSystem.getFileBytes(file(f, redirectPath)); diff --git a/polymod/fs/MemoryZipFileSystem.hx b/polymod/fs/MemoryZipFileSystem.hx index 6ea0cde2..92bd51e0 100644 --- a/polymod/fs/MemoryZipFileSystem.hx +++ b/polymod/fs/MemoryZipFileSystem.hx @@ -16,12 +16,12 @@ class MemoryZipFileSystem extends StubFileSystem public function new(params:ZipFileSystemParams) { super(params); - Polymod.error(FUNCTIONALITY_NOT_IMPLEMENTED, "This file system not supported for this platform, and is only intended for use in html5"); + Polymod.error(POLYMOD_FUNCTIONALITY_NOT_IMPLEMENTED, "This file system not supported for this platform, and is only intended for use in html5"); } public function addZipFile(zipName:String, zipBytes:Bytes) { - Polymod.error(FUNCTIONALITY_NOT_IMPLEMENTED, "This file system not supported for this platform, and is only intended for use in html5"); + Polymod.error(POLYMOD_FUNCTIONALITY_NOT_IMPLEMENTED, "This file system not supported for this platform, and is only intended for use in html5"); } } #else diff --git a/polymod/hscript/_internal/HScriptableMacro.hx b/polymod/hscript/_internal/HScriptableMacro.hx index b44c5567..687d4ce1 100644 --- a/polymod/hscript/_internal/HScriptableMacro.hx +++ b/polymod/hscript/_internal/HScriptableMacro.hx @@ -177,7 +177,7 @@ class HScriptableMacro } else { - polymod.Polymod.debug('The scripted function ' + $v{pathName} + ' could not be found, but that is fine because it is optional.', SCRIPT_RUNTIME); + polymod.Polymod.debug('The scripted function ' + $v{pathName} + ' could not be found, but that is fine because it is optional.'); // Prevent the script from running but do not prevent the function body from executing. // wasCancelled = true; diff --git a/polymod/hscript/_internal/PolymodScriptClass.hx b/polymod/hscript/_internal/PolymodScriptClass.hx index 53e9dc5a..ef11bc13 100644 --- a/polymod/hscript/_internal/PolymodScriptClass.hx +++ b/polymod/hscript/_internal/PolymodScriptClass.hx @@ -183,6 +183,7 @@ class PolymodScriptClass } } + #if lime static function registerScriptClassByPathAsync(path:String):lime.app.Future { var promise = new lime.app.Promise(); @@ -231,6 +232,7 @@ class PolymodScriptClass // Await the promise return promise.future; } + #end /** * Returns a list of all registered classes. diff --git a/samples/.gitignore b/samples/.gitignore new file mode 100644 index 00000000..438073da --- /dev/null +++ b/samples/.gitignore @@ -0,0 +1,2 @@ +.haxelib +hmm.json diff --git a/samples/flixel/hmm.json b/samples/flixel/hmm.json index f7fdfc87..3bbc308f 100644 --- a/samples/flixel/hmm.json +++ b/samples/flixel/hmm.json @@ -45,7 +45,9 @@ }, { "name": "thx.semver", - "type": "haxelib" + "type": "git", + "ref": "master", + "url": "https://github.com/fponticelli/thx.semver" } ] } diff --git a/samples/flixel_zip/hmm.json b/samples/flixel_zip/hmm.json index 3cff2bd9..0a7cfb9d 100644 --- a/samples/flixel_zip/hmm.json +++ b/samples/flixel_zip/hmm.json @@ -25,6 +25,16 @@ "type": "haxelib", "version": null }, + { + "name": "jsonpatch", + "type": "haxelib", + "version": null + }, + { + "name": "jsonpath", + "type": "haxelib", + "version": null + }, { "name": "lime", "type": "haxelib", @@ -40,10 +50,17 @@ "path": "../..", "type": "dev" }, + { + "name": "thx.core", + "type": "git", + "ref": "master", + "url": "https://github.com/fponticelli/thx.core" + }, { "name": "thx.semver", - "type": "haxelib", - "version": null + "type": "git", + "ref": "master", + "url": "https://github.com/fponticelli/thx.semver" } ] } diff --git a/samples/heaps/hmm.json b/samples/heaps/hmm.json index 6d360aaa..ffab65d5 100644 --- a/samples/heaps/hmm.json +++ b/samples/heaps/hmm.json @@ -1,5 +1,10 @@ { "dependencies": [ + { + "name": "format", + "type": "haxelib", + "version": null + }, { "name": "heaps", "type": "haxelib", @@ -15,15 +20,32 @@ "type": "haxelib", "version": null }, + { + "name": "jsonpatch", + "type": "haxelib", + "version": null + }, + { + "name": "jsonpath", + "type": "haxelib", + "version": null + }, { "name": "polymod", "path": "../..", "type": "dev" }, + { + "name": "thx.core", + "type": "git", + "ref": "master", + "url": "https://github.com/fponticelli/thx.core" + }, { "name": "thx.semver", - "type": "haxelib", - "version": null + "type": "git", + "ref": "master", + "url": "https://github.com/fponticelli/thx.semver" } ] } diff --git a/samples/heaps/res/data/greeting.txt b/samples/heaps/res/data/greeting.txt new file mode 100644 index 00000000..af5626b4 --- /dev/null +++ b/samples/heaps/res/data/greeting.txt @@ -0,0 +1 @@ +Hello, world! diff --git a/samples/heaps/res/data/objects.json b/samples/heaps/res/data/objects.json new file mode 100644 index 00000000..c20b7397 --- /dev/null +++ b/samples/heaps/res/data/objects.json @@ -0,0 +1,6 @@ +{ + "object_0": { "value": "moon" }, + "object_1": { "value": "star" }, + "object_2": { "value": "sun" }, + "nested": { "object": { "array": ["a", "b", "c"] } } +} diff --git a/samples/heaps/res/data/objects.xml b/samples/heaps/res/data/objects.xml new file mode 100644 index 00000000..280a9584 --- /dev/null +++ b/samples/heaps/res/data/objects.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/samples/heaps/res/img/a.png b/samples/heaps/res/img/a.png new file mode 100644 index 0000000000000000000000000000000000000000..9728421723a4acaee87cc2bc7e40e3f19811eb3e GIT binary patch literal 878 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY3?!3`olAjKdw@@fE08{O?JkjM$I-KEb|0Cu zcE_@<`xkH8d-C$_%?C~%yLe;fs;!64T|0j1=K8(I_no@5^Vqoqr!Vh5et!Sy%ZJWg zJ$UBIhJDB9Z`gI@{Pl$!cdy)WaMOX4^Vjd1y=ME;E&EPgxqbTT9lq(-RzRoll?3?( zGbkkV@4wFwF#o;7`iAqh)6aD=Ffes^x;TbZ#2uY+bJ}7BfwqIZ9Z@@G+wMKHYtR4B zzPCJ^HFcbC&ojQSDt@1{Rr6K**#pf6T@T%4S{eN_BAgUbc=$Go$P0fAU~J^txjkd@ zA)S}UypO2bxO_Uk$fuEAt6JfaWk5;#+VgV*pVs)Ph`hbXd~FGf?kR>c_S&Z#n9oG= z&p9|LP>J)yn*2Eo3-b?fbh=zCzSNfPOjm?*p%Z^;*5SG5m&X;_#QRmwXp6-^F z&5agyEjz>upLW$X^LO3vEGlq);BF_Dy20VglCP6>g^i_^yL>-A-`m$EJ+Xzc=ifh9{k^YM4V}}?y3L!P3tv+T%6-)m1T2Z zFb~-He>z9LZky|aq~khGt`8pfM{ukb*u)T~m>?6@xHxS0l!{e9!+-Ooz5I4HVN z?^-)EhYK>VJCCWoVa@C>y1zegySV$cm|MH*lkH0#)f9j2n04#R+*KL3A3r^{F}M5F zm&Lng?%8Dd@6PO1^Pj$+{!&rNb8h3Fxu0u_iyX7qbak3?UH{E_pQm@@#>Mlzx`!WH z{LxS=YTP63cK77Jpef&{&EFqapyzNnW0K(Hzf0G~{cgOzs#dYcv5oCp<%^gJi#a|9 z3JNL;Z46PlGsD$*GWVv=2ky^#t;9W)x`YfH&#+G7INs6$qk08=Z2r>mdKI;Vst09kOl AbpQYW literal 0 HcmV?d00001 diff --git a/samples/heaps/res/img/b.png b/samples/heaps/res/img/b.png new file mode 100644 index 0000000000000000000000000000000000000000..d00c34d2d6ddedd70a958ecf4bd128c602285696 GIT binary patch literal 900 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY3?!3`olAjKW`IwKE0F$w#utiiHvfkspdg$L zWI)tF7|2|R8n_7%U2qbv>t=K8rD=n*t!29(L=N0Df z?-$tb5O6;r!D0P*gZTwE&y9r{7?_rOx;TbZFrK|}bJ8jUfriA4X%4e$y+vZ~|5rS( zVzpB2sGFtu=UD6dQpwE66*lq*_#@&RS_4J8XR_3(9Q2WKUAVx;afy)N=8%BOL?>6d zfXucIqgbA)9sc?&4y=;166!57RJph+omtY=*~v7j$S~xwugV;;cef67epnXG^R+^m zz3_U&V>c<4dtbU23OrZd`e4OR2Z?jerG3Gc^?lM zBk5HSPF`%=)STetC)1kLBz{X_$?ryPNxMBIXMWbYycE{aSoU>cTF{4M_pVz?Tlw$P zY6#b;zqHD zEnarq{^0epCqK4NS@x5?=+>o$ip!3a_+)r%R{p)97GKlg(UGzL#RP%iBrBCKsV{%j zInPU2TKmtgq;0BNUix-zcCH;4_`*KMx3w8+?dB1D?X8s{IyWxM<;*T4srKLEPZm0t zSS?KGeekfKPp!l;OT=zX0E=>v_`|OrN58#0U_EoT^wnyQ6BqB=TRvN+GI7DezL?7v zY5wi9ygPHuxK=Z;?R?ZHdCybdZFS$#yXmtv)?Mtf6?99j_dUAac#UJ-lO@;p^&EQM zJ*_RY?~U@L16p0Yp&R(5gEsj6t9-HKN_X^}XHFkH-ZHIT*>zqlnlEHE^Wy}&PnDb4 z7bQ8(N}F|{E3oa*43AY$olTNGH>>f?3X17SJE6bV@y^>Ty8<2?`Bg@T^le+&68q2V zr?11w<@I72@e}*F4f!%W4t`*H-W9gP^2*}U8#1phbp7-5__wq(MY5)KL literal 0 HcmV?d00001 diff --git a/samples/heaps/res/img/c.png b/samples/heaps/res/img/c.png new file mode 100644 index 0000000000000000000000000000000000000000..38400d98b011291f2130cbb04803fd5804cc4e9e GIT binary patch literal 902 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY3?!3`olAjKLV!<*E0F#&frohXeX+v76P{mZ zhgr~7BG?calrzqgtG+GO~BzRb^68sBD1{5$H}%Xjua&<_5R zAirP+gY^so?;8^KpLe)FKR|&o^WAF(2Bu@4E{-7;aeHT6FIr+C;Of4{!DkQGlZ5~O z#RS2+ooVysH}+I@eL}8^?W=3ST-$pIJIB5kdBIFLRM(bf-L4IoT&-HUm8+XdY4NjR_1igTXHe?BkNkVi^bO25ffJZ5K`T^ zVe-G!m#Kvwot-J(E>ACus=rvVV4KUFN0ySp-(9zuMb2@#bV^2W_g$B1PcOV$>}?jl&E_j-xatce3m)KjWZEfF*~2BM>8xa?uY24n_ws7S6W2ty2sLbb z8knpYzv9UE2A7y3y>qXaDxUJ$0|EYR|>I zo}5^BriO+24m@Ed4GKFq))sA)-pnKJdFzblk@qibCtfxza=!BToUGvapanO7EGw3} zx7plbR-uru)Pb}WM-RDge02D|GV7ku>D$>fbf(U<^;^37X3DjrKoM~_+1E8!_?y4D z#i+M0EPrxk`Xc`LbYP?~nEGb1zjoRVwivAbW|onC(DGUCwk*zbC1f!N2{ zW;|K9{u&l-IB`r`xw@HmS*q{>ZAMqABSJ`%lAL#e-jwqacsZSk@&2C?@hJ; zuk4mTeR%z%iPImyc>Qa=y}}Xu%p>-jj@bV`V()U)zISik?~Ui4-}(G7-tX6Mk*p5Z RUBJZ7;OXk;vd$@?2>_Vut#$wa literal 0 HcmV?d00001 diff --git a/samples/nme/hmm.json b/samples/nme/hmm.json index e9dc5449..30dc5000 100644 --- a/samples/nme/hmm.json +++ b/samples/nme/hmm.json @@ -10,15 +10,34 @@ "type": "haxelib", "version": null }, + { + "name": "nme-dev", + "type": "haxelib", + "version": null + }, + { + "name": "nme-toolkit", + "type": "haxelib", + "version": null + }, { "name": "polymod", "path": "../..", "type": "dev" }, + { + "name": "thx.core", + "type": "git", + "dir": null, + "ref": "master", + "url": "https://github.com/fponticelli/thx.core" + }, { "name": "thx.semver", - "type": "haxelib", - "version": null + "type": "git", + "dir": null, + "ref": "master", + "url": "https://github.com/fponticelli/thx.semver" } ] -} +} \ No newline at end of file diff --git a/samples/openfl/hmm.json b/samples/openfl/hmm.json index c8efc8b4..cdc316e6 100644 --- a/samples/openfl/hmm.json +++ b/samples/openfl/hmm.json @@ -10,6 +10,16 @@ "type": "haxelib", "version": null }, + { + "name": "jsonpatch", + "type": "haxelib", + "version": null + }, + { + "name": "jsonpath", + "type": "haxelib", + "version": null + }, { "name": "lime", "type": "haxelib", @@ -25,10 +35,19 @@ "path": "../..", "type": "dev" }, + { + "name": "thx.core", + "type": "git", + "dir": null, + "ref": "master", + "url": "https://github.com/fponticelli/thx.core" + }, { "name": "thx.semver", - "type": "haxelib", - "version": null + "type": "git", + "dir": null, + "ref": "master", + "url": "https://github.com/fponticelli/thx.semver" } ] -} +} \ No newline at end of file diff --git a/samples/openfl_firetongue/hmm.json b/samples/openfl_firetongue/hmm.json index 2c9b37b9..ce7daf6c 100644 --- a/samples/openfl_firetongue/hmm.json +++ b/samples/openfl_firetongue/hmm.json @@ -15,6 +15,16 @@ "type": "haxelib", "version": null }, + { + "name": "jsonpatch", + "type": "haxelib", + "version": null + }, + { + "name": "jsonpath", + "type": "haxelib", + "version": null + }, { "name": "lime", "type": "haxelib", @@ -30,10 +40,19 @@ "path": "../..", "type": "dev" }, + { + "name": "thx.core", + "type": "git", + "dir": null, + "ref": "master", + "url": "https://github.com/fponticelli/thx.core" + }, { "name": "thx.semver", - "type": "haxelib", - "version": null + "type": "git", + "dir": null, + "ref": "master", + "url": "https://github.com/fponticelli/thx.semver" } ] } diff --git a/samples/openfl_hscript/hmm.json b/samples/openfl_hscript/hmm.json index 0bfaa61d..3a78979b 100644 --- a/samples/openfl_hscript/hmm.json +++ b/samples/openfl_hscript/hmm.json @@ -15,6 +15,16 @@ "type": "haxelib", "version": null }, + { + "name": "jsonpatch", + "type": "haxelib", + "version": null + }, + { + "name": "jsonpath", + "type": "haxelib", + "version": null + }, { "name": "lime", "type": "haxelib", @@ -30,10 +40,19 @@ "path": "../..", "type": "dev" }, + { + "name": "thx.core", + "type": "git", + "dir": null, + "ref": "master", + "url": "https://github.com/fponticelli/thx.core" + }, { "name": "thx.semver", - "type": "haxelib", - "version": null + "type": "git", + "dir": null, + "ref": "master", + "url": "https://github.com/fponticelli/thx.semver" } ] } diff --git a/samples/openfl_hscript_class/hmm.json b/samples/openfl_hscript_class/hmm.json index 0bfaa61d..3a78979b 100644 --- a/samples/openfl_hscript_class/hmm.json +++ b/samples/openfl_hscript_class/hmm.json @@ -15,6 +15,16 @@ "type": "haxelib", "version": null }, + { + "name": "jsonpatch", + "type": "haxelib", + "version": null + }, + { + "name": "jsonpath", + "type": "haxelib", + "version": null + }, { "name": "lime", "type": "haxelib", @@ -30,10 +40,19 @@ "path": "../..", "type": "dev" }, + { + "name": "thx.core", + "type": "git", + "dir": null, + "ref": "master", + "url": "https://github.com/fponticelli/thx.core" + }, { "name": "thx.semver", - "type": "haxelib", - "version": null + "type": "git", + "dir": null, + "ref": "master", + "url": "https://github.com/fponticelli/thx.semver" } ] } diff --git a/samples/run.hxml b/samples/run.hxml new file mode 100644 index 00000000..e8046c17 --- /dev/null +++ b/samples/run.hxml @@ -0,0 +1,3 @@ +--class-path scripts +--main SamplesBuild +--interp diff --git a/samples/scripts/SamplesBuild.hx b/samples/scripts/SamplesBuild.hx new file mode 100644 index 00000000..2b0327a2 --- /dev/null +++ b/samples/scripts/SamplesBuild.hx @@ -0,0 +1,74 @@ +package ; + +import haxe.format.JsonPrinter; +import haxe.format.JsonParser; +import haxe.Json; +import sys.io.File; +import haxe.io.Path; +import sys.FileSystem; + +typedef HMMDependency = +{ + name:String, + type:String, + ?version: String, + ?path:String, + ?dir:String, + ?url:String, + ?ref:String, +} + +class SamplesBuild +{ + static final IGNORE_LIST:Array = ['nme']; + + public static function main() + { + final scriptsPath:String = Path.directory(Sys.programPath()); + final workPath:String = Path.normalize('$scriptsPath/..'); + + var searchPaths:Array = FileSystem.readDirectory(workPath); + var dependencies:Map = []; + + for (path in searchPaths) + { + if (IGNORE_LIST.contains(path)) continue; + if (!FileSystem.isDirectory(path)) continue; + + final hmmPath:String = Path.join([path, 'hmm.json']); + if (!FileSystem.exists(hmmPath)) continue; + + var hmmContent:String = File.getContent(hmmPath); + try + { + var json:{ dependencies:Array } = Json.parse(hmmContent); + if (json.dependencies == null) continue; + + for (dependency in json.dependencies) + { + if (dependencies.exists(dependency.name)) + { + continue; + } + + dependencies.set(dependency.name, dependency); + } + } + catch (_) {} + } + + var result = { dependencies: [] }; + for (dependency in dependencies) + { + if (dependency.name == 'polymod' && dependency.type == 'dev') + { + // Force correct relative path + dependency.path = '..'; + } + + result.dependencies.push(dependency); + } + + File.saveContent(Path.join([workPath, 'hmm.json']), Json.stringify(result, ' ')); + } +}