forked from johndevs/gradle-vaadin-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
365 lines (319 loc) · 11.3 KB
/
build.gradle
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
/*
* Copyright 2018 John Ahlroos
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.tools.ant.filters.ReplaceTokens
/***********************************************************************************************************************
*
* Plugins
*
**********************************************************************************************************************/
plugins {
id 'groovy'
id 'maven'
id 'idea'
id 'codenarc'
id 'com.gradle.plugin-publish' version '0.10.0'
id 'checkstyle'
}
/***********************************************************************************************************************
*
* Basic properties
*
**********************************************************************************************************************/
defaultTasks 'jar'
group = "com.devsoap.plugin"
version = project.hasProperty('BUILD_VERSION') ? getProperty('BUILD_VERSION') : 'SNAPSHOT-'+ new Date().format('yyyyMMdd')
archivesBaseName ='gradle-vaadin-plugin'
sourceCompatibility = 1.8
targetCompatibility = 1.8
ext {
testCategory = project.hasProperty('TEST_CATEGORY') ? getProperty('TEST_CATEGORY') : null
}
/***********************************************************************************************************************
*
* Repositories & Dependencies
*
**********************************************************************************************************************/
repositories{
mavenCentral()
maven { // FIXME For Junit 4.13-SNAPSHOT, remove when released
name 'JBoss'
url 'https://repository.jboss.org/'
}
}
configurations {
deploy
proxyTest
}
dependencies {
compile gradleApi()
compile localGroovy()
// Jetty application server
compile "org.eclipse.jetty.aggregate:jetty-all:${project.property('jetty.version')}"
compile "org.eclipse.jetty:jetty-annotations:${project.property('jetty.version')}"
compile "org.eclipse.jetty:jetty-plus:${project.property('jetty.version')}"
compile "org.eclipse.jetty:jetty-deploy:${project.property('jetty.version')}"
//Payara application server
compile "fish.payara.extras:payara-embedded-web:${project.property('payara.version')}"
// For GET requests
compile 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1'
// Sass compilation with libSass
compile "io.bit3:jsass:${project.property('jsass.version')}"
deploy 'org.apache.maven.wagon:wagon-ssh:2.2'
testCompile gradleTestKit()
testCompile 'junit:junit:4.13-SNAPSHOT'
// ProxyTest needs its own special configuration to avoid conflicts
proxyTest ('org.mock-server:mockserver-netty:3.10.4') {
exclude group:'ch.qos.logback'
}
project.configurations.proxyTest.exclude group: 'fish.payara.extras'
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
/***********************************************************************************************************************
*
* Compilation
*
**********************************************************************************************************************/
/**
* Compiles the tests
*/
compileTestGroovy {
classpath += configurations.proxyTest
}
/**
* Processes the resources before compilation
*/
processResources {
// Directory where previously built versions are located
def debugDir = new File(project.buildDir, 'libs').canonicalPath
// Mark processed resources as dirty if build properties change
inputs.property('version', project.version)
inputs.property('debugdir', debugDir)
// Apply build properties
from(sourceSets.main.resources.srcDirs){
// Files Matching is required to prevent binary files from becoming corrupt
filesMatching('*.properties'){
filter(ReplaceTokens, tokens: [
version: project.version,
debugdir: debugDir
])
}
}
}
/***********************************************************************************************************************
*
* Artifacts
*
**********************************************************************************************************************/
/**
* Main plugin artifact.
*/
jar {
manifest{
attributes(
'Vaadin-Package-Version': 1,
'Vaadin-License-Title': 'Apache 2.0',
'Implementation-Title': 'Vaadin Plugin for Gradle',
'Implementation-Version': version,
'Implementation-Vendor': 'John Ahlroos',
)
}
from 'gradle.properties'
}
/**
* Plugin artifact sources.
*/
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
include 'com/**/*.groovy'
include 'com/**/*.java'
}
/**
* Artifacts in build
*/
artifacts {
archives jar
archives sourcesJar
}
/**
* API documentation
*/
groovydoc {
docTitle = "Gradle Vaadin Plugin $version API"
windowTitle = "Gradle Vaadin Plugin Version $version"
footer = "Gradle Vaadin Plugin is maintained by <a href=\"https://github.com/johndevs/\">@johndevs</a>. Copyright © 2018"
}
/***********************************************************************************************************************
*
* Tests
*
**********************************************************************************************************************/
/**
* Configure test phase only to run ordinary unit tests.
*/
test {
exclude '**/tests/**'
}
/**
* Run integration tests with a different tasks so they are only run when running check
*/
task uncategorizedTests(type:Test, dependsOn:['test','jar']) {
testLogging {
exceptionFormat "full"
showStandardStreams = true
}
useJUnit {
excludeCategories 'com.devsoap.plugin.categories.WidgetsetCompile'
excludeCategories 'com.devsoap.plugin.categories.ThemeCompile'
excludeCategories 'com.devsoap.plugin.categories.WidgetsetAndThemeCompile'
excludeCategories 'com.devsoap.plugin.categories.RunProject'
}
exclude '**/tests/*ProxyTest*'
systemProperty 'integrationTestProjectVersion', version
maxParallelForks = Runtime.runtime.availableProcessors() > 1 ? Runtime.runtime.availableProcessors() - 1 : 1
}
task widgetsetCompileTests(type:Test, dependsOn:['test','jar']) {
testLogging {
exceptionFormat "full"
showStandardStreams = true
}
useJUnit {
includeCategories 'com.devsoap.plugin.categories.WidgetsetCompile'
excludeCategories 'com.devsoap.plugin.categories.ThemeCompile'
}
systemProperty 'integrationTestProjectVersion', version
maxParallelForks = Runtime.runtime.availableProcessors() > 1 ? Runtime.runtime.availableProcessors() - 1 : 1
}
task themeCompileTests(type:Test, dependsOn:['test','jar']) {
testLogging {
exceptionFormat "full"
showStandardStreams = true
}
useJUnit {
excludeCategories 'com.devsoap.plugin.categories.WidgetsetCompile'
includeCategories 'com.devsoap.plugin.categories.ThemeCompile'
}
systemProperty 'integrationTestProjectVersion', version
maxParallelForks = Runtime.runtime.availableProcessors() > 1 ? Runtime.runtime.availableProcessors() - 1 : 1
}
task fullCompileTests(type:Test, dependsOn:['test','jar']) {
testLogging {
exceptionFormat "full"
showStandardStreams = true
}
useJUnit {
includeCategories 'com.devsoap.plugin.categories.WidgetsetAndThemeCompile'
}
systemProperty 'integrationTestProjectVersion', version
maxParallelForks = Runtime.runtime.availableProcessors() > 1 ? Runtime.runtime.availableProcessors() - 1 : 1
}
task runProjectTests(type:Test, dependsOn:['test','jar']) {
testLogging {
exceptionFormat "full"
showStandardStreams = true
}
useJUnit {
includeCategories 'com.devsoap.plugin.categories.RunProject'
}
systemProperty 'integrationTestProjectVersion', version
maxParallelForks = Runtime.runtime.availableProcessors() > 1 ? Runtime.runtime.availableProcessors() - 1 : 1
}
/**
* Runs proxy integration test that needs special configuration
*/
task proxyTest(type:Test, dependsOn: ['test','jar']) {
def oldClassPath = classpath
classpath = configurations.proxyTest
classpath += oldClassPath
testLogging {
exceptionFormat "full"
showStandardStreams = true
}
include '**/tests/*ProxyTest*'
systemProperty 'integrationTestProjectVersion', version
}
if(!ext.testCategory) {
check.dependsOn 'uncategorizedTests'
check.dependsOn 'widgetsetCompileTests'
check.dependsOn 'themeCompileTests'
check.dependsOn 'fullCompileTests'
check.dependsOn 'runProjectTests'
check.dependsOn 'proxyTest'
} else{
check.dependsOn ext.testCategory
}
/***********************************************************************************************************************
*
* Quality
*
***********************************************************************************************************************/
codenarc{
toolVersion = '1.1'
configFile = rootProject.file('config/codenarc/ruleset.groovy')
maxPriority1Violations = 0
maxPriority2Violations = 0
maxPriority3Violations = 500
codenarcTest {
configFile = rootProject.file('config/codenarc/ruleset-test.groovy')
}
}
checkstyle {
configDir = rootProject.file('config/checkstyle')
}
plugins.withType(GroovyBasePlugin) {
sourceSets.all { sourceSet ->
task "${sourceSet.getTaskName('checkstyle', 'groovy')}"(type: Checkstyle) {
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
source sourceSet.allGroovy
classpath = sourceSet.compileClasspath
reports.xml.destination rootProject.file("build/reports/checkstyle/${sourceSet.name}.xml")
}
}
}
/***********************************************************************************************************************
*
* Deployment
*
***********************************************************************************************************************/
pluginBundle {
website = 'https://github.com/johndevs/gradle-vaadin-plugin/wiki'
vcsUrl = 'https://github.com/johndevs/gradle-vaadin-plugin'
description = 'Build Vaadin applications with Gradle!'
tags = ['vaadin', 'java', 'groovy', 'kotlin']
plugins {
vaadinPlugin {
id = 'com.devsoap.plugin.vaadin'
displayName = 'Gradle Vaadin plugin'
}
}
mavenCoordinates {
groupId = 'com.devsoap.plugin'
artifactId = 'gradle-vaadin-plugin'
}
}
/***********************************************************************************************************************
*
* Misc.
*
**********************************************************************************************************************/
task wrapper(type: Wrapper) {
gradleVersion = '4.3'
}