forked from Liftric/vault-client-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
95 lines (89 loc) · 2.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
import net.nemerosa.versioning.tasks.VersionDisplayTask
plugins {
`kotlin-dsl`
`maven-publish`
id("com.gradle.plugin-publish") version "0.18.0"
id("net.nemerosa.versioning") version "2.15.1"
}
group = "com.liftric.vault"
allprojects {
version = with(versioning.info) {
if (branch == "HEAD" && dirty.not()) {
tag
} else {
full
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation(gradleApi())
implementation(kotlin("gradle-plugin"))
implementation(kotlin("stdlib-jdk8"))
implementation("com.bettercloud:vault-java-driver:5.1.0")
testImplementation(gradleTestKit())
testImplementation("junit:junit:4.13.2")
testImplementation("com.github.stefanbirkner:system-rules:1.19.0")
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
withType<VersionDisplayTask> {
doLast {
println("[VersionDisplayTask] version=$version")
}
}
val createVersionFile by creating {
doLast {
mkdir(buildDir)
file("$buildDir/version").apply {
if (exists()) delete()
createNewFile()
writeText(project.version.toString())
}
}
}
val build by existing
val publish by existing
val publishToMavenLocal by existing
listOf(build.get(), publish.get(), publishToMavenLocal.get()).forEach { it.dependsOn(createVersionFile) }
val setupPluginsLogin by creating {
// see: https://github.com/gradle/gradle/issues/1246
val publishKey: String? = System.getenv("GRADLE_PUBLISH_KEY")
val publishSecret: String? = System.getenv("GRADLE_PUBLISH_SECRET")
if (publishKey != null && publishSecret != null) {
println("[setupPluginsLogin] seeting plugin portal credentials from env")
System.getProperties().setProperty("gradle.publish.key", publishKey)
System.getProperties().setProperty("gradle.publish.secret", publishSecret)
}
}
val publishPlugins by existing
publishPlugins.get().dependsOn(setupPluginsLogin)
}
publishing {
repositories {
mavenLocal()
}
}
gradlePlugin {
plugins {
create("VaultClientPlugin") {
id = "com.liftric.vault-client-plugin"
displayName = "vault-client-plugin"
implementationClass = "com.liftric.vault.VaultClientPlugin"
description = "Read and use vault secrets in your build script"
}
}
}
pluginBundle {
website = "https://github.com/Liftric/vault-client-plugin"
vcsUrl = "https://github.com/Liftric/vault-client-plugin"
description = "Gradle plugin to use Vault secrets in build scripts"
tags = listOf("vault", "hashicorp", "secret")
}