-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
104 lines (89 loc) · 2.68 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
/* The Groovy plugin for Gradle assumes the following layout
* src/main/java
* src/main/resources
* src/main/groovy
*
* src/test/java
* src/test/resources
* src/test/groovy
*
* src/<sourceSet>/java
* src/<sourceSet>/resources
* src/<sourceSet>/groovy
*
* You can override or create a new sourceSet with the following snippet:
*
* sourceSets {
* main {
* // We can override src/main/groovy to also add src/main/zip
* groovy {
* srcDirs = ['src/main/groovy', 'src/main/zip']
* }
* }
* mySourceSet {
* groovy {
* srcDirs = ['src/myDir/groovy']
* }
* }
* }
*/
import org.apache.tools.ant.filters.ReplaceTokens
apply plugin: 'groovy'
defaultTasks 'distPlugin'
def buildLocaleDir = 'build/locale'
configurations {
// Remove the groovy-all jar from runtime dependencies
runtime.exclude module: 'groovy-all'
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
compile group: 'com.ibm.urbancode.plugins', name: 'groovy-plugin-utils', version: '1.0'
compile group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7'
compile group: 'org.codehaus.jettison', name: 'jettison', version: '1.1'
compile localGroovy()
println '[Local Compile] Compiling libs/uDeployRestClient.jar and libs/HttpComponents-Util.jar...'
println '[Possible Solution] If ":compileGroovy" failure, please view the Resource-Utilities-UCD GitHub project for help.'
compile files ("libs/uDeployRestClient.jar", "libs/HttpComponents-Util.jar")
// testCompile group: 'junit', name: 'junit', version: '4.11'
}
task listJars << {
configurations.compile.each { File file -> println file.name }
}
sourceSets {
main {
groovy {
srcDirs = ['src/main/groovy', 'src/main/zip', 'src/main/util']
}
}
}
task copyDeps(type: Copy) {
from configurations.runtime
into 'lib'
}
task distPlugin(type: Zip, dependsOn: ['compileGroovy', 'gatherI18n']) {
def releaseVersion = apiVersion + "." + pluginVersion
from(sourceSets.main.groovy.srcDirs) {
filter(ReplaceTokens, tokens: [API_VERSION: apiVersion, RELEASE_VERSION: releaseVersion])
exclude 'i18n-scraper.groovy'
}
into('lib') {
from copyDeps
}
into('locale') {
from buildLocaleDir
}
archiveName = "${pluginName}-${releaseVersion}.zip"
}
task gatherI18n(type: JavaExec) {
delete buildLocaleDir
mkdir buildLocaleDir
main = 'i18n-scraper'
args 'build/locale/en.properties'
classpath = sourceSets.main.runtimeClasspath
}
task cleanAll(dependsOn: ['clean', 'cleanCopyDeps', 'cleanDistPlugin', 'cleanGatherI18n'])