Skip to content

Commit 4ebd5f1

Browse files
Initial commit.
0 parents  commit 4ebd5f1

19 files changed

+1842
-0
lines changed

Diff for: .gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.class
2+
.metals/
3+
.git/
4+
.vscode/
5+
target/

Diff for: .sbtopts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-J-Xmx4G
2+
-J-Xms1G
3+
-J-Xss4M
4+
-J-XX:+UseG1GC
5+
-J--add-opens=java.base/java.lang=ALL-UNNAMED
6+
-J--add-opens=java.base/java.util=ALL-UNNAMED
7+
-J-XX:+CrashOnOutOfMemoryError

Diff for: .scalafmt.conf

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
version = 2.7.5
2+
maxColumn = 120
3+
4+
optIn.forceBlankLineBeforeDocstring = true
5+
trailingCommas = "never"
6+
7+
align {
8+
openParenCallSite = false
9+
openParenDefnSite = false
10+
preset=some
11+
stripMargin = false
12+
tokens = []
13+
}
14+
15+
assumeStandardLibraryStripMargin = true
16+
binPack.parentConstructors = "never"
17+
18+
continuationIndent {
19+
callSite = 2
20+
ctorSite = 4
21+
defnSite = 4
22+
extendSite = 4
23+
}
24+
25+
danglingParentheses {
26+
ctrlSite = true
27+
defnSite = true
28+
}
29+
30+
31+
docstrings.style = "Asterisk" // JavaDoc
32+
includeCurlyBraceInSelectChains = true
33+
includeNoParensInSelectChains = false
34+
35+
literals {
36+
double = "Lower"
37+
float = "Lower"
38+
hexDigits = "Lower"
39+
hexPrefix = "Lower"
40+
long = "Upper"
41+
}
42+
43+
newlines {
44+
afterCurlyLambdaParams = squash
45+
afterCurlyLambdaParams=squash
46+
alwaysBeforeElseAfterCurlyIf = false
47+
beforeCurlyLambdaParams = multilineWithCaseOnly
48+
beforeMultiline = fold
49+
beforeMultilineDef = false
50+
implicitParamListModifierPrefer = before
51+
}
52+
53+
rewrite {
54+
redundantBraces {
55+
generalExpressions = false
56+
ifElseExpressions = false
57+
methodBodies = false
58+
parensForOneLineApply = true
59+
stringInterpolation = true
60+
}
61+
rules = [
62+
RedundantBraces,
63+
RedundantParens,
64+
SortModifiers,
65+
SortImports
66+
]
67+
redundantBraces {
68+
generalExpressions = false
69+
methodBodies = false
70+
ifElseExpressions = false
71+
parensForOneLineApply = true
72+
stringInterpolation = true
73+
}
74+
sortModifiers {
75+
order = [
76+
"implicit",
77+
"final",
78+
"sealed",
79+
"abstract",
80+
"override",
81+
"private",
82+
"protected",
83+
"lazy"
84+
]
85+
}
86+
}
87+
88+
continuationIndent {
89+
callSite = 2
90+
defnSite = 4
91+
ctorSite = 4
92+
extendSite = 4
93+
}
94+
95+
align {
96+
preset=some
97+
tokens = []
98+
openParenCallSite = false
99+
openParenDefnSite = false
100+
preset = some
101+
stripMargin = false
102+
tokens = []
103+
}
104+
105+
danglingParentheses {
106+
defnSite = true
107+
ctrlSite = true
108+
}
109+
110+
spaces {
111+
afterKeywordBeforeParen = true
112+
afterSymbolicDefs = false
113+
beforeContextBoundColon = "Never"
114+
inByNameTypes = true
115+
inParentheses = false
116+
neverAroundInfixTypes = []
117+
afterKeywordBeforeParen = true
118+
inByNameTypes = true
119+
afterSymbolicDefs = false
120+
}
121+
122+
literals {
123+
long = "Upper"
124+
float = "Lower"
125+
double = "Lower"
126+
hexPrefix = "Lower"
127+
hexDigits = "Lower"
128+
}
129+
130+
docstrings {
131+
style = "Asterisk" // JavaDoc
132+
}
133+
134+
binPack {
135+
parentConstructors = "Never"
136+
}

Diff for: LICENSE

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Source code in this repository is variously licensed under the Business Source License 1.1 (BSL) and the Apache 2.0 license.
2+
A copy of each license can be found in the licenses directory.
3+
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.

Diff for: README.md

Whitespace-only changes.

