From 7f9f18bc76efa21c649986602640db86fb6da52e Mon Sep 17 00:00:00 2001 From: Daniel Vigovszky Date: Thu, 18 Apr 2024 13:00:36 +0200 Subject: [PATCH] Fix version replacement (#423) --- Makefile.toml | 119 +++++--------------------------------------------- 1 file changed, 12 insertions(+), 107 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index 9b3579bfb4..d5a7f1af1b 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -46,13 +46,7 @@ description = """This is the top-level task that builds everything in release mo to build for other target than the current one, can be linux/amd64 or linux/arm64. This is used for cross-compiling for docker images.""" dependencies = [ - "set-golem-template-service-version", - "set-golem-worker-service-version", - "set-golem-worker-executor-version", - "set-golem-shard-manager-version", - "set-golem-api-grpc-version", - "set-golem-common-version", - "set-golem-test-framework-version", + "set-version", "build-release-default", "build-release-override-linux-amd64", "build-release-override-linux-arm64" @@ -64,9 +58,6 @@ dependencies = [ [tasks.build-release-default] description = "Build the project in release mode" condition = { env_not_set = ["PLATFORM_OVERRIDE"] } -dependencies = [ - "set-golem-client-version", "set-golem-cli-version", # these need to be set before the build for publishing -] command = "cargo" args = ["build", "--release"] @@ -246,70 +237,28 @@ dependencies = [ "publish-golem-cli" ] -[tasks.set-golem-client-version] -description = "Sets the version in golem-client/Cargo.toml to the value of the VERSION environment variable" +[tasks.set-version] +description = "Sets the version in all Cargo.toml files to the value of the VERSION environment variable" condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-client/Cargo.toml"] +script = ''' +grep -rl --include '.*Cargo\.toml' '0\.0\.0' | xargs sed -i "s/0\.0\.0/${VERSION}/g" +''' -[tasks.set-golem-client-version.mac] +[tasks.set-version.mac] condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-client/Cargo.toml"] +script = ''' +grep -rl --include '.*Cargo\.toml' '0\.0\.0' | xargs sed -i "" "s/0\.0\.0/${VERSION}/g" +''' [tasks.publish-golem-client] description = "Publishes golem-client package to crates.io" -dependencies = ["set-golem-client-version", "set-golem-cli-version", "build-release"] +dependencies = ["build-release"] command = "cargo" args = ["publish", "-p", "golem-client", "--all-features", "--allow-dirty"] -[tasks.set-golem-cli-version] -description = "Sets the version in golem-cli/Cargo.toml to the value of the VERSION environment variable" -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-cli/Cargo.toml"] - -[tasks.set-golem-cli-version.mac] -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-cli/Cargo.toml"] - -[tasks.set-golem-test-framework-version] -description = "Sets the version in golem-test-framework/Cargo.toml to the value of the VERSION environment variable" -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-test-framework/Cargo.toml"] - -[tasks.set-golem-test-framework-version.mac] -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-test-framework/Cargo.toml"] - -[tasks.set-golem-common-version] -description = "Sets the version in golem-common/Cargo.toml to the value of the VERSION environment variable" -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-common/Cargo.toml"] - -[tasks.set-golem-common-version.mac] -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-common/Cargo.toml"] - -[tasks.set-golem-api-grpc-version] -description = "Sets the version in golem-api-grpc/Cargo.toml to the value of the VERSION environment variable" -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-api-grpc/Cargo.toml"] - -[tasks.set-golem-api-grpc-version.mac] -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-api-grpc/Cargo.toml"] - [tasks.publish-golem-cli] description = "Publishes golem-cli package to crates.io" -dependencies = ["set-golem-cli-version", "set-golem-client-version", "build-release"] +dependencies = ["build-release"] command = "cargo" args = ["publish", "-p", "golem-cli", "--all-features", "--allow-dirty"] @@ -363,47 +312,3 @@ env = { "PLATFORM_TARGET" = "aarch64-unknown-linux-gnu" } extend = "package-release-base" dependencies = ["build-release-override-linux-arm64"] - -[tasks.set-golem-template-service-version] -description = "Sets the version in golem-template-service/Cargo.toml to the value of the VERSION environment variable" -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-template-service/Cargo.toml"] - -[tasks.set-golem-template-service-version.mac] -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-template-service/Cargo.toml"] - -[tasks.set-golem-worker-service-version] -description = "Sets the version in golem-worker-service/Cargo.toml to the value of the VERSION environment variable" -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-worker-service/Cargo.toml"] - -[tasks.set-golem-worker-service-version.mac] -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-worker-service/Cargo.toml"] - -[tasks.set-golem-worker-executor-version] -description = "Sets the version in golem-worker-executor/Cargo.toml to the value of the VERSION environment variable" -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-worker-executor/Cargo.toml"] - -[tasks.set-golem-worker-executor-version.mac] -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-worker-executor/Cargo.toml"] - -[tasks.set-golem-shard-manager-version] -description = "Sets the version in golem-shard-manager/Cargo.toml to the value of the VERSION environment variable" -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "s/0\\.0\\.0/${VERSION}/g", "golem-shard-manager/Cargo.toml"] - -[tasks.set-golem-shard-manager-version.mac] -condition = { env_set = ["VERSION"] } -command = "sed" -args = ["-i", "", "s/0\\.0\\.0/${VERSION}/g", "golem-shard-manager/Cargo.toml"]