-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle.kts
91 lines (78 loc) · 2.33 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
plugins {
`java-gradle-plugin`
`maven-publish`
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.gradle.plugin.publish)
}
dependencies {
compileOnly(gradleApi())
testImplementation(gradleTestKit())
testImplementation(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter.api)
testRuntimeOnly(libs.junit.jupiter.engine)
testRuntimeOnly(libs.junit.vintage.engine)
testRuntimeOnly(libs.junit.platform.launcher)
testImplementation(libs.assertk)
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(libs.versions.java.toolchain.get().toInt()))
}
}
sourceSets {
getByName("main").java.srcDirs("src/main/kotlin")
getByName("test").java.srcDirs("src/test/kotlin")
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = JavaVersion.toVersion(libs.versions.java.toolchain.get()).toString()
}
compileTestKotlin {
kotlinOptions.jvmTarget = JavaVersion.toVersion(libs.versions.java.toolchain.get()).toString()
}
test {
useJUnitPlatform()
}
}
// region publishing
object Artifact {
val groupId = "co.uzzu.dotenv"
val artifactId = "gradle"
val version = "3.0.0"
}
group = Artifact.groupId
version = Artifact.version
publishing {
publishing {
repositories {
mavenLocal()
}
publications.create("pluginMaven", MavenPublication::class) {
artifactId = Artifact.artifactId
}
}
}
@Suppress("UnstableApiUsage")
gradlePlugin {
website = "https://github.com/uzzu/dotenv-gradle"
vcsUrl = "https://github.com/uzzu/dotenv-gradle.git"
plugins {
create("dotenv") {
id = "co.uzzu.dotenv.gradle"
implementationClass = "co.uzzu.dotenv.gradle.DotEnvPlugin"
displayName = "Gradle dotenv plugin"
description = "A converting plugin from dotenv(.env.template, .env) files to Gradle project extension"
tags = listOf("dotenv")
}
}
}
if (env.PUBLISH_PRODUCTION.isPresent) {
val setPublishingSecrets by tasks.creating {
doLast {
System.setProperty("gradle.publish.key", env.GRADLE_PUBLISH_KEY.value)
System.setProperty("gradle.publish.secret", env.GRADLE_PUBLISH_SECRET.value)
}
}
tasks.getByName("publishPlugins").dependsOn(setPublishingSecrets)
}
// endregion