Skip to content

Commit 1d052a3

Browse files
committed
converting to build using gradle
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
1 parent 909381a commit 1d052a3

File tree

91 files changed

+636
-1821
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+636
-1821
lines changed

.classpath

Lines changed: 0 additions & 10 deletions
This file was deleted.

.gitignore

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
htsjdk.iws
22
.command_tmp
3-
classes
4-
testclasses
5-
javadoc
6-
dist
7-
contracts
83
atlassian-ide-plugin.xml
9-
intellij.testclasses
10-
intellij.classes
114
/htsjdk.version.properties
12-
/bin
135
/test-output
14-
target
15-
.idea/libraries
16-
.idea/workspace.xml
6+
7+
#intellij
8+
.idea/
9+
src/htsjdk.iml
10+
*.iml
11+
*.ipr
12+
*.iws
13+
14+
15+
16+
17+
#gradle stuff
18+
.gradle/
19+
build/

.idea/.name

Lines changed: 0 additions & 1 deletion
This file was deleted.

.idea/compiler.xml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.idea/copyright/profiles_settings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.idea/encodings.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.idea/modules.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.idea/modules/htsjdk-build.iml

Lines changed: 0 additions & 81 deletions
This file was deleted.

.idea/modules/htsjdk.iml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.idea/sbt.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.idea/scala_compiler.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/scopes/scope_settings.xml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.

.project

Lines changed: 0 additions & 17 deletions
This file was deleted.

.travis.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
language: java
2+
dist: trusty
23
sudo: true
4+
before_cache:
5+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
6+
cache:
7+
directories:
8+
- $HOME/.gradle/caches/
9+
- $HOME/.gradle/wrapper/
10+
- $HOME/.m2
311
jdk:
412
- oraclejdk8
5-
install: ant
6-
script: ant all test sra-test
13+
script: ./gradlew test testSRA testIntelDeflater
714
after_success:
815
- echo "TRAVIS_BRANCH='$TRAVIS_BRANCH'";
916
echo "JAVA_HOME='$JAVA_HOME'";
10-
if [ "$TRAVIS_BRANCH" == "master" ] && [ "$JAVA_HOME" == "/usr/lib/jvm/java-8-oracle" ]; then
11-
sbt \
12-
'set buildSnapshot := true' \
13-
'set javacOptions in (Compile, doc) ++= Seq("-quiet")' \
14-
'set test in publish := {}' \
15-
'set resolvers += Resolver.url("bintray-sbt-plugin-releases", url("http://dl.bintray.com/content/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)' \
16-
'set publishTo := Option("artifactory-snapshots-publish" at "https://artifactory.broadinstitute.org/artifactory/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)' \
17-
"set credentials += Credentials(\"Artifactory Realm\", \"artifactory.broadinstitute.org\", \"${ARTIFACTORY_USERNAME}\", \"${ARTIFACTORY_PASSWORD}\")" \
18-
publish;
17+
if [ "$TRAVIS_BRANCH" == "master" ]; then
18+
./gradlew uploadArchives;
1919
fi

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,62 @@ Please see the [HTSJDK Documentation](http://samtools.github.io/htsjdk) for more
1515

1616
> **NOTE: _HTSJDK does not currently support the latest Variant Call Format Specification (VCFv4.3 and BCFv2.2)._**
1717
18+
#### Building HTSJDK
19+
20+
HTSJDK is now built using [gradle](http://gradle.org/).
21+
22+
A wrapper script (`gradlew`) is included which will download the appropriate version of gradle on the first invocation.
23+
24+
Example gradle usage from the htsjdk root directory:
25+
- compile and build a jar
26+
```
27+
./gradlew
28+
```
29+
or
30+
```
31+
./gradlew jar
32+
```
33+
The jar will be in build/libs/htsjdk-\<version\>.jar where version is based on the current git commit.
34+
35+
- run tests, a specific test class, or run a test and wait for the debugger to connect
36+
```
37+
./gradlew test
38+
39+
./gradlew test --tests htsjdk.variant.variantcontext.AlleleUnitTest
40+
./gradlew test --tests "*AlleleUnitTest"
41+
42+
./gradlew test --tests "*AlleleUnitTest" --debug-jvm
43+
```
44+
45+
- clean the project directory
46+
```
47+
./gradlew clean
48+
```
49+
50+
- build a monolithic jar that includes all of htsjdk's dependencies
51+
```
52+
./gradlew shadowJar
53+
```
54+
55+
- create a snapshot and install it into your local maven repository
56+
```
57+
./gradlew install
58+
```
59+
60+
- for an exhaustive list of all available targets
61+
```
62+
./gradlew tasks
63+
```
64+
65+
#### Create an HTSJDK project in IntelliJ
66+
To create a project in IntelliJ IDE for htsjdk do the following:
67+
68+
1. Select fom the menu: `File -> New -> Project from Existing Sources`
69+
2. In the resulting dialog, chose `Import from existing model`, select `Gradle` and `Next`
70+
3. Choose the `default gradle wrapper` and `Finish`.
71+
72+
From time to time if dependencies change in htsjdk you may need to refresh the project from the `View -> Gradle` menu.
73+
1874
#### Licensing Information
1975

2076
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.

0 commit comments

Comments
 (0)