-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
65 lines (54 loc) · 2.87 KB
/
build.gradle
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
import com.gradle.publish.LoginTask
import com.gradle.publish.PublishTask
import static java.lang.System.*
plugins {
id "org.jetbrains.kotlin.jvm" version "1.8.21"
id "com.adarshr.test-logger" version "3.2.0"
id "org.jlleitschuh.gradle.ktlint" version "11.3.2"
id "com.gradle.plugin-publish" version "1.2.0"
id "com.gtramontina.ghooks.gradle" version "2.0.0"
id "java-gradle-plugin"
}
group = "com.gtramontina.ghooks.gradle"
compileKotlin { kotlinOptions.jvmTarget = "11" }
compileTestKotlin { kotlinOptions.jvmTarget = "11" }
repositories { mavenCentral() }
dependencies {
implementation(group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: "1.8.21")
implementation(group: "commons-io", name: "commons-io", version: "2.11.0")
testImplementation(group: "io.kotlintest", name: "kotlintest-runner-junit5", version: "3.4.2")
testImplementation(group: "org.junit.jupiter", name: "junit-jupiter-api", version: "5.9.3")
testImplementation(group: "org.awaitility", name: "awaitility", version: "4.2.0")
testRuntimeOnly(group: "org.junit.platform", name: "junit-platform-launcher", version: "1.9.3")
testRuntimeOnly(group: "org.junit.jupiter", name: "junit-jupiter-engine", version: "5.9.3")
}
test { useJUnitPlatform() }
// Plugin Definition ---------------------------------------------------------------------------------------------------
gradlePlugin {
website = "https://github.com/gtramontina/ghooks.gradle"
vcsUrl = "https://github.com/gtramontina/ghooks.gradle"
plugins {
create(rootProject.name.toString()) {
id = group.toString()
displayName = "ghooks"
description = "Simple Git hooks"
implementationClass = "com.gtramontina.ghooks.GHooks"
tags.set(["git", "hook", "ghook", "ghooks", "versioned"])
}
}
}
// Plugin Publishing Custom Tasks --------------------------------------------------------------------------------------
tasks.register("checkPublishCredentials") {
group = "plugin portal"
description = "Checks if your environment has the publishing credentials properly setup."
def key = getProperty("gradle.publish.key", getenv("GRADLE_PUBLISH_KEY"))
def secret = getProperty("gradle.publish.secret", getenv("GRADLE_PUBLISH_SECRET"))
doLast {
if (!key?.trim()) throw new GradleException("Could not find either the system property 'gradle.publish.key' or the environment variable 'GRADLE_PUBLISH_KEY'")
if (!secret?.trim()) throw new GradleException("Could not find either the system property 'gradle.publish.secret' or the environment variable 'GRADLE_PUBLISH_SECRET'")
setProperty("gradle.publish.key", key)
setProperty("gradle.publish.secret", secret)
}
}
tasks.withType(LoginTask).configureEach { enabled = false }
tasks.withType(PublishTask).configureEach { dependsOn("checkPublishCredentials") }