-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle.kts
120 lines (88 loc) · 3.38 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
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
import com.gradle.publish.PublishTask.GRADLE_PUBLISH_KEY
import com.gradle.publish.PublishTask.GRADLE_PUBLISH_KEY_ENV
import com.gradle.publish.PublishTask.GRADLE_PUBLISH_SECRET
import com.gradle.publish.PublishTask.GRADLE_PUBLISH_SECRET_ENV
plugins {
id("java-gradle-plugin")
id("org.jetbrains.kotlin.jvm") version "2.0.21"
id("io.gitlab.arturbosch.detekt") version "1.23.7"
id("com.autonomousapps.dependency-analysis") version "2.2.0"
id("com.gradle.plugin-publish") version "1.3.0"
}
val setupPluginUpload by tasks.registering {
if (!providers.environmentVariable("GITHUB_ACTION").isPresent) return@registering
val key = providers.environmentVariable(GRADLE_PUBLISH_KEY_ENV)
.orElse(providers.systemProperty(GRADLE_PUBLISH_KEY))
val secret = providers.environmentVariable(GRADLE_PUBLISH_SECRET_ENV)
.orElse(providers.systemProperty(GRADLE_PUBLISH_SECRET))
if (!key.isPresent || !secret.isPresent) {
error("GRADLE_PUBLISH_KEY and/or GRADLE_PUBLISH_SECRET are not defined environment or system variables")
}
// This is the git tag for a release
val githubRefName = providers.environmentVariable("GITHUB_REF_NAME").map { it.trimStart('v') }
version = checkNotNull(githubRefName.orNull) { "No GITHUB_REF_NAME env value defined" }
}
tasks.named("publishPlugins") {
dependsOn(setupPluginUpload)
}
group = "org.assertj"
version = "2.2.0-SNAPSHOT"
gradlePlugin {
website.set("https://github.com/assertj/assertj-generator-gradle-plugin")
vcsUrl.set("https://github.com/assertj/assertj-generator-gradle-plugin.git")
plugins {
create("assertJGeneratorPlugin") {
id = "org.assertj.generator"
displayName = "AssertJ Generator Gradle Plugin"
description = "Run the AssertJ generator against your source files to generate test sources."
tags.set(listOf("assertj", "testing", "generator"))
implementationClass = "org.assertj.generator.gradle.AssertJGeneratorGradlePlugin"
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib"))
api(gradleApi())
api("com.google.code.findbugs:jsr305:3.0.2")
api("org.assertj:assertj-assertions-generator:2.2.1")
implementation(gradleKotlinDsl())
implementation("com.google.guava:guava:33.3.1-jre")
val kotlinVersion = "1.6.21"
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin-api:$kotlinVersion")
testCompileOnly("org.jetbrains:annotations:26.0.1")
testImplementation(localGroovy())
testImplementation(gradleTestKit())
val junitVersion = "5.11.4"
testImplementation("org.assertj:assertj-core:3.26.3")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testImplementation("net.navatwo:gradle-plugin-better-testing-junit5:0.0.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
}
tasks.test {
useJUnitPlatform()
jvmArgs("-Djunit.jupiter.extensions.autodetection.enabled=true")
}
sourceSets {
test {
resources {
srcDir("src/test/projects")
}
}
}
tasks.check {
dependsOn(tasks.named("projectHealth"))
}
detekt {
parallel = true
autoCorrect = true
buildUponDefaultConfig = true // preconfigure defaults
config.from("$rootDir/detekt.yaml")
allRules = false // activate all available (even unstable) rules.
}
dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.7")
}