From f01a5a573daabe05ede0f18dbdd0605a348b1380 Mon Sep 17 00:00:00 2001 From: SpaiR Date: Sun, 17 Apr 2022 22:57:06 +0300 Subject: [PATCH] [Build] Tweak build classes --- buildSrc/scripts/release.sh | 22 +++++++++---------- .../src/main/groovy/tool/UpVersion.groovy | 16 ++++++++------ .../groovy/tool/generator/GenerateLibs.groovy | 3 +-- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/buildSrc/scripts/release.sh b/buildSrc/scripts/release.sh index ab51ebd..172858f 100644 --- a/buildSrc/scripts/release.sh +++ b/buildSrc/scripts/release.sh @@ -3,24 +3,24 @@ BASEDIR=$(dirname "$0") cd $BASEDIR/../.. || exit -echo > Publishing Modules... -echo >> Module [imgui-app] +echo '> Publishing Modules...' +echo '>> Module [imgui-app]' ./gradlew :imgui-app:publishMavenJavaPublicationToMavenCentralRepository -echo >> Module [imgui-lwjgl3] +echo '>> Module [imgui-lwjgl3]' ./gradlew :imgui-lwjgl3:publishMavenJavaPublicationToMavenCentralRepository -echo >> Module [imgui-binding] +echo '>> Module [imgui-binding]' ./gradlew :imgui-binding:publishMavenJavaPublicationToMavenCentralRepository -echo > Publishing Natives... -echo >> Natives: [win & freetype] +echo '> Publishing Natives...' +echo '>> Natives: [win & freetype]' ./gradlew :imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType=win -Pfreetype=true -echo >> Natives: [win & no freetype] +echo '>> Natives: [win & no freetype]' ./gradlew :imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType=win -Pfreetype=false -echo >> Natives: [linux & freetype] +echo '>> Natives: [linux & freetype]' ./gradlew :imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType=linux -Pfreetype=true -echo >> Natives: [linux & no freetype] +echo '>> Natives: [linux & no freetype]' ./gradlew :imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType=linux -Pfreetype=false -echo >> Natives: [mac & freetype] +echo '>> Natives: [mac & freetype]' ./gradlew :imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType=mac -Pfreetype=true -echo >> Natives: [mac & no freetype] +echo '>> Natives: [mac & no freetype]' ./gradlew :imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType=mac -Pfreetype=false diff --git a/buildSrc/src/main/groovy/tool/UpVersion.groovy b/buildSrc/src/main/groovy/tool/UpVersion.groovy index d09ce2b..e0f7cf4 100644 --- a/buildSrc/src/main/groovy/tool/UpVersion.groovy +++ b/buildSrc/src/main/groovy/tool/UpVersion.groovy @@ -1,32 +1,34 @@ package tool -import groovy.transform.CompileStatic import org.gradle.api.DefaultTask import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction -@CompileStatic class UpVersion extends DefaultTask { @Internal String group = 'build' @Internal String description = 'Up project version to the next one.' - private final String currentVersion = project.findProperty('version') - private final String nextVersion = project.findProperty('next') - @TaskAction void up() { + String currentVersion = project.findProperty('version') + String nextVersion = project.findProperty('next') + if (!currentVersion) { - throw new IllegalArgumentException('No property was found: "version"') + throw new IllegalStateException('No property was found: "version"') } if (!nextVersion) { - throw new IllegalArgumentException('No property was found: "next"') + throw new IllegalStateException('No property was found: "next"') } + println "Up project version: $nextVersion..." + + println 'Updating gradle.properties...' def propsFile = project.file('gradle.properties') propsFile.text = propsFile.text.replace("version=$currentVersion", "version=$nextVersion") + println 'Updating README.md...' def readmeFile = project.file('README.md') readmeFile.text = readmeFile.text.replace(currentVersion, nextVersion) } diff --git a/buildSrc/src/main/groovy/tool/generator/GenerateLibs.groovy b/buildSrc/src/main/groovy/tool/generator/GenerateLibs.groovy index bb2d323..7a7f6f2 100644 --- a/buildSrc/src/main/groovy/tool/generator/GenerateLibs.groovy +++ b/buildSrc/src/main/groovy/tool/generator/GenerateLibs.groovy @@ -38,8 +38,7 @@ class GenerateLibs extends DefaultTask { println '=====================================' if (!buildEnvs) { - println 'No build targets. Task is cancelled.' - return + throw new IllegalStateException('No build targets') } // Generate h/cpp files for JNI