diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d50e82b1383..2d03511bb83 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,6 +6,7 @@ on: [push, pull_request] jobs: windows64-build: + if: false runs-on: windows-latest env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true @@ -121,6 +122,7 @@ jobs: linux-build: + if: false runs-on: ubuntu-20.04 env: PLATFORM: linux64 @@ -228,6 +230,7 @@ jobs: path: extra/doc linux-test: + if: false needs: linux-build runs-on: ubuntu-20.04 env: @@ -315,6 +318,7 @@ jobs: working-directory: ${{github.workspace}}/tests test-docgen: + if: false needs: linux-build runs-on: ubuntu-20.04 env: @@ -395,6 +399,7 @@ jobs: working-directory: ${{github.workspace}}/tests/docgen linux-arm64: + if: false runs-on: ubuntu-20.04 permissions: packages: write @@ -451,6 +456,7 @@ jobs: path: out/linux/arm64 mac-build: + if: false strategy: fail-fast: false matrix: @@ -564,7 +570,6 @@ jobs: windows64-test: - needs: windows64-build runs-on: windows-latest env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true @@ -576,15 +581,11 @@ jobs: fail-fast: false matrix: # TODO enable lua after https://github.com/HaxeFoundation/haxe/issues/10919 - target: [macro, js, hl, cpp, jvm, php, python, flash, neko] + target: [hl] steps: - uses: actions/checkout@main with: submodules: recursive - - uses: actions/download-artifact@v4 - with: - name: win${{env.ARCH}}Binaries - path: win${{env.ARCH}}Binaries - name: Install Neko from S3 shell: pwsh @@ -602,12 +603,12 @@ jobs: with: node-version: 18.17.1 - # - name: Quick test - # shell: pwsh - # run: | - # $DOWNLOADDIR="./win$($env:ARCH)Binaries" - # new-item -Name $DOWNLOADDIR -ItemType directory - # Invoke-WebRequest https://build.haxe.org/builds/haxe/$env:PLATFORM/haxe_latest.zip -OutFile $DOWNLOADDIR/haxe_bin.zip + - name: Quick test + shell: pwsh + run: | + $DOWNLOADDIR="./win$($env:ARCH)Binaries" + new-item -Name $DOWNLOADDIR -ItemType directory + Invoke-WebRequest https://build.haxe.org/builds/haxe/$env:PLATFORM/haxe_latest.zip -OutFile $DOWNLOADDIR/haxe_bin.zip - name: Setup Haxe shell: pwsh @@ -653,6 +654,11 @@ jobs: mkdir "$env:HAXELIB_ROOT" haxelib setup "$env:HAXELIB_ROOT" + - name: Add msbuild to PATH (hl/c) + uses: microsoft/setup-msbuild@v2 + with: + msbuild-architecture: x64 + - name: Test shell: pwsh run: haxe RunCi.hxml @@ -660,6 +666,7 @@ jobs: mac-build-universal: + if: false needs: mac-build runs-on: macos-latest steps: @@ -693,6 +700,7 @@ jobs: path: out mac-test: + if: false needs: mac-build-universal runs-on: macos-13 env: diff --git a/extra/github-actions/test-windows.yml b/extra/github-actions/test-windows.yml index 96c02751847..9f3bf59dd4e 100644 --- a/extra/github-actions/test-windows.yml +++ b/extra/github-actions/test-windows.yml @@ -53,6 +53,11 @@ mkdir "$env:HAXELIB_ROOT" haxelib setup "$env:HAXELIB_ROOT" +- name: Add msbuild to PATH (hl/c) + uses: microsoft/setup-msbuild@v2 + with: + msbuild-architecture: x64 + - name: Test shell: pwsh run: haxe RunCi.hxml diff --git a/src/generators/hl2c.ml b/src/generators/hl2c.ml index 645e2982a8d..5fdefc9d6ad 100644 --- a/src/generators/hl2c.ml +++ b/src/generators/hl2c.ml @@ -841,14 +841,15 @@ let generate_function ctx f = | OUMod (r,a,b) -> sexpr "%s = %s == 0 ? 0 : ((unsigned)%s) %% ((unsigned)%s)" (reg r) (reg b) (reg a) (reg b) | OShl (r,a,b) -> - sexpr "%s = %s << %s" (reg r) (reg a) (reg b) + let size = (match rtype r with HUI8 -> 8 | HUI16 -> 16 | HI32 -> 32 | HI64 -> 64 |_ -> Globals.die "" __LOC__ ) in + sexpr "%s = %s << (%s %% %d)" (reg r) (reg a) (reg b) size | OSShr (r,a,b) -> - sexpr "%s = %s >> %s" (reg r) (reg a) (reg b) + let size = (match rtype r with HUI8 -> 8 | HUI16 -> 16 | HI32 -> 32 | HI64 -> 64 |_ -> Globals.die "" __LOC__ ) in + sexpr "%s = %s >> (%s %% %d)" (reg r) (reg a) (reg b) size | OUShr (r,a,b) -> - (match rtype r with - | HI64 -> sexpr "%s = ((uint64)%s) >> %s" (reg r) (reg a) (reg b) - | _ -> sexpr "%s = ((unsigned)%s) >> %s" (reg r) (reg a) (reg b) - ); + let size = (match rtype r with HUI8 -> 8 | HUI16 -> 16 | HI32 -> 32 | HI64 -> 64 |_ -> Globals.die "" __LOC__ ) in + let prefix = (match rtype r with HI64 -> "uint64" | _ -> "unsigned") in + sexpr "%s = ((%s)%s) >> (%s %% %d)" (reg r) prefix (reg a) (reg b) size | OAnd (r,a,b) -> sexpr "%s = %s & %s" (reg r) (reg a) (reg b) | OOr (r,a,b) -> diff --git a/tests/runci/targets/Hl.hx b/tests/runci/targets/Hl.hx index 75f7238c3ad..3a561ef712a 100644 --- a/tests/runci/targets/Hl.hx +++ b/tests/runci/targets/Hl.hx @@ -72,6 +72,11 @@ class Hl { runCommand(hlBinary, ["--version"]); haxelibDev("hashlink", '$hlSrc/other/haxelib/'); + + if (systemName == "Windows") { + Sys.putEnv("HASHLINK_SRC", hlSrc); + Sys.putEnv("HASHLINK_BIN", hlInstallBinDir); + } } static function buildAndRunHlc(dir:String, filename:String, ?run) { @@ -82,7 +87,6 @@ class Hl { final compiler = if (systemName == "Mac") "clang" else "gcc"; final extraCompilerFlags = if (systemName == "Windows") ["-ldbghelp", "-municode"] else []; - runCommand(compiler, [ "-o", '$dir/$filename.exe', '$dir/$filename.c', @@ -97,6 +101,18 @@ class Hl { ].concat(extraCompilerFlags)); run('$dir/$filename.exe', []); + + // Run with MSBuild + if (systemName == "Windows") { + runCommand("MSBuild.exe", [ + '$dir/$filename.sln', + '-nologo', '-verbosity:minimal', + '-t:$filename', + '-property:Configuration=Release', + '-property:Platform=x64' + ]); + run('$dir/x64/Release/$filename.exe', []); + } } static function buildAndRun(hxml:String, target:String, ?args:Array) { @@ -105,7 +121,7 @@ class Hl { runCommand("haxe", [hxml, "-hl", '$target/hl-jit.hl'].concat(args)); runCommand(hlBinary, ['$target/hl-jit.hl']); - runCommand("haxe", [hxml, "-hl", '$target/hlc.c'].concat(args)); + runCommand("haxe", [hxml, "-hl", '$target/hlc.c', "-D", "hlgen.makefile=ci"].concat(args)); buildAndRunHlc(target, "hlc"); } diff --git a/tests/unit/compile-hlc.hxml b/tests/unit/compile-hlc.hxml index 61c9f1d83a4..e68d492aaaa 100644 --- a/tests/unit/compile-hlc.hxml +++ b/tests/unit/compile-hlc.hxml @@ -4,3 +4,4 @@ compile-each.hxml #-D interp -D hl-check -D hl-ver=1.13.0 +-D hlgen.makefile=ci diff --git a/tests/unit/src/unit/TestInt64.hx b/tests/unit/src/unit/TestInt64.hx index a49e1be434b..97c320927c9 100644 --- a/tests/unit/src/unit/TestInt64.hx +++ b/tests/unit/src/unit/TestInt64.hx @@ -489,7 +489,7 @@ class TestInt64 extends Test { } function int64eq(v:Int64, v2:Int64, ?pos) { - t(v == v2); + t(v == v2, pos); } public function testParseString() {