diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index 6d56b96a..b82d0eb3 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -29,5 +29,5 @@ if [ -x /usr/local/bin/chrome ] && [ ! -e /usr/local/bin/google-chrome ]; then fi # -./bt install --dev +./bt install ./bt build \ No newline at end of file diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 8251cc8d..8ca65126 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -52,10 +52,11 @@ jobs: ## server ## extensions/VSCode # On Windows, GitHub Actions runs these commands in PowerShell, which runs - # `bt.ps1`; elsewhere, bash runs `bt`. + # `bt.ps1`; elsewhere, bash runs `bt`. PowerShell, unlike bash, doesn't + # stop when a native command fails, so chain the steps with `&&`. # - name: Run tests run: | rustup update - ./bt install --dev - ./bt full + # + ./bt install && ./bt full diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aa66a5d5..7f013f1e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,7 +64,7 @@ jobs: # we specify bash to get pipefail; it guards against the `curl` command # failing. otherwise `sh` won't catch that `curl` returned non-0 shell: bash - run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.32.0/cargo-dist-installer.sh | sh" + run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.33.1/cargo-dist-installer.sh | sh" - name: Cache dist uses: actions/upload-artifact@v7 with: @@ -124,7 +124,7 @@ jobs: # but keeping it here makes it easier to keep the Node version in sync with the node install for `build-global-artifacts` below. - uses: actions/setup-node@v6 with: - node-version: 24 + node-version: 26 - name: Install Rust non-interactively if not already installed if: ${{ matrix.container }} run: | @@ -252,7 +252,7 @@ jobs: submodules: recursive - uses: actions/setup-node@v6 with: - node-version: 24 + node-version: 26 - name: Install cached dist uses: actions/download-artifact@v8 with: diff --git a/bt.ps1 b/bt.ps1 index d1da188d..4e716cda 100644 --- a/bt.ps1 +++ b/bt.ps1 @@ -26,5 +26,8 @@ $manifest_path = Join-Path -Path $PSScriptRoot -ChildPath builder/Cargo.toml echo $manifest_path cargo run --manifest-path=$manifest_path -- $args +# A script's success, as seen by its caller's `&&`, doesn't reflect the exit +# code of its last native command; pass it on explicitly. +exit $LASTEXITCODE # CodeChat Editor lexer: python diff --git a/builder/src/main.rs b/builder/src/main.rs index f0f6f1a6..d579fe8c 100644 --- a/builder/src/main.rs +++ b/builder/src/main.rs @@ -69,11 +69,7 @@ struct Cli { #[derive(Subcommand)] enum Commands { /// Install all dependencies. - Install { - /// True to install developer-only dependencies. - #[arg(short, long, default_value_t = false)] - dev: bool, - }, + Install, /// Update all dependencies. Update, /// Run formatters and linters. @@ -148,7 +144,7 @@ static WORKSPACE_MANIFEST_PATH: &str = "../Cargo.toml"; // second, explicit pass over it. static BUILDER_PATH: &str = "../builder"; static NAPI_TARGET: &str = "NAPI_TARGET"; -static DIST_VERSION: &str = "0.32.0"; +static DIST_VERSION: &str = "0.33.1"; // Code // ---- @@ -382,10 +378,8 @@ fn patch_client_libs() -> io::Result<()> { Ok(()) } -fn run_install(dev: bool) -> io::Result<()> { - if dev { - run_script("npm", &["install", "-g", "pnpm@latest-11"], ".", true)?; - } +fn run_install(cargo_dist: bool) -> io::Result<()> { + run_script("npm", &["install", "-g", "pnpm"], ".", true)?; // See [the client manifest](../../client/package.json5) for an explanation // of `--no-frozen-lockfile`. run_script("pnpm", &["install"], CLIENT_PATH, true)?; @@ -397,22 +391,22 @@ fn run_install(dev: bool) -> io::Result<()> { info "Builder: cargo fetch"; cargo fetch --manifest-path=$BUILDER_PATH/Cargo.toml; )?; - if dev { - // Install the cargo binstall binary, taken from the - // [docs](https://docs.rs/crate/cargo-binstall/1.15.5). - #[cfg(windows)] - run_cmd! { - pwsh -Command "Set-ExecutionPolicy Unrestricted -Scope Process; iex (iwr 'https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1').Content"; - }?; - #[cfg(not(windows))] - // The original command had `'=https'`, but single quotes confused - // `cmd_lib` and aren't needed to quote this. Note that `//` in the URL - // is a comment in Rust, so it must be - // [enclosed in quotes](https://github.com/rust-shell-script/rust_cmd_lib/issues/88). - run_cmd! { - curl -L --proto =https --tlsv1.2 -sSf "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh" | bash; - }?; - + // Install the cargo binstall binary, taken from the + // [docs](https://docs.rs/crate/cargo-binstall/1.15.5). + #[cfg(windows)] + run_cmd! { + pwsh -Command "Set-ExecutionPolicy Unrestricted -Scope Process; iex (iwr 'https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1').Content"; + }?; + #[cfg(not(windows))] + // The original command had `'=https'`, but single quotes confused + // `cmd_lib` and aren't needed to quote this. Note that `//` in the URL + // is a comment in Rust, so it must be + // [enclosed in quotes](https://github.com/rust-shell-script/rust_cmd_lib/issues/88). + run_cmd! { + curl -L --proto =https --tlsv1.2 -sSf "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh" | bash; + }?; + + if cargo_dist { // Installing `cargo-dist` using `cargo binstall` fails intermittently // on MacOS. Try another approach. #[cfg(target_os = "macos")] @@ -425,25 +419,24 @@ fn run_install(dev: bool) -> io::Result<()> { info "cargo binstall cargo-dist"; cargo binstall cargo-dist@${DIST_VERSION} --no-confirm; )?; - - run_cmd!( - info "cargo binstall cargo-outdated"; - cargo binstall cargo-outdated --no-confirm; - info "cargo binstall cargo-sort"; - cargo binstall cargo-sort --no-confirm; - info "cargo binstall cargo-audit"; - cargo binstall cargo-audit --no-confirm; - info "cargo binstall cargo-machete"; - cargo binstall cargo-machete --no-confirm; - info "cargo binstall cargo-llvm-cov"; - cargo binstall cargo-llvm-cov --no-confirm; - // Install the required llvm-tools component used by cargo-llvm-cov - // without prompting. - info "rustup component add llvm-tools-preview"; - rustup component add llvm-tools-preview; - )?; } - Ok(()) + + run_cmd!( + info "cargo binstall cargo-outdated"; + cargo binstall cargo-outdated --no-confirm; + info "cargo binstall cargo-sort"; + cargo binstall cargo-sort --no-confirm; + info "cargo binstall cargo-audit"; + cargo binstall cargo-audit --no-confirm; + info "cargo binstall cargo-machete"; + cargo binstall cargo-machete --no-confirm; + info "cargo binstall cargo-llvm-cov"; + cargo binstall cargo-llvm-cov --no-confirm; + // Install the required llvm-tools component used by cargo-llvm-cov + // without prompting. + info "rustup component add llvm-tools-preview"; + rustup component add llvm-tools-preview; + ) } fn run_update() -> io::Result<()> { @@ -802,7 +795,7 @@ fn run_change_version(new_version: &String) -> io::Result<()> { fn run_prerelease() -> io::Result<()> { // Clean out all bundled files before the rebuild. remove_dir_all_if_exists(format!("{CLIENT_PATH}/static/bundled"))?; - run_install(true)?; + run_install(false)?; run_client_build(true, false) } @@ -875,7 +868,7 @@ fn run_coverage() -> io::Result<()> { impl Cli { fn run(self) -> io::Result<()> { match &self.command { - Commands::Install { dev } => run_install(*dev), + Commands::Install => run_install(true), Commands::Update => run_update(), Commands::Flint { check } => run_format_and_lint(*check), Commands::Full => run_full(), diff --git a/dist-workspace.toml b/dist-workspace.toml index b49064ec..7667dabc 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -25,14 +25,10 @@ members = ["cargo:."] # Config for 'dist' [dist] -# Extra static files to include in each App. Paths are relative to this file. -include = [ - "client/static", - "server/hashLocations.json", - "server/log4rs.yml", -] +# Extra static files to include in each App (path relative to this Cargo.toml's dir) +include = ["client/static", "server/hashLocations.json", "server/log4rs.yml"] # The preferred dist version to use in CI (Cargo.toml SemVer syntax) -cargo-dist-version = "0.32.0" +cargo-dist-version = "0.33.1" # CI backends to support ci = "github" # The installers to generate for each app diff --git a/server/src/processing/cache.rs b/server/src/processing/cache.rs index 4aaa1aba..d0b6fce8 100644 --- a/server/src/processing/cache.rs +++ b/server/src/processing/cache.rs @@ -1825,7 +1825,7 @@ fn scan_file( ) { // Perform I/O before locking the cache, so that the lock isn't held during // it. - let stamp = match fs::metadata(path) { + let current_stamp = match fs::metadata(path) { Ok(metadata) if metadata.is_file() => FileStamp::new(&metadata), // The file no longer exists -- or a directory has replaced it, which // the walker reports separately. @@ -1843,7 +1843,7 @@ fn scan_file( let entry = cache.files.get(path); let is_modified = entry .and_then(|entry| entry.stamp.as_ref()) - .is_none_or(|cached| !cached.is_unmodified(&stamp)); + .is_none_or(|cached| !cached.is_unmodified(¤t_stamp)); is_toc_changed = is_modified && entry.is_some() && path == cache.toc_path(); if cache.is_current_file(path) { // The connections' sidebars show the TOC from their own IDE's text @@ -1910,7 +1910,7 @@ fn scan_file( // such write leaves the file matching. ScanOutcome::Translated => { if let Some(entry) = cache.files.get_mut(path) { - entry.stamp = Some(stamp); + entry.stamp = Some(current_stamp); } } // A file which can't be translated defines nothing. Committing it @@ -1918,7 +1918,7 @@ fn scan_file( // translatable, and records its stamp, so that later walks skip it // until it changes rather than reading it again. ScanOutcome::Untranslatable => { - cache.commit_file(path, Some(stamp), FileFacts::default()); + cache.commit_file(path, Some(current_stamp), FileFacts::default()); } // The translation may have failed after committing the file's // facts, along with a stamp which matches the file; discard that