forked from tolgee/tolgee-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
152 lines (122 loc) · 4.06 KB
/
build.gradle
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
* Copyright (c) 2020. Tolgee
*/
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath libs.kotlin
}
}
project.ext {
dbSchemaContainerName = 'tolgee_postgres_dbschema'
}
if (System.getenv().containsKey("VERSION")) {
project.version = System.getenv().get("VERSION")
} else {
project.version = 'local'
}
configurations {
ktlint
}
apply plugin: 'idea'
repositories {
mavenCentral()
}
def unpackTarget = "${project.buildDir}/dependency"
dependencies {
ktlint("com.pinterest:ktlint:0.43.2") {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL))
}
}
}
project(':server-app').afterEvaluate {
task unpack(type: Copy) {
from(zipTree(project(':server-app').tasks.findByName("bootJar").outputs.files.singleFile))
into(unpackTarget)
if (System.getenv("SKIP_SERVER_BUILD") != "true") {
dependsOn "bootJar"
}
}
task addVersionFile(type: Task) {
mustRunAfter unpack
doLast {
def file = new File("${unpackTarget}/BOOT-INF/classes/.VERSION")
file.write(project.version.toString())
}
}
apply from: "./gradle/webapp.gradle"
apply from: "./gradle/docker.gradle"
apply from: "./gradle/e2e.gradle"
project.tasks.findByName("docker").mustRunAfter(copyDist)
task packResources(type: Zip) {
dependsOn "unpack"
dependsOn "copyDist"
dependsOn "addVersionFile"
from "${project.projectDir}/build/dependency"
archiveFileName = "tolgee.jar"
destinationDirectory = file("$buildDir/libs")
entryCompression ZipEntryCompression.STORED
}
task build {
dependsOn project(':server-app').tasks.findByName("build")
dependsOn runE2e
}
task check {
dependsOn project(':server-app').tasks.findByName("check")
dependsOn ktlint
}
task bootJar {
dependsOn project(':server-app').tasks.findByName("bootJar")
}
task startDbChangelogContainer {
doLast {
exec {
commandLine "docker", "run", "-e", "POSTGRES_PASSWORD=postgres", "-d", "-p55432:5432", "--name", dbSchemaContainerName, "postgres:13"
}
Thread.sleep(5000)
}
}
task stopDbChangelogContainer(type: Exec) {
commandLine "docker", "rm", "--force", dbSchemaContainerName
mustRunAfter project(':data').tasks.findByName("diffChangeLog")
mustRunAfter project(':ee-app').tasks.findByName("diffChangeLog")
}
task diffChangeLog {
subprojects.forEach({
it.tasks.findByName("diffChangeLog")?.mustRunAfter(project(':server-app').tasks.findByName("bootRun"))
})
project(':server-app').tasks.findByName("bootRun").mustRunAfter(startDbChangelogContainer)
finalizedBy = [
startDbChangelogContainer,
project(':server-app').tasks.findByName("bootRun"),
project(':data').tasks.findByName("diffChangeLog"),
]
def billingDiffChangelog = project(':billing-app').tasks.findByName("diffChangeLog")
if (billingDiffChangelog != null) {
finalizedBy.add(billingDiffChangelog)
}
finalizedBy.add(stopDbChangelogContainer)
doFirst {
project(':server-app').bootRun.systemProperty('spring.profiles.active', 'dbschema')
}
}
}
task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "**/*.kt", "!**/data/PluralData.kt", '../billing/**/*.kt'
}
task ktlintFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style deviations."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "-F", "**/*.kt", "!**/data/PluralData.kt", '../billing/**/*.kt'
jvmArgs = ["--add-opens=java.base/java.lang=ALL-UNNAMED"]
}
subprojects {
task allDeps(type: DependencyReportTask) {}
}