From 4d1daab652fcc2b0ff85215da31f2d6a1de60883 Mon Sep 17 00:00:00 2001 From: Daniel Henry-Mantilla Date: Tue, 30 Jul 2024 11:10:42 +0200 Subject: [PATCH 1/5] Add `scripts/change_version.sh` convenience helper --- scripts/change_version.sh | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 scripts/change_version.sh diff --git a/scripts/change_version.sh b/scripts/change_version.sh new file mode 100755 index 0000000000..ef08d6cc02 --- /dev/null +++ b/scripts/change_version.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# Script to bump da `safer-ffi` version of the repo (both in `.toml` and `.lock` files). + +set -euo pipefail +cd "$(git rev-parse --show-toplevel)" + +usage() { + cat >&2 <<-EOF + Usage: + ${0} + Current version: + ${0} $(sed -nE 's/^version = "(.*)"\s*# Keep in sync.*/\1/p' src/proc_macro/Cargo.toml) + EOF + false +} + +new_version="${1:?$(usage)}" + +PACKAGES=( + Cargo.toml + src/proc_macro/Cargo.toml +) + +for package in "${PACKAGES[@]}"; do + ( + set -x + sed -i.bak -E 's/^version = "(=?)(.*)"(\s*# Keep in sync)/version = "\1'"${new_version}"'"\3/' "${package}" + ) + rm "${package}".bak +done + +find . -type f -name 'Cargo.lock' -print0 \ +| while IFS= read -r -d '' lockfile; do + dir="$(dirname ${lockfile})" + ( + set -x + cd "${dir}" && cargo update -vw + ) +done From 2a3bfa6bcec6dcc23a6f134b76a77a56022607c9 Mon Sep 17 00:00:00 2001 From: Daniel Henry-Mantilla Date: Tue, 30 Jul 2024 11:59:11 +0200 Subject: [PATCH 2/5] Add `scripts/cargo_publish.sh` convenience helper too. --- scripts/cargo_publish.sh | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 scripts/cargo_publish.sh diff --git a/scripts/cargo_publish.sh b/scripts/cargo_publish.sh new file mode 100755 index 0000000000..ec9109794b --- /dev/null +++ b/scripts/cargo_publish.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# Script to cargo publish a new version to safer-ffi + +set -euo pipefail +cd "$(git rev-parse --show-toplevel)" + +(set -x + git status >&2 +) +if [ -n "$(git status --porcelain)" ]; then + echo >&2 "❌ Uncommitted changes detected." + false +fi + +current_version="$(sed -nE 's/^version = "(.*)"\s*# Keep in sync.*/\1/p' src/proc_macro/Cargo.toml)" +(set -x + current_version="${current_version}" +) + +echo -n "Version desired? [${current_version}] " +read -r desired_version + +set -x +desired_version="${desired_version:-$current_version}" +{ set +x; } 2>/dev/null + +(set -x + ./scripts/change_version.sh "${desired_version}" +) + +if [ -n "$(git status --porcelain)" ]; then + git add -u + (set -x + git commit -m "Version \`${desired_version}\` release" + ) +fi +(set -x + git push +) + +PACKAGES=( + src/proc_macro/ + ./ +) +for package in "${PACKAGES[@]}"; do + (set -x + cd "${package}" + cargo publish + ) +done From 9b942a84695f853cd2ea21f222414ba8a93794d8 Mon Sep 17 00:00:00 2001 From: Daniel Henry-Mantilla Date: Tue, 30 Jul 2024 12:07:09 +0200 Subject: [PATCH 3/5] Version `0.1.10-rc4` release --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- ffi_tests/Cargo.lock | 4 ++-- js_tests/Cargo.lock | 4 ++-- src/proc_macro/Cargo.toml | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 83d6185c5a..5829d9e410 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -622,7 +622,7 @@ checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "safer-ffi" -version = "0.1.10-rc3" +version = "0.1.10-rc4" dependencies = [ "async-compat", "cratesio-placeholder-package", @@ -654,7 +654,7 @@ dependencies = [ [[package]] name = "safer_ffi-proc_macros" -version = "0.1.10-rc3" +version = "0.1.10-rc4" dependencies = [ "macro_rules_attribute", "prettyplease", diff --git a/Cargo.toml b/Cargo.toml index 998a5f637d..5b15f7c72b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ path = "src/_lib.rs" [package] name = "safer-ffi" -version = "0.1.10-rc3" # Keep in sync +version = "0.1.10-rc4" # Keep in sync authors = [ "Daniel Henry-Mantilla ", ] @@ -179,7 +179,7 @@ version = "0.0.3" [dependencies.safer_ffi-proc_macros] path = "src/proc_macro" -version = "=0.1.10-rc3" # Keep in sync +version = "=0.1.10-rc4" # Keep in sync [workspace] members = [ diff --git a/ffi_tests/Cargo.lock b/ffi_tests/Cargo.lock index d88dbb3a8d..c16b2573de 100644 --- a/ffi_tests/Cargo.lock +++ b/ffi_tests/Cargo.lock @@ -331,7 +331,7 @@ checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "safer-ffi" -version = "0.1.10-rc3" +version = "0.1.10-rc4" dependencies = [ "futures", "inventory", @@ -348,7 +348,7 @@ dependencies = [ [[package]] name = "safer_ffi-proc_macros" -version = "0.1.10-rc3" +version = "0.1.10-rc4" dependencies = [ "macro_rules_attribute", "prettyplease", diff --git a/js_tests/Cargo.lock b/js_tests/Cargo.lock index 1bd64d0c72..3d590b5c52 100644 --- a/js_tests/Cargo.lock +++ b/js_tests/Cargo.lock @@ -629,7 +629,7 @@ checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "safer-ffi" -version = "0.1.10-rc3" +version = "0.1.10-rc4" dependencies = [ "cratesio-placeholder-package", "inventory", @@ -654,7 +654,7 @@ dependencies = [ [[package]] name = "safer_ffi-proc_macros" -version = "0.1.10-rc3" +version = "0.1.10-rc4" dependencies = [ "macro_rules_attribute", "prettyplease", diff --git a/src/proc_macro/Cargo.toml b/src/proc_macro/Cargo.toml index e310c5c90d..13a303089a 100644 --- a/src/proc_macro/Cargo.toml +++ b/src/proc_macro/Cargo.toml @@ -4,7 +4,7 @@ proc-macro = true [package] name = "safer_ffi-proc_macros" -version = "0.1.10-rc3" # Keep in sync +version = "0.1.10-rc4" # Keep in sync authors = ["Daniel Henry-Mantilla "] edition = "2021" From ccfa8d8cec86ea26878a85b7e85591bdaf25765c Mon Sep 17 00:00:00 2001 From: Daniel Henry-Mantilla Date: Tue, 30 Jul 2024 12:12:02 +0200 Subject: [PATCH 4/5] fixup! Add `scripts/cargo_publish.sh` convenience helper too. --- scripts/cargo_publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cargo_publish.sh b/scripts/cargo_publish.sh index ec9109794b..17108cbdd5 100755 --- a/scripts/cargo_publish.sh +++ b/scripts/cargo_publish.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Script to cargo publish a new version to safer-ffi +# Script to cargo publish a new version of safer-ffi set -euo pipefail cd "$(git rev-parse --show-toplevel)" From af3e083f2cfdaf17caaa28c013011ef4e8a6cb6e Mon Sep 17 00:00:00 2001 From: Daniel Henry-Mantilla Date: Tue, 30 Jul 2024 12:12:15 +0200 Subject: [PATCH 5/5] fixup! Add `scripts/change_version.sh` convenience helper --- scripts/change_version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/change_version.sh b/scripts/change_version.sh index ef08d6cc02..5fbc9029ce 100755 --- a/scripts/change_version.sh +++ b/scripts/change_version.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Script to bump da `safer-ffi` version of the repo (both in `.toml` and `.lock` files). +# Script to bump the `safer-ffi` version of the repo (both in `.toml` and `.lock` files). set -euo pipefail cd "$(git rev-parse --show-toplevel)"