-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.gradle
More file actions
97 lines (72 loc) · 2.25 KB
/
Copy pathbuild.gradle
File metadata and controls
97 lines (72 loc) · 2.25 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
plugins {
id "org.jetbrains.kotlin.jvm" version "1.6.10"
id "java"
id "application"
}
def determineVersion() {
def releaseVersion = System.getenv("GITHUB_RELEASE_NAME")
def githubSha = System.getenv("GITHUB_SHA")
if (null != releaseVersion) {
return releaseVersion
}
if (null != githubSha) {
return githubSha
}
return "1.0-SNAPSHOT"
}
group "me.stojan.kmspgp"
version determineVersion()
application {
mainClass = "me.stojan.kmspgp.cli.CLI"
}
jar {
manifest {
attributes(
"Main-Class": application.mainClass.get(),
"Implementation-Version": determineVersion()
)
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
exclude "META-INF/*"
exclude "META-INF/**/*"
exclude "module-info.class"
exclude "org/junit/**/*"
exclude "org/apache/http/**/*"
exclude "org/bouncycastle/jce/**/*"
exclude "org/bouncycastle/jcajce/**/*"
exclude "org/bouncycastle/pqc/**/*"
exclude "org/bouncycastle/x509/**/*"
exclude "io/netty/**/*"
}
task("generateBuildInfo") {
def file = new File(projectDir.absoluteFile, "src/main/kotlin/me/stojan/kmspgp/cli/BuildInfo.kt")
try {
file.delete()
} catch (ignored) {
// do nothing
}
def fileWriter = new FileWriter(file)
fileWriter.write("object BuildInfo {\n val version = \"${determineVersion()}\"\n val commit = \"${System.getenv("GITHUB_SHA") ?: "<snapshot>"}\"\n}")
fileWriter.flush()
fileWriter.close()
}
project.tasks.findByName("compileKotlin").dependsOn("generateBuildInfo")
repositories {
mavenCentral()
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation "org.slf4j:slf4j-nop:1.7.36"
implementation platform("software.amazon.awssdk:bom:2.16.60")
implementation "software.amazon.awssdk:kms"
implementation "software.amazon.awssdk:url-connection-client"
implementation "com.github.ajalt.clikt:clikt:3.4.0"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.1"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.8.1"
}
test {
useJUnitPlatform()
}