-
Notifications
You must be signed in to change notification settings - Fork 118
/
Copy pathbuild.gradle.kts
137 lines (118 loc) · 3.79 KB
/
build.gradle.kts
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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.nio.file.Files
import java.nio.file.Paths
plugins {
application
kotlin(Plugins.Kotlin.PLUGIN_JVM)
kotlin(Plugins.Kotlin.PLUGIN_SERIALIZATION) version Versions.KOTLIN
id(Plugins.PLUGIN_SHADOW_JAR) version Versions.SHADOW
id(Plugins.MAVEN_PUBLISH)
id(Plugins.CHECK_VERSION_UPDATED)
}
val artifactID = "flank-scripts"
val shadowJar: ShadowJar by tasks
shadowJar.apply {
archiveClassifier.set("")
archiveFileName.set("$artifactID.jar")
mergeServiceFiles()
@Suppress("UnstableApiUsage")
manifest {
attributes(mapOf("Main-Class" to "flank.scripts.MainKt"))
}
}
// <breaking change>.<feature added>.<fix/minor change>
version = "1.9.28"
group = "com.github.flank"
application {
mainClassName = "flank.scripts.cli.MainKt"
applicationDefaultJvmArgs = listOf(
"-Xmx2048m",
"-Xms512m"
)
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/Flank/flank")
credentials {
username = System.getenv("GITHUB_ACTOR") ?: properties["GITHUB_ACTOR"].toString()
password = System.getenv("GITHUB_TOKEN") ?: properties["GITHUB_TOKEN"].toString()
}
}
}
publications {
create<MavenPublication>("mavenJava") {
groupId = group.toString()
artifactId = artifactID
version = version
artifact(shadowJar)
pom {
name.set("Flank-scripts")
description.set("Scripts for Flank")
url.set("https://github.com/Flank/flank")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
}
pom.withXml {
// Remove deps since we're publishing a fat jar
val pom = asNode()
val depNode: groovy.util.NodeList = pom.get("dependencies") as groovy.util.NodeList
for (child in depNode) {
pom.remove(child as groovy.util.Node)
}
}
}
}
}
tasks.test {
maxHeapSize = "2048m"
minHeapSize = "512m"
}
repositories {
mavenCentral()
}
dependencies {
implementation(Dependencies.KOTLIN_SERIALIZATION)
implementation(project(Modules.COMMON))
implementation(Dependencies.CLIKT)
implementation(Dependencies.JCABI_GITHUB)
implementation(Dependencies.SLF4J_NOP)
implementation(Dependencies.GLASSFISH_JSON)
implementation(Dependencies.Fuel.COROUTINES)
testImplementation(Dependencies.JUNIT)
testImplementation(Dependencies.MOCKK)
testImplementation(Dependencies.TRUTH)
testImplementation(Dependencies.SYSTEM_RULES)
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { kotlinOptions.jvmTarget = "1.8" }
val prepareJar by tasks.registering(Copy::class) {
dependsOn("shadowJar")
from("$buildDir/libs")
include("flank-scripts.jar")
into("$projectDir/bash")
}
val download by tasks.registering(Exec::class) {
commandLine(
"gh", "release", "download", "flank-scripts-$version", "-D", System.getenv("GITHUB_WORKSPACE") ?: ".."
)
doLast {
Files.copy(
Paths.get("$artifactID.jar"),
Paths.get("flank-scripts", "bash", "$artifactID.jar")
)
}
}
val releaseFlankScripts by tasks.registering(Exec::class) {
dependsOn(":flank-scripts:publish")
commandLine(
"gh", "release", "create",
"flank-scripts-$version", "$buildDir/libs/$artifactID.jar",
"-t", "Flank Scripts $version",
"-p"
)
}