-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
117 lines (95 loc) · 2.99 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
117 lines (95 loc) · 2.99 KB
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
import de.undercouch.gradle.tasks.download.Download
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
/* Kotlin JVM version. */
kotlin("jvm") version "2.2.21"
/* Kotlinx serialization plugin. */
id("org.jetbrains.kotlin.plugin.serialization") version "2.2.21"
/* OpenAPI Generator for Frontend internal API generation. */
id ("org.openapi.generator") version "7.17.0"
/* Download plugin to load OAS. */
id ("de.undercouch.download") version "5.6.0"
idea
}
allprojects {
/* Repositories for build script. */
buildscript {
repositories {
mavenCentral()
}
}
/* Project repositories for build script. */
repositories {
mavenCentral()
}
}
subprojects {
/* All subprojects are Kotlin projects. */
apply {
plugin("kotlin")
plugin("application")
plugin("idea")
plugin("org.jetbrains.kotlin.plugin.serialization")
}
/* Group name of our artifacts */
group = "ch.pontius.kiar"
/* Our current version, on dev branch this should always be release+1-SNAPSHOT */
version = "1.4.1"
tasks {
compileKotlin {
compilerOptions {
compilerOptions.jvmTarget = JvmTarget.JVM_21
}
}
compileTestKotlin {
compilerOptions {
compilerOptions.jvmTarget = JvmTarget.JVM_21
}
}
test {
useJUnitPlatform()
}
}
}
val fullOAS = "http://localhost:7070/swagger-docs"
val oasFile = "${project.projectDir}/doc/oas.json"
openApiGenerate {
generatorName.set("typescript-angular")
inputSpec.set(oasFile)
outputDir.set("${project.projectDir}/kiar-ui/openapi")
configOptions.set(mapOf(
"npmName" to "@kiar-openapi/api",
"ngVersion" to "20.3.0",
"snapshot" to "true",
"enumPropertyNaming" to "original"
))
}
/**
* Task to generate OAS. Requires running tool
*/
tasks.register<Download>("generateOAS") {
val f = project.file(oasFile)
src(fullOAS)
dest(f)
}
/**
* Task to run database migration. Requires running tool
*/
tasks.register<JavaExec>("runMigration") {
group = "application"
description = "Run the database migration logic (Xodus > SQLite) with two custom arguments."
// use the same classpath that the standard `run` task uses
val migration = project(":kiar-migration")
classpath = migration.sourceSets["main"].runtimeClasspath
mainClass = "ch.pontius.kiar.migration.MainKt"
// read arguments from project properties (e.g. -PfirstArg=foo -PsecondArg=bar)
val source: String by project
val destination: String by project
args(source, destination)
// optional: fail fast if the user forgets to provide the arguments
doFirst {
if (!project.hasProperty("source") || !project.hasProperty("destination")) {
throw GradleException("Both `source` and `destination` must be supplied, e.g. -source=foo -destination=bar")
}
}
}