/
build.gradle.kts
95 lines (83 loc) · 2.74 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 org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("com.gradle.plugin-publish") version "0.10.1"
kotlin("jvm") version embeddedKotlinVersion
`kotlin-dsl`
`java-gradle-plugin`
groovy
id("net.researchgate.release") version "2.8.1"
id("com.palantir.idea-test-fix") version "0.1.0"
}
repositories {
jcenter()
gradlePluginPortal()
}
dependencies {
api(gradleApi())
implementation("gradle.plugin.net.minecrell:licenser:0.4.1")
implementation("net.researchgate:gradle-release:2.8.1")
implementation("de.marcphilipp.gradle:nexus-publish-plugin:0.4.0")
implementation("com.google.gradle:osdetector-gradle-plugin:1.6.2")
compileOnly(kotlin("stdlib-jdk8"))
compileOnly(kotlin("gradle-plugin"))
testImplementation("junit:junit:4.12")
testImplementation("com.google.guava:guava:28.1-jre")
testImplementation("org.spockframework:spock-core:1.3-groovy-2.5") {
exclude(group = "org.codehaus.groovy")
}
}
tasks.named<Copy>("processResources") {
filter {
it.replace("%VERSION%", project.version.toString())
}
}
// include our Groovy extensions last
tasks {
val compileKotlin = named<KotlinCompile>("compileKotlin")
val compileGroovy = named<GroovyCompile>("compileGroovy")
compileKotlin.configure {
setDependsOn(dependsOn.minus("compileJava"))
}
compileGroovy.configure {
dependsOn(compileKotlin)
val kt = compileKotlin.get()
classpath = classpath.plus(files(kt.destinationDir))
}
named<Task>("classes") {
dependsOn(compileGroovy)
}
}
pluginBundle {
website = "https://techshroom.com"
vcsUrl = "https://github.com/TechShroom/incise-blue"
plugins {
create("inciseBlue") {
id = "${project.group}.${project.name}"
displayName = "incise-blue plugin"
tags = listOf(
"incise-blue", "maven-publish",
"java", "ide", "eclipse",
"intellij", "kotlin-dsl")
description = "TechShroom's own build plugin. Extremely biased towards internal desires."
}
}
}
val jdk = JavaVersion.VERSION_1_8
// validate the current JDK, we must be running under JDK 8.
val verifyJavaVersionForPublish by tasks.registering {
description = "Validates the JDK for the publish build, to ensure consistency."
doLast {
if (JavaVersion.current() != jdk) {
throw IllegalStateException("Must build release with JDK ${jdk}.")
}
}
}
release {
buildTasks.add(verifyJavaVersionForPublish.name)
}
tasks.named<Task>("afterReleaseBuild") {
dependsOn("publishPlugins")
}
require(JavaVersion.current().isCompatibleWith(jdk)) {
"Must build with a JDK compatible with $jdk"
}