Skip to content

Commit c45cc6c

Browse files
committed
moved to new project build type
1 parent ccf2fe5 commit c45cc6c

29 files changed

+392
-1150
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/bin/
22
*/build/*
33
build/*
4-
*/.gradle/*
4+
*.gradle
55
.project*
66
.classpath
7+
*/.settings
8+
*/.gitignore

build.gradle

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
subprojects {
2+
apply plugin: 'java'
3+
apply plugin: 'checkstyle'
4+
apply plugin: 'jacoco'
5+
apply plugin: 'maven'
6+
apply plugin: 'eclipse'
7+
8+
repositories {
9+
mavenCentral()
10+
maven {
11+
url 'https://oss.sonatype.org/content/repositories/snapshots/'
12+
}
13+
}
14+
15+
compileJava {
16+
options.compilerArgs << "-Xlint:all" << "-Werror"
17+
}
18+
19+
compileTestJava {
20+
options.compilerArgs << "-Xlint:all" << "-Werror"
21+
}
22+
23+
plugins.withType(JavaPlugin) {
24+
checkstyle.sourceSets = [sourceSets.main]
25+
}
26+
27+
test {
28+
maxParallelForks = Math.max(1, (int)(Runtime.getRuntime().availableProcessors() / 4))
29+
jacoco {
30+
excludes = ['**/package-info**','**/*Test']
31+
destinationFile = file("$buildDir/reports/jacoco/test.exec")
32+
}
33+
getReports().getJunitXml().setDestination(file("$buildDir/reports/tests/xml"))
34+
getReports().getHtml().setDestination(file("$buildDir/reports/tests/html"))
35+
setBinResultsDir(file("$buildDir/reports/tests/bin"))
36+
}
37+
38+
build.dependsOn jacocoTestReport
39+
40+
jacocoTestReport {
41+
doFirst {
42+
classDirectories = fileTree(dir: 'build/classes/java/main', include: 'org/threadly/**')
43+
sourceDirectories = fileTree(dir: 'src/main/java', include: 'org/threadly/**')
44+
}
45+
reports {
46+
csv.enabled = false
47+
xml.enabled = true
48+
xml.destination = file("$buildDir/reports/jacoco/jacoco.xml")
49+
html.enabled = true
50+
html.destination = file("$buildDir/reports/jacoco/html")
51+
}
52+
doLast {
53+
println "Test results available at:"
54+
println "html - $buildDir/reports/tests/html/index.html"
55+
println "Test coverage reports available at:"
56+
println "html - $buildDir/reports/jacoco/html/index.html"
57+
}
58+
}
59+
60+
jar {
61+
manifest {
62+
attributes 'Implementation-Title': 'litesockets-http', 'Implementation-Version': version
63+
}
64+
}
65+
66+
javadoc {
67+
source = sourceSets.main.allJava
68+
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PUBLIC
69+
}
70+
71+
task javadocJar(type: Jar, dependsOn: javadoc) {
72+
classifier = 'javadoc'
73+
from 'build/docs/javadoc'
74+
}
75+
76+
task sourcesJar(type: Jar) {
77+
from sourceSets.main.allSource
78+
classifier = 'sources'
79+
}
80+
81+
build.dependsOn("copyLibs");
82+
83+
task copyLibs(type: Copy) {
84+
into "$buildDir/dependencies/"
85+
from configurations.testRuntime
86+
}
87+
88+
artifacts {
89+
archives jar
90+
archives javadocJar
91+
archives sourcesJar
92+
}
93+
}
94+
95+
project(':protocol') {
96+
archivesBaseName = 'litesockets-http-protocol'
97+
98+
dependencies {
99+
compile (
100+
"org.threadly:threadly:$threadlyVersion",
101+
"org.threadly:litesockets:$litesocketsVersion"
102+
)
103+
104+
testCompile (
105+
"junit:junit:$junitVersion",
106+
)
107+
}
108+
}
109+
110+
111+
project(':client') {
112+
archivesBaseName = 'litesockets-http-client'
113+
114+
dependencies {
115+
compile (
116+
project(":protocol"),
117+
"org.threadly:threadly:$threadlyVersion",
118+
"org.threadly:litesockets:$litesocketsVersion"
119+
)
120+
testCompile (
121+
"junit:junit:$junitVersion",
122+
)
123+
}
124+
}
125+
126+
project(':server') {
127+
archivesBaseName = 'litesockets-http-server'
128+
129+
dependencies {
130+
compile (
131+
project(":protocol"),
132+
"org.threadly:threadly:$threadlyVersion",
133+
"org.threadly:litesockets:$litesocketsVersion"
134+
)
135+
testCompile (
136+
"junit:junit:$junitVersion",
137+
)
138+
}
139+
}
140+

