-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #53
- Loading branch information
Showing
17 changed files
with
146 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
import dependencies._ | ||
// shadow sbt-scalajs' crossProject and CrossType from Scala.js 0.6.x | ||
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} | ||
|
||
val stableVersion = "0.2.1" | ||
|
||
val catsVersion = "1.4.0" | ||
val scalacheckVersion = "1.13.5" | ||
val drosteVersion = "0.6.0" | ||
val fastParseVersion = "2.1.0" | ||
|
||
val catsOrg = "org.typelevel" | ||
|
||
val scalacheckOrg = "org.scalacheck" | ||
|
||
val drosteOrg = "io.higherkindness" | ||
|
||
val isTravisBuild = | ||
settingKey[Boolean]("Flag indicating whether the current build is running under Travis") | ||
|
||
inThisBuild( | ||
List( | ||
organization := "net.ceedubs", | ||
|
@@ -14,46 +29,61 @@ inThisBuild( | |
"[email protected]", | ||
url("https://github.com/ceedubs") | ||
) | ||
) | ||
), | ||
isTravisBuild := sys.env.get("TRAVIS").isDefined | ||
)) | ||
|
||
coverageExcludedPackages in ThisBuild := "ceedubs.irrec.bench" | ||
|
||
lazy val kleene = (project in file("kleene")) | ||
lazy val kleene = crossProject(JSPlatform, JVMPlatform) | ||
.crossType(CrossType.Pure) | ||
.in(file("kleene")) | ||
.settings( | ||
moduleName := "irrec-kleene", | ||
libraryDependencies ++= Seq(cats.core, cats.testkit % Test)) | ||
libraryDependencies += catsOrg %%% "cats-core" % catsVersion) | ||
.settings(commonSettings) | ||
|
||
lazy val regex = (project in file("regex")) | ||
.settings(moduleName := "irrec-regex", libraryDependencies ++= Seq(droste, cats.testkit % Test)) | ||
lazy val regex = crossProject(JSPlatform, JVMPlatform) | ||
.crossType(CrossType.Pure) | ||
.in(file("regex")) | ||
.dependsOn(kleene) | ||
.settings( | ||
moduleName := "irrec-regex", | ||
libraryDependencies += drosteOrg %%% "droste-core" % drosteVersion) | ||
.settings(commonSettings) | ||
// see https://github.com/sbt/sbt/issues/2698#issuecomment-311417188 | ||
|
||
lazy val tests = crossProject(JSPlatform, JVMPlatform) | ||
.crossType(CrossType.Pure) | ||
.in(file("tests")) | ||
.dependsOn(regexGen, parser) | ||
.settings( | ||
unmanagedClasspath in Test ++= | ||
(fullClasspath in (regexGenRef, Compile)).value ++ | ||
(fullClasspath in (parserRef, Compile)).value) | ||
.dependsOn(kleene % "test->test;compile->compile") | ||
moduleName := "irrec-tests", | ||
libraryDependencies += catsOrg %%% "cats-testkit" % catsVersion % Test) | ||
.settings(commonSettings) | ||
.settings(noPublishSettings) | ||
|
||
lazy val regexGen = (project in file("regex-gen")) | ||
lazy val regexGen = crossProject(JSPlatform, JVMPlatform) | ||
.crossType(CrossType.Pure) | ||
.dependsOn(kleene, regex) | ||
.in(file("regex-gen")) | ||
.settings( | ||
moduleName := "irrec-regex-gen", | ||
libraryDependencies ++= Seq(scalacheck, cats.testkit % Test)) | ||
libraryDependencies += scalacheckOrg %%% "scalacheck" % scalacheckVersion) | ||
.settings(commonSettings) | ||
.dependsOn(regex % "test->test;compile->compile") | ||
|
||
lazy val regexGenRef = LocalProject("regexGen") | ||
|
||
lazy val parser = (project in file("parser")) | ||
.settings(moduleName := "irrec-parser", libraryDependencies += fastparse) | ||
lazy val parser = crossProject(JSPlatform, JVMPlatform) | ||
.crossType(CrossType.Pure) | ||
.in(file("parser")) | ||
.settings( | ||
moduleName := "irrec-parser", | ||
libraryDependencies += "com.lihaoyi" %%% "fastparse" % fastParseVersion) | ||
.settings(commonSettings) | ||
.dependsOn(regex % "test->test;compile->compile", regexGen % Test) | ||
|
||
lazy val parserRef = LocalProject("parser") | ||
.dependsOn(kleene, regex) | ||
|
||
lazy val docs = (project in file("irrec-docs")) | ||
lazy val docs = project | ||
.in(file("irrec-docs")) | ||
.enablePlugins(MdocPlugin) | ||
.dependsOn(regex, regexGen, parser) | ||
.dependsOn(regex.jvm, regexGen.jvm, parser.jvm) | ||
.settings( | ||
mdocOut := (baseDirectory in LocalRootProject).value, | ||
mdocVariables := Map( | ||
|
@@ -63,18 +93,35 @@ lazy val docs = (project in file("irrec-docs")) | |
) | ||
.settings(noPublishSettings) | ||
|
||
lazy val benchmarks = (project in file("benchmarks")) | ||
lazy val benchmarks = project | ||
.in(file("benchmarks")) | ||
.settings(moduleName := "irrec-benchmarks") | ||
.enablePlugins(JmhPlugin) | ||
.settings(commonSettings) | ||
.settings(noPublishSettings) | ||
.dependsOn(regex) | ||
.dependsOn(regex.jvm) | ||
|
||
lazy val jvm = project | ||
.settings( | ||
moduleName := "irrec-root-jvm" | ||
) | ||
.aggregate(kleene.jvm, regex.jvm, regexGen.jvm, parser.jvm, tests.jvm, benchmarks) | ||
.settings(commonSettings) | ||
.settings(noPublishSettings) | ||
|
||
lazy val js = project | ||
.settings( | ||
moduleName := "irrec-root-js" | ||
) | ||
.aggregate(kleene.js, regex.js, regexGen.js, parser.js, tests.js) | ||
.settings(commonSettings) | ||
.settings(noPublishSettings) | ||
|
||
lazy val root = project | ||
.settings( | ||
moduleName := "irrec-root" | ||
) | ||
.aggregate(kleene, regex, regexGen, parser) | ||
.aggregate(jvm, js) | ||
.settings(commonSettings) | ||
.settings(noPublishSettings) | ||
|
||
|
@@ -160,6 +207,12 @@ val commonSettings: Seq[Setting[_]] = Seq( | |
crossScalaVersions := List("2.11.12", "2.12.8") | ||
) ++ scalacOptionSettings | ||
|
||
val commonJsSettings: Seq[Setting[_]] = Seq( | ||
parallelExecution := false, | ||
// batch mode decreases the amount of memory needed to compile Scala.js code | ||
scalaJSOptimizerOptions := scalaJSOptimizerOptions.value.withBatchMode(isTravisBuild.value) | ||
) | ||
|
||
val noPublishSettings = Seq( | ||
publish := {}, | ||
publishLocal := {}, | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#! /usr/bin/env nix-shell | ||
#! nix-shell ../shell.nix -i bash | ||
|
||
# adapted from https://github.com/higherkindness/droste/blob/bad7dae60a0c32e66918613068d6713d209cc6b4/scripts/ci-jobs.sh | ||
|
||
set -euxo pipefail | ||
|
||
case "$1" in | ||
"docs") | ||
sbt 'docs/mdoc' | ||
;; | ||
"lint") | ||
sbt 'lint' | ||
;; | ||
"testJVM") | ||
sbt '+jvm/test' | ||
;; | ||
"testJS") | ||
sbt '+js/test' | ||
;; | ||
"coverage") | ||
sbt ';coverage;jvm/test;coverageReport' | ||
bash <(curl -s https://codecov.io/bash) | ||
;; | ||
"release") | ||
sbt 'ci-release' | ||
;; | ||
*) | ||
echo "no command specified!" | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,6 @@ in | |
sbt | ||
git # used by sbt-dynver | ||
graphviz # used for ScalaDoc diagrams | ||
nodejs # used by scala.js | ||
]; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.