Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelbranco80 committed Sep 9, 2024
0 parents commit 4ebd5f1
Show file tree
Hide file tree
Showing 19 changed files with 1,842 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.class
.metals/
.git/
.vscode/
target/
7 changes: 7 additions & 0 deletions .sbtopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-J-Xmx4G
-J-Xms1G
-J-Xss4M
-J-XX:+UseG1GC
-J--add-opens=java.base/java.lang=ALL-UNNAMED
-J--add-opens=java.base/java.util=ALL-UNNAMED
-J-XX:+CrashOnOutOfMemoryError
136 changes: 136 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
version = 2.7.5
maxColumn = 120

optIn.forceBlankLineBeforeDocstring = true
trailingCommas = "never"

align {
openParenCallSite = false
openParenDefnSite = false
preset=some
stripMargin = false
tokens = []
}

assumeStandardLibraryStripMargin = true
binPack.parentConstructors = "never"

continuationIndent {
callSite = 2
ctorSite = 4
defnSite = 4
extendSite = 4
}

danglingParentheses {
ctrlSite = true
defnSite = true
}


docstrings.style = "Asterisk" // JavaDoc
includeCurlyBraceInSelectChains = true
includeNoParensInSelectChains = false

literals {
double = "Lower"
float = "Lower"
hexDigits = "Lower"
hexPrefix = "Lower"
long = "Upper"
}

newlines {
afterCurlyLambdaParams = squash
afterCurlyLambdaParams=squash
alwaysBeforeElseAfterCurlyIf = false
beforeCurlyLambdaParams = multilineWithCaseOnly
beforeMultiline = fold
beforeMultilineDef = false
implicitParamListModifierPrefer = before
}

rewrite {
redundantBraces {
generalExpressions = false
ifElseExpressions = false
methodBodies = false
parensForOneLineApply = true
stringInterpolation = true
}
rules = [
RedundantBraces,
RedundantParens,
SortModifiers,
SortImports
]
redundantBraces {
generalExpressions = false
methodBodies = false
ifElseExpressions = false
parensForOneLineApply = true
stringInterpolation = true
}
sortModifiers {
order = [
"implicit",
"final",
"sealed",
"abstract",
"override",
"private",
"protected",
"lazy"
]
}
}

continuationIndent {
callSite = 2
defnSite = 4
ctorSite = 4
extendSite = 4
}

align {
preset=some
tokens = []
openParenCallSite = false
openParenDefnSite = false
preset = some
stripMargin = false
tokens = []
}

danglingParentheses {
defnSite = true
ctrlSite = true
}

spaces {
afterKeywordBeforeParen = true
afterSymbolicDefs = false
beforeContextBoundColon = "Never"
inByNameTypes = true
inParentheses = false
neverAroundInfixTypes = []
afterKeywordBeforeParen = true
inByNameTypes = true
afterSymbolicDefs = false
}

literals {
long = "Upper"
float = "Lower"
double = "Lower"
hexPrefix = "Lower"
hexDigits = "Lower"
}

docstrings {
style = "Asterisk" // JavaDoc
}

binPack {
parentConstructors = "Never"
}
3 changes: 3 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Source code in this repository is variously licensed under the Business Source License 1.1 (BSL) and the Apache 2.0 license.
A copy of each license can be found in the licenses directory.
Source code in a given file is licensed under the BSL and the copyright belongs to RAW Labs S.A. unless otherwise noted at the beginning of the file.
Empty file added README.md
Empty file.
116 changes: 116 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import sbt.Keys._
import sbt._

import java.nio.file.Paths

ThisBuild / credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
"raw-labs",
sys.env.getOrElse("GITHUB_TOKEN", "")
)

val isRelease = sys.props.getOrElse("release", "false").toBoolean

lazy val commonSettings = Seq(
homepage := Some(url("https://www.raw-labs.com/")),
organization := "com.raw-labs",
organizationName := "RAW Labs SA",
organizationHomepage := Some(url("https://www.raw-labs.com/")),
// Use cached resolution of dependencies
// http://www.scala-sbt.org/0.13/docs/Cached-Resolution.html
updateOptions := updateOptions.in(Global).value.withCachedResolution(true),
resolvers ++= Seq(Resolver.mavenLocal),
resolvers += "GHR snapi repo" at "https://maven.pkg.github.com/raw-labs/snapi",
resolvers += "GHR protocol-das repo" at "https://maven.pkg.github.com/raw-labs/protocol-das",
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
resolvers ++= Resolver.sonatypeOssRepos("releases")
)

lazy val buildSettings = Seq(
scalaVersion := "2.12.18",
isSnapshot := !isRelease,
javacOptions ++= Seq(
"-source",
"21",
"-target",
"21"
),
scalacOptions ++= Seq(
"-feature",
"-unchecked",
// When compiling in encrypted drives in Linux, the max size of a name is reduced to around 140
// https://unix.stackexchange.com/a/32834
"-Xmax-classfile-name",
"140",
"-deprecation",
"-Xlint:-stars-align,_",
"-Ywarn-dead-code",
"-Ywarn-macros:after", // Fix for false warning of unused implicit arguments in traits/interfaces.
"-Ypatmat-exhaust-depth",
"160"
)
)

lazy val compileSettings = Seq(
Compile / doc / sources := Seq.empty,
Compile / packageDoc / mappings := Seq(),
Compile / packageSrc / publishArtifact := true,
Compile / packageDoc / publishArtifact := false,
Compile / packageBin / packageOptions += Package.ManifestAttributes(
"Automatic-Module-Name" -> name.value.replace('-', '.')
),
// Ensure Java annotations get compiled first, so that they are accessible from Scala.
compileOrder := CompileOrder.JavaThenScala
)

lazy val testSettings = Seq(
// Ensuring tests are run in a forked JVM for isolation.
Test / fork := true,
// Disabling parallel execution of tests.
//Test / parallelExecution := false,
// Pass system properties starting with "raw." to the forked JVMs.
Test / javaOptions ++= {
import scala.collection.JavaConverters._
val props = System.getProperties
props
.stringPropertyNames()
.asScala
.filter(_.startsWith("raw."))
.map(key => s"-D$key=${props.getProperty(key)}")
.toSeq
},
// Set up heap dump options for out-of-memory errors.
Test / javaOptions ++= Seq(
"-XX:+HeapDumpOnOutOfMemoryError",
s"-XX:HeapDumpPath=${Paths.get(sys.env.getOrElse("SBT_FORK_OUTPUT_DIR", "target/test-results")).resolve("heap-dumps")}"
),
Test / publishArtifact := true
)

val isCI = sys.env.getOrElse("CI", "false").toBoolean

lazy val publishSettings = Seq(
versionScheme := Some("early-semver"),
publish / skip := false,
publishMavenStyle := true,
publishTo := Some("GitHub raw-labs Apache Maven Packages" at "https://maven.pkg.github.com/raw-labs/das-server-scala"),
publishConfiguration := publishConfiguration.value.withOverwrite(isCI)
)

lazy val strictBuildSettings = commonSettings ++ compileSettings ++ buildSettings ++ testSettings ++ Seq(
scalacOptions ++= Seq(
"-Xfatal-warnings"
)
)

lazy val root = (project in file("."))
.settings(
name := "das-server-scala",
strictBuildSettings,
publishSettings,
libraryDependencies ++= Seq(
"com.raw-labs" %% "protocol-das" % "0.1.0" % "compile->compile;test->test",
"com.raw-labs" %% "das-sdk-scala" % "0.1.0" % "compile->compile;test->test"
)
)
Loading

0 comments on commit 4ebd5f1

Please sign in to comment.