diff --git a/Cargo.lock b/Cargo.lock index bf6ba16..8c4fd57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -818,14 +818,14 @@ dependencies = [ [[package]] name = "session-keys-macros" -version = "0.1.2" +version = "3.0.10" dependencies = [ "session-keys-macros-attribute", ] [[package]] name = "session-keys-macros-attribute" -version = "0.1.2" +version = "3.0.10" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 0340fd8..e087a2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,29 @@ [workspace] -resolver = "2" members = [ "programs/gpl_session", "programs/gpl_session/macros", "programs/gpl_session/macros/attribute", ] +resolver = "2" + +[workspace.package] +version = "3.0.10" +authors = ["Magicblock Labs "] +edition = "2021" +license = "MIT" +homepage = "https://www.magicblock.gg/" +documentation = "https://docs.magicblock.gg/" +repository = "https://github.com/magicblock-labs/session-keys" +readme = "README.md" + +[workspace.dependencies] +session-keys = { path = "programs/gpl_session", version = "=3.0.10" } +session-keys-macros = { path = "programs/gpl_session/macros", version = "=3.0.10" } +session-keys-macros-attribute = { path = "programs/gpl_session/macros/attribute", version = "=3.0.10" } + +# Magicblock + [profile.release] overflow-checks = true lto = "fat" diff --git a/programs/gpl_session/Cargo.toml b/programs/gpl_session/Cargo.toml index 1800869..06995b9 100644 --- a/programs/gpl_session/Cargo.toml +++ b/programs/gpl_session/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "session-keys" -version = "3.0.10" +version = { workspace = true } edition = "2021" authors = ["Gum Core Dev "] license = "GPL-3.0-or-later" @@ -22,4 +22,4 @@ idl-build = ["anchor-lang/idl-build"] [dependencies] anchor-lang = "^0" solana-security-txt = "^1.1.1" -session-keys-macros = { version = "^0.1.2", path = "macros", optional = true } +session-keys-macros = { workspace = true, path = "macros", optional = true } diff --git a/programs/gpl_session/macros/Cargo.toml b/programs/gpl_session/macros/Cargo.toml index 33c0ded..6215e07 100644 --- a/programs/gpl_session/macros/Cargo.toml +++ b/programs/gpl_session/macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "session-keys-macros" -version = "0.1.2" +version = { workspace = true } edition = "2021" authors = ["Magicblock Dev "] license = "GPL-3.0-or-later" @@ -10,4 +10,4 @@ repository = "https://github.com/magicblock-labs/gum-program-library" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -session-keys-macros-attribute = { version = "0.1.2", path = "attribute" } +session-keys-macros-attribute = { workspace = true , path = "attribute" } diff --git a/programs/gpl_session/macros/attribute/Cargo.toml b/programs/gpl_session/macros/attribute/Cargo.toml index 56f6c7e..e24a7e1 100644 --- a/programs/gpl_session/macros/attribute/Cargo.toml +++ b/programs/gpl_session/macros/attribute/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "session-keys-macros-attribute" -version = "0.1.2" +version = { workspace = true } edition = "2021" authors = ["Magicblock Dev "] license = "GPL-3.0-or-later" diff --git a/version_align.sh b/version_align.sh new file mode 100755 index 0000000..afee270 --- /dev/null +++ b/version_align.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +set -e + +echo "Reading Cargo.toml" + +# Step 1: Read the version from Cargo.toml +version=$(grep '^version = ' Cargo.toml | head -n 1 | sed 's/version = "\(.*\)"/\1/') + +if [ -z "$version" ]; then + echo "Version not found in Cargo.toml" + exit 1 +fi + +echo "Aligning for version: $version" + +# GNU/BSD compat +sedi=(-i'') +case "$(uname)" in + # For macOS, use two parameters + Darwin*) sedi=(-i '') +esac + +echo "Updating ..." + +# Update the version for all crates in the Cargo.toml workspace.dependencies section +sed "${sedi[@]}" -e '/\[workspace.dependencies\]/,/# Magicblock/s/version = ".*"/version = "='$version'"/' Cargo.toml + +# Potential for collisions in Cargo.lock, use cargo update to update it +cargo update --workspace --manifest-path ./Cargo.toml + +# Check if any changes have been made to the specified files, if running with --check +if [[ "$1" == "--check" ]]; then + files_to_check=( + "Cargo.toml" + "programs/gpl_session/Cargo.toml" + "programs/gpl_session/macros/Cargo.toml" + "programs/gpl_session/macros/attribute/Cargo.toml" + ) + + for file in "${files_to_check[@]}"; do + # Check if the file has changed from the previous commit + if git diff --name-only | grep -q "$file"; then + echo "Error: version not aligned for $file. Align the version, commit and try again." + exit 1 + fi + done + exit 0 +fi