Skip to content

Commit de73bfa

Browse files
committed
gradle build working
1 parent f1a947d commit de73bfa

23 files changed

Lines changed: 499 additions & 69 deletions

File tree

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
.project
77
.settings
88
build
9-
gradle
10-
gradlew
11-
gradlew.bat
129
out
1310
target
1411
bin/
1512
*.iml
1613
*.ipr
1714
*.iws
1815
.config.properties
19-
.checkstyle
16+
.checkstyle
17+
.gradletasknamecache

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ jdk:
66
branches:
77
except:
88
- gh-pages
9+
before_cache:
10+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
11+
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
912
cache:
1013
directories:
11-
- $HOME/.m2
14+
- $HOME/.m2
15+
- $HOME/.gradle/caches/
16+
- $HOME/.gradle/wrapper/
1217
env:
1318
global:
1419
- secure: S2KIWOJX35j1FczyV7JRFrFpTftb8Hmkf6C50bJh8E03IbPu7tnX2znPKBbRWcIQndO6qd5dL7+BqtXabByOzd5Slj5/NBdXPcGffsO7B0cpFQS8ngpIMAGReCXQ12PbOiO8CIk2f/20lU3L0kqcP1TaPyZYIlSwkUg98ls8p90=

.utility/deploy_snapshot.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [ "$TRAVIS_REPO_SLUG" == "watson-developer-cloud/java-sdk" ] && \
1414
[ "$TRAVIS_BRANCH" == "master" ]; then
1515
echo "Publishing Maven snapshot..."
1616

17-
mvn clean source:jar javadoc:jar deploy --settings=".utility/settings.xml" -DskipTests=true
18-
17+
#mvn clean source:jar javadoc:jar deploy --settings=".utility/settings.xml" -DskipTests=true
18+
./gradle uploadArchives
1919
echo "Maven snapshot published."
2020
fi

