diff --git a/.github/workflows/web-deploy.yml b/.github/workflows/web-deploy.yml new file mode 100644 index 00000000..50efe6c1 --- /dev/null +++ b/.github/workflows/web-deploy.yml @@ -0,0 +1,91 @@ +# Builds DraftCraft's browser version (apps/draftcraft-web, wasm via Trunk) from `main` and publishes it to +# GitHub Pages at https://app.draftcraft.dev/ (Settings › Pages › Source: GitHub Actions) on every push to +# `main`, so the site is always the live main. Only in withshalom/draftcraft-app (WithShalom Studios' fork of +# SkryxDev/DraftCraft); any other branch or repository builds nothing. This file is the fork's own: it is +# not part of the pull requests sent upstream. +name: web-deploy + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + +# A custom domain, when there is one: set it here and point its DNS at GitHub Pages. +env: + CUSTOM_DOMAIN: app.draftcraft.dev + TRUNK_VERSION: 0.21.14 + TRUNK_SHA256: f2b4680cd239693a646a2795e4633c625328d7b2a044fbe749fa3a2fe9e7036b + +jobs: + build: + # Only in withshalom/draftcraft-app, only from main. + if: github.repository == 'withshalom/draftcraft-app' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + timeout-minutes: 90 + env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: Install Rust (stable) with the wasm target + uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1 + with: + toolchain: stable + targets: wasm32-unknown-unknown + + - name: Cache cargo and target + uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 + with: + key: web-deploy + + - name: Install Trunk (checksum verified, as upstream's release does) + run: | + url="https://github.com/trunk-rs/trunk/releases/download/v${TRUNK_VERSION}/trunk-x86_64-unknown-linux-gnu.tar.gz" + curl --proto '=https' --proto-redir =https -fsSL -o "$RUNNER_TEMP/trunk.tar.gz" "$url" + echo "$TRUNK_SHA256 $RUNNER_TEMP/trunk.tar.gz" | sha256sum -c - + tar -xz -C "$HOME/.cargo/bin" -f "$RUNNER_TEMP/trunk.tar.gz" trunk + trunk --version + + - name: Build (release) + working-directory: apps/draftcraft-web + run: trunk build --release + + - name: Check the site uses relative URLs + run: | + test -f dist/web/index.html + if grep -Eq '(src|href)="/[^/]' dist/web/index.html; then + echo "index.html has root-absolute URLs" >&2 + exit 1 + fi + + - name: Add Pages files + run: | + touch dist/web/.nojekyll + if [ -n "$CUSTOM_DOMAIN" ]; then echo "$CUSTOM_DOMAIN" > dist/web/CNAME; fi + + - uses: actions/configure-pages@v5 + + - uses: actions/upload-pages-artifact@v3 + with: + path: dist/web + + deploy: + if: github.repository == 'withshalom/draftcraft-app' && github.ref == 'refs/heads/main' + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/AGENTS.md b/AGENTS.md index c8bf35aa..797447a6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -18,7 +18,7 @@ People trust DraftCraft with their drawings; a crash loses their work. **This ou - Every workspace crate manifest carries `[lints] workspace = true`; every production crate root carries `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]`. ## Non-negotiables -- **Clean-room.** AutoCAD may only be *observed* black-box (run it, look at its UI with your own drawings). Never read, disassemble or copy anything inside an Autodesk install; never copy Autodesk fonts (SHX), hatch patterns (`.pat`), linetypes (`.lin`), templates, CUI/PGP files, icons, artwork or help text; never commit files produced by AutoCAD or screenshots of it. File formats come from public specifications (Autodesk's published DXF Reference, the Open Design Alliance's public DWG specification) and our own tests. Never copy or link GPL/LGPL/AGPL code (LibreDWG, LibreCAD, QCAD, FreeCAD's planegcs, SolveSpace, OpenCASCADE) — don't even read their sources. +- **Clean-room.** Take no proprietary code or information directly from the application software. AutoCAD may only be *observed* black-box (run it, look at its UI with your own drawings). Never read, disassemble or copy anything inside an Autodesk install; never copy Autodesk fonts (SHX), hatch patterns (`.pat`), linetypes (`.lin`), templates, CUI/PGP files, icons, artwork or help text; never commit screenshots of AutoCAD. DWG and DXF files are a different matter, whichever program saved them, AutoCAD included: they are the files people exchange, and reading them, testing against them and keeping them in the repository as test drawings is interoperability and allowed (a drawing kept here needs its row in `ATTRIBUTION.md` like any other file asset). File formats come from public specifications (Autodesk's published DXF Reference, the Open Design Alliance's public DWG specification), from DWG and DXF files themselves, and from our own tests. Never copy or link GPL/LGPL/AGPL code (LibreDWG, LibreCAD, QCAD, FreeCAD's planegcs, SolveSpace, OpenCASCADE) — don't even read their sources. - **Assets.** DraftCraft contains **no Autodesk, Adobe or Avid iconography, images, fonts, patterns or artwork — ever**, and no brand marks other than DraftCraft's own. Every icon is drawn in code (`crates/ui-egui/src/icons.rs`), every hatch pattern and linetype is our own definition (`crates/doc/src/library.rs`), the drafting font is our own (`crates/fonts/src/stroke.rs`). Any file asset must be original, public domain/CC0, OSI-licensed or redistributable Creative Commons, and **must have a row in `ATTRIBUTION.md`** with author, source and licence (`cargo xtask assets` enforces it). - **Fonts** come from [`storytold/craft-fonts`](https://github.com/storytold/craft-fonts), an optional build input (`CRAFT_FONTS_DIR`, embedded by `crates/fonts/build.rs`), never a `Cargo.toml` dependency and never committed here. Code and tests must work without it. - **Everything is a command.** User-visible behaviour = a command in `crates/engine/src/cmd/*` (`CommandSpec`: id = AutoCAD's command name in lower case, label, menu path, shortcut, aliases, params doc, `enabled`, JSON `run`, optional `interactive` prompt machine) + tests. UI-only commands live in `crates/ui-egui/src/menus.rs` (`UI_COMMANDS`). The ribbon, menus, command line, scripts, CLI, control channel and MCP all reach the same commands. diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 1c879bd0..f06f6b25 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -54,6 +54,22 @@ contributors, and where a line says so by Skryx Dev: | `assets/app-icon/draftcraft-1024.png` | WithShalom Studios (DraftCraft) | original work for DraftCraft, drawn by `packaging/compass-icon.py` in [withshalom/draftcraft](https://github.com/withshalom/draftcraft) (2026) | MIT OR Apache-2.0 (the DraftCraft name and marks: [docs/brand/LICENSE-brand.txt](docs/brand/LICENSE-brand.txt)) | | | `assets/app-icon/draftcraft-macos-512.png` | WithShalom Studios (DraftCraft) | original work for DraftCraft, drawn by `packaging/compass-icon.py` in [withshalom/draftcraft](https://github.com/withshalom/draftcraft) (2026) | MIT OR Apache-2.0 (the DraftCraft name and marks: [docs/brand/LICENSE-brand.txt](docs/brand/LICENSE-brand.txt)) | | | `examples/apartment.dxf` | the DraftCraft contributors | sample drawing made with the CLI's commands | MIT OR Apache-2.0 | Original | +| `crates/io/tests/data/mi201/mi201-r12.dxf` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DXF by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r14.dwg` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DWG by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2000.dwg` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DWG by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2000.dxf` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DXF by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2004.dwg` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DWG by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2004.dxf` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DXF by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2007.dwg` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DWG by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2007.dxf` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DXF by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2010.dwg` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DWG by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2010.dxf` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DXF by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2013.dwg` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DWG by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2013.dxf` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DXF by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2018-from-ascii-dxf.dwg` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DWG by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2018-from-binary-dxf.dwg` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DWG by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2018.dwg` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DWG by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | +| `crates/io/tests/data/mi201/mi201-r2018.dxf` | WithShalom Studios (MosaicIron) | the owner's own part drawing MI-201 (a bent clip plate), saved as DXF by AutoCAD; from [withshalom/blackcad](https://github.com/withshalom/blackcad) `corpus/mosaiciron-mi201` | MIT OR Apache-2.0 | Test drawing for the DWG reader; the DXF of each version is the reference for its DWG | ## Interface translations diff --git a/Cargo.lock b/Cargo.lock index 67af9182..a4778e72 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,30 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "acadrust" -version = "0.6.8" -source = "git+https://github.com/hakanaktt/acadrust?rev=008c6391bbb5deb7baf4bd44495b7b1cfc53eceb#008c6391bbb5deb7baf4bd44495b7b1cfc53eceb" -dependencies = [ - "anyhow", - "bitflags 2.13.2", - "byteorder", - "encoding_rs", - "flate2", - "foldhash 0.2.0", - "indexmap", - "itoa", - "memchr", - "memmap2", - "nom 7.1.3", - "oem_cp", - "once_cell", - "rayon", - "ryu", - "thiserror 2.0.21", - "web-time", -] - [[package]] name = "accesskit" version = "0.25.2" @@ -1220,7 +1196,7 @@ checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" [[package]] name = "draftcraft" -version = "2.1.0" +version = "3.0.0" dependencies = [ "chrono", "clap", @@ -1250,7 +1226,7 @@ dependencies = [ [[package]] name = "draftcraft-cli" -version = "2.1.0" +version = "3.0.0" dependencies = [ "clap", "clap_complete", @@ -1266,14 +1242,14 @@ dependencies = [ [[package]] name = "draftcraft-color" -version = "2.1.0" +version = "3.0.0" dependencies = [ "serde", ] [[package]] name = "draftcraft-constraints" -version = "2.1.0" +version = "3.0.0" dependencies = [ "draftcraft-doc", "draftcraft-geom", @@ -1283,7 +1259,7 @@ dependencies = [ [[package]] name = "draftcraft-doc" -version = "2.1.0" +version = "3.0.0" dependencies = [ "draftcraft-color", "draftcraft-geom", @@ -1294,15 +1270,14 @@ dependencies = [ [[package]] name = "draftcraft-dwg" -version = "2.1.0" +version = "3.0.0" dependencies = [ - "acadrust", - "log", + "chrono", ] [[package]] name = "draftcraft-dxf" -version = "2.1.0" +version = "3.0.0" dependencies = [ "encoding_rs", "log", @@ -1311,7 +1286,7 @@ dependencies = [ [[package]] name = "draftcraft-engine" -version = "2.1.0" +version = "3.0.0" dependencies = [ "craft-docpath", "draftcraft-color", @@ -1334,7 +1309,7 @@ dependencies = [ [[package]] name = "draftcraft-fonts" -version = "2.1.0" +version = "3.0.0" dependencies = [ "draftcraft-geom", "encoding_rs", @@ -1346,16 +1321,16 @@ dependencies = [ [[package]] name = "draftcraft-geom" -version = "2.1.0" +version = "3.0.0" dependencies = [ "serde", ] [[package]] name = "draftcraft-io" -version = "2.1.0" +version = "3.0.0" dependencies = [ - "acadrust", + "chrono", "craft-pdf", "draftcraft-color", "draftcraft-doc", @@ -1376,7 +1351,7 @@ dependencies = [ [[package]] name = "draftcraft-mcp" -version = "2.1.0" +version = "3.0.0" dependencies = [ "clap", "draftcraft-engine", @@ -1390,7 +1365,7 @@ dependencies = [ [[package]] name = "draftcraft-render" -version = "2.1.0" +version = "3.0.0" dependencies = [ "draftcraft-color", "draftcraft-doc", @@ -1404,7 +1379,7 @@ dependencies = [ [[package]] name = "draftcraft-ui-egui" -version = "2.1.0" +version = "3.0.0" dependencies = [ "chrono", "craft-ui", @@ -1432,7 +1407,7 @@ dependencies = [ [[package]] name = "draftcraft-web" -version = "2.1.0" +version = "3.0.0" dependencies = [ "craft-web-host", "draftcraft-engine", @@ -3032,12 +3007,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.8.9" @@ -3190,16 +3159,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - [[package]] name = "nom" version = "8.0.0" @@ -3558,15 +3517,6 @@ dependencies = [ "objc2-foundation 0.2.2", ] -[[package]] -name = "oem_cp" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7959d3349f484aec36462f98226983578bf7d33f9b034c32967489c7000e1f" -dependencies = [ - "phf 0.11.3", -] - [[package]] name = "once_cell" version = "1.21.4" @@ -3705,15 +3655,6 @@ dependencies = [ "indexmap", ] -[[package]] -name = "phf" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" -dependencies = [ - "phf_shared 0.11.3", -] - [[package]] name = "phf" version = "0.13.1" @@ -3781,15 +3722,6 @@ dependencies = [ "syn 2.0.119", ] -[[package]] -name = "phf_shared" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" -dependencies = [ - "siphasher", -] - [[package]] name = "phf_shared" version = "0.13.1" @@ -5072,7 +5004,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" dependencies = [ "memchr", - "nom 8.0.0", + "nom", "petgraph", ] @@ -6210,7 +6142,7 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee" [[package]] name = "xtask" -version = "2.1.0" +version = "3.0.0" dependencies = [ "chrono", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 4ed33777..430776c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = ["crates/*", "apps/*", "xtask"] # default-members [workspace.package] -version = "2.1.0" +version = "3.0.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95" diff --git a/NOTICE b/NOTICE index 82be3108..4f3a52c5 100644 --- a/NOTICE +++ b/NOTICE @@ -14,11 +14,9 @@ version should not be presented as DraftCraft. Their terms are in docs/brand/LIC Third-party material -Software dependencies are listed in Cargo.lock. One is under a weak-copyleft licence: the acadrust -crate (DWG reading and writing, https://github.com/hakanaktt/acadrust) is licensed under the -Mozilla Public License 2.0 and is used unmodified as a separate library (crates/dwg). Its source -is available from crates.io and the repository above. DraftCraft's own DWG reader and writer don't -use it; it is the fallback for files they don't cover yet (crates/dwg/src/acadrust). +Software dependencies are listed in Cargo.lock. DWG files are read and written by DraftCraft's own +code (crates/dwg, crates/io), from the Open Design Alliance's public DWG specification and our own +tests. DraftCraft's icons, drafting font, hatch patterns and linetypes are drawn or defined in code. diff --git a/apps/draftcraft-cli/src/main.rs b/apps/draftcraft-cli/src/main.rs index 438d8509..b211769d 100644 --- a/apps/draftcraft-cli/src/main.rs +++ b/apps/draftcraft-cli/src/main.rs @@ -1,11 +1,6 @@ #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] fn main() { - // A copy of this program started to read or write a DWG file does only that. - if let Some(code) = draftcraft_io::dwg_worker::serve_if_asked() { - std::process::exit(code); - } - draftcraft_io::dwg_worker::use_own_worker(); // `args_os`, not `args`: a non-Unicode argument (a Latin-1 file name on Linux) must be // reported as an error, not panic before anything is printed. let code = draftcraft_cli::run(std::env::args_os().skip(1), &mut std::io::stdout(), &mut std::io::stderr()); diff --git a/apps/draftcraft-cli/tests/dwg_worker.rs b/apps/draftcraft-cli/tests/dwg_worker.rs deleted file mode 100644 index 51cb1001..00000000 --- a/apps/draftcraft-cli/tests/dwg_worker.rs +++ /dev/null @@ -1,33 +0,0 @@ -//! The DWG reader and writer run in a child process, so a decoder that dies ends one open or save, -//! not the app. The worker setting is process-wide, so everything runs in one test. - -#![cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))] - -use draftcraft_io::dwg_worker; - -#[test] -fn a_real_worker_reads_and_writes_and_its_death_is_an_error_here() { - let drawing = draftcraft_engine::sample::bracket(); - let in_process = draftcraft_io::write(&drawing, "a.dwg").unwrap(); - - dwg_worker::use_worker(env!("CARGO_BIN_EXE_draftcraft-cli").into(), vec![dwg_worker::WORKER_ARG.into()]); - let written = draftcraft_io::write(&drawing, "a.dwg").unwrap(); - assert_eq!(written.get(..6), in_process.get(..6), "the same version of file"); - let read = draftcraft_io::read(&written, "a.dwg").unwrap(); - assert_eq!(read.model.len(), drawing.model.len()); - - // A decode error comes back as that error, not as the worker stopping. - let mut bad = in_process.clone(); - bad.truncate(64); - let e = draftcraft_io::read(&bad, "a.dwg").unwrap_err().to_string(); - assert!(!e.contains("worker"), "{e}"); - - // The worker aborts as the third-party code can. This process goes on. - let e = dwg_worker::crash_worker_for_test().unwrap_err(); - assert!(e.contains("worker stopped"), "{e}"); - assert!(draftcraft_io::read(&written, "a.dwg").is_ok(), "the next file gets a new worker"); - - // No worker to start: the work happens here, as without one. - dwg_worker::use_worker("no-such-program-here".into(), Vec::new()); - assert!(draftcraft_io::read(&written, "a.dwg").is_ok()); -} diff --git a/apps/draftcraft-web/index.html b/apps/draftcraft-web/index.html index f1bdf8d4..2ec834f0 100644 --- a/apps/draftcraft-web/index.html +++ b/apps/draftcraft-web/index.html @@ -5,6 +5,15 @@ DraftCraft + + + + + + + + +