Skip to content

Commit 227ef28

Browse files
committed
objdiff-wasm build improvements
1 parent 678210d commit 227ef28

File tree

12 files changed

+72
-56
lines changed

12 files changed

+72
-56
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ jobs:
3636
- name: Cache Rust workspace
3737
uses: Swatinem/rust-cache@v2
3838
- name: Cargo check
39-
run: cargo check --all-targets --all-features
39+
run: cargo check --all-targets --all-features --workspace
4040
- name: Cargo clippy
41-
run: cargo clippy --all-targets --all-features
41+
run: cargo clippy --all-targets --all-features --workspace
4242

4343
fmt:
4444
name: Format
@@ -92,7 +92,7 @@ jobs:
9292
- name: Cache Rust workspace
9393
uses: Swatinem/rust-cache@v2
9494
- name: Cargo test
95-
run: cargo test --release --features all
95+
run: cargo test --release --all-features --workspace
9696

9797
build-cli:
9898
name: Build objdiff-cli

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
description: Run cargo clippy on all project files.
2525
language: system
2626
entry: cargo
27-
args: ["+nightly", "clippy", "--all-targets", "--all-features"]
27+
args: ["+nightly", "clippy", "--all-targets", "--all-features", "--workspace"]
2828
pass_filenames: false
2929
- id: cargo-deny
3030
name: cargo deny

Cargo.lock

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

Cargo.toml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,28 @@ members = [
55
"objdiff-gui",
66
"objdiff-wasm",
77
]
8+
default-members = [
9+
"objdiff-cli",
10+
"objdiff-core",
11+
"objdiff-gui",
12+
# Exclude objdiff-wasm by default
13+
]
814
resolver = "3"
915

10-
[profile.release-lto]
11-
inherits = "release"
12-
lto = "fat"
13-
strip = "debuginfo"
14-
codegen-units = 1
15-
1616
[workspace.package]
17-
version = "3.0.0"
17+
version = "3.0.1"
1818
authors = ["Luke Street <[email protected]>"]
1919
edition = "2024"
2020
license = "MIT OR Apache-2.0"
2121
repository = "https://github.com/encounter/objdiff"
2222
rust-version = "1.88"
23+
24+
[profile.release-lto]
25+
inherits = "release"
26+
lto = "fat"
27+
strip = "debuginfo"
28+
codegen-units = 1
29+
30+
[profile.release-min]
31+
inherits = "release-lto"
32+
opt-level = "z"

deny.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ ignore = [
7474
#"[email protected]", # you can also ignore yanked crate versions if you wish
7575
#{ crate = "[email protected]", reason = "you can specify why you are ignoring the yanked crate" },
7676
{ id = "RUSTSEC-2024-0436", reason = "Unmaintained paste crate is an indirect dependency" },
77+
{ id = "RUSTSEC-2025-0052", reason = "Unmaintained async-std crate is an indirect dependency" },
7778
]
7879
# If this is true, then cargo deny will use the git executable to fetch advisory database.
7980
# If this is false, then it uses a built-in git library.
@@ -241,8 +242,8 @@ allow-git = []
241242
[sources.allow-org]
242243
# github.com organizations to allow git sources for
243244
github = [
244-
"enarx", # flagset
245245
"encounter",
246+
"gimli-rs", # gimli
246247
]
247248
# gitlab.com organizations to allow git sources for
248249
gitlab = []

objdiff-core/src/jobs/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,6 @@ pub enum JobResult {
170170
CreateScratch(Option<Box<CreateScratchResult>>),
171171
}
172172

173-
fn should_cancel(rx: &Receiver<()>) -> bool {
174-
match rx.try_recv() {
175-
Ok(_) | Err(TryRecvError::Disconnected) => true,
176-
Err(_) => false,
177-
}
178-
}
179-
180173
fn start_job(
181174
waker: Waker,
182175
title: &str,
@@ -203,7 +196,6 @@ fn start_job(
203196
}
204197
});
205198
let id = JOB_ID.fetch_add(1, Ordering::Relaxed);
206-
// log::info!("Started job {}", id); TODO
207199
JobState { id, kind, handle: Some(handle), context, cancel: tx }
208200
}
209201

@@ -228,3 +220,10 @@ fn update_status(
228220
context.waker.wake_by_ref();
229221
Ok(())
230222
}
223+
224+
fn should_cancel(rx: &Receiver<()>) -> bool {
225+
match rx.try_recv() {
226+
Ok(_) | Err(TryRecvError::Disconnected) => true,
227+
Err(_) => false,
228+
}
229+
}

objdiff-wasm/.cargo/config.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build]
2+
target = "wasm32-wasip2"
3+
4+
[unstable]
5+
build-std = ["panic_abort", "core", "alloc"]
6+
build-std-features = ["compiler-builtins-mem"]

objdiff-wasm/Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ build = "build.rs"
1717
crate-type = ["cdylib"]
1818

1919
[features]
20-
default = ["std"]
20+
default = []
2121
std = ["objdiff-core/std"]
2222

2323
[dependencies]
2424
log = { version = "0.4", default-features = false }
2525
regex = { version = "1.11", default-features = false, features = ["unicode-case"] }
26+
wit-bindgen = { version = "0.44", default-features = false, features = ["macros"] }
2627
xxhash-rust = { version = "0.8", default-features = false, features = ["xxh3"] }
2728

2829
[dependencies.objdiff-core]
@@ -33,8 +34,5 @@ features = ["arm", "arm64", "mips", "ppc", "superh", "x86", "dwarf"]
3334
[target.'cfg(target_family = "wasm")'.dependencies]
3435
talc = { version = "4.4", default-features = false, features = ["lock_api"] }
3536

36-
[target.'cfg(target_os = "wasi")'.dependencies]
37-
wit-bindgen = { version = "0.43", default-features = false, features = ["macros"] }
38-
3937
[build-dependencies]
4038
wit-deps = "0.5"

objdiff-wasm/package-lock.json

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

objdiff-wasm/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "objdiff-wasm",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "A local diffing tool for decompilation projects.",
55
"author": {
66
"name": "Luke Street",
@@ -19,8 +19,8 @@
1919
"types": "dist/objdiff.d.ts",
2020
"scripts": {
2121
"build": "npm run build:wasm && npm run build:transpile && npm run build:lib",
22-
"build:wasm": "cargo +nightly -Zbuild-std=panic_abort,core,alloc -Zbuild-std-features=compiler-builtins-mem build --target wasm32-wasip2 --release --no-default-features",
23-
"build:transpile": "jco transpile ../target/wasm32-wasip2/release/objdiff_wasm.wasm --no-nodejs-compat --no-wasi-shim --no-namespaced-exports --map wasi:logging/logging=./wasi-logging.js --optimize -o pkg --name objdiff",
22+
"build:wasm": "cargo build --profile release-min --no-default-features",
23+
"build:transpile": "jco transpile ../target/wasm32-wasip2/release-min/objdiff_wasm.wasm --no-nodejs-compat --no-wasi-shim --no-namespaced-exports --map wasi:logging/logging=./wasi-logging.js --optimize -o pkg --name objdiff",
2424
"build:lib": "rslib build"
2525
},
2626
"devDependencies": {

0 commit comments

Comments
 (0)