-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle.kts
96 lines (83 loc) · 2.09 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
plugins {
id("java")
id("jacoco")
}
group = "io.github.jetkai"
version = "1.1.2"
java {
//withSourcesJar()
//withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
mavenCentral()
}
dependencies {
//Jackson to parse JSON data
implementation("com.fasterxml.jackson.core:jackson-databind:2.14.2")
//JUnit for testing
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
}
/**
* Character Encoding
* --- START ---
*/
tasks.withType<JavaExec> {
jvmArgs = listOf("-Dfile.encoding=UTF-8", "-Dconsole.encoding=UTF-8")
}
tasks.withType<Javadoc> {
options.encoding = "UTF-8"
}
tasks.compileJava {
options.encoding = "UTF-8"
}
/**
* Character Encoding
* --- END ---
*/
/**
* Set Environmental Variables for the OPEN_AI_API_KEY
* Called by System.getenv("OPEN_AI_API_KEY"); in source-code
*/
tasks.register("setEnvironmentVariable") {
doFirst {
val env = System.getenv().toMutableMap()
env["OPEN_AI_API_KEY"] = property("open.ai.api.key") as String
env["OPEN_AI_ORGANIZATION"] = property("open.ai.organization") as String
env["JIRA_USERNAME"] = property("jira.username") as String
env["JIRA_PASSWORD"] = property("jira.password") as String
val processBuilder = ProcessBuilder()
processBuilder.environment().putAll(env)
}
}
tasks.withType<Jar> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveFileName.set("openai-binary.jar")
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}
tasks.getByName<Test>("test") {
useJUnitPlatform()
}
/**
* Jacoco Testing Plugin
* --- START ---
*/
tasks.test {
finalizedBy(tasks.jacocoTestReport)
}
tasks.jacocoTestReport {
reports {
xml.required.set(true)
}
dependsOn(tasks.test)
}
/**
* Jacoco Testing Plugin
* --- END ---
*/