Conversation
magicDGS
left a comment
There was a problem hiding this comment.
We need to setup for the very first build system a multi-module project; otherwise, we will need to move files around to accomodate to the modules once we are close to the release - and this is bad for the git history.
In addition, I believe that stub files are better if they stay in the repository, so I propose some meaningful ones to add.
| @@ -0,0 +1,5 @@ | |||
| distributionBase=GRADLE_USER_HOME | |||
| distributionPath=wrapper/dists | |||
| distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip | |||
There was a problem hiding this comment.
We need a explicit wrapper version on the build script
There was a problem hiding this comment.
It's not technically necessary, but it's probably clearer to add it.
There was a problem hiding this comment.
I prefer so, because it is easier to read the requires only with the gradle build script.
There was a problem hiding this comment.
Version 4.10 is already here - does it break something that we need?
There was a problem hiding this comment.
Oh, no, I just didn't realize 4.10 was out. Will update.
| @@ -0,0 +1,12 @@ | |||
| plugins { | |||
There was a problem hiding this comment.
Add at the top the buildscript repositories. I would say to use jcenter() for the plugins...
There was a problem hiding this comment.
Lets add the optional stuff when we add our first non-included.
| @@ -0,0 +1,12 @@ | |||
| plugins { | |||
| id 'java-library' | |||
There was a problem hiding this comment.
likewise, we can add when we actually get some tests :)
build.gradle
Outdated
| sourceCompatibility = 1.8 | ||
|
|
||
| repositories { | ||
| mavenCentral() |
There was a problem hiding this comment.
Do we want also jcenter() here?
There was a problem hiding this comment.
Lets add it when we hit a dependency that requires it?
There was a problem hiding this comment.
I was thinking to include only jcenter as it contains all maven central, plus other libraries. Anyway, I am fine with maven central too.
|
|
||
| rootProject.name = 'htsjdk-next-beta' | ||
| enableFeaturePreview('IMPROVED_POM_SUPPORT') | ||
|
|
There was a problem hiding this comment.
We would like a multi-module project. See discusion in samtools/htsjdk#896 - this requires changes in this file and probably the build.gradle
There was a problem hiding this comment.
We should decide if sub-modules are called in the form htsjdk-* or simply the package name (e.g., htsjdk-core vs. core)
There was a problem hiding this comment.
That's a good idea to set it up as a multimodule project... I'm not actually certain the best way to do it though. Without some code to play with I don't think I'll get it right off the bat. Do you have a suggestion for how to stub that?
src/test/resources/README.md
Outdated
| @@ -0,0 +1 @@ | |||
| test resources go here | |||
There was a problem hiding this comment.
We can add a bunch of test files for core functionality (maybe in a large source directory tracked with git-lfs) in a different PR: a matched SAM/BAM/FASTA/VCF might be ideal. In that case, do we really need a stub file?
src/test/java/README.md
Outdated
| @@ -0,0 +1 @@ | |||
| test files go here | |||
There was a problem hiding this comment.
I would add a base test class instead as a stub here, where we can start adding common methods as they are needed. So the structure here will be adding a core/src/test/java/org/htsjdk/core as following:
/**
* Base test class for HTSJDK.
*
* <p>All tests should implement this base class.
*/
public class HtsjdkBaseTest {
}| @@ -0,0 +1,172 @@ | |||
| #!/usr/bin/env sh | |||
There was a problem hiding this comment.
I wish that the new framework is completely multi-platform, so I would like to have the gradlew.bat also tracked in the repository. Lately, we can setup an AppVeyor run for testing the build on Windows. This will be useful for check if we are correctly setting up paths (I don't want hardcoded path separators, but rather use filesystem methods to generate them).
There was a problem hiding this comment.
That's fine with me as long as you are willing to be the champion of the windows builds. I have essentially no interest in supporting windows but I have no objections.
There was a problem hiding this comment.
Using java.nio and its method for path construction/resolution should be enough to support windows, and I am willing to check the builds and test them in my computer. I would like to have a complete multi-platform support to allow development and usability of the library in different contexts (e.g., multi-platform GUIs like IGV or command line java tools).
But anyway, I can setup the builds with AppVeyor and the gradle wrapper once this is in.
| @@ -0,0 +1 @@ | |||
| test data goes here | |||
There was a problem hiding this comment.
Do we need a test data directory? I believe that this is better tracked in the ${module_name}/src/test/resources unless it is share by several modules.
A proper way of sharing the resources and test helpers is to create another module htsjdk-test; this also will allow to include test dependencies in the artifact (e.g., JUnit/TestNG dependencies, or HDFS/GCS to test in other filesystems).
There was a problem hiding this comment.
So I think the htsjdk/gatk project structure of having test/resources directory that includes all the test data files was probably a mistake. I believe the test resources is really meant to be for resources that should be packaged into the jar for access at test runtime. This includes things like log4j.xml files and configuration files for mocks, etc.
It takes a significant amount of time to package test data into the jar, and we don't actually want it there, since we want to be referring to it by file path. In gatk we have modifications to the test packaging commands that strips out all of the test data files when packaging the test jar, but leaves in the resource files. It's crufty and causes confusion, so I would rather just have them separated.
There was a problem hiding this comment.
I think that to some extend makes sense to package the data in the test resources to be able to distribute the packaged jar with all the content - also true that we should be more careful how we access the data in that case.
Another option is to set an integration-test separate for the unit test, for data-related testing (see, for example, https://www.petrikainulainen.net/programming/gradle/getting-started-with-gradle-integration-testing/)
There was a problem hiding this comment.
Let's open another issue to decide this...
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } |
There was a problem hiding this comment.
We can also add some basic dependencies already: concretely, I would propose to add SLF4J as a logging system (users can choose whatever logging they want, and how to set the log level) and maybe Apache commons-compress to support different compression for files out-of-the-box (we can also create a compressor in the library for bgzip and the gzip compressor from commons-compress might be a better solution to gzip due to the bugs in the java.util.zip implementation).
If this is too controversial, we can let the dependencies for another PR (I will open an issue for the logging system anyway for initiate discussion).
Adding core and sam modules. Adding a stub core/Record and sam/SamRecord to demonstrate that the multiproject dependencies are working correctly. Adding a stub test to show tests are working.
|
@magicDGS I've made it into a multiproject build with some stub classes. You're not going to like where The test framework classes are going to probably need to depend on the basic API classes, so unless we either want a circular dependency between modules, or to put the tests for the core module in a third of it, they need to be in the core module I'm not quite sure what to do about it. I have a pr in gatk that splits out a separate test artifact from the same module, maybe we could do that same thing here. |
I've already realized when I was exploring the multi-project configuration that it might be a bit complicated (compared to maven), but it does not look that bad. Nice job!
You are right, I don't like the idea of puluting the main sources of the
At the end, what is important about the modular design for downstream users is:
For the library itself, the multi-project is just a separation of concerns, and should be careful with maintenance issues:
Do you think that any of the previous solutions can fit in both the dowstream and maintainers needs? |
jacarey
left a comment
There was a problem hiding this comment.
Sorry for the late response. I'm fine with this, though it has been open long enough that gradle 4.10 is out. I think it makes sense to keep current.
|
@magicDGS Did you have further changes requested here? Are you ok pushing the decision of what to do with test files off for a future pr? I would like to get this merged soon if possible since it's hard to do much without a build system. |
magicDGS
left a comment
There was a problem hiding this comment.
Ok, no problem to move forward and decide later about test classes. Just some minor comments, and once they are solve any of you can press the merge button.
Once it is in, I will update my PRs and branches to discuss also about code. Thanks @lbergelson!
| @@ -0,0 +1,10 @@ | |||
| language: java | |||
| jdk: | |||
| - openjdk8 | |||
There was a problem hiding this comment.
We should open an issue for deciding if we are going to support/test other versions of java (unrelated with the acceptance of this build, but just came in this pass)
| apply plugin: 'java-library' | ||
|
|
||
| group 'org.htsjdk' | ||
| version '0.0.1' |
There was a problem hiding this comment.
Versioning with gradle will be also nice (for another issue). I am interested in this one at the moment, which looks nice also to release to github: https://github.com/ajoberstar/reckon
|
|
||
| group 'org.htsjdk' | ||
| version '0.0.1' | ||
| sourceCompatibility = 1.8 |
There was a problem hiding this comment.
Should we also add explicitly targetCompatibility (https://docs.gradle.org/current/userguide/java_plugin.html#other_convention_properties), to be able to change them independently (related with my first comment in this review)?
build.gradle
Outdated
|
|
||
| } | ||
|
|
||
| project(':sam') { |
There was a problem hiding this comment.
I prefer to have here cram, as we know almost for sure that it will be a different module (I thought that we were thinking to put sam into core, no?)
| @@ -0,0 +1,7 @@ | |||
| package org.htsjdk.core.test; | |||
There was a problem hiding this comment.
I agree to decide later how to package test-helpers, but better if at least the classes live in org.htsjdk.test instead of inside core (easier to split later and separate from the concept of core)
| @@ -0,0 +1 @@ | |||
| test data goes here | |||
There was a problem hiding this comment.
Let's open another issue to decide this...
| @@ -0,0 +1,5 @@ | |||
| distributionBase=GRADLE_USER_HOME | |||
| distributionPath=wrapper/dists | |||
| distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip | |||
There was a problem hiding this comment.
Version 4.10 is already here - does it break something that we need?
| @@ -0,0 +1,84 @@ | |||
| @if "%DEBUG%" == "" @echo off | |||
|
|
||
| import org.htsjdk.core.api.Record; | ||
|
|
||
| public class SamRecord implements Record { |
There was a problem hiding this comment.
Change to RecordImpl, as this placeholder will be removed instead of implement (the same as the Record interface).
There was a problem hiding this comment.
I changed it to CramStubRecord which I think gets the point across that's not intended to be a final thing.
There was a problem hiding this comment.
I think that you forgot to add/commit that change!
settings.gradle
Outdated
| rootProject.name = 'htsjdk-next-beta' | ||
| enableFeaturePreview('IMPROVED_POM_SUPPORT') | ||
|
|
||
| include ("core", "sam") |
There was a problem hiding this comment.
Here should be change too: sam -> cram
|
@jacarey Sorry, I missed your comment before some how. Thanks for taking a look. |
|
Ok, merging this one! |
|
🎉 (but you forgot the |
|
@magicDGS Ack! You're right. I don't know how I missed that... Sorry! |
Since I'm a proponent of using gradle over mill, here's a pr creating a stub project structure and a simple gradle build.