-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 98b92f8
Showing
17 changed files
with
904 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.* | ||
!.gitignore | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
## v1.0 / 2014-10-10 | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2014 Chiang Seng Chang | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# ctzen-common | ||
|
||
Common Utilities. | ||
|
||
### `ToStringUtil` | ||
Assorted `toString()` helpers. | ||
|
||
### `MultiLineIndentToStringStyle` | ||
|
||
[Apache Commons Lang](http://commons.apache.org/proper/commons-lang/)'s [ToStringStyle](http://commons.apache.org/proper/commons-lang/javadocs/api-3.1/org/apache/commons/lang3/builder/ToStringStyle.html) that supports multi-level indents. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* Make assert failures look better */ | ||
|
||
.result { | ||
font-family: Lucida Console, Monaco, Courier New, monospace; | ||
} | ||
|
||
a { | ||
text-decoration: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
//================================================== | ||
// ctzen-common build file | ||
//================================================== | ||
|
||
group = 'com.ctzen' | ||
version = '1.0' | ||
|
||
defaultTasks 'clean', 'build' | ||
|
||
apply plugin: 'groovy' | ||
|
||
//================================================== | ||
// dependencies | ||
//================================================== | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
// groovy | ||
compile 'org.codehaus.groovy:groovy-all:2.3.6' // version matches eclipse plug-in | ||
// must haves | ||
compile 'org.apache.commons:commons-lang3:3.3.2' | ||
// logging | ||
compile 'org.slf4j:slf4j-api:1.7.7' | ||
runtime 'ch.qos.logback:logback-classic:1.1.2' | ||
runtime 'org.slf4j:jcl-over-slf4j:1.7.7' // bridge commons-logging to slf4j | ||
runtime 'org.slf4j:log4j-over-slf4j:1.7.7' // bridge log4j to slf4j | ||
// testing | ||
testCompile 'org.slf4j:jcl-over-slf4j:1.7.7' // need this to compile groovy tests | ||
testCompile 'org.testng:testng:6.8.8' | ||
testRuntime 'org.uncommons:reportng:1.1.4' // nicer testng reports | ||
testRuntime 'com.google.inject:guice:2.0' // required by reportng (no major version due to bad meta on repo) | ||
} | ||
|
||
configurations { | ||
all*.exclude group: 'commons-logging' // exclude to use slf4j | ||
all*.exclude group: 'log4j' // exclude to use slf4j | ||
} | ||
|
||
//================================================== | ||
// java / groovy | ||
//================================================== | ||
|
||
ext { | ||
// CANNOT be full path or eclipse plugin may misbehave! | ||
srcDir = 'src' // main sources and resources | ||
classesDir = 'build/classes' // main classes | ||
testSrcDir = 'src-test' // test sources and resources | ||
testClassesDir = 'build/classes-test' // test classes | ||
assetsDir = 'assets' // e.g. reportng css | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
options.encoding = 'UTF-8' | ||
options.deprecation = true | ||
options.compilerArgs << '-Xlint:unchecked' | ||
} | ||
|
||
tasks.withType(GroovyCompile) { | ||
options.encoding = 'UTF-8' | ||
options.deprecation = true | ||
options.compilerArgs << '-Xlint:unchecked' | ||
} | ||
|
||
sourceSets { | ||
main { | ||
java { | ||
srcDirs = [] | ||
} | ||
groovy { | ||
srcDirs = ["${srcDir}"] | ||
} | ||
resources { | ||
srcDirs = ["${srcDir}"] // note same as main source | ||
} | ||
output.classesDir = "${classesDir}" | ||
output.resourcesDir = "${classesDir}" // note same as main classes | ||
} | ||
test { | ||
java { | ||
srcDirs = [] | ||
} | ||
groovy { | ||
srcDirs = ["${testSrcDir}"] | ||
} | ||
resources { | ||
srcDirs = ["${testSrcDir}"] // note same as test source | ||
} | ||
output.classesDir = "${testClassesDir}" | ||
output.resourcesDir = "${testClassesDir}" // note same as test classes | ||
} | ||
} | ||
|
||
// workaround dup entries in jar until GRADLE-2213 is fixed | ||
jar.doFirst { | ||
sourceSets.main.output.resourcesDir = "/does/not/exist" | ||
} | ||
jar.doLast { | ||
sourceSets.main.output.resourcesDir = sourceSets.main.output.classesDir | ||
} | ||
|
||
//================================================== | ||
// unit test | ||
//================================================== | ||
|
||
apply plugin: 'jacoco' | ||
|
||
test { | ||
useTestNG() { | ||
parallel 'tests' | ||
threadCount 5 | ||
} | ||
systemProperty 'org.uncommons.reportng.stylesheet', "${assetsDir}/reportng-custom.css" | ||
options { | ||
listeners << 'org.uncommons.reportng.HTMLReporter' // use reportng | ||
listeners << 'org.uncommons.reportng.JUnitXMLReporter' // also produce junit xml reports for | ||
// downstream build step such as | ||
// jenkins' unit test report | ||
} | ||
jacoco { | ||
append = false | ||
destinationFile = file("${reporting.baseDir}/jacoco/jacoco.exec") | ||
} | ||
doLast { | ||
jacocoTestReport.execute() | ||
} | ||
} | ||
|
||
jacocoTestReport { | ||
group = 'Reporting' | ||
description = 'Generate Jacoco unit tests coverage report.' | ||
dependsOn test | ||
reports { | ||
xml.enabled = false | ||
csv.enabled false | ||
html.enabled true | ||
html.destination "${reporting.baseDir}/jacoco/html" | ||
} | ||
} | ||
|
||
//================================================== | ||
// eclipse integration | ||
//================================================== | ||
|
||
apply plugin: 'eclipse' | ||
|
||
eclipse { | ||
classpath { | ||
downloadSources = true | ||
// setup separate output classes folders. | ||
defaultOutputDir = file("${classesDir}") | ||
file { | ||
// Classpath entry for Eclipse which changes the order of classpathentries | ||
// otherwise no sources for 3rd party jars are shown | ||
withXml { xml -> | ||
def node = xml.asNode() | ||
def j2eeNode = node.find { it.@path == 'org.eclipse.jst.j2ee.internal.web.container' } | ||
if (j2eeNode) { | ||
node.remove(j2eeNode) | ||
node.appendNode( 'classpathentry', [ kind: 'con', path: 'org.eclipse.jst.j2ee.internal.web.container', exported: 'true']) | ||
} | ||
} | ||
// switch test classes output folder | ||
whenMerged { cp -> | ||
cp.entries.findAll { | ||
it.kind == 'src' && it.path == "${testSrcDir}" | ||
}*.output = "${testClassesDir}" | ||
} | ||
} | ||
} | ||
} | ||
|
||
// always clean when generating eclipse project files | ||
// because the generated files without cleaning could be bad | ||
tasks.eclipse.dependsOn cleanEclipse | ||
|
||
//================================================== | ||
// publish | ||
//================================================== | ||
|
||
apply plugin: 'maven-publish' | ||
|
||
task sourceJar(type: Jar) { | ||
from sourceSets.main.allSource | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
artifact sourceJar { | ||
classifier "sources" | ||
} | ||
} | ||
} | ||
} | ||
|
||
task publishLocal { | ||
group = 'Publishing' | ||
description = 'Alias for publishToMavenLocal' | ||
dependsOn publishToMavenLocal | ||
} | ||
|
||
//================================================== | ||
// gradle wrapper | ||
//================================================== | ||
|
||
task wrapper(type: Wrapper) { | ||
gradleVersion = '2.1' | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Thu Oct 09 19:28:01 EDT 2014 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip |
Oops, something went wrong.