Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/build-samples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# 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
# Workaround for an error on the Windows target
#env:
# HAXEPATH: ${{ env.HAXE_STD_PATH }}/..
run: |
haxelib --global --quiet install hmm
haxelib --global run hmm setup

- name: Install sample dependencies
shell: bash
run: |
for sample in samples/*; do
if [ -d "$sample" ] && [ -f "$sample/hmm.json" ]; then
echo "Installing dependencies for $sample"
(cd "$sample" && haxelib run hmm install --quiet)
fi
done

- 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: |
haxelib update --always --quiet
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 lime 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


3 changes: 3 additions & 0 deletions include.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<!-- These values are added to the project XML when you include this library. -->
<haxelib name="jsonpath" />
<haxelib name="jsonpatch" />
<haxelib name="thx.core" />
<haxelib name="thx.semver" />
<!-- <haxelib name="hscript" /> This library is now OPTIONAL. -->
<!--
Expand Down
7 changes: 7 additions & 0 deletions polymod/Polymod.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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`.
Expand Down
13 changes: 9 additions & 4 deletions polymod/backends/HEAPSBackend.hx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ class HEAPSBackend implements IBackend
throw 'Function not implemented';
}

public function listLibraries():Array<String>
{
throw 'Function not implemented';
}

public function getPath(id:String):String
{
throw 'Function not implemented';
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion polymod/backends/LimeBackend.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package polymod.backends;

import lime.system.ThreadPool;
import polymod.backends.PolymodAssetLibrary;
import polymod.backends.PolymodAssets.PolymodAssetType;
import polymod.fs.PolymodFileSystem;
Expand All @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions polymod/backends/NMEBackend.hx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ class NMEBackend implements IBackend
throw 'Function not implemented';
}

public function listLibraries():Array<String>
{
throw 'Function not implemented';
}

public function getPath(id:String):String
{
throw 'Function not implemented';
Expand Down
4 changes: 2 additions & 2 deletions polymod/backends/PolymodAssetLibrary.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions polymod/fs/MemoryZipFileSystem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions polymod/hscript/_internal/PolymodScriptClass.hx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class PolymodScriptClass
}
}

#if lime
static function registerScriptClassByPathAsync(path:String):lime.app.Future<Bool>
{
var promise = new lime.app.Promise<Bool>();
Expand Down Expand Up @@ -231,6 +232,7 @@ class PolymodScriptClass
// Await the promise
return promise.future;
}
#end

/**
* Returns a list of all registered classes.
Expand Down
4 changes: 3 additions & 1 deletion samples/flixel/hmm.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
},
{
"name": "thx.semver",
"type": "haxelib"
"type": "git",
"ref": "master",
"url": "https://github.com/fponticelli/thx.semver"
}
]
}
21 changes: 19 additions & 2 deletions samples/flixel_zip/hmm.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
"type": "haxelib",
"version": null
},
{
"name": "jsonpatch",
"type": "haxelib",
"version": null
},
{
"name": "jsonpath",
"type": "haxelib",
"version": null
},
{
"name": "lime",
"type": "haxelib",
Expand All @@ -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"
}
]
}
26 changes: 24 additions & 2 deletions samples/heaps/hmm.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"dependencies": [
{
"name": "format",
"type": "haxelib",
"version": null
},
{
"name": "heaps",
"type": "haxelib",
Expand All @@ -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"
}
]
}
1 change: 1 addition & 0 deletions samples/heaps/res/data/greeting.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello, world!
6 changes: 6 additions & 0 deletions samples/heaps/res/data/objects.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"object_0": { "value": "moon" },
"object_1": { "value": "star" },
"object_2": { "value": "sun" },
"nested": { "object": { "array": ["a", "b", "c"] } }
}
6 changes: 6 additions & 0 deletions samples/heaps/res/data/objects.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<data>
<object id="0" value="moon" />
<object id="1" value="star" />
<object id="2" value="sun" />
</data>
Binary file added samples/heaps/res/img/a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/heaps/res/img/b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/heaps/res/img/c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 16 additions & 2 deletions samples/nme/hmm.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,29 @@
"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"
}
]
}
Loading
Loading