Skip to content

Commit 6dbbcde

Browse files
committed
Fallback to WASI on ARM arch to avoid crash. Use improved CI.
1 parent c61ebf8 commit 6dbbcde

File tree

4 files changed

+10
-28
lines changed

4 files changed

+10
-28
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,24 @@ jobs:
4141
run: echo '${{ fromJson(steps.get_package_json.outputs.packageJson).server_version }}'
4242
env:
4343
PACKAGE_JSON: echo $PACKAGE_JSON
44-
- name: Download windows shader language server.
44+
- name: Download shader language servers.
4545
uses: robinraju/[email protected]
4646
env:
4747
PACKAGE_JSON: echo $PACKAGE_JSON
4848
with:
4949
repository: 'antaalt/shader-sense'
5050
tag: ${{ format('v{0}', fromJson(steps.get_package_json.outputs.packageJson).server_version) }}
5151
fileName: '*.zip'
52-
#token: '${{ secrets.GH_PAT }}'
5352
- name: Create bin folder
5453
run: mkdir ./bin
5554
- name: Copy windows binaries to bin
56-
run: mkdir ./bin/windows && unzip shader-language-server-windows.zip -d ./bin/windows && rm ./shader-language-server-windows.zip
55+
run: mkdir ./bin/windows && unzip shader-language-server-x86_64-pc-windows-msvc.zip -d ./bin/windows && rm ./shader-language-server-x86_64-pc-windows-msvc.zip
5756
- name: Copy linux binaries to bin
58-
run: mkdir ./bin/linux && unzip shader-language-server-linux.zip -d ./bin/linux && rm ./shader-language-server-linux.zip
59-
- name: Copy macos binaries to bin
60-
run: mkdir ./bin/macos && unzip shader-language-server-macos.zip -d ./bin/macos && rm ./shader-language-server-macos.zip
57+
run: mkdir ./bin/linux && unzip shader-language-server-x86_64-unknown-linux-gnu.zip -d ./bin/linux && rm ./shader-language-server-x86_64-unknown-linux-gnu.zip
6158
- name: Copy wasi binaries to bin
62-
run: mkdir ./bin/wasi && unzip shader-language-server-wasi.zip -d ./bin/wasi && rm ./shader-language-server-wasi.zip
59+
run: mkdir ./bin/wasi && unzip shader-language-server-wasm32-wasip1-threads.zip -d ./bin/wasi && rm ./shader-language-server-wasm32-wasip1-threads.zip
6360
- name: Mark server as executable on Linux
6461
run: chmod +x ./bin/linux/shader-language-server
65-
- name: Mark server as executable on MacOS
66-
run: chmod +x ./bin/macos/shader-language-server
6762
- name: Get server version
6863
run: echo "SERVER_VERSION=$(./bin/linux/shader-language-server --version | sed 's/shader-language-server v//g')" >> $GITHUB_ENV
6964
# VScode need a framebuffer to run test. So create one.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"color": "#9ad0ff",
88
"theme": "light"
99
},
10-
"version": "0.6.0",
11-
"server_version": "0.6.0",
10+
"version": "0.6.1",
11+
"server_version": "0.6.1",
1212
"publisher": "antaalt",
1313
"repository": {
1414
"type": "git",

src/test/suite/binary.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,4 @@ suite('Binary Test Suite', () => {
3434
assert.ok(doesBinaryExist("linux/libdxcompiler.so"));
3535
assert.ok(doesBinaryExist("linux/libdxil.so"));
3636
});
37-
test('Check macos binary', () => {
38-
assert.ok(doesBinaryExist("macos/shader-language-server"));
39-
// Dxc need these dll or it will crash.
40-
assert.ok(doesBinaryExist("macos/libdxcompiler.so"));
41-
assert.ok(doesBinaryExist("macos/libdxil.so"));
42-
});
4337
});

src/validator.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { sidebar } from "./extension";
2727
export enum ServerPlatform {
2828
windows,
2929
linux,
30-
macOS,
3130
wasi,
3231
}
3332

@@ -43,8 +42,6 @@ function getPlatformBinaryDirectoryPath(platform: ServerPlatform) : string {
4342
return "bin/windows/";
4443
case ServerPlatform.linux:
4544
return "bin/linux/";
46-
case ServerPlatform.macOS:
47-
return "bin/macos/";
4845
case ServerPlatform.wasi:
4946
return "bin/wasi/";
5047
}
@@ -55,8 +52,6 @@ function getPlatformBinaryName(platform: ServerPlatform) : string {
5552
return "shader-language-server.exe";
5653
case ServerPlatform.linux:
5754
return "shader-language-server";
58-
case ServerPlatform.macOS:
59-
return "shader-language-server";
6055
case ServerPlatform.wasi:
6156
return "shader-language-server.wasm";
6257
}
@@ -89,16 +84,14 @@ export function getServerPlatform() : ServerPlatform {
8984
if (isRunningOnWeb()) {
9085
return ServerPlatform.wasi;
9186
} else {
87+
// Dxc only built for linux x64 & windows x64. Fallback to WASI for every other situations.
9288
switch (process.platform) {
9389
case "win32":
94-
return ServerPlatform.windows;
90+
return (process.arch === 'x64') ? ServerPlatform.windows : ServerPlatform.wasi;
9591
case "linux":
96-
return ServerPlatform.linux;
97-
case "darwin":
98-
return ServerPlatform.wasi; // For now, use WASI as I cannot test on MAC.
99-
//return ServerPlatform.macOS;
92+
return (process.arch === 'x64') ? ServerPlatform.linux : ServerPlatform.wasi;
10093
default:
101-
return ServerPlatform.wasi; // Not supported. Fallback to WASI.
94+
return ServerPlatform.wasi;
10295
}
10396
}
10497
}

0 commit comments

Comments
 (0)