@@ -22,6 +22,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
2222 *
2323 **********************************************************************************************************************/
2424plugins {
25+ id ' java-gradle-plugin'
2526 id ' groovy'
2627 id ' maven'
2728 id ' idea'
4647 testCategory = project. hasProperty(' TEST_CATEGORY' ) ? getProperty(' TEST_CATEGORY' ) : null
4748}
4849
50+
51+ /* **********************************************************************************************************************
52+ *
53+ * Sources
54+ *
55+ **********************************************************************************************************************/
56+
57+ sourceSets {
58+ functionalTest {
59+ groovy {
60+ srcDir file(' src/functionalTest/groovy' )
61+ }
62+ resources {
63+ srcDir file(' src/functionalTest/resources' )
64+ }
65+ compileClasspath + = sourceSets. main. output + configurations. testRuntime
66+ runtimeClasspath + = output + compileClasspath
67+ }
68+ }
69+
4970/* **********************************************************************************************************************
5071 *
5172 * Repositories & Dependencies
@@ -111,7 +132,7 @@ idea {
111132/**
112133 * Compiles the tests
113134 */
114- compileTestGroovy {
135+ compileFunctionalTestGroovy {
115136 classpath + = configurations. proxyTest
116137}
117138
@@ -195,12 +216,6 @@ groovydoc {
195216 *
196217 **********************************************************************************************************************/
197218
198- /**
199- * Configure test phase only to run ordinary unit tests.
200- */
201- test {
202- exclude ' **/tests/**'
203- }
204219
205220/**
206221 * Run integration tests with a different tasks so they are only run when running check
@@ -219,6 +234,8 @@ task uncategorizedTests(type:Test, dependsOn:['test','jar']) {
219234 exclude ' **/tests/*ProxyTest*'
220235 systemProperty ' integrationTestProjectVersion' , version
221236 maxParallelForks = Runtime . runtime. availableProcessors() > 1 ? Runtime . runtime. availableProcessors() - 1 : 1
237+ testClassesDirs = sourceSets. functionalTest. output. classesDirs
238+ classpath = sourceSets. functionalTest. runtimeClasspath
222239}
223240
224241task widgetsetCompileTests (type :Test , dependsOn :[' test' ,' jar' ]) {
@@ -232,6 +249,8 @@ task widgetsetCompileTests(type:Test, dependsOn:['test','jar']) {
232249 }
233250 systemProperty ' integrationTestProjectVersion' , version
234251 maxParallelForks = Runtime . runtime. availableProcessors() > 1 ? Runtime . runtime. availableProcessors() - 1 : 1
252+ testClassesDirs = sourceSets. functionalTest. output. classesDirs
253+ classpath = sourceSets. functionalTest. runtimeClasspath
235254}
236255
237256task themeCompileTests (type :Test , dependsOn :[' test' ,' jar' ]) {
@@ -245,6 +264,8 @@ task themeCompileTests(type:Test, dependsOn:['test','jar']) {
245264 }
246265 systemProperty ' integrationTestProjectVersion' , version
247266 maxParallelForks = Runtime . runtime. availableProcessors() > 1 ? Runtime . runtime. availableProcessors() - 1 : 1
267+ testClassesDirs = sourceSets. functionalTest. output. classesDirs
268+ classpath = sourceSets. functionalTest. runtimeClasspath
248269}
249270
250271task fullCompileTests (type :Test , dependsOn :[' test' ,' jar' ]) {
@@ -257,6 +278,8 @@ task fullCompileTests(type:Test, dependsOn:['test','jar']) {
257278 }
258279 systemProperty ' integrationTestProjectVersion' , version
259280 maxParallelForks = Runtime . runtime. availableProcessors() > 1 ? Runtime . runtime. availableProcessors() - 1 : 1
281+ testClassesDirs = sourceSets. functionalTest. output. classesDirs
282+ classpath = sourceSets. functionalTest. runtimeClasspath
260283}
261284
262285task runProjectTests (type :Test , dependsOn :[' test' ,' jar' ]) {
@@ -269,21 +292,35 @@ task runProjectTests(type:Test, dependsOn:['test','jar']) {
269292 }
270293 systemProperty ' integrationTestProjectVersion' , version
271294 maxParallelForks = Runtime . runtime. availableProcessors() > 1 ? Runtime . runtime. availableProcessors() - 1 : 1
295+ testClassesDirs = sourceSets. functionalTest. output. classesDirs
296+ classpath = sourceSets. functionalTest. runtimeClasspath
272297}
273298
274299/**
275300 * Runs proxy integration test that needs special configuration
276301 */
277302task proxyTest (type :Test , dependsOn : [' test' ,' jar' ]) {
278- def oldClassPath = classpath
279- classpath = configurations. proxyTest
280- classpath + = oldClassPath
281303 testLogging {
282304 exceptionFormat " full"
283305 showStandardStreams = true
284306 }
285307 include ' **/tests/*ProxyTest*'
286308 systemProperty ' integrationTestProjectVersion' , version
309+ testClassesDirs = sourceSets. functionalTest. output. classesDirs
310+ classpath + = sourceSets. functionalTest. runtimeClasspath + configurations. proxyTest
311+ }
312+
313+ /**
314+ * Runs all the tests. Use this with --tests filter to run filtered tests in Idea.
315+ */
316+ task allTests (type :Test , dependsOn :[' test' ,' jar' ]) {
317+ testLogging {
318+ exceptionFormat " full"
319+ showStandardStreams = true
320+ }
321+ systemProperty ' integrationTestProjectVersion' , version
322+ testClassesDirs = sourceSets. functionalTest. output. classesDirs
323+ classpath = sourceSets. functionalTest. runtimeClasspath
287324}
288325
289326if (! ext. testCategory) {
@@ -336,6 +373,15 @@ plugins.withType(GroovyBasePlugin) {
336373 * Deployment
337374 *
338375 ***********************************************************************************************************************/
376+ gradlePlugin {
377+ testSourceSets sourceSets. test
378+ plugins {
379+ vaadinPlugin {
380+ id = ' com.devsoap.plugin.vaadin'
381+ implementationClass = ' com.devsoap.plugin.GradleVaadinPlugin'
382+ }
383+ }
384+ }
339385
340386pluginBundle {
341387 website = ' https://github.com/johndevs/gradle-vaadin-plugin/wiki'
@@ -344,7 +390,7 @@ pluginBundle {
344390 tags = [' vaadin' , ' java' , ' groovy' , ' kotlin' ]
345391 plugins {
346392 vaadinPlugin {
347- id = ' com.devsoap.plugin.vaadin '
393+ id = gradlePlugin . plugins . vaadinPlugin . id
348394 displayName = ' Gradle Vaadin plugin'
349395 }
350396 }
0 commit comments