Skip to content

Commit 6fb61b5

Browse files
committed
feat(java): edit native compiler targets and local JAR dependencies
1 parent 9933d75 commit 6fb61b5

26 files changed

Lines changed: 1423 additions & 17 deletions

‎.github/workflows/ci.yml‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
node-version: 22
3434
- name: Test package resources
3535
run: node --test --test-timeout=60000 scripts/package/*.test.mjs
36+
- name: Test bounded integration tool cleanup
37+
run: node --test --test-timeout=15000 scripts/compiler/process.test.mjs
3638
- name: Check formatting
3739
run: cargo fmt --all --check
3840
- name: Lint
@@ -74,6 +76,17 @@ jobs:
7476
package=$(scripts/build-package.sh --arch "$arch")
7577
scripts/archive-package.sh --package "$package" --arch "$arch"
7678
done
79+
- name: Verify native compiler settings and JARs with JDT
80+
run: |
81+
package=".artifacts/package/$(uname -m)/io.github.lithe-idea.java-support"
82+
node scripts/compiler/test-live.mjs "$package"
83+
LITHE_JAVA_PROJECT_KIND=eclipse node scripts/compiler/test-live.mjs "$package"
84+
- name: Upload native compiler projections
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: native-compiler-projection
88+
path: .artifacts/compiler/visual-*.json
89+
if-no-files-found: error
7790
- name: Upload the archives
7891
uses: actions/upload-artifact@v4
7992
with:
@@ -126,3 +139,42 @@ jobs:
126139
dist/*-linux-*.zip.sha256
127140
if-no-files-found: error
128141
retention-days: 7
142+
143+
native-settings-visual:
144+
name: Native compiler settings screenshots
145+
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
146+
needs: package
147+
runs-on: ubuntu-latest
148+
timeout-minutes: 25
149+
steps:
150+
- uses: actions/checkout@v4
151+
- uses: actions/download-artifact@v4
152+
with:
153+
name: native-compiler-projection
154+
path: .artifacts/compiler
155+
- name: Read pinned host revision
156+
id: host
157+
run: echo "revision=$(node -p 'JSON.parse(require("fs").readFileSync("compiler-host.json")).revision')" >> "$GITHUB_OUTPUT"
158+
- uses: actions/checkout@v4
159+
with:
160+
repository: 1lck/Lithe-IDEA
161+
ref: ${{ steps.host.outputs.revision }}
162+
path: .artifacts/host
163+
- uses: actions/setup-go@v5
164+
with:
165+
go-version-file: .artifacts/host/desktop/go.mod
166+
cache: false
167+
- uses: dtolnay/rust-toolchain@master
168+
with:
169+
toolchain: 1.100.0
170+
- uses: actions/setup-node@v4
171+
with:
172+
node-version: 22
173+
- name: Render actual compiler projections through the native host
174+
run: node scripts/compiler/visual.mjs .artifacts/host
175+
- uses: actions/upload-artifact@v4
176+
with:
177+
name: native-compiler-settings-screenshots
178+
path: .artifacts/compiler/visual/
179+
if-no-files-found: error
180+
retention-days: 14

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release
33
# Tags must match plugin.json. Build macOS arm64/x64, Windows x64 and Linux
44
# ARM64/x64 packages from the same revision, then upload a draft prerelease.
55
# The maintainer verifies the downloaded assets before publishing the draft.
6-
# Contract 0 currently requires the matching Viva preview, not stable Lithe.
6+
# Publish only after verification and after a stable desktop supports the required capabilities.
77
on:
88
push:
99
tags: ["v*"]

‎Cargo.lock‎

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

‎backend/Cargo.toml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ base64 = "0.22.1"
2020
zip.workspace = true
2121
url.workspace = true
2222
dunce = "1.0.5"
23+
24+
sha2.workspace = true
25+
java-properties = "2.0.0"
26+
xmltree = "0.12.0"
27+
jsonc-parser = { version = "0.34.0", features = ["cst", "serde"] }
28+
libc = "0.2"

‎backend/src/launch.rs‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,14 +647,22 @@ pub fn resolve_launch_function(
647647
};
648648
let trigger_files = trigger_files(&folders)?;
649649
context.check_cancelled()?;
650-
let answer = resolve(
650+
let mut answer = resolve(
651651
&request,
652652
&package_root,
653653
&fragments,
654654
&trigger_files,
655655
now_unix_seconds(),
656656
&report,
657657
)?;
658+
if let Some(folder) = folders.first() {
659+
let configuration = crate::settings_session::with_native_settings(
660+
answer["workspaceConfiguration"].clone(),
661+
folder,
662+
)?;
663+
answer["workspaceConfiguration"] = configuration.clone();
664+
answer["initializationOptions"]["settings"] = configuration;
665+
}
658666
context.check_cancelled()?;
659667
Ok(answer)
660668
}

‎backend/src/lib.rs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
pub mod class_content;
5151
pub mod launch;
5252
pub mod plugin_functions;
53+
pub mod project_settings;
5354
pub mod run;
5455
pub mod settings_session;
5556

@@ -240,6 +241,18 @@ pub fn backend() -> Result<Backend, SdkError> {
240241
let run_session = Arc::clone(&run_session);
241242
move |params, context| run::rerun_function(&run_session, params, context)
242243
})?;
244+
let projects = Arc::new(project_settings::ProjectSettings::default());
245+
for (function, libraries) in [("compiler.settings", false), ("libraries.settings", true)] {
246+
let projects = Arc::clone(&projects);
247+
let session = Arc::clone(&session);
248+
backend.function(function, move |params, context| {
249+
projects.snapshot(params, context, libraries, &session)
250+
})?;
251+
backend.suppress_success_diagnostics(function)?;
252+
}
253+
backend.function("compiler.prepareSettings", move |params, context| {
254+
projects.edit(params, context)
255+
})?;
243256
Ok(backend)
244257
}
245258

0 commit comments

Comments
 (0)