update build.py

This commit is contained in:
ansgarz 2023-11-24 23:10:02 +01:00
parent e060d584e9
commit 48e9b74b37
2 changed files with 51 additions and 33 deletions

View file

@ -1,5 +1,5 @@
buildscript { buildscript {
ext.kotlin_version = "1.7.20" ext.kotlin_version_no = "1.7.20"
ext.CI_PROJECT_ID = System.env.CI_PROJECT_ID ext.CI_PROJECT_ID = System.env.CI_PROJECT_ID
repositories { repositories {
@ -8,8 +8,8 @@ buildscript {
} }
plugins { plugins {
id "org.jetbrains.kotlin.jvm" version "$kotlin_version" id "org.jetbrains.kotlin.jvm" version "$kotlin_version_no"
id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version" id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version_no"
id "java" id "java"
id "java-test-fixtures" id "java-test-fixtures"
} }
@ -68,7 +68,7 @@ compileTestJava.options.debugOptions.debugLevel = "source,lines,vars"
dependencies { 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-json:1.3.2")
api("org.jetbrains.kotlinx:kotlinx-serialization-core:1.3.2") api("org.jetbrains.kotlinx:kotlinx-serialization-core:1.3.2")
api("org.jetbrains.kotlinx:kotlinx-cli:0.3.4") 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-classic:1.2.11')
api('ch.qos.logback:logback-core: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("com.hierynomus:sshj:0.32.0")
implementation("aws.sdk.kotlin:s3:0.17.1-beta") implementation("aws.sdk.kotlin:s3:0.17.1-beta")

View file

@ -19,40 +19,54 @@ def initialize(project):
"mixin_types": ["RELEASE"], "mixin_types": ["RELEASE"],
"release_primary_build_file": "build.gradle", "release_primary_build_file": "build.gradle",
"release_secondary_build_files": [], "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 @task
def patch(project): 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) release(project)
@task @task
def minor(project): 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) release(project)
@task @task
def major(project): 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) release(project)
@task
def dev(project):
linttest(project, "NONE")
@task
def prepare(project):
build = get_devops_build(project)
build.prepare_release()
@task @task
def tag(project): def tag(project):
build = get_devops_build(project) build = get_devops_build(project)
@ -60,24 +74,28 @@ def tag(project):
@task @task
def build(project): def release(project):
print("---------- build stage ----------") build = get_devops_build(project)
run("./gradlew assemble", shell=True) build.prepare_release()
tag(project)
@task @task
def package(project): def package(project):
run("./gradlew -x test jar", shell=True) run("./gradlew assemble -x test jar", shell=True)
run("./gradlew -x test uberjarDesktop", shell=True) run("./gradlew assemble -x test uberjarDesktop", shell=True)
run("./gradlew -x test uberjarServer", shell=True) run("./gradlew assemble -x test uberjarServer", shell=True)
run("./gradlew -x test uberjarSyspec", 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 sha256sum {} \; | sort > sha256sum.lst", shell=True)
run("cd build/libs/ && find . -type f -exec sha512sum {} \; | sort > sha512sum.lst", shell=True) run("cd build/libs/ && find . -type f -exec sha512sum {} \; | sort > sha512sum.lst", shell=True)
def release(project): @task
prepare(project) def publish_artifacts(project):
tag(project) build = get_devops_build(project)
build.publish_artifacts()
def linttest(project, release_type):
build(project) def increase_version_number(project, release_type):
build = get_devops_build(project)
build.update_release_type(release_type)