Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/release-proxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release Proxy Binary

on:
release:
types: [published]

permissions:
contents: write

jobs:
build:
name: Build ${{ matrix.asset_name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: true
matrix:
include:
- target: aarch64-apple-darwin
runner: macos-14
asset_name: java-lsp-proxy-darwin-aarch64.tar.gz
- target: x86_64-apple-darwin
runner: macos-15-intel
asset_name: java-lsp-proxy-darwin-x86_64.tar.gz
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
asset_name: java-lsp-proxy-linux-x86_64.tar.gz
- target: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
asset_name: java-lsp-proxy-linux-aarch64.tar.gz
- target: x86_64-pc-windows-msvc
runner: windows-latest
asset_name: java-lsp-proxy-windows-x86_64.zip
- target: aarch64-pc-windows-msvc
runner: windows-11-arm
asset_name: java-lsp-proxy-windows-aarch64.zip

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Build proxy binary
working-directory: proxy
run: cargo build --release --target ${{ matrix.target }}
shell: bash

- name: Package binary (Unix)
if: runner.os != 'Windows'
run: |
tar -czf ${{ matrix.asset_name }} \
-C target/${{ matrix.target }}/release \
java-lsp-proxy

- name: Package binary (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive -Path target/${{ matrix.target }}/release/java-lsp-proxy.exe -DestinationPath ${{ matrix.asset_name }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.asset_name }}
retention-days: 1

release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
grammars/
target/
proxy/target/
extension.wasm
.DS_Store
83 changes: 83 additions & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[workspace]
members = [
".",
"proxy"
]

[package]
name = "zed_java"
Expand Down
33 changes: 33 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
native_target := `rustc -vV | grep host | awk '{print $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" }
proxy_bin := ext_dir / "proxy-bin" / "java-lsp-proxy"

# Build proxy in debug mode
proxy-build:
cd proxy && cargo build --target {{ native_target }}

# Build proxy in release mode
proxy-release:
cd proxy && cargo build --release --target {{ native_target }}

# Build proxy release and install to extension workdir for testing
proxy-install: proxy-release
mkdir -p "{{ ext_dir }}/proxy-bin"
cp "target/{{ native_target }}/release/java-lsp-proxy" "{{ proxy_bin }}"
@echo "Installed to {{ proxy_bin }}"

# Build WASM extension in release mode
ext-build:
cargo build --release

# Format all code
fmt:
cargo fmt --all

# Run clippy on both crates
clippy:
cargo clippy --all-targets --fix --allow-dirty
cd proxy && cargo clippy --all-targets --fix --allow-dirty --target {{ native_target }}

# Build everything: fmt, clippy, extension, proxy install
all: fmt clippy ext-build proxy-install
2 changes: 2 additions & 0 deletions proxy/.cargo/config.toml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust-analyzer without it wasn't able to recognize the active code behind cfg. I'm open to better options. The idea otherwise was to provide all possible values as comment and ask the maintainer to select the proper system.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
target = "aarch64-apple-darwin"
Loading