-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
118 lines (99 loc) · 3.82 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
import java.util.Properties
plugins {
kotlin("jvm") version "1.9.21"
`java-library`
jacoco
`maven-publish`
}
group = "com.smelman"
version = "1.0.0"
repositories {
mavenCentral()
}
val objectMapperVersion = "2.17.2"
val junitJupiterVersion = "5.9.3"
val slf4jVersion = "2.0.16"
val logbackVersion = "1.5.7"
val mockitoVersion = "5.5.0"
dependencies {
implementation("com.fasterxml.jackson.core:jackson-databind:$objectMapperVersion")
implementation(kotlin("stdlib-jdk8"))
implementation("org.slf4j:slf4j-api:$slf4jVersion")
implementation("ch.qos.logback:logback-classic:$logbackVersion") // SLF4J binding for Logback
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion")
testImplementation("org.junit.jupiter:junit-jupiter-params:$junitJupiterVersion")
testImplementation("org.mockito:mockito-core:$mockitoVersion") // For mocking
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion")
}
tasks.withType<Jar> {
archiveBaseName.set("rapyd-api-headers") // Change to your library name
archiveVersion.set("1.0.0") // Change to your version
from(sourceSets.main.get().output)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE // Avoids issues with duplicate files
}
tasks.test {
useJUnitPlatform()
finalizedBy("jacocoTestReport") // Generate Jacoco report after tests
}
// Configure the Jacoco report task if it exists
val jacocoTestReportTask = tasks.findByName("jacocoTestReport")
if (jacocoTestReportTask != null) {
(jacocoTestReportTask as JacocoReport).apply {
dependsOn(tasks.test) // Ensure tests are run before generating the report
reports {
xml.required.set(true) // Generate XML report
html.required.set(true) // Generate HTML report
}
sourceDirectories.setFrom(files("src/main/kotlin"))
classDirectories.setFrom(files("build/classes/kotlin/main"))
executionData.setFrom(files("build/jacoco/test.exec"))
}
}
kotlin {
jvmToolchain(17)
}
// JVM Arguments (Optional)
val gradlePropertiesFile = file("gradle.properties")
if (gradlePropertiesFile.exists()) {
val gradleProperties = Properties().apply {
load(gradlePropertiesFile.inputStream())
}
gradleProperties["org.gradle.jvmargs"] = "-Xmx4g -Xms1g -Xss2m"
gradleProperties.store(gradlePropertiesFile.outputStream(), null)
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
// Define the artifact coordinates
groupId = "com.smelman"
artifactId = "rapyd-api-headers"
version = "1.0.0"
// POM metadata
pom {
name.set("Rapyd API Headers")
description.set("A library for generating headers for Rapyd API requests")
url.set("https://github.com/semyonmelman/rapyd-api-headers") // Adjust to your GitHub repository URL
licenses {
license {
name.set("Apache License 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0")
}
}
developers {
developer {
id.set("@semyonmelman")
name.set("Melman Semyon")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/semyonmelman/rapyd-api-headers.git")
developerConnection.set("scm:git:ssh://github.com/semyonmelman/rapyd-api-headers.git")
url.set("https://github.com/semyonmelman/rapyd-api-headers")
}
}
}
}
}