.utility/push-javadoc-to-gh-pages.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if [ "$TRAVIS_REPO_SLUG" == "watson-developer-cloud/java-sdk" ] && [ "$TRAVIS_PU
1111
rm -rf docs/$TRAVIS_BRANCH
1212
mkdir -p docs/$TRAVIS_BRANCH
1313

14-
cp -rf ../target/site/apidocs/* docs/$TRAVIS_BRANCH
14+
cp -rf ../build/docs/all/* docs/$TRAVIS_BRANCH
1515
../.utility/generate_index_html.sh > index.html
1616

1717
# update the latest/ symlink

.utility/travis.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
set -e # enforces the script to fail as soon as one command fails
44

5-
mvn clean install -Dmaven.test.skip=true
6-
mvn javadoc:aggregate > /dev/null
5+
./gradlew install -x check
6+
./gradlew docs > /dev/null
77

88
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
99
echo '$TRAVIS_PULL_REQUEST is false, running all tests'
1010
openssl aes-256-cbc -K $encrypted_a973fe4f8e79_key -iv $encrypted_a973fe4f8e79_iv -in .config.properties.enc -out tests/src/test/resources/.config.properties -d
11-
mvn cobertura:cobertura-integration-test
11+
./gradlew cobertura
1212
else
1313
echo '$TRAVIS_PULL_REQUEST is not false ($TRAVIS_PULL_REQUEST), running unit tests'
14-
mvn test
14+
./gradlew check
1515
fi

build.gradle

Lines changed: 178 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,189 @@
1+
plugins {
2+
id 'ru.vyarus.animalsniffer' version '1.2.0'
3+
id 'net.saliman.cobertura' version '2.3.2'
4+
}
15
apply plugin: 'java'
2-
apply plugin: 'maven'
3-
apply plugin: 'eclipse'
4-
apply plugin: 'idea'
56

6-
sourceCompatibility = 1.7
7-
targetCompatibility = 1.7
8-
group = 'com.ibm.watson.developercloud'
9-
archivesBaseName = 'watson-developer-cloud'
10-
version = '3.5.2'
7+
import org.apache.tools.ant.filters.*
8+
9+
archivesBaseName = 'java-sdk'
10+
1111

1212
description = 'Client library to use the IBM Watson and Alchemy Services'
1313

14-
repositories {
15-
mavenCentral()
14+
task docs(type: Javadoc) {
15+
destinationDir = file("$buildDir/docs/all")
16+
}
17+
18+
19+
def getDate() {
20+
def date = new Date()
21+
def formattedDate = date.format('yyyyMMddHHmmss')
22+
return formattedDate
1623
}
17-
dependencies {
18-
compile group: 'com.squareup.okhttp3', name: 'okhttp', version:'3.3.1'
19-
compile group: 'com.squareup.okhttp3', name: 'okhttp-ws', version:'3.3.1'
20-
compile group: 'com.squareup.okhttp3', name: 'logging-interceptor', version:'3.3.1'
21-
compile group: 'com.squareup.okhttp3', name: 'okhttp-urlconnection', version:'3.3.1'
22-
compile group: 'com.google.code.gson', name: 'gson', version:'2.6.2'
23-
compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.4'
24-
compile group: 'org.glassfish.jersey.bundles.repackaged', name: 'jersey-jsr166e', version:'2.22.2'
25-
testCompile group: 'com.squareup.okhttp3', name: 'mockwebserver', version:'3.3.1'
26-
testCompile group: 'ch.qos.logback', name: 'logback-classic', version:'1.1.7'
27-
testCompile group: 'com.google.guava', name: 'guava', version:'19.0'
28-
testCompile group: 'junit', name: 'junit-dep', version:'4.11'
29-
}
30-
31-
task sourcesJar(type: Jar) {
24+
25+
subprojects {
26+
afterEvaluate {
27+
if (plugins.hasPlugin(JavaPlugin)) {
28+
rootProject.tasks.docs {
29+
source += files(sourceSets.collect { srcSet -> srcSet.allJava })
30+
classpath += files(sourceSets*.compileClasspath)
31+
}
32+
}
33+
}
34+
}
35+
36+
allprojects {
37+
apply plugin: 'ru.vyarus.animalsniffer'
38+
apply plugin: 'net.saliman.cobertura'
39+
apply plugin: 'java'
40+
apply plugin: 'maven'
41+
apply plugin: 'checkstyle'
42+
43+
version = '3.5.2-SNAPSHOT'
44+
group = 'com.ibm.watson.developercloud'
45+
46+
task sourcesJar(type: Jar) {
3247
classifier = 'sources'
3348
from sourceSets.main.allSource
34-
}
49+
}
3550

36-
artifacts {
51+
task javadocJar(type: Jar, dependsOn: javadoc) {
52+
classifier = 'javadoc'
53+
from javadoc.destinationDir
54+
}
55+
56+
repositories {
57+
mavenCentral()
58+
}
59+
60+
artifacts {
3761
archives sourcesJar
62+
archives javadocJar
63+
}
64+
65+
checkstyle {
66+
configFile = rootProject.file('checkstyle.xml')
67+
}
68+
69+
dependencies {
70+
testCompile group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '3.3.1'
71+
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.7'
72+
testCompile group: 'com.google.guava', name: 'guava', version: '19.0'
73+
testCompile group: 'junit', name: 'junit-dep', version: '4.11'
74+
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
75+
}
76+
77+
processResources {
78+
filter ReplaceTokens, tokens: [
79+
"pom.version": project.version,
80+
"build.date" : getDate()
81+
]
82+
}
83+
84+
uploadArchives {
85+
repositories.mavenDeployer {
86+
repository(url: "http://oss.sonatype.org/service/local/staging/deploy/maven2/") {
87+
authentication(userName: System.env.CI_DEPLOY_USERNAME, password: System.env.CI_DEPLOY_PASSWORD)
88+
}
89+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/"){
90+
authentication(userName: System.env.CI_DEPLOY_USERNAME, password: System.env.CI_DEPLOY_PASSWORD)
91+
}
92+
}
93+
}
94+
95+
cobertura {
96+
coverageFormats = ['html', 'xml']
97+
coverageIgnoreTrivial = true
98+
coverageIgnores = ['org.slf4j.Logger.*']
99+
coverageReportDir = new File("$buildDir/reports/cobertura")
100+
}
101+
}
102+
103+
104+
configure(subprojects - project(':core')) {
105+
dependencies {
106+
compile project(':core')
107+
testCompile project(path: ':core', configuration: 'tests')
108+
}
109+
}
110+
111+
project(':core') {
112+
113+
task testJar(type: Jar) {
114+
classifier = 'tests'
115+
from sourceSets.test.output
116+
}
117+
118+
configurations {
119+
tests
120+
}
121+
122+
artifacts {
123+
tests testJar
124+
}
125+
126+
dependencies {
127+
compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.3.1'
128+
compile group: 'com.squareup.okhttp3', name: 'okhttp-ws', version: '3.3.1'
129+
compile group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: '3.3.1'
130+
compile group: 'com.squareup.okhttp3', name: 'okhttp-urlconnection', version: '3.3.1'
131+
compile group: 'com.google.code.gson', name: 'gson', version: '2.6.2'
132+
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
133+
compile group: 'org.glassfish.jersey.bundles.repackaged', name: 'jersey-jsr166e', version: '2.22.2'
134+
135+
}
136+
}
137+
138+
project(':dialog') {
139+
dependencies {
140+
compile project(':core')
141+
compile project(':conversation')
142+
}
38143
}
144+
145+
project(':tests') {
146+
dependencies {
147+
testCompile project(':core')
148+
testCompile project(':natural-language-classifier')
149+
testCompile project(':alchemy')
150+
testCompile project(':android-utils')
151+
testCompile project(':conversation')
152+
testCompile project(':dialog')
153+
testCompile project(':document-conversion')
154+
testCompile project(':language-translation')
155+
testCompile project(':language-translator')
156+
testCompile project(':personality-insights')
157+
testCompile project(':retrieve-and-rank')
158+
testCompile project(':speech-to-text')
159+
testCompile project(':text-to-speech')
160+
testCompile project(':tone-analyzer')
161+
testCompile project(':tradeoff-analytics')
162+
testCompile project(':visual-recognition')
163+
164+
testCompile group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '3.3.1'
165+
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.7'
166+
testCompile group: 'com.google.guava', name: 'guava', version: '19.0'
167+
testCompile group: 'junit', name: 'junit-dep', version: '4.11'
168+
}
169+
}
170+
171+
configure(rootProject) {
172+
dependencies {
173+
compile project(':natural-language-classifier')
174+
compile project(':alchemy')
175+
compile project(':android-utils')
176+
compile project(':conversation')
177+
compile project(':dialog')
178+
compile project(':document-conversion')
179+
compile project(':language-translation')
180+
compile project(':language-translator')
181+
compile project(':personality-insights')
182+
compile project(':retrieve-and-rank')
183+
compile project(':speech-to-text')
184+
compile project(':text-to-speech')
185+
compile project(':tone-analyzer')
186+
compile project(':tradeoff-analytics')
187+
compile project(':visual-recognition')
188+
}
189+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=${pom.version}
2-
build.date=${timestamp}
1+
version=@pom.version@
2+
build.date=@build.date@

gradle/wrapper/gradle-wrapper.jar

53 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Nov 18 08:34:20 CET 2016
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2-all.zip

0 commit comments

Comments
 (0)