-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
138 lines (121 loc) · 3.53 KB
/
build.gradle.kts
File metadata and controls
138 lines (121 loc) · 3.53 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.ktlint)
alias(libs.plugins.dokka)
id("maven-publish")
id("signing")
}
repositories {
mavenCentral()
}
java {
withSourcesJar()
withJavadocJar()
}
dependencies {
implementation(libs.kotlin.stdlib)
implementation(libs.commonsCodecs)
implementation(libs.kotlinx.coroutinesCore)
testImplementation(libs.mockk)
testImplementation(libs.kotest.runnerJUnit5)
testImplementation(libs.kotest.property)
}
group = "com.atlassian"
version = "2.2.0"
description = "onetime"
val javaVersion = JavaVersion.VERSION_1_8
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
sourceCompatibility = javaVersion.toString()
targetCompatibility = javaVersion.toString()
}
tasks.withType<KotlinCompile> {
compilerOptions {
// Default to JVM 1.8 for main source (backward compatibility)
jvmTarget.set(JvmTarget.JVM_1_8)
freeCompilerArgs.addAll(
listOf(
"-progressive",
"-java-parameters",
"-opt-in=kotlin.time.ExperimentalTime",
"-opt-in=kotlin.RequiresOptIn",
),
)
// https://youtrack.jetbrains.com/issue/KTIJ-1224
// This is really an IDE bug.
// Without explicit languageVersion the Gradle build does compile 1.5 structures (sealed interfaces). So, for Gradle the value is 1.5.
// The wrong value is only in IDE settings.
languageVersion.set(KotlinVersion.KOTLIN_2_2)
apiVersion.set(KotlinVersion.KOTLIN_2_2)
}
}
// Compile tests with JVM 17 to match test dependencies (mockk, kotest)
tasks.named<KotlinCompile>("compileTestKotlin") {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
// Compile test Java code with JVM 17 to match Kotlin tests
tasks.named<JavaCompile>("compileTestJava") {
sourceCompatibility = JavaVersion.VERSION_17.toString()
targetCompatibility = JavaVersion.VERSION_17.toString()
}
tasks {
// This task is added by Gradle when we use java.withJavadocJar()
named<Jar>("javadocJar") {
from(dokkaGenerate)
}
test {
useJUnitPlatform()
}
publishing {
publications {
create<MavenPublication>("release") {
from(project.components["java"])
pom {
packaging = "jar"
name.set(project.name)
description.set("TOTP and HOTP generator and validator for multi-factor authentication")
url.set("https://github.com/atlassian/1time")
scm {
connection.set("git@github.com:atlassian/1time.git")
url.set("https://github.com/atlassian/1time.git")
}
developers {
developer {
id.set("docampoherrera")
name.set("Diego Ocampo")
email.set("docampoherrera@atlassian.com")
}
}
licenses {
license {
name.set("Apache License 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0")
distribution.set("repo")
}
}
}
}
}
repositories {
maven {
url = uri("https://packages.atlassian.com/maven-central")
credentials {
username = System.getenv("ARTIFACTORY_USERNAME")
password = System.getenv("ARTIFACTORY_API_KEY")
}
}
}
}
signing {
useInMemoryPgpKeys(
System.getenv("SIGNING_KEY"),
System.getenv("SIGNING_PASSWORD"),
)
sign(publishing.publications["release"])
}
}