diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2e933c3..072b2f7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -36,9 +36,9 @@ jobs: - name: Cache Rust workspace uses: Swatinem/rust-cache@v2 - name: Cargo check - run: cargo check --all-targets --all-features + run: cargo check --all-targets --all-features --workspace - name: Cargo clippy - run: cargo clippy --all-targets --all-features + run: cargo clippy --all-targets --all-features --workspace fmt: name: Format @@ -92,7 +92,7 @@ jobs: - name: Cache Rust workspace uses: Swatinem/rust-cache@v2 - name: Cargo test - run: cargo test --release --features all + run: cargo test --release --all-features --workspace build-cli: name: Build objdiff-cli diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 922825d..8a7d813 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: description: Run cargo clippy on all project files. language: system entry: cargo - args: ["+nightly", "clippy", "--all-targets", "--all-features"] + args: ["+nightly", "clippy", "--all-targets", "--all-features", "--workspace"] pass_filenames: false - id: cargo-deny name: cargo deny diff --git a/Cargo.lock b/Cargo.lock index c7e78af..9cfa944 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3436,7 +3436,7 @@ dependencies = [ [[package]] name = "objdiff-cli" -version = "3.0.0" +version = "3.0.1" dependencies = [ "anyhow", "argp", @@ -3459,7 +3459,7 @@ dependencies = [ [[package]] name = "objdiff-core" -version = "3.0.0" +version = "3.0.1" dependencies = [ "anyhow", "arm-attr", @@ -3514,7 +3514,7 @@ dependencies = [ [[package]] name = "objdiff-gui" -version = "3.0.0" +version = "3.0.1" dependencies = [ "anyhow", "argp", @@ -3551,7 +3551,7 @@ dependencies = [ [[package]] name = "objdiff-wasm" -version = "3.0.0" +version = "3.0.1" dependencies = [ "log", "objdiff-core", @@ -5863,9 +5863,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.235.0" +version = "0.236.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3bc393c395cb621367ff02d854179882b9a351b4e0c93d1397e6090b53a5c2a" +checksum = "724fccfd4f3c24b7e589d333fc0429c68042897a7e8a5f8694f31792471841e7" dependencies = [ "leb128fmt", "wasmparser", @@ -5873,9 +5873,9 @@ dependencies = [ [[package]] name = "wasm-metadata" -version = "0.235.0" +version = "0.236.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b055604ba04189d54b8c0ab2c2fc98848f208e103882d5c0b984f045d5ea4d20" +checksum = "c909f94a49a8de3365f3c0344f064818f1e369ff1740c5b04f455f85d454768e" dependencies = [ "anyhow", "indexmap", @@ -5898,9 +5898,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.235.0" +version = "0.236.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161296c618fa2d63f6ed5fffd1112937e803cb9ec71b32b01a76321555660917" +checksum = "a9b1e81f3eb254cf7404a82cee6926a4a3ccc5aad80cc3d43608a070c67aa1d7" dependencies = [ "bitflags 2.9.1", "hashbrown", @@ -6726,19 +6726,19 @@ dependencies = [ [[package]] name = "wit-bindgen" -version = "0.43.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a18712ff1ec5bd09da500fe1e91dec11256b310da0ff33f8b4ec92b927cf0c6" +checksum = "04bd9ed271234163b18c92783b0d406f08ca32c232e972f207a68c7b324c44bf" dependencies = [ - "wit-bindgen-rt 0.43.0", + "wit-bindgen-rt 0.44.0", "wit-bindgen-rust-macro", ] [[package]] name = "wit-bindgen-core" -version = "0.43.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c53468e077362201de11999c85c07c36e12048a990a3e0d69da2bd61da355d0" +checksum = "b4103c7a3e178b75cd8b0b574fa199ed015e8399c9859b003865cc28834b474b" dependencies = [ "anyhow", "heck", @@ -6756,18 +6756,18 @@ dependencies = [ [[package]] name = "wit-bindgen-rt" -version = "0.43.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd734226eac1fd7c450956964e3a9094c9cee65e9dafdf126feef8c0096db65" +checksum = "653c85dd7aee6fe6f4bded0d242406deadae9819029ce6f7d258c920c384358a" dependencies = [ "bitflags 2.9.1", ] [[package]] name = "wit-bindgen-rust" -version = "0.43.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "531ebfcec48e56473805285febdb450e270fa75b2dacb92816861d0473b4c15f" +checksum = "95d164b3b6fbd2b0dd8b639b1012110c0bc256519a0a6def410d4020fa8ae106" dependencies = [ "anyhow", "heck", @@ -6781,9 +6781,9 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.43.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7852bf8a9d1ea80884d26b864ddebd7b0c7636697c6ca10f4c6c93945e023966" +checksum = "2c9100a5e1ac85e526dcd4ef49c3ff7689e026fa5e56e2a2047fd377fc682e02" dependencies = [ "anyhow", "prettyplease", @@ -6796,9 +6796,9 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.235.0" +version = "0.236.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a57a11109cc553396f89f3a38a158a97d0b1adaec113bd73e0f64d30fb601f" +checksum = "3622959ed7ed6341c38e5aa35af243632534b0a36226852faa802939ce11e00f" dependencies = [ "anyhow", "bitflags 2.9.1", @@ -6840,9 +6840,9 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.235.0" +version = "0.236.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1f95a87d03a33e259af286b857a95911eb46236a0f726cbaec1227b3dfc67a" +checksum = "16e4833a20cd6e85d6abfea0e63a399472d6f88c6262957c17f546879a80ba15" dependencies = [ "anyhow", "id-arena", diff --git a/Cargo.toml b/Cargo.toml index c5f9fe6..5ecec1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,18 +5,28 @@ members = [ "objdiff-gui", "objdiff-wasm", ] +default-members = [ + "objdiff-cli", + "objdiff-core", + "objdiff-gui", + # Exclude objdiff-wasm by default +] resolver = "3" +[workspace.package] +version = "3.0.1" +authors = ["Luke Street "] +edition = "2024" +license = "MIT OR Apache-2.0" +repository = "https://github.com/encounter/objdiff" +rust-version = "1.88" + [profile.release-lto] inherits = "release" lto = "fat" strip = "debuginfo" codegen-units = 1 -[workspace.package] -version = "3.0.0" -authors = ["Luke Street "] -edition = "2024" -license = "MIT OR Apache-2.0" -repository = "https://github.com/encounter/objdiff" -rust-version = "1.88" +[profile.release-min] +inherits = "release-lto" +opt-level = "z" diff --git a/deny.toml b/deny.toml index 17cdf4e..623b9d2 100644 --- a/deny.toml +++ b/deny.toml @@ -74,6 +74,7 @@ ignore = [ #"a-crate-that-is-yanked@0.1.1", # you can also ignore yanked crate versions if you wish #{ crate = "a-crate-that-is-yanked@0.1.1", reason = "you can specify why you are ignoring the yanked crate" }, { id = "RUSTSEC-2024-0436", reason = "Unmaintained paste crate is an indirect dependency" }, + { id = "RUSTSEC-2025-0052", reason = "Unmaintained async-std crate is an indirect dependency" }, ] # If this is true, then cargo deny will use the git executable to fetch advisory database. # If this is false, then it uses a built-in git library. @@ -241,8 +242,8 @@ allow-git = [] [sources.allow-org] # github.com organizations to allow git sources for github = [ - "enarx", # flagset "encounter", + "gimli-rs", # gimli ] # gitlab.com organizations to allow git sources for gitlab = [] diff --git a/objdiff-core/src/jobs/mod.rs b/objdiff-core/src/jobs/mod.rs index 06e2e1e..4344044 100644 --- a/objdiff-core/src/jobs/mod.rs +++ b/objdiff-core/src/jobs/mod.rs @@ -170,13 +170,6 @@ pub enum JobResult { CreateScratch(Option>), } -fn should_cancel(rx: &Receiver<()>) -> bool { - match rx.try_recv() { - Ok(_) | Err(TryRecvError::Disconnected) => true, - Err(_) => false, - } -} - fn start_job( waker: Waker, title: &str, @@ -203,7 +196,6 @@ fn start_job( } }); let id = JOB_ID.fetch_add(1, Ordering::Relaxed); - // log::info!("Started job {}", id); TODO JobState { id, kind, handle: Some(handle), context, cancel: tx } } @@ -228,3 +220,10 @@ fn update_status( context.waker.wake_by_ref(); Ok(()) } + +fn should_cancel(rx: &Receiver<()>) -> bool { + match rx.try_recv() { + Ok(_) | Err(TryRecvError::Disconnected) => true, + Err(_) => false, + } +} diff --git a/objdiff-wasm/.cargo/config.toml b/objdiff-wasm/.cargo/config.toml new file mode 100644 index 0000000..e72cb40 --- /dev/null +++ b/objdiff-wasm/.cargo/config.toml @@ -0,0 +1,6 @@ +[build] +target = "wasm32-wasip2" + +[unstable] +build-std = ["panic_abort", "core", "alloc"] +build-std-features = ["compiler-builtins-mem"] diff --git a/objdiff-wasm/Cargo.toml b/objdiff-wasm/Cargo.toml index dcb7b4b..28c798e 100644 --- a/objdiff-wasm/Cargo.toml +++ b/objdiff-wasm/Cargo.toml @@ -17,12 +17,13 @@ build = "build.rs" crate-type = ["cdylib"] [features] -default = ["std"] +default = [] std = ["objdiff-core/std"] [dependencies] log = { version = "0.4", default-features = false } regex = { version = "1.11", default-features = false, features = ["unicode-case"] } +wit-bindgen = { version = "0.44", default-features = false, features = ["macros"] } xxhash-rust = { version = "0.8", default-features = false, features = ["xxh3"] } [dependencies.objdiff-core] @@ -33,8 +34,5 @@ features = ["arm", "arm64", "mips", "ppc", "superh", "x86", "dwarf"] [target.'cfg(target_family = "wasm")'.dependencies] talc = { version = "4.4", default-features = false, features = ["lock_api"] } -[target.'cfg(target_os = "wasi")'.dependencies] -wit-bindgen = { version = "0.43", default-features = false, features = ["macros"] } - [build-dependencies] wit-deps = "0.5" diff --git a/objdiff-wasm/package-lock.json b/objdiff-wasm/package-lock.json index 41dfd66..df9eb8c 100644 --- a/objdiff-wasm/package-lock.json +++ b/objdiff-wasm/package-lock.json @@ -1,12 +1,12 @@ { "name": "objdiff-wasm", - "version": "3.0.0", + "version": "3.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "objdiff-wasm", - "version": "3.0.0", + "version": "3.0.1", "license": "MIT OR Apache-2.0", "devDependencies": { "@biomejs/biome": "^1.9.3", diff --git a/objdiff-wasm/package.json b/objdiff-wasm/package.json index 11b3fda..84247f0 100644 --- a/objdiff-wasm/package.json +++ b/objdiff-wasm/package.json @@ -1,6 +1,6 @@ { "name": "objdiff-wasm", - "version": "3.0.0", + "version": "3.0.1", "description": "A local diffing tool for decompilation projects.", "author": { "name": "Luke Street", @@ -19,8 +19,8 @@ "types": "dist/objdiff.d.ts", "scripts": { "build": "npm run build:wasm && npm run build:transpile && npm run build:lib", - "build:wasm": "cargo +nightly -Zbuild-std=panic_abort,core,alloc -Zbuild-std-features=compiler-builtins-mem build --target wasm32-wasip2 --release --no-default-features", - "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", + "build:wasm": "cargo build --profile release-min --no-default-features", + "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", "build:lib": "rslib build" }, "devDependencies": { diff --git a/objdiff-wasm/rust-toolchain.toml b/objdiff-wasm/rust-toolchain.toml new file mode 100644 index 0000000..a5ece49 --- /dev/null +++ b/objdiff-wasm/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "nightly" +components = ["rust-src"] +targets = ["wasm32-wasip2"] diff --git a/objdiff-wasm/src/lib.rs b/objdiff-wasm/src/lib.rs index ab5d102..0c59d73 100644 --- a/objdiff-wasm/src/lib.rs +++ b/objdiff-wasm/src/lib.rs @@ -1,9 +1,7 @@ #![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; -#[cfg(target_os = "wasi")] mod api; -#[cfg(target_os = "wasi")] mod logging; #[cfg(all(target_os = "wasi", not(feature = "std")))]