Skip to content

Commit

Permalink
Moving sopt to its own project
Browse files Browse the repository at this point in the history
  • Loading branch information
nh13 committed May 8, 2017
1 parent f854ddb commit 75d55ff
Show file tree
Hide file tree
Showing 50 changed files with 461 additions and 96 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
target
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
sudo: false
language: scala
scala:
- 2.11.7
jdk:
- oraclejdk8
script:
- sbt +clean coverage +test && sbt coverageReport coverageAggregate
- find $HOME/.sbt -name "*.lock" | xargs rm
- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm
cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt/boot/
before_install:
- pip install --user codecov
after_success:
- codecov
- test "$TRAVIS_REPO_SLUG" == 'fulcrumgenomics/sopt' && test "$TRAVIS_PULL_REQUEST" == 'false' && test "$TRAVIS_BRANCH" == 'master' && sbt publish
env:
global:
- secure: AjbCqJPaYLWVYTNS7Czdu+SVX0Vs1bDuVg+YjNasFs8peu97hQxx9TNqxZcvrs8SwGD6gXlJComMJPVeLUjYf/EqmJMICtS/UTTBONlfEZgF+KSO1FeXxyvsFskuCn9GxK8JSGE49YKCWnSuAQ6JBgjSidUVgumjiyFg7Dgac5rUNJZ4SR7nQbufF5NsegLZNEsiDJxK20roksZnbdpI7PQE/pthoTzowLuElMEFpF5DZ9LfY/HeSm3+s0edYOVBgivc2tjqROSsgOEmz3uQ0tLpvaAMpt0aSXuultql3GL1aiJKFjo21vbEA95jlfdq/BXZvh6q25TaciGT0LZOBcbQSiwsIsWQfulw7QEQ1C0mv1UuYBHvF4jeMVTRL3Aj7El1fNeHA8nkNTr+GZEcRpkBQOHuD9kDX7Ks6iU8+arsSr7YnR6eENJd/UB8XogZvKydFbUJ90Cmn5W4S1BHQXsv2BkJ/BubdH3groEfKbUsrGRjf7oBt/l0O8X5SO5+fAF3KCsHDSAIIM16b14RXKCrASkIGc4S0wQryRksMZADl6GUZCnIyWLUfNQC5SXS30K4f8ny7LG9yYzfph++S+s3YUC0qS+ZFLG6fHcw+kjOi7nwrR+oyJp2Q2f5z3Vq1A81h1NgOMR3lQn002oes+TYTymY+/SXcldV+9p5MHE=
- secure: YgmhR2puvVq8w5UAmo3UPjm1CKTKGq7cc3TneKASiZW/eHj/GAJ1BHDjSNNUS1eaNQr16H+2ws1u6tD2rOGRuISnQtRagncVrcviXaRBI8PDLrTC6N0pcUFMvziUuJAwmPgfeZDfZQpev9Ssod6z6rPRR8bFC69KV7Df90M1SjWP/c5dU62TBIw5EOyP3q8ui3W4tMEeFuYCH9CPKErqopfiDHRkJhE4DHuMKVA+xLT/TzEzsyJMJqXHVfow/N3tGRraL5G6JBUiwerPj0/Tm1ovd/4xT9Jqr4ujoG0cWydNEkK9pcMpBNFnV30krTgMtw8ibwZJPkFWk40De4fDj4UU7HQEdyfEj2zcfoWRvI+RvzTw6xVsWXSurTKJwSc+6e/7xjn4zgFngr6WYt26PFH/sKgG3FjtiEAiNOOgyAlN8N7MZhYVWpgzzNAyzaCrfqlpLOzxcEqI+vum2SAZCdNWME+t/Hd16GXRpR4pHmuvHqVR5cK9XmpSE9eB6svB3sQiJC46KfmlfBkwXIu57syyKrFSlLf/QeuviUza0kRHQ+1HbjCHna600HP78arZuYrZgpDI2nQlEn9LasHkhiaKTtb2/an3cFLD1ld5NLuY/3AymWP1zvvo7iOGcrrhRUwxS81dYPCqW+x1rvcQszyioR4WrsLbLy3vGaU3NWI=
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2015-2016 Fulcrum Genomics LLC

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.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[![Build Status](https://travis-ci.org/fulcrumgenomics/sopt.svg?branch=master)](https://travis-ci.org/fulcrumgenomics/sopt)
[![Coverage Status](https://codecov.io/github/fulcrumgenomics/sopt/coverage.svg?branch=master)](https://codecov.io/github/fulcrumgenomics/sopt?branch=master)
[![Code Review](https://api.codacy.com/project/badge/grade/52e1d786d9784c7192fae2f8e853fa34)](https://www.codacy.com/app/contact_32/sopt)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fulcrumgenomics/sopt_2.11/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.fulcrumgenomics/sopt_2.11)
[![Dependency Status](https://www.versioneye.com/user/projects/56b2d2d593b95a003c714340/badge.svg)](https://www.versioneye.com/user/projects/56b2d2d593b95a003c714340#dialog_dependency_badge)
[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/fulcrumgenomics/sopt/blob/master/LICENSE)
[![Language](http://img.shields.io/badge/language-scala-brightgreen.svg)](http://www.scala-lang.org/)

Scala Option Parsing
====

Coming soon, documentation!
161 changes: 160 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,160 @@
assemblyJarName in assembly := "dagr-sopt-" + version.value + ".jar"
import com.typesafe.sbt.SbtGit.GitCommand
import sbt.Keys._
import sbt._
import sbtassembly.AssemblyKeys.assembly
import sbtassembly.MergeStrategy
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
import scoverage.ScoverageKeys._

////////////////////////////////////////////////////////////////////////////////////////////////
// We have the following "settings" in this build.sbt:
// - versioning with sbt-release
// - custom JAR name for the root project
// - settings to publish to Sonatype
// - exclude the root, tasks, and pipelines project from code coverage
// - scaladoc settings
// - custom merge strategy for assembly
////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////
// Use sbt-release to bump the version numbers.
//
// see: http://blog.byjean.eu/2015/07/10/painless-release-with-sbt.html
////////////////////////////////////////////////////////////////////////////////////////////////

// Release settings
releaseVersionBump := sbtrelease.Version.Bump.Next
releasePublishArtifactsAction := PgpKeys.publishSigned.value
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
ReleaseStep(action = Command.process("publishSigned", _)),
setNextVersion,
commitNextVersion,
ReleaseStep(action = Command.process("sonatypeReleaseAll", _)),
pushChanges
)

////////////////////////////////////////////////////////////////////////////////////////////////
// For the aggregate (root) jar, override the name. For the sub-projects,
// see the build.sbt in each project folder.
////////////////////////////////////////////////////////////////////////////////////////////////
assemblyJarName in assembly := "sopt-" + version.value + ".jar"

////////////////////////////////////////////////////////////////////////////////////////////////
// Sonatype settings
////////////////////////////////////////////////////////////////////////////////////////////////
publishMavenStyle := true
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
publishArtifact in Test := false
pomIncludeRepository := { _ => false }
// For Travis CI - see http://www.cakesolutions.net/teamblogs/publishing-artefacts-to-oss-sonatype-nexus-using-sbt-and-travis-ci
credentials ++= (for {
username <- Option(System.getenv().get("SONATYPE_USER"))
password <- Option(System.getenv().get("SONATYPE_PASS"))
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq

////////////////////////////////////////////////////////////////////////////////////////////////
// Coverage settings: include all sources
////////////////////////////////////////////////////////////////////////////////////////////////
val htmlReportsDirectory: String = "target/test-reports"

////////////////////////////////////////////////////////////////////////////////////////////////
// scaladoc options
////////////////////////////////////////////////////////////////////////////////////////////////
val docScalacOptions = Seq("-groups", "-implicits")

////////////////////////////////////////////////////////////////////////////////////////////////
// Common settings for all projects
////////////////////////////////////////////////////////////////////////////////////////////////

lazy val commonSettings = Seq(
organization := "com.fulcrumgenomics",
organizationName := "Fulcrum Genomics LLC",
organizationHomepage := Some(url("http://www.fulcrumgenomics.com")),
homepage := Some(url("http://github.com/fulcrumgenomics/sopt")),
startYear := Some(2015),
scalaVersion := "2.11.8",
crossScalaVersions := Seq("2.11.8", "2.12.1"),
scalacOptions += "-target:jvm-1.8",
scalacOptions in (Compile, doc) ++= docScalacOptions,
scalacOptions in (Test, doc) ++= docScalacOptions,
autoAPIMappings := true,
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-h", Option(System.getenv("TEST_HTML_REPORTS")).getOrElse(htmlReportsDirectory)),
testOptions in Test += Tests.Argument("-l", "LongRunningTest"), // ignores long running tests
// uncomment for full stack traces
//testOptions in Test += Tests.Argument("-oD"),
fork in Test := true,
resolvers += Resolver.jcenterRepo,
shellPrompt := { state => "%s| %s> ".format(GitCommand.prompt.apply(state), version.value) },
updateOptions := updateOptions.value.withCachedResolution(true)
) ++ Defaults.coreDefaultSettings

////////////////////////////////////////////////////////////////////////////////////////////////
// sopt project
////////////////////////////////////////////////////////////////////////////////////////////////
lazy val assemblySettings = Seq(
test in assembly := {},
logLevel in assembly := Level.Info
)
lazy val root = Project(id="sopt", base=file("."))
.settings(commonSettings: _*)
.settings(unidocSettings: _*)
.settings(assemblySettings: _*)
.settings(description := "Scala sopt for Fulcrum Genomics.")
.settings(
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"com.fulcrumgenomics" %% "commons" % "0.2.0-SNAPSHOT",

//---------- Test libraries -------------------//
"org.scalatest" %% "scalatest" % "3.0.1" % "test->*" excludeAll ExclusionRule(organization="org.junit", name="junit")
)
)

////////////////////////////////////////////////////////////////////////////////////////////////
// Merge strategy for assembly
////////////////////////////////////////////////////////////////////////////////////////////////
val customMergeStrategy: String => MergeStrategy = {
case x if Assembly.isConfigFile(x) =>
MergeStrategy.concat
case PathList(ps@_*) if Assembly.isReadme(ps.last) || Assembly.isLicenseFile(ps.last) =>
MergeStrategy.rename
case PathList("META-INF", xs@_*) =>
xs map {
_.toLowerCase
} match {
case ("manifest.mf" :: Nil) | ("index.list" :: Nil) | ("dependencies" :: Nil) =>
MergeStrategy.discard
case ps@(x :: xt) if ps.last.endsWith(".sf") || ps.last.endsWith(".dsa") =>
MergeStrategy.discard
case "plexus" :: xt =>
MergeStrategy.discard
case "spring.tooling" :: xt =>
MergeStrategy.discard
case "com.google.guava" :: xt =>
MergeStrategy.discard
case "services" :: xt =>
MergeStrategy.filterDistinctLines
case ("spring.schemas" :: Nil) | ("spring.handlers" :: Nil) =>
MergeStrategy.filterDistinctLines
case _ => MergeStrategy.deduplicate
}
case "asm-license.txt" | "overview.html" =>
MergeStrategy.discard
case "logback.xml" =>
MergeStrategy.first
case _ => MergeStrategy.deduplicate
}
assemblyMergeStrategy in assembly := customMergeStrategy
8 changes: 8 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
coverage:
status:
patch:
default:
target: '80'
project:
default:
target: auto
1 change: 1 addition & 0 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=0.13.9
9 changes: 9 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resolvers += Resolver.url("fix-sbt-plugin-releases", url("http://dl.bintray.com/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)

addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.8.5")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.3")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.1")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.3.3")
26 changes: 26 additions & 0 deletions sonatype.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
sonatypeProfileName := "com.fulcrumgenomics"

pomExtra in Global := {
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.html</url>
</license>
</licenses>
<scm>
<url>git@github.com:fulcrumgenomics/sopt</url>
<connection>scm:git:git@github.com:fulcrumgenomics/sopt.git</connection>
</scm>
<developers>
<developer>
<id>nh13</id>
<name>Nils Homer</name>
<url>http://github.com/nh13</url>
</developer>
<developer>
<id>tfenne</id>
<name>Tim Fennell</name>
<url>http://github.com/tfenne</url>
</developer>
</developers>
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package dagr.sopt.cmdline;
package com.fulcrumgenomics.sopt.cmdline;

import java.lang.annotation.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package dagr.sopt.cmdline;
package com.fulcrumgenomics.sopt.cmdline;

import com.fulcrumgenomics.sopt.cmdline.ClpGroup;
import com.fulcrumgenomics.sopt.cmdline.Clps;

import java.lang.annotation.*;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
* THE SOFTWARE.
*/

package dagr.sopt.cmdline
package com.fulcrumgenomics.sopt.cmdline

import java.util

import dagr.commons.reflect.ReflectionUtil
import dagr.sopt.util._
import dagr.commons.util.StringUtil
import com.fulcrumgenomics.commons.reflect.ReflectionUtil
import com.fulcrumgenomics.commons.util.StringUtil
import com.fulcrumgenomics.sopt.util.{KCYN, KGRN}
import com.fulcrumgenomics.sopt.util._

import scala.util.{Failure, Success}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* THE SOFTWARE.
*/

package dagr.sopt.cmdline
package com.fulcrumgenomics.sopt.cmdline

/**
* Trait for groups of CommandLinePrograms.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
* THE SOFTWARE.
*/

package dagr.sopt.cmdline
package com.fulcrumgenomics.sopt.cmdline

import dagr.commons.reflect.{ReflectionUtil, Argument, ArgumentLookup, ReflectiveBuilder}
import dagr.commons.util.StringUtil
import dagr.sopt.{arg, clp}
import com.fulcrumgenomics.commons.reflect.{Argument, ArgumentLookup, ReflectionUtil, ReflectiveBuilder}
import com.fulcrumgenomics.commons.util.StringUtil
import dagr.sopt.arg

import scala.collection.mutable
import scala.collection.mutable.ListBuffer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* THE SOFTWARE.
*/

package dagr.sopt.cmdline
package com.fulcrumgenomics.sopt.cmdline

object CommandLineException {
/** Prepends the exception name to the message. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
* THE SOFTWARE.
*/

package dagr.sopt.cmdline
package com.fulcrumgenomics.sopt.cmdline

import dagr.commons.reflect.ReflectionUtil
import dagr.commons.util.StringUtil
import com.fulcrumgenomics.commons.reflect.ReflectionUtil
import com.fulcrumgenomics.sopt.util._
import dagr.sopt.clp
import dagr.sopt.util.ParsingUtil._
import dagr.sopt.util._
import com.fulcrumgenomics.sopt.util.ParsingUtil._
import com.fulcrumgenomics.sopt.util._

import scala.collection.JavaConversions._
import scala.collection.mutable.ListBuffer
Expand Down
Loading

0 comments on commit 75d55ff

Please sign in to comment.