Skip to content

Commit 3ddaaba

Browse files
author
drizzle9
committed
Support cross-platform UI
1 parent 2609e62 commit 3ddaaba

53 files changed

Lines changed: 19680 additions & 7 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,22 @@ autotests/history/*
2929
*.swp
3030

3131
!tests/*.ts
32+
33+
# dependencies
34+
ui/node_modules/
35+
ui/target/
36+
37+
# logs
38+
ui/npm-debug.log*
39+
ui/yarn-debug.log*
40+
ui/yarn-error.log*
41+
ui/pnpm-debug.log*
42+
43+
# OS / IDE
44+
ui/.DS_Store
45+
ui/Thumbs.db
46+
ui/.idea/
47+
ui/.vscode/
48+
49+
50+
ui/src-tauri/gen/

astgen.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ void AstGen::VisitIntrinsic(GraphVisitor *visitor, Inst *inst_base)
755755
void AstGen::VisitCatchPhi(GraphVisitor *visitor, Inst *inst)
756756
{
757757
std::cout << "[+] VisitCatchPhi >>>>>>>>>>>>>>>>>" << std::endl;
758+
HandleError("haha");
758759
// The Acc register stores the exception object.
759760
// Create an STA instruction if the exception is used later in virtual registers.
760761

fundepscan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ bool FunDepScan::RunImpl(){
88
size_t aliveblockcount = GetGraph()->GetAliveBlocksCount();
99
std::cout << "blockcount: " << blockcount << " , aliveblockcount: " << aliveblockcount << " , ratio: " << 1.0*aliveblockcount/blockcount << std::endl;
1010

11-
if(blockcount == 0 || (1.0 * aliveblockcount / blockcount) <= 0.8){
11+
if(blockcount == 0 || (1.0 * aliveblockcount / blockcount) <= 0.7){
1212
return false;
1313
}
1414
//std::cout << "[-] @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << std::endl;

hot.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
../out/x64.debug/arkcompiler/ets_frontend/es2abc --module --dump-symbol-table base.map --output 1.abc 1.ts
2-
../out/x64.debug/arkcompiler/ets_frontend/es2abc --module --hot-reload --input-symbol-table base.map --output demo.abc 2.ts
3-
../out/x64.debug/arkcompiler/runtime_core/ark_disasm demo.abc demo.pa
4-
rm 1.abc
1+
../out/x64.release/arkcompiler/ets_frontend/es2abc --module --dump-symbol-table base.map --output 1.abc 1.ts
2+
../out/x64.release/arkcompiler/ets_frontend/es2abc --module --hot-reload --input-symbol-table base.map --output demo.abc 2.ts
3+
../out/x64.release/arkcompiler/runtime_core/ark_disasm demo.abc demo.pa
4+
#rm 1.abc

tests/9.hotcompile.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@
2222
// let e = 5;
2323
// let m = d + e + n;
2424
// return m;
25-
// }
26-
25+
// }

ui/.cargo/config.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[build]
2+
target-dir = "target/tauri"
3+
4+
[env]
5+
TAURI_OUTPUT_DIRECTORY = "target/tauri/gen"

ui/.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# dependencies
2+
node_modules/
3+
target/
4+
5+
# logs
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
pnpm-debug.log*
10+
11+
# OS / IDE
12+
.DS_Store
13+
Thumbs.db
14+
.idea/
15+
.vscode/
16+
17+
18+
src-tauri/gen/

ui/.npmrc

Whitespace-only changes.

ui/build-electron.bat

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
@echo off
2+
setlocal
3+
cd /d "%~dp0"
4+
echo ==============================
5+
echo Building arkdecompiler (Electron)
6+
echo ==============================
7+
8+
set NEED_SYNC_DEPS=0
9+
if not exist "node_modules" (
10+
set NEED_SYNC_DEPS=1
11+
) else if exist "package-lock.json" (
12+
if not exist "node_modules\.package-lock.json" (
13+
set NEED_SYNC_DEPS=1
14+
) else (
15+
for %%I in (package-lock.json) do set LOCK_TIME=%%~tI
16+
for %%I in (node_modules\.package-lock.json) do set NM_LOCK_TIME=%%~tI
17+
if /I not "%LOCK_TIME%"=="%NM_LOCK_TIME%" (
18+
set NEED_SYNC_DEPS=1
19+
)
20+
)
21+
)
22+
23+
if "%NEED_SYNC_DEPS%"=="1" (
24+
echo Syncing npm dependencies...
25+
call npm install
26+
)
27+
28+
call npm run build:web
29+
if %errorlevel% neq 0 (
30+
echo [ERROR] Web build failed.
31+
pause
32+
exit /b 1
33+
)
34+
35+
echo Cleaning previous electron output...
36+
if exist "target\electron" rmdir /s /q "target\electron"
37+
38+
echo Trying default output: target/electron
39+
call npx electron-builder --win
40+
if %errorlevel% equ 0 (
41+
echo [OK] Electron build completed.
42+
echo Output: target/electron
43+
pause
44+
exit /b 0
45+
)
46+
47+
echo [WARN] Default output directory may be locked.
48+
echo Trying fallback output: target/electron-fallback
49+
call npx electron-builder --win --config.directories.output=target/electron-fallback
50+
if %errorlevel% neq 0 (
51+
echo [ERROR] Electron build failed on both default and fallback outputs.
52+
pause
53+
exit /b 1
54+
)
55+
56+
echo [OK] Electron build completed with fallback output.
57+
echo Output: target/electron-fallback
58+
pause

ui/build-electron.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
5+
cd "$SCRIPT_DIR"
6+
7+
OS_NAME="$(uname -s)"
8+
BUILD_TARGET=""
9+
10+
case "$OS_NAME" in
11+
Darwin)
12+
BUILD_TARGET="--mac"
13+
;;
14+
Linux)
15+
BUILD_TARGET="--linux"
16+
;;
17+
*)
18+
echo "[ERROR] Unsupported OS: $OS_NAME"
19+
echo "This script supports macOS and Linux only."
20+
exit 1
21+
;;
22+
esac
23+
24+
echo "=============================="
25+
echo "Building arkdecompiler (Electron: $OS_NAME)"
26+
echo "=============================="
27+
28+
NEED_SYNC_DEPS=0
29+
30+
if [ ! -d "node_modules" ]; then
31+
NEED_SYNC_DEPS=1
32+
elif [ -f "package-lock.json" ]; then
33+
if [ ! -f "node_modules/.package-lock.json" ] || [ "package-lock.json" -nt "node_modules/.package-lock.json" ]; then
34+
NEED_SYNC_DEPS=1
35+
fi
36+
fi
37+
38+
if [ "$NEED_SYNC_DEPS" -eq 1 ]; then
39+
echo "Syncing npm dependencies..."
40+
bash ./install-deps.sh
41+
fi
42+
43+
npm run build:web
44+
45+
echo "Trying default output: target/electron"
46+
if npx electron-builder $BUILD_TARGET; then
47+
echo "[OK] Electron build completed."
48+
echo "Output: target/electron"
49+
exit 0
50+
fi
51+
52+
echo "[WARN] Default output directory may be locked or unavailable."
53+
echo "Trying fallback output: target/electron-fallback"
54+
if npx electron-builder $BUILD_TARGET --config.directories.output=target/electron-fallback; then
55+
echo "[OK] Electron build completed with fallback output."
56+
echo "Output: target/electron-fallback"
57+
exit 0
58+
fi
59+
60+
echo "[ERROR] Electron build failed on both default and fallback outputs."
61+
exit 1

0 commit comments

Comments
 (0)