-
Notifications
You must be signed in to change notification settings - Fork 2
/
better-build-file-names.gradle.kts
101 lines (85 loc) · 2.92 KB
/
better-build-file-names.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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`kotlin-dsl`
`java-gradle-plugin`
`maven-publish`
id ("com.gradle.plugin-publish") version "0.9.10"
}
group = "org.gradleweaver.plugins"
version = "0.0.1"
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
compileOnly(gradleApi())
testCompileOnly(gradleTestKit())
fun junitJupiter(name: String, version: String = "5.2.0") =
create(group = "org.junit.jupiter", name = name, version = version)
testCompile(junitJupiter(name = "junit-jupiter-api"))
testCompile(junitJupiter(name = "junit-jupiter-engine"))
testCompile(junitJupiter(name = "junit-jupiter-params"))
testCompile(group = "org.junit-pioneer", name = "junit-pioneer", version = "0.2.2")
testCompile(group = "com.natpryce", name = "hamkrest", version = "1.6.0.0")
}
publishing {
repositories {
// Work around Gradle TestKit limitations in order to allow for compileOnly dependencies
maven {
name = "test"
url = uri("$buildDir/plugin-test-repository")
}
}
publications {
create<MavenPublication>("mavenJar") {
from(components.getByName("java"))
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "1.8"
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
val registeredPlugin = gradlePlugin.plugins.register("better-build-file-names") {
id = "${project.group}.${project.name}"
displayName = "Better Build File Names"
implementationClass = "org.gradleweaver.plugins.settings.BetterBuildFileNamesPlugin"
description = "Gives your build better default build file names."
}
pluginBundle {
website = "https://github.com/gradleweaver/better-build-file-names"
vcsUrl = "https://github.com/gradleweaver/better-build-file-names"
tags = listOf("build-file-names", "conventions")
plugins {
register("better-build-file-names") {
id = registeredPlugin.get().id
displayName = registeredPlugin.get().displayName
description = registeredPlugin.get().description
}
}
}
tasks {
val publishPluginsToTestRepository by creating {
dependsOn("publishPluginMavenPublicationToTestRepository")
}
val processTestResources: ProcessResources by getting
val writeTestProperties by creating(WriteProperties::class) {
outputFile = processTestResources.destinationDir.resolve("test.properties")
property("version", version)
property("kotlinVersion", KotlinVersion.CURRENT)
}
processTestResources.dependsOn(writeTestProperties)
"test" {
dependsOn(publishPluginsToTestRepository)
}
}
// Keep at the bottom of this file
tasks.withType<Wrapper>().configureEach {
gradleVersion = "4.10.2"
distributionType = Wrapper.DistributionType.ALL
}