forked from johndevs/gradle-vaadin-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
239 lines (202 loc) · 6.35 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
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:0.5"
}
}
apply plugin: "com.jfrog.bintray"
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'idea'
defaultTasks 'jar'
group = "fi.jasoft.plugin"
version = project.hasProperty('BUILD_VERSION') ? getProperty('BUILD_VERSION') : 'SNAPSHOT-'+ new Date().format('yyyyMMdd')
archivesBaseName ='gradle-vaadin-plugin'
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories{
mavenCentral()
}
configurations {
deploy
}
dependencies {
compile gradleApi()
compile localGroovy()
compile 'org.eclipse.jetty.aggregate:jetty-all:9.2.2.v20140723'
compile 'org.eclipse.jetty:jetty-annotations:9.2.2.v20140723'
compile 'org.eclipse.jetty:jetty-plus:9.2.2.v20140723'
compile 'org.eclipse.jetty:jetty-deploy:9.2.2.v20140723'
deploy 'org.apache.maven.wagon:wagon-ssh:2.2'
}
sourceSets {
ast {
groovy {
srcDirs = ['src/ast']
}
}
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
include 'fi/**/*.groovy'
include 'fi/**/*.java'
}
artifacts {
archives jar
archives sourcesJar
}
bintray {
user = System.getProperty('PLUGIN_MAVEN_RELEASE_REPOSITORY_USER')
key = System.getProperty('PLUGIN_MAVEN_RELEASE_REPOSITORY_PASSWORD')
configurations = ['archives']
dryRun = false
publish = false
pkg {
repo = 'maven'
name = 'gradle-vaadin-plugin'
desc = 'Build Vaadin applications with Gradle!'
websiteUrl = 'https://github.com/johndevs/gradle-vaadin-plugin'
issueTrackerUrl = 'https://github.com/johndevs/gradle-vaadin-plugin/issues'
vcsUrl = 'https://github.com/johndevs/gradle-vaadin-plugin.git'
licenses = ['Apache-2.0']
labels = ['vaadin','gradle','plugin']
publicDownloadNumbers = true
version {
name = project.version
vcsTag = project.version
attributes = ['gradle-plugin': 'fi.jasoft.plugin.vaadin:fi.jasoft.plugin:gradle-vaadin-plugin']
}
}
}
task configurePluginPom << {
configure(install.repositories.mavenInstaller) {
pom.project {
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'johndevs'
name 'John Ahlroos'
}
}
scm {
url 'https://github.com/johndevs/gradle-vaadin-plugin'
connection 'scm:git://github.com/johndevs/gradle-vaadin-plugin'
developerConnection 'scm:[email protected]:johndevs/gradle-vaadin-plugin'
}
}
pom.scopeMappings.mappings.remove(configurations.compile)
}
}
install.dependsOn configurePluginPom
uploadArchives {
dependsOn configurePluginPom
repositories.mavenDeployer {
def snapshotRepositoryUrl = System.getProperty('PLUGIN_MAVEN_SNAPSHOT_REPOSITORY')
def snapshotRepositoryUser = System.getProperty('PLUGIN_MAVEN_SNAPSHOT_REPOSITORY_USER')
def snapshotRepositoryPassword = System.getProperty('PLUGIN_MAVEN_SNAPSHOT_REPOSITORY_PASSWORD')
def snapshotRepositoryPrivateKey = System.getProperty('PLUGIN_MAVEN_SNAPSHOT_REPOSITORY_KEY')
configuration = configurations.deploy
snapshotRepository( url: snapshotRepositoryUrl ) {
authentication(
userName: snapshotRepositoryUser,
password: snapshotRepositoryPassword,
privateKey: snapshotRepositoryPrivateKey
)
}
}
}
// Use wrapper
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
// Create pom.xml for Vaadin Directory
task createPOMforVaadinDirectory {
File pomDir = new File("src/main/resources/META-INF/maven/${project.group}/${project.archivesBaseName}")
pomDir.mkdirs()
File pomFile = new File(pomDir.canonicalPath+'/pom.xml')
outputs.file pomFile
pom {
artifactId = project.archivesBaseName
project {
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
repositories {
repository {
name 'Jasoft.fi Repository'
url 'http://mvn.jasoft.fi/maven2'
}
}
}
}.writeTo(pomFile.canonicalPath)
}
task compileGroovyAstTransforms(type: GroovyCompile) {
groovyOptions.with {
fork = true
keepStubs = false
fileExtensions = ["groovy"]
}
source = sourceSets.ast.groovy.srcDirs
classpath = sourceSets.main.compileClasspath
destinationDir = sourceSets.ast.output.classesDir
}
compileGroovy {
dependsOn compileGroovyAstTransforms
classpath += files(sourceSets.ast.output.classesDir)
}
compileTestGroovy {
dependsOn compileGroovyAstTransforms
classpath += files(sourceSets.ast.output.classesDir)
}
processResources {
// Create pom.xml for Vaadin directory
dependsOn project.createPOMforVaadinDirectory
// Apply build properties
def debugDir = project.file(".").getAbsolutePath()+'/build/libs'
from(sourceSets.main.resources.srcDirs){
filter(ReplaceTokens, tokens: [
version: project.version,
debugdir: debugDir
])
}
}
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',
)
}
}
test {
classpath += files(sourceSets.ast.output.classesDir)
testLogging {
exceptionFormat "full"
}
exclude '**/integration/**'
}
task integrationTest(type:Test) {
dependsOn 'jar'
classpath += files(sourceSets.ast.output.classesDir)
testLogging {
exceptionFormat "full"
}
include '**/integration/**'
}