diff --git a/.github/workflows/release-proxy.yml b/.github/workflows/release-proxy.yml index dfa6b08..d9e96ee 100644 --- a/.github/workflows/release-proxy.yml +++ b/.github/workflows/release-proxy.yml @@ -54,7 +54,7 @@ jobs: # cdylib) out of the native target build. The Gradle bridge implements # vscode-gradle 3.18's JSON-RPC transport over platform-local IPC. - name: Build binaries - run: cargo build --release --target ${{ matrix.target }} -p java-lsp-proxy -p gradle-lsp-bridge + run: cargo build --locked --release --target ${{ matrix.target }} -p java-lsp-proxy -p gradle-lsp-bridge shell: bash - name: Package binaries (Unix) diff --git a/.gitignore b/.gitignore index 45f1f9d..fdf4353 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ grammars/ target/ -proxy/target/ extension.wasm .DS_Store diff --git a/Cargo.lock b/Cargo.lock index 455b15d..bd4d0eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -314,7 +314,7 @@ dependencies = [ [[package]] name = "gradle-lsp-bridge" -version = "6.8.23" +version = "6.8.30" dependencies = [ "base64", "prost", @@ -502,7 +502,7 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "java-lsp-proxy" -version = "6.8.23" +version = "6.8.30" dependencies = [ "hex", "proxy-common", @@ -639,7 +639,7 @@ dependencies = [ [[package]] name = "proxy-common" -version = "6.8.23" +version = "6.8.30" dependencies = [ "libc", "percent-encoding", diff --git a/Cargo.toml b/Cargo.toml index 5b59c67..80c3dc4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,24 +1,13 @@ -[workspace] -members = [ - ".", - "proxy", - "proxy-common", - "gradle-bridge" -] - -[workspace.dependencies] -proxy-common = { path = "proxy-common" } - [package] name = "zed_java" -version = "6.8.30" +version.workspace = true edition = "2024" -publish = false license = "Apache-2.0" +publish = false [lib] -path = "src/java.rs" crate-type = ["cdylib"] +path = "src/java.rs" [dependencies] hex = "0.4.3" @@ -30,8 +19,24 @@ sha1 = "0.10.6" zed_extension_api = "0.7.0" [dev-dependencies] +insta = { version = "1.46", features = ["yaml"] } tree-sitter = "0.26.8" tree-sitter-java = "0.23.5" # Same commit as `grammars.kotlin` in extension.toml, so the test compiles the queries Zed loads. tree-sitter-kotlin = { git = "https://github.com/fwcd/tree-sitter-kotlin", rev = "1852ea17b7f60fb3f9d84e0b1555d56b46b39fb1" } -insta = { version = "1.46", features = ["yaml"] } + +[workspace] +resolver = "3" +members = [ + ".", + "crates/gradle-bridge", + "crates/proxy", + "crates/proxy-common", +] +default-members = ["."] + +[workspace.package] +version = "6.8.30" + +[workspace.dependencies] +proxy-common = { path = "crates/proxy-common" } diff --git a/README.md b/README.md index 049f309..26cdb3f 100644 --- a/README.md +++ b/README.md @@ -745,7 +745,7 @@ If you want to contribute to this extension or test local changes, you can insta ### Prerequisites - [Rust](https://rustup.rs/) toolchain -- The `wasm32-wasip1` target: `rustup target add wasm32-wasip1` +- The `wasm32-wasip2` target: `rustup target add wasm32-wasip2` - [just](https://github.com/casey/just) command runner (optional but recommended) ### Installing as a Dev Extension diff --git a/gradle-bridge/Cargo.toml b/crates/gradle-bridge/Cargo.toml similarity index 75% rename from gradle-bridge/Cargo.toml rename to crates/gradle-bridge/Cargo.toml index 0b453f3..9d7a49d 100644 --- a/gradle-bridge/Cargo.toml +++ b/crates/gradle-bridge/Cargo.toml @@ -1,19 +1,19 @@ [package] name = "gradle-lsp-bridge" -version = "6.8.23" +version.workspace = true edition = "2021" -publish = false -license = "Apache-2.0" description = "Bridges Zed to the Gradle Language Server, driving the real gradle-server.jar over JSON-RPC for plugin-aware completions" +license = "Apache-2.0" +publish = false [[bin]] name = "gradle-lsp-bridge" path = "src/main.rs" [dependencies] +base64 = "0.22" +prost = "0.14" proxy-common = { workspace = true, features = ["tokio"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -base64 = "0.22" -prost = "0.14" -tokio = { version = "1", features = ["rt-multi-thread", "macros", "io-util", "io-std", "net", "process", "sync", "time", "fs"] } +tokio = { version = "1", features = ["fs", "io-std", "io-util", "macros", "net", "process", "rt-multi-thread", "sync", "time"] } diff --git a/gradle-bridge/proto/gradle.proto b/crates/gradle-bridge/proto/gradle.proto similarity index 100% rename from gradle-bridge/proto/gradle.proto rename to crates/gradle-bridge/proto/gradle.proto diff --git a/gradle-bridge/src/channel.rs b/crates/gradle-bridge/src/channel.rs similarity index 100% rename from gradle-bridge/src/channel.rs rename to crates/gradle-bridge/src/channel.rs diff --git a/gradle-bridge/src/gen/gradle.rs b/crates/gradle-bridge/src/gen/gradle.rs similarity index 100% rename from gradle-bridge/src/gen/gradle.rs rename to crates/gradle-bridge/src/gen/gradle.rs diff --git a/gradle-bridge/src/jsonrpc.rs b/crates/gradle-bridge/src/jsonrpc.rs similarity index 100% rename from gradle-bridge/src/jsonrpc.rs rename to crates/gradle-bridge/src/jsonrpc.rs diff --git a/gradle-bridge/src/main.rs b/crates/gradle-bridge/src/main.rs similarity index 100% rename from gradle-bridge/src/main.rs rename to crates/gradle-bridge/src/main.rs diff --git a/gradle-bridge/src/model.rs b/crates/gradle-bridge/src/model.rs similarity index 100% rename from gradle-bridge/src/model.rs rename to crates/gradle-bridge/src/model.rs diff --git a/gradle-bridge/src/proto.rs b/crates/gradle-bridge/src/proto.rs similarity index 100% rename from gradle-bridge/src/proto.rs rename to crates/gradle-bridge/src/proto.rs diff --git a/gradle-bridge/src/server.rs b/crates/gradle-bridge/src/server.rs similarity index 100% rename from gradle-bridge/src/server.rs rename to crates/gradle-bridge/src/server.rs diff --git a/gradle-bridge/src/sync.rs b/crates/gradle-bridge/src/sync.rs similarity index 100% rename from gradle-bridge/src/sync.rs rename to crates/gradle-bridge/src/sync.rs diff --git a/gradle-bridge/src/transport.rs b/crates/gradle-bridge/src/transport.rs similarity index 100% rename from gradle-bridge/src/transport.rs rename to crates/gradle-bridge/src/transport.rs diff --git a/proxy-common/Cargo.toml b/crates/proxy-common/Cargo.toml similarity index 69% rename from proxy-common/Cargo.toml rename to crates/proxy-common/Cargo.toml index 4de15ac..f1bf5e7 100644 --- a/proxy-common/Cargo.toml +++ b/crates/proxy-common/Cargo.toml @@ -1,26 +1,26 @@ [package] name = "proxy-common" -version = "6.8.23" +version.workspace = true edition = "2021" -publish = false -license = "Apache-2.0" description = "Shared primitives (LSP framing, parent-process monitor) for the Zed Java extension's native binaries" +license = "Apache-2.0" +publish = false + +[features] +tokio = ["dep:tokio"] [lib] name = "proxy_common" path = "src/lib.rs" -[features] -tokio = ["dep:tokio"] - [dependencies] percent-encoding = "2.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tokio = { version = "1", default-features = false, features = ["io-util"], optional = true } -[target.'cfg(unix)'.dependencies] +[target."cfg(unix)".dependencies] libc = "0.2" -[target.'cfg(windows)'.dependencies] -windows-sys = { version = "0.59", features = ["Win32_System_Threading", "Win32_Foundation", "Win32_System_Diagnostics_ToolHelp"] } +[target."cfg(windows)".dependencies] +windows-sys = { version = "0.59", features = ["Win32_Foundation", "Win32_System_Diagnostics_ToolHelp", "Win32_System_Threading"] } diff --git a/proxy-common/src/lib.rs b/crates/proxy-common/src/lib.rs similarity index 100% rename from proxy-common/src/lib.rs rename to crates/proxy-common/src/lib.rs diff --git a/proxy-common/src/lsp.rs b/crates/proxy-common/src/lsp.rs similarity index 100% rename from proxy-common/src/lsp.rs rename to crates/proxy-common/src/lsp.rs diff --git a/proxy-common/src/platform/mod.rs b/crates/proxy-common/src/platform/mod.rs similarity index 100% rename from proxy-common/src/platform/mod.rs rename to crates/proxy-common/src/platform/mod.rs diff --git a/proxy-common/src/platform/unix.rs b/crates/proxy-common/src/platform/unix.rs similarity index 100% rename from proxy-common/src/platform/unix.rs rename to crates/proxy-common/src/platform/unix.rs diff --git a/proxy-common/src/platform/windows.rs b/crates/proxy-common/src/platform/windows.rs similarity index 100% rename from proxy-common/src/platform/windows.rs rename to crates/proxy-common/src/platform/windows.rs diff --git a/proxy-common/src/uri.rs b/crates/proxy-common/src/uri.rs similarity index 100% rename from proxy-common/src/uri.rs rename to crates/proxy-common/src/uri.rs diff --git a/proxy/.cargo/config.toml b/crates/proxy/.cargo/config.toml similarity index 100% rename from proxy/.cargo/config.toml rename to crates/proxy/.cargo/config.toml diff --git a/proxy/Cargo.toml b/crates/proxy/Cargo.toml similarity index 93% rename from proxy/Cargo.toml rename to crates/proxy/Cargo.toml index 50a81fe..978fb12 100644 --- a/proxy/Cargo.toml +++ b/crates/proxy/Cargo.toml @@ -1,18 +1,18 @@ [package] name = "java-lsp-proxy" -version = "6.8.23" +version.workspace = true edition = "2021" -publish = false -license = "Apache-2.0" description = "Native LSP proxy for the Zed Java extension" +license = "Apache-2.0" +publish = false [[bin]] name = "java-lsp-proxy" path = "src/main.rs" [dependencies] -proxy-common.workspace = true hex = "0.4" +proxy-common.workspace = true serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" sha1 = "0.10" diff --git a/proxy/src/completions.rs b/crates/proxy/src/completions.rs similarity index 100% rename from proxy/src/completions.rs rename to crates/proxy/src/completions.rs diff --git a/proxy/src/decompile.rs b/crates/proxy/src/decompile.rs similarity index 100% rename from proxy/src/decompile.rs rename to crates/proxy/src/decompile.rs diff --git a/proxy/src/http.rs b/crates/proxy/src/http.rs similarity index 100% rename from proxy/src/http.rs rename to crates/proxy/src/http.rs diff --git a/proxy/src/log.rs b/crates/proxy/src/log.rs similarity index 100% rename from proxy/src/log.rs rename to crates/proxy/src/log.rs diff --git a/proxy/src/main.rs b/crates/proxy/src/main.rs similarity index 100% rename from proxy/src/main.rs rename to crates/proxy/src/main.rs diff --git a/proxy/src/output.rs b/crates/proxy/src/output.rs similarity index 100% rename from proxy/src/output.rs rename to crates/proxy/src/output.rs diff --git a/proxy/src/pending.rs b/crates/proxy/src/pending.rs similarity index 100% rename from proxy/src/pending.rs rename to crates/proxy/src/pending.rs diff --git a/justfile b/justfile index 248e709..b605eb1 100644 --- a/justfile +++ b/justfile @@ -9,7 +9,7 @@ proxy-build: # Build proxy in release mode proxy-release: - cd proxy && cargo build --release --target {{ native_target }} + cargo build --release --target {{ native_target }} -p java-lsp-proxy # Build proxy release and install to extension workdir for testing proxy-install: proxy-release @@ -18,6 +18,7 @@ proxy-install: proxy-release @echo "Installed to {{ ext_dir }}" # --- Core recipes --- + # Build gradle-lsp-bridge in debug mode bridge-build: cargo build --target {{ native_target }} -p gradle-lsp-bridge @@ -34,7 +35,7 @@ bridge-install: bridge-release # Build WASM extension in release mode ext-build: - cargo build --release + cargo build --locked --release --target wasm32-wasip2 -p zed_java # Format all code fmt: diff --git a/proxy/Cargo.lock b/proxy/Cargo.lock deleted file mode 100644 index 956558d..0000000 --- a/proxy/Cargo.lock +++ /dev/null @@ -1,188 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "itoa" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" - -[[package]] -name = "java-lsp-proxy" -version = "6.8.12" -dependencies = [ - "libc", - "serde", - "serde_json", - "windows-sys", -] - -[[package]] -name = "libc" -version = "0.2.182" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" - -[[package]] -name = "memchr" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" - -[[package]] -name = "proc-macro2" -version = "1.0.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "serde" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_core" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.149" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" -dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - -[[package]] -name = "syn" -version = "2.0.117" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "zmij" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"