-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
178 lines (154 loc) · 5.28 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("java-gradle-plugin")
id("maven-publish")
id("org.jetbrains.kotlin.jvm") version "1.6.21"
id("com.gradle.plugin-publish") version "1.0.0"
id("io.gitlab.arturbosch.detekt") version "1.21.0"
id("net.researchgate.release") version "3.0.2"
id("com.github.breadmoirai.github-release") version "2.4.1"
}
defaultTasks("build", "publishToMavenLocal")
description = "Gradle Environment Plugin"
group = "com.cognifide.gradle"
allprojects {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
plugins.withId("java") {
java {
withSourcesJar()
withJavadocJar()
}
tasks.withType<JavaCompile>().configureEach{
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
tasks.withType<Test>().configureEach {
testLogging.showStandardStreams = true
useJUnitPlatform()
}
}
plugins.withId("kotlin") {
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
}
}
dependencies {
// Build environment
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.21.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
implementation("com.cognifide.gradle:common-plugin:1.1.11")
// External
implementation("org.buildobjects:jproc:2.8.0")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("commons-io:commons-io:2.11.0")
implementation("org.apache.httpcomponents:httpclient:4.5.13")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.1")
// Cross-project
compileOnly(project(":common"))
}
val functionalTestSourceSet = sourceSets.create("functionalTest")
gradlePlugin.testSourceSets(functionalTestSourceSet)
configurations.getByName("functionalTestImplementation").extendsFrom(configurations.getByName("testImplementation"))
val functionalTest by tasks.creating(Test::class) {
testClassesDirs = functionalTestSourceSet.output.classesDirs
classpath = functionalTestSourceSet.runtimeClasspath
dependsOn("detektFunctionalTest")
}
val check by tasks.getting(Task::class) {
dependsOn(functionalTest)
}
tasks {
jar {
dependsOn(":hosts:jar")
from(provider { zipTree((project(":common").tasks.getByName("jar") as Jar).archiveFile) })
from(provider { project(":hosts").tasks.getByName("jar") })
}
withType<Test>().configureEach {
testLogging.showStandardStreams = true
useJUnitPlatform()
}
named<Test>("test") {
dependsOn("detektTest")
}
named<Task>("build") {
dependsOn("sourcesJar", "javadocJar")
}
named<Task>("publishToMavenLocal") {
dependsOn("sourcesJar", "javadocJar")
}
named("afterReleaseBuild") {
dependsOn("publishPlugins")
}
named("githubRelease") {
mustRunAfter("release")
}
register("fullRelease") {
dependsOn("release", "githubRelease")
}
}
detekt {
config.from(file("detekt.yml"))
parallel = true
autoCorrect = true
}
gradlePlugin {
plugins {
create("environment") {
id = "com.cognifide.environment"
implementationClass = "com.cognifide.gradle.environment.EnvironmentPlugin"
displayName = "Environment Plugin"
description = "Provides seamless Gradle integration with Docker & Swarm."
}
create("common") {
id = "com.cognifide.environment.common"
implementationClass = "com.cognifide.gradle.environment.EnvironmentCommonPlugin"
displayName = "Environment Common Plugin"
}
}
}
pluginBundle {
website = "https://github.com/wttech/gradle-environment-plugin"
vcsUrl = "https://github.com/wttech/gradle-environment-plugin.git"
description = "Gradle Environment Plugin"
tags = listOf("docker", "swarm", "environment", "docker-compose")
}
githubRelease {
owner("wttech")
repo("gradle-environment-plugin")
token((project.findProperty("github.token") ?: "").toString())
tagName(project.version.toString())
releaseName(project.version.toString())
releaseAssets(tasks["jar"], tasks["sourcesJar"], tasks["javadocJar"])
draft((project.findProperty("github.draft") ?: "false").toString().toBoolean())
overwrite((project.findProperty("github.override") ?: "true").toString().toBoolean())
val prerelease = (project.findProperty("github.prerelease") ?: "true").toString().toBoolean()
if (prerelease) {
prerelease(true)
} else {
body { """
|# What's new
|
|TBD
|
|# Upgrade notes
|
|Nothing to do.
|
|# Contributions
|
|None.
""".trimMargin()
}
}
}