forked from NocWriter/runsql-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
130 lines (115 loc) · 3.71 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
plugins {
id("java-gradle-plugin")
id("com.adarshr.test-logger") version ("2.0.0")
id("com.gradle.plugin-publish") version ("0.11.0")
}
group = "com.nocwriter.runsql"
version = "1.0.2"
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
//
// Create a new source set for integration tests.
//
sourceSets {
create("iTest") {
java {
// NOTE: By default, integration tests does not require access to plugin's sources ('src/main/java').
// However,in case any of the integration tests DOES requires access to plugin sources, uncomment the
// following lines:
compileClasspath += sourceSets.main.get().compileClasspath
runtimeClasspath += sourceSets.main.get().runtimeClasspath
}
}
}
//
// Plugin configuration.
//
gradlePlugin {
// Register a plugin.
plugins {
create("runSQLPlugin") {
id = "com.nocwriter.runsql"
displayName = "Run SQL scripts"
description = "This plugins execute a SQL script on a database."
version = "1.0.2"
implementationClass = "com.nocwriter.runsql.gradle.RunSQLPlugin"
}
}
// We must add the test sources available to the plugin, so it can have access to the plugin runtime.
testSourceSets(sourceSets["test"], sourceSets["iTest"])
}
//
// Gradle plugin publishing configuration.
//
pluginBundle {
website = "https://github.com/NocWriter/runsql-gradle-plugin"
vcsUrl = "https://github.com/NocWriter/runsql-gradle-plugin"
tags = listOf("sql", "run", "execute", "execution", "plugin")
}
//
// In order to use the automatically created 'iTestImplementation' by the dependencies, we need to extract it into
// a local variable.
//
val iTestImplementation: Configuration = configurations["iTestImplementation"]
//
// Plugin dependencies.
//
dependencies {
//
// Apache Commons.
//
implementation("org.apache.commons:commons-lang3:3.9")
//
// JUnit platform/test utilities.
//
testImplementation(enforcedPlatform("org.junit:junit-bom:5.6.0"))
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-engine")
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.assertj:assertj-core:3.15.0")
testImplementation("org.hsqldb:hsqldb:2.5.0")
iTestImplementation(enforcedPlatform("org.junit:junit-bom:5.6.0"))
iTestImplementation("org.junit.jupiter:junit-jupiter-api")
iTestImplementation("org.junit.jupiter:junit-jupiter-engine")
iTestImplementation("org.junit.jupiter:junit-jupiter")
iTestImplementation("org.assertj:assertj-core:3.15.0")
iTestImplementation("org.hsqldb:hsqldb:2.5.0")
iTestImplementation("org.hsqldb:hsqldb:2.5.0:sources")
}
tasks.withType<Test> {
useJUnitPlatform()
}
//
// New test task to run integration tests.
//
val integrationTest = task<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"
testClassesDirs = sourceSets["iTest"].output.classesDirs
classpath = sourceSets["iTest"].runtimeClasspath
}
//
// Test listener to display tests status and logging.
//
testlogger {
theme = com.adarshr.gradle.testlogger.theme.ThemeType.STANDARD
showExceptions = true
showStackTraces = true
showFullStackTraces = false
showCauses = true
slowThreshold = 2000
showSummary = true
showSimpleNames = false
showPassed = true
showSkipped = true
showFailed = true
showStandardStreams = false
showPassedStandardStreams = true
showSkippedStandardStreams = true
showFailedStandardStreams = true
}