build.upload

Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
subprojects {
2+
apply plugin: 'java'
3+
apply plugin: 'checkstyle'
4+
apply plugin: 'jacoco'
5+
apply plugin: 'maven'
6+
apply plugin: 'signing'
7+
8+
repositories {
9+
mavenCentral()
10+
maven {
11+
url 'https://oss.sonatype.org/content/repositories/snapshots/'
12+
}
13+
}
14+
15+
sourceCompatibility = 1.8
16+
targetCompatibility = 1.8
17+
18+
compileJava {
19+
String[] java8Paths = new String[9]
20+
java8Paths[0] = "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/"
21+
java8Paths[1] = "/usr/lib/jvm/java-8-openjdk/jre/lib/"
22+
java8Paths[2] = "/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/"
23+
java8Paths[3] = "/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/"
24+
java8Paths[4] = "/usr/lib/jvm/java-8-sun/jre/lib/"
25+
java8Paths[5] = "/usr/lib/jvm/jdk1.8.0_122/jre/lib/"
26+
java8Paths[6] = "/usr/lib/jvm/jdk1.8.0_65/jre/lib/"
27+
java8Paths[7] = "/usr/lib/jvm/jdk1.8.0_45/jre/lib/"
28+
java8Paths[8] = "/usr/lib/jvm/jdk1.8.0_20/jre/lib/"
29+
for (String path : java8Paths) {
30+
if (new java.io.File(path).exists()) {
31+
println 'Using java 8: ' + path
32+
options.bootstrapClasspath = fileTree(include: ['*.jar'], dir: path)
33+
break
34+
}
35+
}
36+
if (options.bootstrapClasspath == null) {
37+
println 'Unable to find java 8 rt.jar, will cause failure so exiting now'
38+
println ''
39+
System.exit(1)
40+
}
41+
}
42+
43+
compileTestJava {
44+
options.compilerArgs << "-Xlint:all" << "-Xlint:-deprecation" << "-Werror"
45+
46+
String[] java8Paths = new String[9]
47+
java8Paths[0] = "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/"
48+
java8Paths[1] = "/usr/lib/jvm/java-8-openjdk/jre/lib/"
49+
java8Paths[2] = "/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/"
50+
java8Paths[3] = "/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/"
51+
java8Paths[4] = "/usr/lib/jvm/java-8-sun/jre/lib/"
52+
java8Paths[5] = "/usr/lib/jvm/jdk1.8.0_122/jre/lib/"
53+
java8Paths[6] = "/usr/lib/jvm/jdk1.8.0_65/jre/lib/"
54+
java8Paths[7] = "/usr/lib/jvm/jdk1.8.0_45/jre/lib/"
55+
java8Paths[8] = "/usr/lib/jvm/jdk1.8.0_20/jre/lib/"
56+
for (String path : java8Paths) {
57+
if (new java.io.File(path).exists()) {
58+
options.bootstrapClasspath = fileTree(include: ['*.jar'], dir: path)
59+
break
60+
}
61+
}
62+
}
63+
64+
signing {
65+
sign configurations.archives
66+
}
67+
68+
uploadArchives {
69+
repositories {
70+
mavenDeployer {
71+
beforeDeployment {
72+
MavenDeployment deployment -> signing.signPom(deployment)
73+
}
74+
75+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
76+
authentication(userName: sonatypeUsername, password: sonatypePassword)
77+
}
78+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots") {
79+
authentication(userName: sonatypeUsername, password: sonatypePassword)
80+
}
81+
82+
pom.project {
83+
name 'litesockets-http'
84+
packaging 'jar'
85+
description 'Libraries to help parse and use HTTP protocol'
86+
url 'http://threadly.org/'
87+
88+
scm {
89+
url 'scm:[email protected]:threadly/litesockets-http.git'
90+
connection 'scm:[email protected]:threadly/litesockets-http.git'
91+
developerConnection 'scm:[email protected]:threadly/litesockets-http.git'
92+
}
93+
94+
licenses {
95+
license {
96+
name 'Mozilla Public License Version 2.0'
97+
url 'https://www.mozilla.org/MPL/2.0/'
98+
distribution 'repo'
99+
}
100+
}
101+
102+
developers {
103+
developer {
104+
id 'jent'
105+
name 'Mike Jensen'
106+
107+
}
108+
developer {
109+
id 'lwahlmeier'
110+
name 'Luke Wahlmeier'
111+
112+
}
113+
}
114+
}
115+
}
116+
}
117+
}
118+
119+
compileJava {
120+
options.compilerArgs << "-Xlint:all" << "-Werror"
121+
}
122+
123+
compileTestJava {
124+
options.compilerArgs << "-Xlint:all" << "-Werror"
125+
}
126+
127+
plugins.withType(JavaPlugin) {
128+
checkstyle.sourceSets = [sourceSets.main]
129+
}
130+
131+
test {
132+
maxParallelForks = Math.max(1, (int)(Runtime.getRuntime().availableProcessors() / 4))
133+
jacoco {
134+
excludes = ['**/package-info**','**/*Test']
135+
destinationFile = file("$buildDir/reports/jacoco/test.exec")
136+
}
137+
getReports().getJunitXml().setDestination(file("$buildDir/reports/tests/xml"))
138+
getReports().getHtml().setDestination(file("$buildDir/reports/tests/html"))
139+
setBinResultsDir(file("$buildDir/reports/tests/bin"))
140+
}
141+
142+
build.dependsOn jacocoTestReport
143+
144+
jacocoTestReport {
145+
doFirst {
146+
classDirectories = fileTree(dir: 'build/classes/java/main', include: 'org/threadly/**')
147+
sourceDirectories = fileTree(dir: 'src/main/java', include: 'org/threadly/**')
148+
}
149+
reports {
150+
csv.enabled = false
151+
xml.enabled = true
152+
xml.destination = file("$buildDir/reports/jacoco/jacoco.xml")
153+
html.enabled = true
154+
html.destination = file("$buildDir/reports/jacoco/html")
155+
}
156+
doLast {
157+
println "Test results available at:"
158+
println "html - $buildDir/reports/tests/html/index.html"
159+
println "Test coverage reports available at:"
160+
println "html - $buildDir/reports/jacoco/html/index.html"
161+
}
162+
}
163+
164+
jar {
165+
manifest {
166+
attributes 'Implementation-Title': 'litesockets-http', 'Implementation-Version': version
167+
}
168+
}
169+
170+
javadoc {
171+
source = sourceSets.main.allJava
172+
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PUBLIC
173+
}
174+
175+
task javadocJar(type: Jar, dependsOn: javadoc) {
176+
classifier = 'javadoc'
177+
from 'build/docs/javadoc'
178+
}
179+
180+
task sourcesJar(type: Jar) {
181+
from sourceSets.main.allSource
182+
classifier = 'sources'
183+
}
184+
185+
build.dependsOn("copyLibs");
186+
187+
task copyLibs(type: Copy) {
188+
into "$buildDir/dependencies/"
189+
from configurations.testRuntime
190+
}
191+
192+
artifacts {
193+
archives jar
194+
archives javadocJar
195+
archives sourcesJar
196+
}
197+
}
198+
199+
200+
project(':protocol') {
201+
archivesBaseName = 'litesockets-http-protocol'
202+
203+
dependencies {
204+
compile (
205+
"org.threadly:threadly:$threadlyVersion",
206+
"org.threadly:litesockets:$litesocketsVersion"
207+
)
208+
209+
testCompile (
210+
"junit:junit:$junitVersion",
211+
)
212+
}
213+
}
214+
215+
216+
project(':client') {
217+
archivesBaseName = 'litesockets-http-client'
218+
219+
dependencies {
220+
compile (
221+
project(":protocol"),
222+
"org.threadly:threadly:$threadlyVersion",
223+
"org.threadly:litesockets:$litesocketsVersion"
224+
)
225+
testCompile (
226+
"junit:junit:$junitVersion",
227+
)
228+
}
229+
}
230+
231+
project(':server') {
232+
archivesBaseName = 'litesockets-http-server'
233+
234+
dependencies {
235+
compile (
236+
project(":protocol"),
237+
"org.threadly:threadly:$threadlyVersion",
238+
"org.threadly:litesockets:$litesocketsVersion"
239+
)
240+
testCompile (
241+
"junit:junit:$junitVersion",
242+
)
243+
}
244+
}
245+

0 commit comments

Comments
 (0)