Skip to content
Snippets Groups Projects
build.gradle.kts 2.26 KiB
Newer Older

repositories {
Jan-Niclas Strüwer's avatar
Jan-Niclas Strüwer committed
    mavenCentral()
tasks.register<Exec>("run-db") {
    group = "OpenCoDE"
    description = "Runs the database in background via docker"
    commandLine("docker", "compose", "up", "-d", "db")
}

tasks.register<Exec>("run-dashboard") {
    group = "OpenCoDE"
    description = "Runs the dashboard in background via docker."
    workingDir("../dashboard")
    commandLine("docker", "compose", "up", "-d", "dashboard")
}

tasks.register("dependencyUpdates") {
Jan-Niclas Strüwer's avatar
Jan-Niclas Strüwer committed
    group = "OpenCoDE"
    description = "Prints possible dependency updates."
    dependsOn(gradle.includedBuild("app").task(":backend:dependencyUpdates"))
}

    group = "OpenCoDE"
    description = "Runs the dataprovider against the database, you should be sure database is running."
    dependsOn(gradle.includedBuild("app").task(":backend:bootRun"))

    // check if db is started and reports healthy
    doFirst {
        val checkHealthCmd = arrayOf("docker", "inspect", "--format='{{.State.Health.Status}}'", "opencode-db-1")
        val process = Runtime.getRuntime().exec(checkHealthCmd)
        val healthStatus = process.inputStream.bufferedReader().readText().trim()

        if (healthStatus != "healthy") {
            throw GradleException("Database container 'opencode-db-1' is not healthy. Please start db first via run-db task. Current db status: \"$healthStatus\" (empty = no db started)")
        }
    }

tasks.register<Exec>("run-container") {
    group = "OpenCoDE"
    description = "Runs the dataprovider against the database in foreground."
    commandLine("docker", "compose", "up", "--build", "data-provider")
tasks.register("clean") {
    group = "OpenCoDE"
    description = "Removes all builds."
    dependsOn(gradle.includedBuild("app").task(":backend:clean"))
}
tasks.register("build") {
    group = "OpenCoDE"
    description = "Build the service"
    dependsOn(gradle.includedBuild("app").task(":backend:build"))
}
tasks.register("test") {
    group = "OpenCoDE"
    description = "Runs tests."
    dependsOn(gradle.includedBuild("app").task(":backend:test"))
}
tasks.register("assemble") {
    group = "OpenCoDE"
    description = "Assembles everything into a deployable format."
    dependsOn(gradle.includedBuild("app").task(":backend:assemble"))

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.