Skip to content

Commit 1c45558

Browse files
author
Nicholas Mathison
committed
Update Gradle build + Support zOs
- Change from Ant/Ivy to Gradle build tool. - Reorganized folder structure. - Fix z/OS IBM-1047 encoding error. - Removed unecessary jars.
1 parent fcee2a9 commit 1c45558

10 files changed

Lines changed: 203 additions & 320 deletions

File tree

.travis.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
language: groovy
22
rvm:
3-
- 1.8.8
3+
- 1.8.8
44
install:
5-
- ant install-ivy -DfailIvy=false
5+
- gradle build
66
before_script:
7-
- export BUILD_LIFE=${TRAVIS_COMMIT:0:7}
8-
- ant run-tests
7+
- gradle test
8+
- export VERSION=${TRAVIS_TAG}.${TRAVIS_COMMIT:0:7}
99
script:
10-
- ant -DbuildLife=${BUILD_LIFE}
10+
- gradle -PpluginVersion=${VERSION}
1111
jdk:
12-
- oraclejdk8
13-
- oraclejdk7
14-
- openjdk7
15-
- openjdk6
12+
- oraclejdk8
13+
- oraclejdk7
14+
- openjdk7
15+
- openjdk6
1616
notifications:
1717
slack:
1818
secure: ESakxB2xuKk6IaGw/jsb8HvGGxPCulqi3y+7g5g6VU+aeZtJyyGwiMVvn7kIsB0+kQd0f34IATwnr/eAtTvDCM4tc8dJzY0UkAdFfBxCcOYHHcmrXOqckCFxmKX7gUkQW0pBvDoBqcZ5Ye0WWtN1XUlJvvsec36mJgu8lajmWd4S/yC8liWokDe2yT39bvVObX96eiVEYpEK8UgA1I7sISNE06yle/g+RhKH9JahEexOke7+oxfOCwFSiqQ4OkgoWicNbujfI+yN5gUKjT0d5UziyBNAUeYQQs33k4RSaptuYXpszn75fdNS/b7NXS34Z+0M86ORmTLQmOTuSrjHpWmfkk33LfdPDvHSJy4a0if2Vczvj5NLu7vhGRfz4qDwzv60jK4gdyaAMyERgNNyAmxl3LNMixFTH1GlN4HYPlEBS1FDQUdvoxL2CkCSJSb5nOWnsY2+NwAfLnsQvBreDdr8X2+vX/1lan3TbZKkM/5mNsQLCT2jvKUGj4fbikPqPyoCKT5SZ4dCwAWf6/kBS/dZkBL7j27RLs466YWDsgp0PTBZvYpa5YO/Z+bM3VLsg+eWvyum/Xu2aATDNRp5Ap0jtjYz2zlqwrkcUCF+IKLrJdHBJ2GgnRZPbjDgzgv7mMO4vXOnP8HNShOgqwmYneicbDuR/HCFfIfFQrsdx8g=

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ This plugin is protected under the [Eclipse Public 1.0 License](http://www.eclip
1818
your own changes to the plugin.
1919

2020
### History
21+
Version 5
22+
- Change from Ant/Ivy to Gradle build tool.
23+
- Reorganized folder structure.
24+
- Fix z/OS IBM-1047 encoding error.
25+
- Removed unecessary jars.
2126
Version 4
2227
- Send Slack Attachment message to multiple channels.
2328
- Changed the Post Custom Notification to Slack step name to Post Attachment Notification to Slack.

build.gradle

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
/**
2+
* (c) Copyright IBM Corporation 2017.
3+
* This is licensed under the following license.
4+
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
5+
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
6+
*/
7+
/* The Groovy plugin for Gradle assumes the following layout
8+
* src/main/java
9+
* src/main/resources
10+
* src/main/groovy
11+
*
12+
* src/test/java
13+
* src/test/resources
14+
* src/test/groovy
15+
*
16+
* src/<sourceSet>/java
17+
* src/<sourceSet>/resources
18+
* src/<sourceSet>/groovy
19+
*
20+
* You can override or create a new sourceSet with the following snippet:
21+
*
22+
* sourceSets {
23+
* main {
24+
* // We can override src/main/groovy to also add src/main/zip
25+
* groovy {
26+
* srcDirs = ['src/main/groovy', 'src/main/zip']
27+
* }
28+
* }
29+
* mySourceSet {
30+
* groovy {
31+
* srcDirs = ['src/myDir/groovy']
32+
* }
33+
* }
34+
* }
35+
*/
36+
37+
import org.apache.tools.ant.filters.ReplaceTokens
38+
39+
def pluginName="Slack-UCD"
40+
def pluginVersion = project.hasProperty('pluginVersion') ? project.getProperty('pluginVersion') : 'dev'
41+
42+
apply plugin: 'groovy'
43+
44+
defaultTasks 'distPlugin'
45+
46+
def buildLocaleDir = 'build/locale'
47+
def buildUtilDir = 'build/util'
48+
49+
configurations {
50+
// Remove the groovy-all jar from runtime dependencies
51+
runtime.exclude module: 'groovy-all'
52+
}
53+
54+
repositories {
55+
mavenCentral()
56+
maven {
57+
url "https://public.dhe.ibm.com/software/products/UrbanCode/maven2/"
58+
}
59+
}
60+
61+
dependencies {
62+
// groovy-plugin-utils pulls down groovy-all as a transitive dependency for the 'compile' configuration
63+
compile 'com.ibm.urbancode.plugins:groovy-plugin-utils:+'
64+
compile 'com.ibm.urbancode.util:i18n-scraper:+'
65+
compile 'commons-codec:commons-codec:1.2'
66+
compile 'commons-httpclient:commons-httpclient:3.1'
67+
compile 'commons-logging:commons-logging:1.1.3'
68+
//compile 'org.codehaus.groovy:groovy-json:2.4.0'
69+
70+
// This compiles the i18n-scraper script
71+
compile localGroovy()
72+
testCompile 'junit:junit:4.11'
73+
testCompile 'org.hamcrest:hamcrest-core:1.3'
74+
}
75+
76+
sourceSets {
77+
main {
78+
groovy {
79+
srcDirs = ['src/main/groovy', 'src/main/zip', "${buildDir}/util"]
80+
}
81+
}
82+
zip {
83+
groovy {
84+
srcDirs = ['src/main/zip']
85+
}
86+
}
87+
classes {
88+
groovy {
89+
srcDirs = ['src/main/groovy', "${buildDir}/util"]
90+
}
91+
}
92+
}
93+
94+
compileJava {
95+
dependsOn 'extractGPU', 'copyi18n'
96+
}
97+
compileGroovy {
98+
include "i18n-scraper.groovy"
99+
}
100+
101+
task copyDeps(type: Copy) {
102+
into 'lib'
103+
copy {
104+
from configurations.runtime
105+
include { target ->
106+
return target.file.path.contains("com.ibm.urbancode")
107+
}
108+
into 'lib'
109+
rename { fileName ->
110+
stripVersion(fileName)
111+
}
112+
}
113+
copy {
114+
from configurations.runtime
115+
exclude { target ->
116+
return target.file.path.contains("com.ibm.urbancode")
117+
}
118+
into 'lib'
119+
}
120+
}
121+
122+
task extractGPU(type: Copy) {
123+
def zipFile = file('lib/groovy-plugin-utils.jar')
124+
def outputDir = file("${buildDir}/util")
125+
126+
from zipTree(zipFile)
127+
into outputDir
128+
}
129+
130+
task copyi18n(type: Copy) {
131+
def i18nFile = file('lib/i18n-scraper.groovy')
132+
def outputDir = file("${buildDir}/util")
133+
134+
from i18nFile
135+
into outputDir
136+
}
137+
138+
task distPlugin(type: Zip, dependsOn: ['compileGroovy', 'gatherI18n']) {
139+
from(sourceSets.zip.groovy.srcDirs) {
140+
filter(ReplaceTokens, tokens: [RELEASE_VERSION: pluginVersion])
141+
}
142+
143+
into('lib') {
144+
from copyDeps
145+
exclude 'i18n-scraper.groovy'
146+
exclude 'groovy-plugin-utils.jar'
147+
exclude 'groovy-all-*.jar'
148+
exclude 'gson-*.jar'
149+
}
150+
into('locale') {
151+
from buildLocaleDir
152+
}
153+
into('classes') {
154+
from sourceSets.classes.groovy.srcDirs
155+
exclude 'META-INF', 'i18n-scraper.groovy'
156+
}
157+
if (pluginVersion) {
158+
archiveName = "${pluginName}-v${pluginVersion}.zip"
159+
} else {
160+
archiveName = "${pluginName}-dev.zip"
161+
}
162+
}
163+
164+
task gatherI18n(type: JavaExec) {
165+
delete buildLocaleDir
166+
mkdir buildLocaleDir
167+
168+
main = 'i18n-scraper'
169+
args 'build/locale/en.properties'
170+
classpath = sourceSets.main.runtimeClasspath
171+
}
172+
173+
task cleanAll(dependsOn: ['clean', 'cleanCopyDeps', 'cleanDistPlugin', 'cleanGatherI18n'])
174+
175+
String stripVersion(String fileNameWithVersion) {
176+
String ext = fileNameWithVersion.substring(fileNameWithVersion.lastIndexOf("."),fileNameWithVersion.length())
177+
int end = fileNameWithVersion.lastIndexOf("-"); //assumes that: name-version.ext. Will not work with name-version-SNAPSHOT.ext
178+
return fileNameWithVersion.substring(0, end) + ext
179+
}

0 commit comments

Comments
 (0)