Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into upstream-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjamuffin99 committed Aug 12, 2024
2 parents 6af4af5 + f0a0baa commit c942bc4
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 39 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ jobs:
- windows-latest
haxe:
- latest
- 4.3.1
- 4.3.5
- 3.4.7
include:
- lib_hxml: lib.hxml
- haxe: 3.4.7
lib_hxml: lib_haxe3.hxml

steps:

Expand All @@ -53,11 +57,11 @@ jobs:
uses: ./
with:
haxe-version: ${{ matrix.haxe }}
cache-dependency-path: 'test-workflow/lib.hxml'
cache-dependency-path: 'test-workflow/${{ matrix.lib_hxml }}'

- run: haxe -version

- run: haxelib install test-workflow/lib.hxml --always
- run: haxelib install test-workflow/${{ matrix.lib_hxml }} --always

- name: Compile test code
run: |
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: krdlab/setup-haxe@v1
with:
haxe-version: 4.3.1
haxe-version: 4.3.4
- run: |
haxe -version
haxelib install hxnodejs
Expand All @@ -43,7 +43,7 @@ jobs:
steps:
- uses: krdlab/setup-haxe@v1
with:
haxe-version: 4.3.1
haxe-version: 4.3.4
cache-dependency-path: 'lib.hxml'
- run: |
haxe -version
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ description: 'Setup a Haxe environment and add it to the PATH'
author: 'Sho Kuroda <[email protected]>'
inputs:
haxe-version:
description: 'Version Spec of the version to use. Example: 4.3.1'
description: 'Version Spec of the version to use. Example: 4.3.4'
required: true
default: '4.3.1'
default: '4.3.4'
cache-dependency-path:
description: 'Used to specify the path to a dependency file.'
required: false
Expand Down
29 changes: 14 additions & 15 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ class Asset {
return found ? toolRoot : null;
}
}
// * NOTE https://github.com/HaxeFoundation/neko/releases/download/v2-3-0/neko-2.3.0-linux64.tar.gz
// * NOTE https://github.com/HaxeFoundation/neko/releases/download/v2-3-0/neko-2.3.0-osx64.tar.gz
// * NOTE https://github.com/HaxeFoundation/neko/releases/download/v2-3-0/neko-2.3.0-win64.zip
// * NOTE https://github.com/HaxeFoundation/neko/releases/download/v2-4-0/neko-2.4.0-linux64.tar.gz
// * NOTE https://github.com/HaxeFoundation/neko/releases/download/v2-4-0/neko-2.4.0-osx-universal.tar.gz
// * NOTE https://github.com/HaxeFoundation/neko/releases/download/v2-4-0/neko-2.4.0-win64.zip
class NekoAsset extends Asset {
static resolveFromHaxeVersion(version) {
const nekoVer = version.startsWith('3.') ? '2.1.0' : '2.3.0'; // Haxe 3 only supports neko 2.1
const nekoVer = version.startsWith('3.') ? '2.1.0' : '2.4.0'; // Haxe 3 only supports neko 2.1
return new NekoAsset(nekoVer);
}
constructor(version, env = new Env('neko')) {
Expand All @@ -171,6 +171,9 @@ class NekoAsset extends Asset {
if (this.env.platform === 'win' && this.version.startsWith('2.1')) {
return this.env.platform;
}
if (this.env.platform === 'osx' && this.version.startsWith('2.4')) {
return 'osx-universal';
}
return `${this.env.platform}${this.env.arch}`;
}
get fileNameWithoutExt() {
Expand Down Expand Up @@ -256,18 +259,13 @@ class Env {
}
get arch() {
const arch = external_node_os_namespaceObject.arch();
switch (arch) {
case 'x64': {
return '64';
}
case 'arm64': {
console.warn(`[${this.name}] using rosetta for arm64`);
return '64';
}
default: {
throw new Error(`${arch} not supported`);
}
if (arch === 'x64') {
return '64';
}
if (arch === 'arm64' && this.platform === 'osx') {
return '64';
}
throw new Error(`${arch} not supported`);
}
}

Expand Down Expand Up @@ -350,6 +348,7 @@ async function setup(version, nightly, cacheDependencyPath) {
lib_core.exportVariable('HAXEPATH', haxePath);
lib_core.exportVariable('HAXE_STD_PATH', external_node_path_namespaceObject.join(haxePath, 'std'));
if (env.platform === 'osx') {
lib_core.exportVariable('DYLD_FALLBACK_LIBRARY_PATH', `${nekoPath}:$DYLD_FALLBACK_LIBRARY_PATH`);
// Ref: https://github.com/asdf-community/asdf-haxe/pull/7
console.log('[neko] fixing dylib paths');
await (0,exec.exec)('ln', [
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions src/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ abstract class Asset {
}
}

// * NOTE https://github.com/HaxeFoundation/neko/releases/download/v2-3-0/neko-2.3.0-linux64.tar.gz
// * NOTE https://github.com/HaxeFoundation/neko/releases/download/v2-3-0/neko-2.3.0-osx64.tar.gz
// * NOTE https://github.com/HaxeFoundation/neko/releases/download/v2-3-0/neko-2.3.0-win64.zip
// * NOTE https://github.com/HaxeFoundation/neko/releases/download/v2-4-0/neko-2.4.0-linux64.tar.gz
// * NOTE https://github.com/HaxeFoundation/neko/releases/download/v2-4-0/neko-2.4.0-osx-universal.tar.gz
// * NOTE https://github.com/HaxeFoundation/neko/releases/download/v2-4-0/neko-2.4.0-win64.zip
export class NekoAsset extends Asset {
static resolveFromHaxeVersion(version: string) {
const nekoVer = version.startsWith('3.') ? '2.1.0' : '2.3.0'; // Haxe 3 only supports neko 2.1
const nekoVer = version.startsWith('3.') ? '2.1.0' : '2.4.0'; // Haxe 3 only supports neko 2.1
return new NekoAsset(nekoVer);
}

Expand All @@ -127,6 +127,10 @@ export class NekoAsset extends Asset {
return this.env.platform;
}

if (this.env.platform === 'osx' && this.version.startsWith('2.4')) {
return 'osx-universal';
}

return `${this.env.platform}${this.env.arch}`;
}

Expand Down Expand Up @@ -233,19 +237,15 @@ export class Env {

get arch() {
const arch = os.arch();
switch (arch) {
case 'x64': {
return '64';
}

case 'arm64': {
console.warn(`[${this.name}] using rosetta for arm64`)
return '64';
}
if (arch === 'x64') {
return '64';
}

default: {
throw new Error(`${arch} not supported`);
}
if (arch === 'arm64' && this.platform === 'osx') {
return '64';
}

throw new Error(`${arch} not supported`);
}
}
2 changes: 2 additions & 0 deletions src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export async function setup(version: string, nightly: boolean, cacheDependencyPa
core.exportVariable('HAXE_STD_PATH', path.join(haxePath, 'std'));

if (env.platform === 'osx') {
core.exportVariable('DYLD_FALLBACK_LIBRARY_PATH', `${nekoPath}:$DYLD_FALLBACK_LIBRARY_PATH`);

// Ref: https://github.com/asdf-community/asdf-haxe/pull/7
console.log('[neko] fixing dylib paths');
await exec('ln', [
Expand Down
1 change: 1 addition & 0 deletions test-workflow/lib_haxe3.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-lib hxnodejs:12.1.0

0 comments on commit c942bc4

Please sign in to comment.