Skip to content

Commit 9081f44

Browse files
authored
JDTLS Rust Proxy (#214)
A new proxy written entirely in Rust. Motivation - **Eliminates the Node.js runtime dependency** - **Faster cold start** as no V8 JIT warmup - **Lower memory footprint** as no garbage collector overhead
1 parent cb0c7d6 commit 9081f44

20 files changed

Lines changed: 1283 additions & 350 deletions

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Release Proxy Binary
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build:
12+
name: Build ${{ matrix.asset_name }}
13+
runs-on: ${{ matrix.runner }}
14+
strategy:
15+
fail-fast: true
16+
matrix:
17+
include:
18+
- target: aarch64-apple-darwin
19+
runner: macos-14
20+
asset_name: java-lsp-proxy-darwin-aarch64.tar.gz
21+
- target: x86_64-apple-darwin
22+
runner: macos-15-intel
23+
asset_name: java-lsp-proxy-darwin-x86_64.tar.gz
24+
- target: x86_64-unknown-linux-gnu
25+
runner: ubuntu-latest
26+
asset_name: java-lsp-proxy-linux-x86_64.tar.gz
27+
- target: aarch64-unknown-linux-gnu
28+
runner: ubuntu-24.04-arm
29+
asset_name: java-lsp-proxy-linux-aarch64.tar.gz
30+
- target: x86_64-pc-windows-msvc
31+
runner: windows-latest
32+
asset_name: java-lsp-proxy-windows-x86_64.zip
33+
- target: aarch64-pc-windows-msvc
34+
runner: windows-11-arm
35+
asset_name: java-lsp-proxy-windows-aarch64.zip
36+
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Install Rust toolchain
42+
uses: dtolnay/rust-toolchain@stable
43+
with:
44+
targets: ${{ matrix.target }}
45+
46+
- name: Build proxy binary
47+
working-directory: proxy
48+
run: cargo build --release --target ${{ matrix.target }}
49+
shell: bash
50+
51+
- name: Package binary (Unix)
52+
if: runner.os != 'Windows'
53+
run: |
54+
tar -czf ${{ matrix.asset_name }} \
55+
-C target/${{ matrix.target }}/release \
56+
java-lsp-proxy
57+
58+
- name: Package binary (Windows)
59+
if: runner.os == 'Windows'
60+
shell: pwsh
61+
run: |
62+
Compress-Archive -Path target/${{ matrix.target }}/release/java-lsp-proxy.exe -DestinationPath ${{ matrix.asset_name }}
63+
64+
- name: Upload artifact
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: ${{ matrix.asset_name }}
68+
path: ${{ matrix.asset_name }}
69+
retention-days: 1
70+
71+
release:
72+
name: Create Release
73+
needs: build
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Download all artifacts
77+
uses: actions/download-artifact@v4
78+
with:
79+
path: artifacts
80+
merge-multiple: true
81+
82+
- name: Upload release assets
83+
uses: softprops/action-gh-release@v2
84+
with:
85+
files: artifacts/*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
grammars/
22
target/
3+
proxy/target/
34
extension.wasm
45
.DS_Store

Cargo.lock

Lines changed: 83 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
[workspace]
2+
members = [
3+
".",
4+
"proxy"
5+
]
16

27
[package]
38
name = "zed_java"

justfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
native_target := `rustc -vV | grep host | awk '{print $2}'`
2+
ext_dir := if os() == "macos" { env("HOME") / "Library/Application Support/Zed/extensions/work/java" } else if os() == "linux" { env("HOME") / ".local/share/zed/extensions/work/java" } else { env("LOCALAPPDATA") / "Zed/extensions/work/java" }
3+
proxy_bin := ext_dir / "proxy-bin" / "java-lsp-proxy"
4+
5+
# Build proxy in debug mode
6+
proxy-build:
7+
cd proxy && cargo build --target {{ native_target }}
8+
9+
# Build proxy in release mode
10+
proxy-release:
11+
cd proxy && cargo build --release --target {{ native_target }}
12+
13+
# Build proxy release and install to extension workdir for testing
14+
proxy-install: proxy-release
15+
mkdir -p "{{ ext_dir }}/proxy-bin"
16+
cp "target/{{ native_target }}/release/java-lsp-proxy" "{{ proxy_bin }}"
17+
@echo "Installed to {{ proxy_bin }}"
18+
19+
# Build WASM extension in release mode
20+
ext-build:
21+
cargo build --release
22+
23+
# Format all code
24+
fmt:
25+
cargo fmt --all
26+
27+
# Run clippy on both crates
28+
clippy:
29+
cargo clippy --all-targets --fix --allow-dirty
30+
cd proxy && cargo clippy --all-targets --fix --allow-dirty --target {{ native_target }}
31+
32+
# Build everything: fmt, clippy, extension, proxy install
33+
all: fmt clippy ext-build proxy-install

proxy/.cargo/config.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build]
2+
target = "aarch64-apple-darwin"
3+
# target = "x86_64-apple-darwin"
4+
# target = "x86_64-unknown-linux-gnu"
5+
# target = "aarch64-unknown-linux-gnu"
6+
# target = "x86_64-pc-windows-msvc"
7+
# target = "aarch64-pc-windows-msvc"

0 commit comments

Comments
 (0)