Diff for: build.sbt

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import sbt.Keys._
2+
import sbt._
3+
4+
import java.nio.file.Paths
5+
6+
ThisBuild / credentials += Credentials(
7+
"GitHub Package Registry",
8+
"maven.pkg.github.com",
9+
"raw-labs",
10+
sys.env.getOrElse("GITHUB_TOKEN", "")
11+
)
12+
13+
val isRelease = sys.props.getOrElse("release", "false").toBoolean
14+
15+
lazy val commonSettings = Seq(
16+
homepage := Some(url("https://www.raw-labs.com/")),
17+
organization := "com.raw-labs",
18+
organizationName := "RAW Labs SA",
19+
organizationHomepage := Some(url("https://www.raw-labs.com/")),
20+
// Use cached resolution of dependencies
21+
// http://www.scala-sbt.org/0.13/docs/Cached-Resolution.html
22+
updateOptions := updateOptions.in(Global).value.withCachedResolution(true),
23+
resolvers ++= Seq(Resolver.mavenLocal),
24+
resolvers += "GHR snapi repo" at "https://maven.pkg.github.com/raw-labs/snapi",
25+
resolvers += "GHR protocol-das repo" at "https://maven.pkg.github.com/raw-labs/protocol-das",
26+
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
27+
resolvers ++= Resolver.sonatypeOssRepos("releases")
28+
)
29+
30+
lazy val buildSettings = Seq(
31+
scalaVersion := "2.12.18",
32+
isSnapshot := !isRelease,
33+
javacOptions ++= Seq(
34+
"-source",
35+
"21",
36+
"-target",
37+
"21"
38+
),
39+
scalacOptions ++= Seq(
40+
"-feature",
41+
"-unchecked",
42+
// When compiling in encrypted drives in Linux, the max size of a name is reduced to around 140
43+
// https://unix.stackexchange.com/a/32834
44+
"-Xmax-classfile-name",
45+
"140",
46+
"-deprecation",
47+
"-Xlint:-stars-align,_",
48+
"-Ywarn-dead-code",
49+
"-Ywarn-macros:after", // Fix for false warning of unused implicit arguments in traits/interfaces.
50+
"-Ypatmat-exhaust-depth",
51+
"160"
52+
)
53+
)
54+
55+
lazy val compileSettings = Seq(
56+
Compile / doc / sources := Seq.empty,
57+
Compile / packageDoc / mappings := Seq(),
58+
Compile / packageSrc / publishArtifact := true,
59+
Compile / packageDoc / publishArtifact := false,
60+
Compile / packageBin / packageOptions += Package.ManifestAttributes(
61+
"Automatic-Module-Name" -> name.value.replace('-', '.')
62+
),
63+
// Ensure Java annotations get compiled first, so that they are accessible from Scala.
64+
compileOrder := CompileOrder.JavaThenScala
65+
)
66+
67+
lazy val testSettings = Seq(
68+
// Ensuring tests are run in a forked JVM for isolation.
69+
Test / fork := true,
70+
// Disabling parallel execution of tests.
71+
//Test / parallelExecution := false,
72+
// Pass system properties starting with "raw." to the forked JVMs.
73+
Test / javaOptions ++= {
74+
import scala.collection.JavaConverters._
75+
val props = System.getProperties
76+
props
77+
.stringPropertyNames()
78+
.asScala
79+
.filter(_.startsWith("raw."))
80+
.map(key => s"-D$key=${props.getProperty(key)}")
81+
.toSeq
82+
},
83+
// Set up heap dump options for out-of-memory errors.
84+
Test / javaOptions ++= Seq(
85+
"-XX:+HeapDumpOnOutOfMemoryError",
86+
s"-XX:HeapDumpPath=${Paths.get(sys.env.getOrElse("SBT_FORK_OUTPUT_DIR", "target/test-results")).resolve("heap-dumps")}"
87+
),
88+
Test / publishArtifact := true
89+
)
90+
91+
val isCI = sys.env.getOrElse("CI", "false").toBoolean
92+
93+
lazy val publishSettings = Seq(
94+
versionScheme := Some("early-semver"),
95+
publish / skip := false,
96+
publishMavenStyle := true,
97+
publishTo := Some("GitHub raw-labs Apache Maven Packages" at "https://maven.pkg.github.com/raw-labs/das-server-scala"),
98+
publishConfiguration := publishConfiguration.value.withOverwrite(isCI)
99+
)
100+
101+
lazy val strictBuildSettings = commonSettings ++ compileSettings ++ buildSettings ++ testSettings ++ Seq(
102+
scalacOptions ++= Seq(
103+
"-Xfatal-warnings"
104+
)
105+
)
106+
107+
lazy val root = (project in file("."))
108+
.settings(
109+
name := "das-server-scala",
110+
strictBuildSettings,
111+
publishSettings,
112+
libraryDependencies ++= Seq(
113+
"com.raw-labs" %% "protocol-das" % "0.1.0" % "compile->compile;test->test",
114+
"com.raw-labs" %% "das-sdk-scala" % "0.1.0" % "compile->compile;test->test"
115+
)
116+
)

0 commit comments

Comments
 (0)