provs/build.py

102 lines
2.6 KiB
Python
Raw Permalink Normal View History

2023-08-08 07:43:28 +00:00
from subprocess import run
from pybuilder.core import init, task
from ddadevops import *
default_task = "dev"
name = "provs"
PROJECT_ROOT_PATH = "."
@init
def initialize(project):
input = {
"name": name,
"module": "notused",
"stage": "notused",
"project_root_path": PROJECT_ROOT_PATH,
"build_types": [],
"mixin_types": ["RELEASE"],
"release_primary_build_file": "build.gradle",
"release_secondary_build_files": [],
2023-11-24 22:10:02 +00:00
# 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",
],
2023-08-08 07:43:28 +00:00
}
@task
2023-11-24 22:10:02 +00:00
def build(project):
run("./gradlew assemble", shell=True)
2023-08-08 07:43:28 +00:00
@task
2023-11-24 22:10:02 +00:00
def dev(project):
build(project)
2023-08-08 07:43:28 +00:00
@task
2023-11-24 22:10:02 +00:00
def patch(project):
"""
updates version to next patch level, creates a tag, creates new SNAPSHOT version,
executes git commit and push
"""
increase_version_number(project, "PATCH")
2023-08-08 07:43:28 +00:00
release(project)
@task
2023-11-24 22:10:02 +00:00
def minor(project):
""" updates version to next minor level, creates new SNAPSHOT version, executes git commit and push """
increase_version_number(project, "MINOR")
release(project)
2023-08-08 07:43:28 +00:00
@task
2023-11-24 22:10:02 +00:00
def major(project):
""" updates version to next major level, creates new SNAPSHOT version, executes git commit and push """
increase_version_number(project, "MAJOR")
release(project)
2023-08-08 07:43:28 +00:00
@task
def tag(project):
build = get_devops_build(project)
build.tag_bump_and_push_release()
2023-08-08 07:43:28 +00:00
@task
2023-11-24 22:10:02 +00:00
def release(project):
build = get_devops_build(project)
build.prepare_release()
tag(project)
2023-08-08 07:43:28 +00:00
@task
def package(project):
2023-11-24 22:10:02 +00:00
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)
2023-11-24 22:10:02 +00:00
@task
def publish_artifacts(project):
build = get_devops_build(project)
build.publish_artifacts()
2023-08-08 07:43:28 +00:00
2023-11-24 22:10:02 +00:00
def increase_version_number(project, release_type):
build = get_devops_build(project)
build.update_release_type(release_type)