-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
188 lines (157 loc) · 4.99 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
/*
* Copyright 2012 the original author or authors.
*
* 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.
*/
apply from: "gradle/maven.gradle"
group = modowner
archivesBaseName = modname
apply plugin: 'java'
apply plugin: 'idea'
defaultTasks = ['assemble']
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
configurations {
provided
testCompile.extendsFrom provided
}
repositories {
if (System.getenv("VERTX_DISABLE_MAVENLOCAL") == null) {
// We don't want to use mavenLocal when running on CI - mavenLocal is only useful in Gradle for
// publishing artifacts locally for development purposes - maven local is also not threadsafe when there
// are concurrent builds
mavenLocal()
}
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
mavenCentral()
}
dependencies {
// We need the jruby-complete.jar since this contains some standard .rb files such as delegate that are used
// by Vert.x
compile "org.jruby:jruby-complete:$jrubyVersion"
provided "io.vertx:vertx-core:$vertxVersion"
provided "io.vertx:vertx-platform:$vertxVersion"
provided "io.vertx:testtools:$toolsVersion"
testCompile( "io.vertx:vertx-testframework:$testFrameworkVersion" ) {
transitive = false
}
testCompile "junit:junit:$junitVersion"
}
sourceSets {
main {
compileClasspath = compileClasspath + configurations.provided
}
test {
resources {
srcDirs "src/test/ruby_scripts", "src/test/resources"
}
}
}
task copyMod( type:Copy, dependsOn: 'classes' ) {
into "build/mod/$modowner~$modname~$version"
from compileJava
from 'src/main/conf'
from 'src/main/api_shim'
into( 'lib' ) {
from configurations.compile
}
}
// Package into build/libs/mod.zip
task dist( type: Zip) {
group = 'vert.x'
classifier = "mod"
description = "Assembles a vert.x module"
destinationDir = project.file('build/libs')
archiveName = "${modname}-${version}" + ".zip"
from copyMod
}
task sourceJar(type: Jar) {
description = 'Builds a source jar artifact suitable for maven deployment.'
classifier = 'sources'
from sourceSets.main.java
}
task javadocJar(type: Jar) {
description = 'Builds a javadoc jar artifact suitable for maven deployment.'
classifier = 'javadoc'
from javadoc.destinationDir
}
javadocJar.dependsOn javadoc
build.dependsOn sourceJar, javadocJar
artifacts {
archives sourceJar, javadocJar, dist
}
task cleanTestTmpModules(type: Delete) {
delete { file("src/test/mod-test").listFiles().find {
true
} }
}
clean {
dependsOn cleanTestTmpModules
}
task prepareVertxTest(type: Copy, dependsOn: [cleanTestTmpModules, copyMod]) {
from 'build/mod'
into 'src/test/mod-test' // Copy the mod into the mods directory
}
test {
dependsOn prepareVertxTest
// Remove any classpath entries for the classes or resources of the rhino verticle and also remove the
// Rhino jar from the classpath
// If we don't do this then the system classloader will load them which can cause issues with loading resources
// from inside JS verticles
classpath -= sourceSets.main.output
classpath -= configurations.compile
outputs.upToDateWhen { false }
// Some vert.x properties
systemProperty 'vertx.test.timeout', 15
systemProperty 'vertx.mods', "$projectDir/src/test/mod-test" // Set vertx.mods to the mod directory
systemProperty 'vertx.version', "$project.version"
// Show output
testLogging.showStandardStreams = true
testLogging { exceptionFormat "full" }
}
task collectDeps(type: Copy) {
group = 'vert.x'
description = 'conveniently collect dependencies for other IDEs'
destinationDir = file("build/deps")
into("compile") {
from configurations.compile
}
into("test") {
from configurations.testCompile
}
}
task yardoc(type:Exec) {
commandLine = [ "yardoc",
"--title", "Ruby API Doc",
"--no-private",
"--quiet",
"--markup-provider", "kramdown",
"--readme", "$rootDir/README.md",
"--output-dir","${project.buildDir}/docs/ruby/api",
"src/main/api_shim/**/*.rb",
"-", "$rootDir/LICENSE.txt" ]
if( System.properties['os.name'].toLowerCase().contains('windows') ) {
commandLine = ['cmd', '/c'] + commandLine
}
}
// Map the 'provided' dependency configuration to the appropriate IDEA visibility scopes.
plugins.withType(IdeaPlugin) {
idea {
module {
scopes.PROVIDED.plus += configurations.provided
scopes.COMPILE.minus += configurations.provided
scopes.TEST.minus += configurations.provided
scopes.RUNTIME.minus += configurations.provided
}
}
}