From 2ce975fd60bb299a90612a95486befa9bd85cd17 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 5 Jan 2025 23:53:59 +0800 Subject: [PATCH] build: add `-dev` suffix to api version in development build --- CHANGELOG.md | 1 + api/build.gradle.kts | 2 +- build.gradle.kts | 10 ++++++++++ server/build.gradle.kts | 11 ++--------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c677db14..ff87b771e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ Unless otherwise specified, any version comparison below is the comparison of se - (API) `EntityBaseComponent#getBlockStateStandingOn` now return `BlockStateWithPos` instead of `BlockState`. - (API) Removed `BlockFace#horizontalIndex` which is useless. - Removed useless class `PackageClassLoaderUtils`, dependency `org.reflections.reflections` is also removed. +- Added `-dev` suffix to api version in development build. ### Fixed diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 04dbfba36..bcf24970a 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -1,7 +1,7 @@ /** * The current version of allay-api */ -version = "0.4.0" +version = "0.4.0" + if (rootProject.ext.get("isDevBuild") as Boolean) "-dev" else "" dependencies { api(libs.network) { diff --git a/build.gradle.kts b/build.gradle.kts index 35c9ab202..73d509f43 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,6 +3,16 @@ plugins { id("maven-publish") } +ext { + /** + * Indicates whether the current build is a development build. + * + * This value should be changed to false before release the next stable version, + * and after releasing, change it back to true. + */ + set("isDevBuild", true) +} + tasks.jar { enabled = false } diff --git a/server/build.gradle.kts b/server/build.gradle.kts index 292c81d57..748701efe 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -1,20 +1,13 @@ import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer import java.io.ByteArrayOutputStream -/** - * Indicates whether the current build is a development build. - * - * This value should be changed to false before release the next stable version, - * and after releasing, change it back to true. - */ -val isDevBuild = true /** * The current version of allay-server * * This is not the same as the version of allay-api. * Please note that they are two things. */ -version = "0.1.3" + if (isDevBuild) "-dev" else "" +version = "0.1.3" + if (rootProject.ext.get("isDevBuild") as Boolean) "-dev" else "" plugins { id("jacoco") @@ -52,7 +45,7 @@ gitProperties { gitPropertiesName = "git.properties" gitPropertiesResourceDir.set(file("${rootProject.projectDir}/data/resources")) gitProperties { - customProperty("git.build.is_dev_build", isDevBuild) + customProperty("git.build.is_dev_build", rootProject.ext.get("isDevBuild") as Boolean) /** * The version of allay-api. *