diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 857907b35e..bd52b3cc51 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -135,10 +135,6 @@ jobs: haxelib install hxp --quiet haxelib install utest --quiet - - name: Enable HXCPP compile cache - run: | - echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV - - name: Rebuild Lime tools run: | haxelib dev lime ${{ github.workspace }} @@ -728,7 +724,7 @@ jobs: runs-on: windows-latest strategy: matrix: - haxe-version: [4.0.5, 4.1.5, 4.2.5, 4.3.6] + haxe-version: [4.0.5, 4.1.5, 4.2.5, 4.3.7] steps: - uses: actions/checkout@v6 @@ -882,7 +878,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - haxe-version: [3.4.7, 4.0.5, 4.1.5, 4.2.5, 4.3.6] + haxe-version: [3.4.7, 4.0.5, 4.1.5, 4.2.5, 4.3.7] steps: - uses: actions/checkout@v6 diff --git a/src/lime/_internal/backend/native/NativeApplication.hx b/src/lime/_internal/backend/native/NativeApplication.hx index 1be8e8df77..e8bcd64538 100644 --- a/src/lime/_internal/backend/native/NativeApplication.hx +++ b/src/lime/_internal/backend/native/NativeApplication.hx @@ -689,7 +689,15 @@ class NativeApplication }); } } - #if (haxe_ver >= 4.2) + #if haxe5 + #if target.threaded + sys.thread.Thread.current().events.loopOnce(); + #else + // Duplicate code required because Haxe 3 can't handle + // #if (haxe_ver >= 4.2 && target.threaded) + @:privateAccess haxe.EntryPoint.processEvents(); + #end + #elseif (haxe_ver >= 4.2) #if target.threaded sys.thread.Thread.current().events.progress(); #else diff --git a/src/lime/_internal/utils/MainLoop.hx b/src/lime/_internal/utils/MainLoop.hx new file mode 100644 index 0000000000..b00b1a32cd --- /dev/null +++ b/src/lime/_internal/utils/MainLoop.hx @@ -0,0 +1,24 @@ +package lime._internal.utils; + +#if haxe5 +import haxe.EventLoop; + +/** + * Wrapper for compatibility with Haxe 5. + */ +@:forwardStatics +abstract MainLoop(haxe.MainLoop) +{ + public static inline function runInMainThread(f:Void->Void) + { + EventLoop.main.run(f); + } + + public static inline function addThread(f:Void->Void) + { + EventLoop.addTask(f); + } +} +#else +typedef MainLoop = haxe.MainLoop; +#end diff --git a/src/lime/app/Promise.hx b/src/lime/app/Promise.hx index 96b59fdc7e..91462c00d8 100644 --- a/src/lime/app/Promise.hx +++ b/src/lime/app/Promise.hx @@ -1,5 +1,6 @@ package lime.app; +import lime._internal.utils.MainLoop; import lime.app.Future; import lime.system.ThreadPool; import lime.system.WorkOutput; @@ -105,7 +106,7 @@ class Promise { if (!ThreadPool.isMainThread()) { - haxe.MainLoop.runInMainThread(complete.bind(data)); + MainLoop.runInMainThread(complete.bind(data)); return this; } @@ -197,7 +198,7 @@ class Promise { if (!ThreadPool.isMainThread()) { - haxe.MainLoop.runInMainThread(error.bind(msg)); + MainLoop.runInMainThread(error.bind(msg)); return this; } @@ -236,7 +237,7 @@ class Promise { if (!ThreadPool.isMainThread()) { - haxe.MainLoop.runInMainThread(this.progress.bind(progress, total)); + MainLoop.runInMainThread(this.progress.bind(progress, total)); return this; }