Skip to content

Commit

Permalink
Merge pull request #242 from pmpowers-usgs/to-gradle-build-240
Browse files Browse the repository at this point in the history
To gradle build 240
  • Loading branch information
pmpowers-usgs authored Aug 24, 2017
2 parents ab03ddb + 666c06e commit 0ced103
Show file tree
Hide file tree
Showing 36 changed files with 412 additions and 1,750 deletions.
13 changes: 1 addition & 12 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="lib/gson-2.8.0.jar">
<attributes>
<attribute name="javadoc_location" value="http://google.github.io/gson/apidocs/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/guava-20.0.jar">
<attributes>
<attribute name="javadoc_location" value="http://google.github.io/guava/releases/20.0/api/docs/"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="owner.project.facets" value="java"/>
Expand Down
11 changes: 4 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
.settings
/bin
/classes
/dist
/docs
/tmp
.gradle
build
classes
tmp
curves*/
eq-prob*/
eq-rate*/
Scratch*.java
nshmp-haz-log*
/src/META-INF
cobertura.ser
9 changes: 7 additions & 2 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,21 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
</natures>
</projectDescription>
28 changes: 10 additions & 18 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
Unless otherwise noted, this software is in the public domain because it contains materials that originally came from the United States Geological Survey (USGS), an agency of the United States Department of Interior. For more information, see the official USGS [copyright policy](http://www.usgs.gov/visual-id/credit_usgs.html#copyright).
Unless otherwise noted, this software is in the public domain because it contains materials that originally came from the U.S. Geological Survey (USGS), an agency of the U.S. Department of Interior. For more information, see the official USGS [copyright policy](http://www.usgs.gov/visual-id/credit_usgs.html#copyright).

Dependent libraries found in the [`lib`](/usgs/nshmp-haz/tree/master/lib) directory are distributed under open source (or open source-like) licenses/agreements. Appropriate license agreements for each library can be found in the [`lib`](/usgs/nshmp-haz/tree/master/lib) directory.
Dependent libraries managed by the [Gradle](https://gradle.org) build tool are distributed under open source (or open source-like) licenses. Links to appropriate license agreements for each can be found below.

#### Libraries used at runtime:
#### Runtime language and libraries:

- [guava-19.0.jar](https://github.com/google/guava)
- [gson-2.5.jar](https://github.com/google/gson)
- [Java 8](http://www.oracle.com/technetwork/java/javase/terms/license)
- [Google Guava 23.0](https://github.com/google/guava/blob/master/COPYING)
- [Google Gson 2.8.1](https://github.com/google/gson/blob/master/LICENSE)

#### Libraries used to test project:
#### Build tools and libraries:

- [asm-5.1.jar] (http://asm.ow2.org)
- [asm-analysis-5.1.jar] (http://asm.ow2.org)
- [asm-commons-5.1.jar] (http://asm.ow2.org)
- [asm-tree-5.1.jar] (http://asm.ow2.org)
- [asm-util-5.1.jar] (http://asm.ow2.org)
- [cobertura-2.1.1.jar] (https://github.com/cobertura/cobertura)
- [commons-lang3-3.4.jar] (https://commons.apache.org/proper/commons-lang)
- [hamcrest-core-1.3.jar] (http://hamcrest.org/JavaHamcrest)
- [junit-4.12.jar] (http://junit.org)
- [oro-2.0.8.jar] (http://jakarta.apache.org/oro/)
- [slf4j-api-1.7.21.jar] (http://www.slf4j.org)
- [slf4j-jdk14-1.7.21.jar] (http://www.slf4j.org)
- [Gradle](https://github.com/gradle/gradle/blob/master/LICENSE)
- [JUnit](http://junit.org/junit4/license.html)
- [JaCoCo](http://www.jacoco.org/jacoco/trunk/doc/license.html)

#### Disclaimer

Expand Down
117 changes: 117 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@

apply plugin: 'java'
apply plugin: 'jacoco'

repositories {
jcenter()
}

dependencies {
compile('com.google.guava:guava:23.0') {
/* skip optional guava dependencies */
transitive = false
}
compile 'com.google.code.gson:gson:2.8.1'
testCompile 'junit:junit:4.12'
}

sourceSets {
main {
java {
srcDirs = ['src']
}
resources {
srcDirs = ['src']
exclude '**/*.java'
}
}
test {
java {
srcDirs = ['test']
}
resources {
srcDirs = ['test']
exclude '**/*.java'
}
}
}

ext {
projectName = 'nshmp-haz'
gitTag = 'git describe --tags'.execute().text.replace('\n', '') ?: 'unknown'
gitLink = '<a href="https://github.com/usgs/nshmp-haz">' + gitTag +'</a>'
propsPath = '/resources/main/app.properties'
docTitle = projectName + ': ' + gitLink
docFooter = '<div style="float: left; font-size: 16px; text-align: right; ' +
'padding: 10px; width: 100%; box-sizing: border-box; background-color: #f9f9f9">' +
'<b><a href="https://www.usgs.gov" target="_top">U.S. Geological Survey</a></b> ' +
'– National Seismic Hazard Mapping Project ' +
'(<a href="https://earthquake.usgs.gov/hazards/" target="_top">NSHMP</a>) ' +
'– <a href="https://github.com/usgs/nshmp-haz/blob/master/LICENSE.md" ' +
'target="_top">License</a> | <b>' + gitLink + '</b></div>'
}

test {
//include 'gov/usgs/earthquake/nshmp/gmm/*'
//exclude 'gov/usgs/earthquake/nshmp/**'
//include 'gov/usgs/earthquake/nshmp/gmm/CeusSoftRock.class'
filter {
includeTestsMatching "gov.usgs.earthquake.nshmp.data.*"
}
}

jacocoTestReport {
reports {
xml.enabled true
html.enabled true
}
}


javadoc {
options.setUse(true)
options.author(true)
options.version(true)
options.windowTitle(projectName)
options.docTitle(docTitle)
options.encoding('UTF-8')
options.docEncoding('UTF-8')
options.charSet('UTF-8')
options.bottom(docFooter)
options.addStringOption('Xdoclint:none', '-quiet')
options.links(
'https://docs.oracle.com/javase/8/docs/api/',
'https://google.github.io/guava/releases/23.0/api/docs/',
'https://google.github.io/gson/apidocs/')
include 'gov/usgs/earthquake/nshmp/**'
exclude 'gov/usgs/earthquake/nshmp/etc/**'
exclude 'gov/usgs/earthquake/nshmp/gcim/**'
exclude 'gov/usgs/earthquake/nshmp/internal/**'
}

/*
* Enhance the jar task to build a fat jar if running the build
* directly and add application version to a properties file.
* Note that 'git describe' only works when running gradle from
* the command line.
*/
jar {
doFirst {

/* possible fat jar */
if (rootProject.name == projectName) {
from { configurations.compile.collect {
it.isDirectory() ? it : zipTree(it).matching {
exclude { it.path.contains('META-INF') }
}
}}
}

/* record app version */
def props = new Properties()
def propsFile = new File(project.buildDir.toString() + propsPath)
propsFile.createNewFile()
props.setProperty('app.version', gitTag)
props.store(propsFile.newWriter(), null)
}
}
Loading

0 comments on commit 0ced103

Please sign in to comment.