From 51dda0606fe0f8b8ef87e0bdeeb1584e6ec8519d Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 1 Feb 2023 10:05:26 +0000 Subject: [PATCH] Try to improve release --- api/build.gradle | 2 +- app/build.gradle | 8 +++----- beacon/build.gradle | 2 +- build.gradle | 2 ++ core/build.gradle | 2 +- dist/build.gradle | 2 +- extension/build.gradle | 2 +- gradle/gradle_scripts/publish-base.gradle | 5 ++--- dist/version => version | 0 9 files changed, 12 insertions(+), 13 deletions(-) rename dist/version => version (100%) diff --git a/api/build.gradle b/api/build.gradle index 98e92f9f4..4c13d8ddf 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -11,7 +11,7 @@ apply from: "$rootDir/gradle/gradle_scripts/junit.gradle" System.setProperty('excludeExtensionLibrary', 'true') apply from: "$rootDir/gradle/gradle_scripts/extension_test.gradle" -version = file("$rootDir/dist/version").text +version = rootProject.versionString group = 'io.xpipe' archivesBaseName = 'xpipe-api' diff --git a/app/build.gradle b/app/build.gradle index 7a44db7c9..e7ae3cd3c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,7 @@ repositories { mavenCentral() } -def appVersion = file('../dist/version').text -def apiVersion = project(':api').version +def appVersion = rootProject.versionString configurations { dep @@ -136,7 +135,7 @@ run { systemProperty 'io.xpipe.app.writeLogs', "true" systemProperty 'io.xpipe.app.writeSysOut', "true" systemProperty 'io.xpipe.app.developerMode', "true" - systemProperty 'io.xpipe.app.logLevel', "trace" + systemProperty 'io.xpipe.app.logLevel', "debug" systemProperty "io.xpipe.beacon.port", "21724" // systemProperty "io.xpipe.beacon.printMessages", "true" systemProperty "io.xpipe.app.extensions", extensionDirList @@ -166,8 +165,7 @@ task writeBuildProperties(type: DefaultTask) { def resourcesDir = new File(sourceSets.main.output.resourcesDir, "io/xpipe/app/resources") resourcesDir.mkdirs() def contents = "version=$appVersion\n" + - "build=$appVersion-${new Date().format('yyyyMMddHHmm')}\n" + - "apiVersion=$apiVersion\n" + "build=$appVersion-${new Date().format('yyyyMMddHHmm')}\n" new File(resourcesDir, "app.properties").text = contents } } diff --git a/beacon/build.gradle b/beacon/build.gradle index ba42b35a4..8b14e6f70 100644 --- a/beacon/build.gradle +++ b/beacon/build.gradle @@ -11,7 +11,7 @@ apply from: "$rootDir/gradle/gradle_scripts/lombok.gradle" dependencies { } -version = file("$rootDir/dist/version").text +version = rootProject.versionString group = 'io.xpipe' archivesBaseName = 'xpipe-beacon' diff --git a/build.gradle b/build.gradle index a52842036..0d4d3d65d 100644 --- a/build.gradle +++ b/build.gradle @@ -25,4 +25,6 @@ project.ext { fullVersion = file("$rootDir/private_files.txt").exists() arch = getArchName() privateExtensions = file("$rootDir/private_extensions.txt").exists() ? file("$rootDir/private_extensions.txt").readLines() : [] + isFullRelease = System.getenv('RELEASE') != null && Boolean.parseBoolean(System.getenv('RELEASE')) + versionString = file('version').text + (isFullRelease ? '' : '-SNAPSHOT') } diff --git a/core/build.gradle b/core/build.gradle index 604927b02..bc2fe3693 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -20,7 +20,7 @@ dependencies { implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jdk8', version: "2.13.0" } -version = file("$rootDir/dist/version").text +version = rootProject.versionString group = 'io.xpipe' archivesBaseName = 'xpipe-core' diff --git a/dist/build.gradle b/dist/build.gradle index bbf238cc6..abbd97315 100644 --- a/dist/build.gradle +++ b/dist/build.gradle @@ -23,7 +23,7 @@ repositories { } -version = file('version').text +version = rootProject.versionString project.ext { buildId = UUID.nameUUIDFromBytes(version.toString().getBytes()) diff --git a/extension/build.gradle b/extension/build.gradle index 8b624cb2f..9d80a7485 100644 --- a/extension/build.gradle +++ b/extension/build.gradle @@ -13,7 +13,7 @@ configurations { compileOnly.extendsFrom(dep) } -version = file("$rootDir/dist/version").text +version = rootProject.versionString group = 'io.xpipe' archivesBaseName = 'xpipe-extension' diff --git a/gradle/gradle_scripts/publish-base.gradle b/gradle/gradle_scripts/publish-base.gradle index b94c86b65..af9f08143 100644 --- a/gradle/gradle_scripts/publish-base.gradle +++ b/gradle/gradle_scripts/publish-base.gradle @@ -3,13 +3,12 @@ java { withSourcesJar() } -def isSnapshot = project.getVersion().endsWith('SNAPSHOT') -def repoUrl = isSnapshot ? 'https://s01.oss.sonatype.org/content/repositories/snapshots/' +def repoUrl = !rootProject.isFullRelease ? 'https://s01.oss.sonatype.org/content/repositories/snapshots/' : 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/' def user = project.hasProperty('sonatypeUsername') ? project.property('sonatypeUsername') : System.getenv('SONATYPE_USERNAME') def pass = project.hasProperty('sonatypePassword') ? project.property('sonatypePassword') : System.getenv('SONATYPE_PASSWORD') -if (!isSnapshot) { +if (rootProject.isFullRelease) { publish.finalizedBy(rootProject.getTasks().getByName('closeAndReleaseRepository')) } diff --git a/dist/version b/version similarity index 100% rename from dist/version rename to version