From 48e9b74b377492e4a70ababe97da6d5074be1fad Mon Sep 17 00:00:00 2001 From: ansgarz Date: Fri, 24 Nov 2023 23:10:02 +0100 Subject: [PATCH] update build.py --- build.gradle | 10 +++---- build.py | 74 ++++++++++++++++++++++++++++++++-------------------- 2 files changed, 51 insertions(+), 33 deletions(-) diff --git a/build.gradle b/build.gradle index ed0ab7d..e9f4f70 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = "1.7.20" + ext.kotlin_version_no = "1.7.20" ext.CI_PROJECT_ID = System.env.CI_PROJECT_ID repositories { @@ -8,8 +8,8 @@ buildscript { } plugins { - id "org.jetbrains.kotlin.jvm" version "$kotlin_version" - id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version" + id "org.jetbrains.kotlin.jvm" version "$kotlin_version_no" + id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version_no" id "java" id "java-test-fixtures" } @@ -68,7 +68,7 @@ compileTestJava.options.debugOptions.debugLevel = "source,lines,vars" dependencies { - api("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version") + api("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version_no") api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2") api("org.jetbrains.kotlinx:kotlinx-serialization-core:1.3.2") api("org.jetbrains.kotlinx:kotlinx-cli:0.3.4") @@ -79,7 +79,7 @@ dependencies { api('ch.qos.logback:logback-classic:1.2.11') api('ch.qos.logback:logback-core:1.2.11') - implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version") + implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version_no") implementation("com.hierynomus:sshj:0.32.0") implementation("aws.sdk.kotlin:s3:0.17.1-beta") diff --git a/build.py b/build.py index 634e3d2..4c1276b 100644 --- a/build.py +++ b/build.py @@ -19,40 +19,54 @@ def initialize(project): "mixin_types": ["RELEASE"], "release_primary_build_file": "build.gradle", "release_secondary_build_files": [], + # release artifacts + "release_artifact_server_url": "https://repo.prod.meissa.de", + "release_organisation": "meissa", + "release_repository_name": name, + "release_artifacts": [ + "build/libs/provs-server.jar", + "build/libs/provs-desktop.jar", + "build/libs/provs-syspec.jar", + "build/libs/sha256sum.lst", + "build/libs/sha512sum.lst", + ], } - build = ReleaseMixin(project, input) - build.initialize_build_dir() + +@task +def build(project): + run("./gradlew assemble", shell=True) + + +@task +def dev(project): + build(project) + @task def patch(project): - linttest(project, "PATCH") + """ + updates version to next patch level, creates a tag, creates new SNAPSHOT version, + executes git commit and push + """ + increase_version_number(project, "PATCH") release(project) @task def minor(project): - linttest(project, "MINOR") + """ updates version to next minor level, creates new SNAPSHOT version, executes git commit and push """ + increase_version_number(project, "MINOR") release(project) @task def major(project): - linttest(project, "MAJOR") + """ updates version to next major level, creates new SNAPSHOT version, executes git commit and push """ + increase_version_number(project, "MAJOR") release(project) -@task -def dev(project): - linttest(project, "NONE") - - -@task -def prepare(project): - build = get_devops_build(project) - build.prepare_release() - - @task def tag(project): build = get_devops_build(project) @@ -60,24 +74,28 @@ def tag(project): @task -def build(project): - print("---------- build stage ----------") - run("./gradlew assemble", shell=True) +def release(project): + build = get_devops_build(project) + build.prepare_release() + tag(project) @task def package(project): - run("./gradlew -x test jar", shell=True) - run("./gradlew -x test uberjarDesktop", shell=True) - run("./gradlew -x test uberjarServer", shell=True) - run("./gradlew -x test uberjarSyspec", shell=True) + run("./gradlew assemble -x test jar", shell=True) + run("./gradlew assemble -x test uberjarDesktop", shell=True) + run("./gradlew assemble -x test uberjarServer", shell=True) + run("./gradlew assemble -x test uberjarSyspec", shell=True) run("cd build/libs/ && find . -type f -exec sha256sum {} \; | sort > sha256sum.lst", shell=True) run("cd build/libs/ && find . -type f -exec sha512sum {} \; | sort > sha512sum.lst", shell=True) -def release(project): - prepare(project) - tag(project) +@task +def publish_artifacts(project): + build = get_devops_build(project) + build.publish_artifacts() -def linttest(project, release_type): - build(project) \ No newline at end of file + +def increase_version_number(project, release_type): + build = get_devops_build(project) + build.update_release_type(release_type)