-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
75 lines (65 loc) · 2.43 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
@file:Suppress("UnstableApiUsage")
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`kotlin-dsl`
signing
alias(libs.plugins.gradle.publish)
}
// Replaces the default configuration applied by KotlinDslCompilerPlugins.kt
kotlinDslPluginOptions {
tasks.withType<KotlinCompile> {
compilerOptions {
// Uses the embedded kotlin api and language version instead of the default language
// version from the KotlinDSL plugin
apiVersion = KotlinVersion.DEFAULT
languageVersion = KotlinVersion.DEFAULT
freeCompilerArgs.addAll(
"-Xexplicit-api=strict",
"-opt-in=kotlin.RequiresOptIn",
// "-Xcontext-receivers", On 19/06/2024 context receivers still work bad with gradle, do not use
)
}
}
}
tasks {
test {
useJUnitPlatform()
}
}
dependencies {
implementation(libs.kotlinx.serialization.json)
testImplementation(kotlin("test"))
}
group = "com.decathlon.gradle"
version = "0.1.0-alpha02"
val releaseVersion = version.toString().endsWith("-SNAPSHOT").not()
java {
withJavadocJar()
withSourcesJar()
}
gradlePlugin {
website = "https://github.com/Decathlon/gradle-gar-authentication"
vcsUrl = "https://github.com/Decathlon/gradle-gar-authentication.git"
plugins.create("authenticated-gar-cli") {
id = "com.decathlon.gradle.authenticated-gar-cli"
displayName = "Authenticated Gar Cli"
description =
"Gradle plugin to connect to a private Google Artifacts Registry using gcloud CLI"
implementationClass =
"com.decathlon.android.gradle.authenticatedgarcli.AuthenticatedGarCliPlugin"
tags = listOf("gar", "gcloud", "google", "artifacts", "registry")
}
}
signing {
setRequired {
// signing is required if this is a release version and the artifacts are to be published
// do not use hasTask() as this require realization of the tasks that maybe are not necessary
releaseVersion && gradle.taskGraph.allTasks.any { it is PublishToMavenRepository }
}
val signingKeyId: String? = System.getenv("GPG_KEY_ID")
val signingKey: String? = System.getenv("GPG_PRIVATE_KEY")
val signingPassword: String? = System.getenv("GPG_PASSPHRASE")
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(tasks["jar"])
}