From 6015c8c0cbcd13f61f82facae4f5104ada5e51cc Mon Sep 17 00:00:00 2001 From: Yann Hamdaoui Date: Thu, 11 Jan 2024 09:15:16 +0000 Subject: [PATCH] Backport 1.4 release to master (#1755) * Only update relevant deps in Cargo.lock The release script needs to update Cargo.lock after having updated Cargo.toml with the new version of various Nickel crates. Indeed, we are running some checks via Nix, and Nix builds are sandboxed without network access. This requires the Nix build to use `cargo --frozen --offline`, which in turns require the Cargo.lock file to be up-to-date or it will fail. The previous version of the release script would do a simple `cargo update`, which has the default of updating all dependencies. This commit changes that to only udpate dependencies which we might have bumped. * Add pause to commit release notes in release script * Fix release script for LSP The release script was missing a part: the removal of `lsp-harness` (a local, unpublished util crates) from the nickel-lang-lsp package priori to publication to crates.io. Passing by, other small improvements and fixes are included as well. * [release.sh] update to 1.4.0 * Specify 'do not commit' when updating release notes * release guide: add missing step for lsp-harness removal --- Cargo.lock | 14 +++++----- Cargo.toml | 8 +++--- RELEASES.md | 29 ++++++++++++++++++-- RELEASING.md | 24 ++++++++++------- core/Cargo.toml | 2 +- scripts/release.sh | 64 +++++++++++++++++++++++++++++--------------- wasm-repl/Cargo.toml | 2 +- 7 files changed, 97 insertions(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b1cc47b1..cc18ccef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1644,7 +1644,7 @@ dependencies = [ [[package]] name = "nickel-lang-cli" -version = "1.3.0" +version = "1.4.0" dependencies = [ "clap 4.4.7", "clap_complete", @@ -1662,7 +1662,7 @@ dependencies = [ [[package]] name = "nickel-lang-core" -version = "0.3.0" +version = "0.4.0" dependencies = [ "ansi_term", "assert_matches", @@ -1717,7 +1717,7 @@ dependencies = [ [[package]] name = "nickel-lang-lsp" -version = "1.3.0" +version = "1.4.0" dependencies = [ "anyhow", "assert_cmd", @@ -1762,7 +1762,7 @@ dependencies = [ [[package]] name = "nickel-wasm-repl" -version = "0.3.0" +version = "0.4.0" dependencies = [ "nickel-lang-core", ] @@ -2108,7 +2108,7 @@ dependencies = [ [[package]] name = "pyckel" -version = "1.3.0" +version = "1.4.0" dependencies = [ "codespan-reporting", "nickel-lang-core", @@ -3070,7 +3070,7 @@ dependencies = [ [[package]] name = "tree-sitter-ocaml" version = "0.20.4" -source = "git+https://github.com/tree-sitter/tree-sitter-ocaml.git#694c57718fd85d514f8b81176038e7a4cfabcaaf" +source = "git+https://github.com/tree-sitter/tree-sitter-ocaml.git#4abfdc1c7af2c6c77a370aee974627be1c285b3b" dependencies = [ "cc", "tree-sitter", @@ -3097,7 +3097,7 @@ dependencies = [ [[package]] name = "tree-sitter-rust" version = "0.20.4" -source = "git+https://github.com/tree-sitter/tree-sitter-rust.git#48e053397b587de97790b055a1097b7c8a4ef846" +source = "git+https://github.com/tree-sitter/tree-sitter-rust.git#79456e6080f50fc1ca7c21845794308fa5d35a51" dependencies = [ "cc", "tree-sitter", diff --git a/Cargo.toml b/Cargo.toml index edb282c9..1d8f61a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ members = [ resolver = "2" [workspace.package] -version = "1.3.0" +version = "1.4.0" authors = ["The Nickel Team "] license = "MIT" edition = "2021" @@ -21,9 +21,9 @@ homepage = "https://nickel-lang.org" readme = "README.md" [workspace.dependencies] -nickel-lang-core = { version = "0.3", path = "./core", default-features = false } -nickel-lang-utils = { version = "0.1", path = "./utils" } -lsp-harness = { version = "0.1", path = "./lsp/lsp-harness" } +nickel-lang-core = { version = "0.4.0", path = "./core", default-features = false } +nickel-lang-utils = { version = "0.1.0", path = "./utils" } +lsp-harness = { version = "0.1.0", path = "./lsp/lsp-harness" } # The wasm-bindgen version is pinned using `=` since flake.nix reads the version # number from Cargo.lock and needs to have matching output hashes for the source diff --git a/RELEASES.md b/RELEASES.md index 62adb497..83c4938e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,5 +1,7 @@ -Next version (planned as 1.4) -============================= +Version 1.4 +=========== + +Nickel 1.4 is a maintenance release, at the exception of a breaking change (see below). Breaking changes ---------------- @@ -21,6 +23,29 @@ Breaking changes `(.)` whenever possible, or you can just replace it with the new `std.record.get`. + (implemented by @yannham in https://github.com/tweag/nickel/pull/1752) + +Tooling +------- + +* Search for imports in NICKEL_IMPORT_PATH by @jneem in https://github.com/tweag/nickel/pull/1716 +* Add a cli param --import-path to specify the search path by @jneem in https://github.com/tweag/nickel/pull/1721 +* LSP: Fix hover on assignments to subrecords by @jneem in https://github.com/tweag/nickel/pull/1725 +* Print something when nickel doc succeeds by @yannham in https://github.com/tweag/nickel/pull/1729 +* Add --error-format flag to serialize err diagnostics by @yannham in https://github.com/tweag/nickel/pull/1740 +* LSP: get record completion in arrays by @jneem in https://github.com/tweag/nickel/pull/1746 + +Core language +------------- + +* Support importing txt files as strings by @Quantum64 in https://github.com/tweag/nickel/pull/1734 + +Fixes +----- + +* `nickel format`: don't fail silently on invalid input anymore by @yannham in https://github.com/tweag/nickel/pull/1749 +* Update Topiary dependencies to correctly handle `(.)` in `nickel format` by @yannham in https://github.com/tweag/nickel/pull/1753 + Version 1.3 =========== diff --git a/RELEASING.md b/RELEASING.md index 97963a00..0fc77c80 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -141,22 +141,24 @@ following steps manually. `./lsp/nls/Cargo.toml` for `nickel-lang-lsp` (work-around for [cargo:#4242](https://github.com/rust-lang/cargo/issues/4242). - **Commit those changes temporarily to please cargo, but they will be - dropped later. Do not push**. -2. For all crates to be published, remove the `format` feature from the list of +2. Remove references to `lsp-harness` from the `[dev-dependencies]` sections of + the `./lsp/nls/Cargo.toml` (workaround for the same issue as 1.). + +3. For all crates to be published, remove the `format` feature from the list of features (in the `[features]` section of their `Cargo.toml` file), remove all dependencies referenced by `format` (of the form `dep:xxx`) from the list of dependencies of the crate, and finally, remove `"format"` from the list of the default features. - **Commit those changes temporarily to please cargo, but they will be - dropped later. Do not push**. - We have to do this because Topiary isn't published on `crates.io` yet, but `cargo` insists that we only depend on published crates. Thus, we have to abandon the format feature - which requires Topiary - for the version published to `crates.io`. -3. Check that a dry run of `cargo publish` succeeds on the crates to be + +4. **Commit the changes made in 1., 2. and 3. temporarily to please cargo, but + they will be dropped later. Do not push**. + +5. Check that a dry run of `cargo publish` succeeds on the crates to be published (`nickel-lang-core`, `nickel-lang-cli` and `nickel-lang-lsp`): - `cargo publish -p nickel-lang-core --dry-run` @@ -168,11 +170,13 @@ following steps manually. team](https://github.com/orgs/nickel-lang/teams/core), and have a `crates.io` API key saved locally on your machine (normally via `cargo login`). For help with this, contact the Nickel maintainers. -4. Actually release `nickel-lang-core`, `nickel-lang-cli` and `nickel-lang-lsp` + +6. Actually release `nickel-lang-core`, `nickel-lang-cli` and `nickel-lang-lsp` (in that order, as the cli and the lsp depend on core) on crates.io: `cargo publish -p ` -5. Ditch the potential changes made to the cargo manifests at step 1. and 2. by - dropping the corresponding commit. + +7. Ditch the potential changes made to the cargo manifests at steps 1., 2. + and 3. by dropping the corresponding commit ### Release on GitHub diff --git a/core/Cargo.toml b/core/Cargo.toml index 41a5f911..0d8a591a 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nickel-lang-core" -version = "0.3.0" +version = "0.4.0" description = "Programmable configuration files." authors.workspace = true edition.workspace = true diff --git a/scripts/release.sh b/scripts/release.sh index 5132b3f1..73e3f2a1 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -16,15 +16,24 @@ # This is of course less robust. For now, it seems largely sufficient, but it # might break in the future if the Cargo.toml files style change. +# In some cases it can be useful to leave the workspace in the state it was to +# finish the release manually. In that case, set this variable to false. +DO_CLEANUP=true + # Perform clean up actions upon unexpected exit. cleanup() { - echo "++ Unexpected exit. Cleaning up..." set +e - for ((i=${#cleanup_actions[@]}-1; i>=0; i--)); do - echo "++ Running cleanup action: ${cleanup_actions[$i]}" - ${cleanup_actions[$i]} || true - done + if [[ $DO_CLEANUP == true ]]; then + echo "++ Unexpected exit. Cleaning up..." + + for ((i=${#cleanup_actions[@]}-1; i>=0; i--)); do + echo "++ Running cleanup action: ${cleanup_actions[$i]}" + ${cleanup_actions[$i]} || true + done + else + echo "++ Unexpected exit. Leaving the workspace in its current state (DO_CLEANUP=$DO_CLEANUP)." + fi cleanup_actions=() exit 1 @@ -314,13 +323,13 @@ report_progress "Creating release branch..." release_branch="$new_workspace_version-release" -if git rev-parse --verify --quiet "$release_branch"; then +if git rev-parse --verify --quiet "$release_branch" > /dev/null; then confirm_proceed " -- [WARNING] The branch '$release_branch' already exists. The script will skip forward to publication to crates.io (but still run checks)." - git switch "$release_branch" + git switch "$release_branch" - report_progress "Building and running checks..." + report_progress "Building and running checks..." - nix flake check + nix flake check else git switch --create "$release_branch" > /dev/null cleanup_actions+=("git branch -d $release_branch") @@ -382,9 +391,10 @@ else # Patch workspace dependencies update_dependencies "workspace" "./Cargo.toml" version_map - # We need to update the lockfile here, because we changed ./Cargo.toml but Nix - # tries to build with --frozen, which will fail if the lockfile is outdated. - cargo update > /dev/null + # We need to update the lockfile here, at least for the dependencies that we + # might have bumped. We changed ./Cargo.toml but Nix tries to build with + # --frozen, which will fail if the lockfile is outdated. + cargo update "${!version_map[@]}" > /dev/null cleanup_actions+=("git restore ./Cargo.lock") git add ./Cargo.lock @@ -394,7 +404,10 @@ else nix flake check - report_progress "Creating the release branch..." + report_progress "Checks run successfully." + confirm_proceed " -- Please add the release notes to RELEASES.md if not already done. Save but don't commit. Then press 'y'." + + report_progress "Pusing the release branch..." git commit -m "[release.sh] update to $new_workspace_version" git push -u origin "$release_branch" @@ -408,7 +421,7 @@ else report_progress "If anything goes wrong from now on, you can restore the previous stable branch by resetting stable to stable-local-save" - confirm_proceed " -- Pushing the release branch to 'stable' and making it the new default" + confirm_proceed " -- Pushing the release branch to 'stable' and making it the new default" git checkout stable git reset --hard "$release_branch" @@ -434,7 +447,7 @@ EOF crates_to_publish=(core cli lsp/nls) -report_progress "Removing 'nickel-lang-utils' from dev-dependencies..." +report_progress "Removing 'nickel-lang-utils' and 'lsp-test-harness' from dev-dependencies..." for crate in "${crates_to_publish[@]}"; do # Remove `nickel-lang-utils` from `dev-dependencies` of released crates. @@ -444,7 +457,8 @@ for crate in "${crates_to_publish[@]}"; do # crates.io) # # see [^tomlq-sed] - sed -i '/^nickel-lang-utils\.workspace\s*=\s*true$/d' "$crate/Cargo.toml" + sed -i '/^nickel-lang-utils\.workspace\s*=\s*true\s*$/d' "$crate/Cargo.toml" + sed -i '/^lsp-harness\.workspace\s*=\s*true\s*$/d' "$crate/Cargo.toml" cleanup_actions+=('git restore '"$crate/Cargo.toml") done @@ -481,23 +495,31 @@ cargo install --force --path ./lsp/nls git restore ./Cargo.lock -report_progress "Successfully installed locally. Trying a dry run of cargo publish..." +report_progress "Successfully installed locally. Trying a dry run of cargo publish 'nickel-lang-core'" cargo publish -p nickel-lang-core --dry-run -confirm_proceed "Dry run successful. Proceed with actual publication of 'nickel-lang-core' to crates.io ?" +confirm_proceed " -- Dry run successful. Proceed with actual publication of 'nickel-lang-core' to crates.io ?" cargo publish -p nickel-lang-core +report_progress "'nickel-lang-core' published successfully" +report_progress "Trying a dry run of cargo publish 'nickel-lang-cli'" + cargo publish -p nickel-lang-cli --dry-run -confirm_proceed "Dry run successful. Proceed with actual publication of 'nickel-lang-cli' to crates.io ?" +confirm_proceed " -- Dry run successful. Proceed with actual publication of 'nickel-lang-cli' to crates.io ?" cargo publish -p nickel-lang-cli +report_progress "'nickel-lang-cli' published successfully" +report_progress "Trying a dry run of cargo publish 'nickel-lang-lsp'" + cargo publish -p nickel-lang-lsp --dry-run -confirm_proceed "Dry run successful. Proceed with actual publication of 'nickel-lang-lsp' to crates.io ?" +confirm_proceed " -- Dry run successful. Proceed with actual publication of 'nickel-lang-lsp' to crates.io ?" cargo publish -p nickel-lang-lsp +report_progress "'nickel-lang-lsp' published successfully" report_progress "Cleaning up..." -# Undo the previous commit removing `nickel-lang-utils` from dev-dependencies +# Undo the previous commit removing `nickel-lang-utils` and other stuff from +# dependencies prior to publication git reset --hard HEAD~ cleanup_actions=() diff --git a/wasm-repl/Cargo.toml b/wasm-repl/Cargo.toml index e5e385a0..eda38dc3 100644 --- a/wasm-repl/Cargo.toml +++ b/wasm-repl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nickel-wasm-repl" -version = "0.3.0" +version = "0.4.0" description = "WebAssembly REPL for the Nickel programming language." authors.workspace = true edition.workspace = true