Skip to content

Commit eaf651d

Browse files
committed
Add Null-Safe C playground with side-by-side comparison
- Interactive web-based playground for testing Null-Safe C - Split-pane output showing null-safety warnings vs suppressed warnings - Terminal-style output with full clang command visible - Clean blue monotone UI with syntax highlighting - URL-based code sharing with base64 encoding - GitHub Actions workflow for building WASM files - Loads WASM from GitHub releases in production, local files in development - Auto-compile on load and Ctrl+Enter keyboard shortcut
1 parent 81053e2 commit eaf651d

File tree

4 files changed

+373
-169
lines changed

4 files changed

+373
-169
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build Playground WASM
2+
3+
on:
4+
push:
5+
tags:
6+
- 'playground-v*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-wasm:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
submodules: recursive
18+
19+
- name: Setup Emscripten
20+
uses: mymindstorm/setup-emsdk@v14
21+
with:
22+
version: 'latest'
23+
24+
- name: Install dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y ninja-build cmake
28+
29+
- name: Configure WASM build (Null-Safe Clang)
30+
run: |
31+
mkdir -p build-wasm
32+
cd build-wasm
33+
emcmake cmake -G Ninja \
34+
-DCMAKE_BUILD_TYPE=Release \
35+
-DLLVM_ENABLE_PROJECTS="clang" \
36+
-DLLVM_TARGETS_TO_BUILD="WebAssembly" \
37+
-DLLVM_ENABLE_THREADS=OFF \
38+
-DLLVM_ENABLE_EH=OFF \
39+
-DLLVM_ENABLE_RTTI=OFF \
40+
-DLLVM_BUILD_TOOLS=OFF \
41+
-DLLVM_BUILD_UTILS=OFF \
42+
-DLLVM_INCLUDE_TESTS=OFF \
43+
-DLLVM_INCLUDE_EXAMPLES=OFF \
44+
-DLLVM_ENABLE_TERMINFO=OFF \
45+
-DLLVM_ENABLE_ZLIB=OFF \
46+
-DLLVM_ENABLE_LIBXML2=OFF \
47+
-DCMAKE_EXE_LINKER_FLAGS="-sEXPORTED_RUNTIME_METHODS=callMain" \
48+
../llvm
49+
50+
- name: Build Null-Safe Clang WASM
51+
run: |
52+
cd build-wasm
53+
ninja clang
54+
55+
- name: Prepare artifacts
56+
run: |
57+
mkdir -p artifacts
58+
cp build-wasm/bin/clang.wasm artifacts/clang-nullsafe.wasm
59+
cp build-wasm/bin/clang.js artifacts/clang-nullsafe.js
60+
61+
# Compress for better download speeds
62+
gzip -k artifacts/clang-nullsafe.wasm
63+
gzip -k artifacts/clang-nullsafe.js
64+
65+
ls -lh artifacts/
66+
67+
- name: Upload artifacts
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: playground-wasm-files
71+
path: artifacts/*
72+
73+
- name: Create Release
74+
if: startsWith(github.ref, 'refs/tags/')
75+
uses: softprops/action-gh-release@v1
76+
with:
77+
files: |
78+
artifacts/clang-nullsafe.wasm
79+
artifacts/clang-nullsafe.js
80+
artifacts/clang-nullsafe.wasm.gz
81+
artifacts/clang-nullsafe.js.gz
82+
body: |
83+
## Null-Safe Clang Playground WASM Files
84+
85+
This release contains the WebAssembly build of Null-Safe Clang for use in the browser playground.
86+
87+
### Files:
88+
- `clang-nullsafe.wasm` - WebAssembly binary (~63MB)
89+
- `clang-nullsafe.js` - Emscripten JavaScript glue code
90+
- `*.gz` - Compressed versions for faster downloads
91+
92+
### Usage:
93+
These files are automatically referenced by the playground at:
94+
https://cs01.github.io/llvm-project/
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

nullsafe-playground/.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
# Generated WASM files (too large to commit, will be built from source)
1+
# Generated WASM files (too large to commit, will be built from source or downloaded from releases)
22
clang.wasm
33
clang.js
4+
clang-nullsafe.wasm
5+
clang-nullsafe.js
6+
clang-mainline.wasm
7+
clang-mainline.js
48

59
# Python cache
610
__pycache__/

0 commit comments

Comments
 (0)