Skip to content

Commit

Permalink
converting to build using gradle
Browse files Browse the repository at this point in the history
replacing the existing ant/sbt build system with gradle
  gradle is a much more modern build system then ant
  it has a richer feature set, better IDE support and will be easier to maintain going forward
  it's self installing using the included gradle wrapper and runs in the jvm

removing checked in intellij files
  you will need to regenerate your intellij project
    it is now trivial to create a correctly configured intellij project by File -> New -> Project from Existing Sources -> Gradle -> choose use default gradle wrapper
  this should help reduce pain from changing personal project configurations

updated tests to be more robust to random order test execution and with new test data path
updated travis build

replacing build.xml with a simple wrapper that calls through to gradle

Example gradle usage:
 to compile htsjdk or it's tests
   ./gradlew compileJava
   ./gradlew compileTest

 to build a jar
   ./gradlew jar

 to build a jar, along with source and document jars
 ./gradlew build

 to build a jar that packages all of htsjdk's dependencies in a single jar
  ./gradlew shadowJar

 to run tests, or a single test, or run a test and wait for the debugger
   ./gradlew test
   ./gradlew test --tests "*AlleleUnitTest"
   ./gradlew test --tests "*AlleleUnitTest" --debug-jvm

 to clean the project directory
   ./gradlew clean

 to see an exhaustive list of all available targets
   ./gradlew tasks

Projects that import htsjdk through maven central should be unaffected by these changes.
Projects that include an htsjdk jar in their libs will now find the jar in build/libs/ after running ./gradlew shadowJar
  this "shadow jar" includes all of htsjdk's dependencies bundled within it

an htsjdk only jar can be built with ./gradlew jar
  • Loading branch information
lbergelson committed May 16, 2016
1 parent 909381a commit 1d052a3
Show file tree
Hide file tree
Showing 91 changed files with 636 additions and 1,821 deletions.
10 changes: 0 additions & 10 deletions .classpath

This file was deleted.

25 changes: 14 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
htsjdk.iws
.command_tmp
classes
testclasses
javadoc
dist
contracts
atlassian-ide-plugin.xml
intellij.testclasses
intellij.classes
/htsjdk.version.properties
/bin
/test-output
target
.idea/libraries
.idea/workspace.xml

#intellij
.idea/
src/htsjdk.iml
*.iml
*.ipr
*.iws




#gradle stuff
.gradle/
build/
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

23 changes: 0 additions & 23 deletions .idea/compiler.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/copyright/profiles_settings.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/encodings.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/modules.xml

This file was deleted.

81 changes: 0 additions & 81 deletions .idea/modules/htsjdk-build.iml

This file was deleted.

44 changes: 0 additions & 44 deletions .idea/modules/htsjdk.iml

This file was deleted.

22 changes: 0 additions & 22 deletions .idea/sbt.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/scala_compiler.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/scopes/scope_settings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/vcs.xml

This file was deleted.

17 changes: 0 additions & 17 deletions .project

This file was deleted.

22 changes: 11 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
language: java
dist: trusty
sudo: true
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.m2
jdk:
- oraclejdk8
install: ant
script: ant all test sra-test
script: ./gradlew test testSRA testIntelDeflater
after_success:
- echo "TRAVIS_BRANCH='$TRAVIS_BRANCH'";
echo "JAVA_HOME='$JAVA_HOME'";
if [ "$TRAVIS_BRANCH" == "master" ] && [ "$JAVA_HOME" == "/usr/lib/jvm/java-8-oracle" ]; then
sbt \
'set buildSnapshot := true' \
'set javacOptions in (Compile, doc) ++= Seq("-quiet")' \
'set test in publish := {}' \
'set resolvers += Resolver.url("bintray-sbt-plugin-releases", url("http://dl.bintray.com/content/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)' \
'set publishTo := Option("artifactory-snapshots-publish" at "https://artifactory.broadinstitute.org/artifactory/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)' \
"set credentials += Credentials(\"Artifactory Realm\", \"artifactory.broadinstitute.org\", \"${ARTIFACTORY_USERNAME}\", \"${ARTIFACTORY_PASSWORD}\")" \
publish;
if [ "$TRAVIS_BRANCH" == "master" ]; then
./gradlew uploadArchives;
fi
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,62 @@ Please see the [HTSJDK Documentation](http://samtools.github.io/htsjdk) for more

> **NOTE: _HTSJDK does not currently support the latest Variant Call Format Specification (VCFv4.3 and BCFv2.2)._**
#### Building HTSJDK

HTSJDK is now built using [gradle](http://gradle.org/).

A wrapper script (`gradlew`) is included which will download the appropriate version of gradle on the first invocation.

Example gradle usage from the htsjdk root directory:
- compile and build a jar
```
./gradlew
```
or
```
./gradlew jar
```
The jar will be in build/libs/htsjdk-\<version\>.jar where version is based on the current git commit.

- run tests, a specific test class, or run a test and wait for the debugger to connect
```
./gradlew test
./gradlew test --tests htsjdk.variant.variantcontext.AlleleUnitTest
./gradlew test --tests "*AlleleUnitTest"
./gradlew test --tests "*AlleleUnitTest" --debug-jvm
```

- clean the project directory
```
./gradlew clean
```

- build a monolithic jar that includes all of htsjdk's dependencies
```
./gradlew shadowJar
```

- create a snapshot and install it into your local maven repository
```
./gradlew install
```

- for an exhaustive list of all available targets
```
./gradlew tasks
```

#### Create an HTSJDK project in IntelliJ
To create a project in IntelliJ IDE for htsjdk do the following:

1. Select fom the menu: `File -> New -> Project from Existing Sources`
2. In the resulting dialog, chose `Import from existing model`, select `Gradle` and `Next`
3. Choose the `default gradle wrapper` and `Finish`.

From time to time if dependencies change in htsjdk you may need to refresh the project from the `View -> Gradle` menu.

#### Licensing Information

Not all sub-packages of htsjdk are subject to the same license, so a license notice is included in each source file or sub-package as appropriate. Please check the relevant license notice whenever you start working with a part of htsjdk that you have not previously worked with to avoid any surprises.
Expand Down
Loading

0 comments on commit 1d052a3

Please sign in to comment.