summaryrefslogtreecommitdiff
path: root/build.gradle
blob: bdcf07d07f0b7318de84330af61f6fe2e538c1cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// This file is in the public domain.

import org.apache.tools.ant.filters.ReplaceTokens

plugins {
    // id 'org.jetbrains.kotlin.jvm' version '1.5.30'
    id 'org.jetbrains.kotlin.jvm' version '1.7.22'
    id 'idea'
    id 'java-library'
    id 'maven-publish'
    // id 'signing'
}

group = 'tech.libeufin'
version = '0.9.2'

if (!JavaVersion.current().isJava11Compatible()){
    throw new GradleException(
        "This build must be run with java 11 " +
        "or later (your version is java ${JavaVersion.current()})")
}

allprojects {
    ext.set("ktor_version", "2.2.1")
    ext.set("ktor_auth_version", "1.6.8")
    ext.set("exposed_version", "0.32.1")

    repositories {
        mavenCentral()
        jcenter()
    }
}

idea {
    module {
        excludeDirs += file("frontend")
    }
}

task versionFile() {
    new File("${projectDir}/util/src/main/resources", "version.txt").text = getRootProject().version
}

// See: https://stackoverflow.com/questions/24936781/gradle-plugin-project-version-number
task libeufinVersion {
    doLast {
        println project.version
    }
}

task replaceVersionCli(type: Copy) {
    from file("cli/bin/libeufin-cli")
    into file("${project.buildDir}/generated/python")
    filter(ReplaceTokens, tokens: [version: getRootProject().version])
}

classes {
    dependsOn versionFile
    dependsOn replaceVersionCli
}

task execArch(type: Zip) {
    dependsOn versionFile
    dependsOn replaceVersionCli
    evaluationDependsOn("nexus")
    evaluationDependsOn("sandbox")
    def topDir = "${getRootProject().name}-${getRootProject().version}"
    archiveFileName = "${topDir}.zip"
    subprojects.each {
        if (it.name == "nexus" || it.name == "sandbox") {
            Task t = it.tasks.getByName("installShadowDist")
            dependsOn(t) // invokes the task 't'
        }
    }
    from("nexus/build/install/nexus-shadow") {
        include("**/libeufin-nexus")
        include("**/*.jar")
    }
    from("sandbox/build/install/sandbox-shadow") {
        include("**/libeufin-sandbox")
        include("**/*.jar")
    }
    from("${project.buildDir}/generated/python") {
      include("libeufin-cli")
      rename { "bin/libeufin-cli" }
    }
    into(topDir)
}