mirror of
https://github.com/fluencelabs/codec
synced 2025-04-24 14:22:14 +00:00
sbt build config
This commit is contained in:
parent
aba255ef2e
commit
793eb4c687
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.idea
|
||||
target
|
||||
log
|
64
.scalafmt.conf
Normal file
64
.scalafmt.conf
Normal file
@ -0,0 +1,64 @@
|
||||
docstrings = JavaDoc
|
||||
|
||||
maxColumn = 120
|
||||
|
||||
rewriteTokens {
|
||||
"=>": "⇒"
|
||||
"<-": "←"
|
||||
}
|
||||
|
||||
align = none
|
||||
align {
|
||||
openParenCallSite = false
|
||||
openParenDefnSite = false
|
||||
tokens = [
|
||||
"%", "%%", "%%%", ":=", "~="
|
||||
]
|
||||
}
|
||||
|
||||
assumeStandardLibraryStripMargin = true
|
||||
includeCurlyBraceInSelectChains = false
|
||||
|
||||
continuationIndent {
|
||||
callSite = 2
|
||||
defnSite = 2
|
||||
extendSite = 4
|
||||
}
|
||||
|
||||
danglingParentheses = true
|
||||
|
||||
newlines {
|
||||
alwaysBeforeTopLevelStatements = true
|
||||
sometimesBeforeColonInMethodReturnType = true
|
||||
penalizeSingleSelectMultiArgList = false
|
||||
alwaysBeforeElseAfterCurlyIf = false
|
||||
neverInResultType = false
|
||||
}
|
||||
|
||||
spaces {
|
||||
afterKeywordBeforeParen = true
|
||||
}
|
||||
|
||||
binPack {
|
||||
parentConstructors = true
|
||||
literalArgumentLists = true
|
||||
}
|
||||
|
||||
optIn {
|
||||
breaksInsideChains = false
|
||||
breakChainOnFirstMethodDot = true
|
||||
configStyleArguments = true
|
||||
}
|
||||
|
||||
runner {
|
||||
optimizer {
|
||||
forceConfigStyleOnOffset = 150
|
||||
forceConfigStyleMinArgCount = 2
|
||||
}
|
||||
}
|
||||
|
||||
rewrite {
|
||||
rules = [
|
||||
SortImports
|
||||
]
|
||||
}
|
145
build.sbt
Normal file
145
build.sbt
Normal file
@ -0,0 +1,145 @@
|
||||
import de.heikoseeberger.sbtheader.License
|
||||
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
|
||||
import sbtcrossproject.crossProject
|
||||
|
||||
name := "codec"
|
||||
|
||||
scalacOptions in Compile ++= Seq("-Ypartial-unification", "-Xdisable-assertions")
|
||||
|
||||
javaOptions in Test ++= Seq("-ea")
|
||||
|
||||
val scalaV = scalaVersion := "2.12.5"
|
||||
|
||||
val commons = Seq(
|
||||
scalaV,
|
||||
version := "0.1",
|
||||
fork in Test := true,
|
||||
parallelExecution in Test := false,
|
||||
organizationName := "Fluence Labs Limited",
|
||||
organizationHomepage := Some(new URL("https://fluence.ai")),
|
||||
startYear := Some(2017),
|
||||
licenses += ("AGPL-3.0", new URL("http://www.gnu.org/licenses/agpl-3.0.en.html")),
|
||||
headerLicense := Some(License.AGPLv3("2017", organizationName.value))
|
||||
)
|
||||
|
||||
commons
|
||||
|
||||
val kindProjector = addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.6")
|
||||
|
||||
val Cats1V = "1.1.0"
|
||||
val ScodecBitsV = "1.1.5"
|
||||
val CirceV = "0.9.3"
|
||||
val ShapelessV = "2.3.+"
|
||||
|
||||
val chill = "com.twitter" %% "chill" % "0.9.2"
|
||||
|
||||
val ScalatestV = "3.0.+"
|
||||
val ScalacheckV = "1.13.4"
|
||||
|
||||
val protobuf = Seq(
|
||||
PB.targets in Compile := Seq(
|
||||
scalapb.gen() -> (sourceManaged in Compile).value
|
||||
),
|
||||
libraryDependencies ++= Seq(
|
||||
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
|
||||
)
|
||||
)
|
||||
|
||||
enablePlugins(AutomateHeaderPlugin)
|
||||
|
||||
lazy val `codec-core` = crossProject(JVMPlatform, JSPlatform)
|
||||
.withoutSuffixFor(JVMPlatform)
|
||||
.crossType(FluenceCrossType)
|
||||
.in(file("core"))
|
||||
.settings(
|
||||
commons,
|
||||
kindProjector,
|
||||
libraryDependencies ++= Seq(
|
||||
"org.typelevel" %%% "cats-core" % Cats1V,
|
||||
"org.typelevel" %%% "cats-laws" % Cats1V % Test,
|
||||
"org.typelevel" %%% "cats-testkit" % Cats1V % Test,
|
||||
"com.github.alexarchambault" %%% "scalacheck-shapeless_1.13" % "1.1.8" % Test,
|
||||
"org.scalacheck" %%% "scalacheck" % ScalacheckV % Test,
|
||||
"org.scalatest" %%% "scalatest" % ScalatestV % Test
|
||||
)
|
||||
)
|
||||
.jsSettings(
|
||||
fork in Test := false
|
||||
)
|
||||
.enablePlugins(AutomateHeaderPlugin)
|
||||
|
||||
lazy val `codec-core-jvm` = `codec-core`.jvm
|
||||
lazy val `codec-core-js` = `codec-core`.js
|
||||
|
||||
lazy val `codec-bits` = crossProject(JVMPlatform, JSPlatform)
|
||||
.withoutSuffixFor(JVMPlatform)
|
||||
.crossType(FluenceCrossType)
|
||||
.in(file("bits"))
|
||||
.settings(
|
||||
commons,
|
||||
libraryDependencies ++= Seq(
|
||||
"org.scodec" %%% "scodec-bits" % ScodecBitsV,
|
||||
"org.scalacheck" %%% "scalacheck" % ScalacheckV % Test,
|
||||
"org.scalatest" %%% "scalatest" % ScalatestV % Test
|
||||
)
|
||||
)
|
||||
.jsSettings(
|
||||
fork in Test := false
|
||||
)
|
||||
.enablePlugins(AutomateHeaderPlugin)
|
||||
.dependsOn(`codec-core`)
|
||||
|
||||
lazy val `codec-bits-js` = `codec-bits`.js
|
||||
lazy val `codec-bits-jvm` = `codec-bits`.jvm
|
||||
|
||||
lazy val `codec-circe` = crossProject(JVMPlatform, JSPlatform)
|
||||
.withoutSuffixFor(JVMPlatform)
|
||||
.crossType(FluenceCrossType)
|
||||
.in(file("circe"))
|
||||
.settings(
|
||||
commons,
|
||||
libraryDependencies ++= Seq(
|
||||
"io.circe" %%% "circe-core" % CirceV,
|
||||
"io.circe" %%% "circe-parser" % CirceV,
|
||||
"org.scalatest" %%% "scalatest" % ScalatestV % Test
|
||||
)
|
||||
)
|
||||
.jsSettings(
|
||||
fork in Test := false
|
||||
)
|
||||
.enablePlugins(AutomateHeaderPlugin)
|
||||
.dependsOn(`codec-core`)
|
||||
|
||||
lazy val `codec-circe-js` = `codec-circe`.js
|
||||
lazy val `codec-circe-jvm` = `codec-circe`.jvm
|
||||
|
||||
lazy val `codec-kryo` = project
|
||||
.in(file("kryo"))
|
||||
.settings(
|
||||
commons,
|
||||
libraryDependencies ++= Seq(
|
||||
chill,
|
||||
"com.chuusai" %% "shapeless" % ShapelessV,
|
||||
"org.scalatest" %% "scalatest" % ScalatestV % Test
|
||||
)
|
||||
)
|
||||
.dependsOn(`codec-core-jvm`)
|
||||
|
||||
lazy val `codec-protobuf` = crossProject(JVMPlatform, JSPlatform)
|
||||
.withoutSuffixFor(JVMPlatform)
|
||||
.crossType(FluenceCrossType)
|
||||
.in(file("codec/protobuf"))
|
||||
.settings(
|
||||
commons,
|
||||
protobuf
|
||||
)
|
||||
.jsSettings(
|
||||
fork in Test := false,
|
||||
scalaJSModuleKind := ModuleKind.CommonJSModule
|
||||
)
|
||||
.enablePlugins(AutomateHeaderPlugin)
|
||||
.dependsOn(`codec-core`)
|
||||
|
||||
lazy val `codec-protobuf-jvm` = `codec-protobuf`.jvm
|
||||
lazy val `codec-protobuf-js` = `codec-protobuf`.js
|
||||
|
@ -1,11 +0,0 @@
|
||||
import SbtCommons._
|
||||
|
||||
enablePlugins(AutomateHeaderPlugin)
|
||||
|
||||
commons
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
chill,
|
||||
shapeless,
|
||||
scalatest
|
||||
)
|
29
project/FluenceCrossType.scala
Normal file
29
project/FluenceCrossType.scala
Normal file
@ -0,0 +1,29 @@
|
||||
import sbt._
|
||||
import sbtcrossproject.CrossPlugin.autoImport._
|
||||
|
||||
import scalajscrossproject.ScalaJSCrossPlugin.autoImport._
|
||||
|
||||
/**
|
||||
* cross types https://github.com/portable-scala/sbt-crossproject
|
||||
* http://xuwei-k.github.io/slides/scala-js-matsuri/#21
|
||||
* avoid move files
|
||||
*/
|
||||
object FluenceCrossType extends sbtcrossproject.CrossType {
|
||||
override def projectDir(crossBase: File, projectType: String) =
|
||||
crossBase / projectType
|
||||
|
||||
override def projectDir(crossBase: File, projectType: sbtcrossproject.Platform) = {
|
||||
val dir = projectType match {
|
||||
case JVMPlatform ⇒ "jvm"
|
||||
case JSPlatform ⇒ "js"
|
||||
}
|
||||
crossBase / dir
|
||||
}
|
||||
|
||||
def shared(projectBase: File, conf: String) =
|
||||
projectBase.getParentFile / "src" / conf / "scala"
|
||||
|
||||
override def sharedSrcDir(projectBase: File, conf: String) =
|
||||
Some(shared(projectBase, conf))
|
||||
}
|
||||
|
1
project/build.properties
Normal file
1
project/build.properties
Normal file
@ -0,0 +1 @@
|
||||
sbt.version = 1.1.2
|
20
project/plugins.sbt
Normal file
20
project/plugins.sbt
Normal file
@ -0,0 +1,20 @@
|
||||
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.4.0")
|
||||
|
||||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.2")
|
||||
|
||||
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "4.1.0")
|
||||
|
||||
addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.18")
|
||||
|
||||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22")
|
||||
addSbtPlugin("org.portable-scala" % "sbt-crossproject" % "0.3.1")
|
||||
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.3.1")
|
||||
|
||||
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.10.0")
|
||||
|
||||
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.0")
|
||||
|
||||
addSbtPlugin("com.lihaoyi" % "workbench" % "0.4.0")
|
||||
|
||||
libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.7.1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user