-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3fa44cb
Showing
26 changed files
with
1,945 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
paths: | ||
- .github/workflows/ci.yaml | ||
- .sbtopts | ||
- build.sbt | ||
- .scalafmt.conf | ||
- project/** | ||
- src/** | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.READ_PACKAGES }} | ||
|
||
jobs: | ||
code-check: | ||
runs-on: self-hosted | ||
container: | ||
image: sbtscala/scala-sbt:eclipse-temurin-jammy-21.0.2_13_1.9.9_2.12.19 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: sbt headerCheckAll | ||
test: | ||
runs-on: self-hosted | ||
container: | ||
image: sbtscala/scala-sbt:eclipse-temurin-jammy-21.0.2_13_1.9.9_2.12.19 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: sbt clean test |
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,22 @@ | ||
name: publish | ||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.WRITE_PACKAGES }} | ||
|
||
jobs: | ||
publish: | ||
runs-on: self-hosted | ||
container: | ||
image: sbtscala/scala-sbt:eclipse-temurin-jammy-21.0.2_13_1.9.9_2.12.19 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: sbt publish | ||
run: | | ||
git config --global --add safe.directory $GITHUB_WORKSPACE | ||
sbt clean publish |
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,7 @@ | ||
*.class | ||
.metals/ | ||
.git/ | ||
.vscode/ | ||
target/ | ||
.bsp/ | ||
.idea/ |
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,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 |
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,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" | ||
} |
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,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.
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,150 @@ | ||
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", | ||
startYear := Some(2023), | ||
organizationHomepage := Some(url("https://www.raw-labs.com/")), | ||
developers := List(Developer("raw-labs", "RAW Labs", "engineering@raw-labs.com", url("https://github.com/raw-labs"))), | ||
licenses := List( | ||
"Business Source License 1.1" -> new URI( | ||
"https://raw.githubusercontent.com/raw-labs/snapi/main/licenses/BSL.txt" | ||
).toURL | ||
), | ||
headerSources / excludeFilter := HiddenFileFilter, | ||
// 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 ++= 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('-', '.') | ||
), | ||
// Add all the classpath to the module path. | ||
Compile / javacOptions ++= Seq( | ||
"--module-path", | ||
(Compile / dependencyClasspath).value.files.absString | ||
), | ||
// The module-info.java requires the Scala classes to be compiled. | ||
compileOrder := CompileOrder.ScalaThenJava | ||
) | ||
|
||
lazy val testSettings = Seq( | ||
// Exclude module-info.java, otherwise it will fail the compilation. | ||
Test / doc / sources := { | ||
(Compile / doc / sources).value.filterNot(_.getName.endsWith("module-info.java")) | ||
}, | ||
// Ensuring tests are run in a forked JVM for isolation. | ||
Test / fork := true, | ||
// 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, | ||
Test / packageSrc / 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/utils-core"), | ||
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 := "utils-core", | ||
strictBuildSettings, | ||
publishSettings, | ||
libraryDependencies ++= Seq( | ||
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.5-rawlabs", | ||
"com.typesafe" % "config" % "1.4.2", | ||
"ch.qos.logback" % "logback-classic" % "1.4.12", | ||
"com.google.guava" % "guava" % "32.1.3-jre", | ||
"org.scala-lang.modules" %% "scala-java8-compat" % "1.0.2", // Required while we are on Scala 2.12. It's built into Scala 2.13. | ||
"com.github.loki4j" % "loki-logback-appender" % "1.4.2", | ||
"commons-io" % "commons-io" % "2.11.0", | ||
"org.apache.commons" % "commons-text" % "1.11.0", | ||
"org.slf4j" % "slf4j-api" % "2.0.5", | ||
"org.slf4j" % "log4j-over-slf4j" % "2.0.5", | ||
"org.slf4j" % "jcl-over-slf4j" % "2.0.5", | ||
"org.slf4j" % "jul-to-slf4j" % "2.0.5", | ||
"com.fasterxml.jackson.core" % "jackson-core" % "2.15.2", | ||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.15.2", | ||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.15.2", | ||
"com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8" % "2.15.2", | ||
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.15.2", | ||
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-cbor" % "2.15.2", | ||
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-csv" % "2.15.2", | ||
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % "2.15.2", | ||
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.15.2-rawlabs", | ||
"org.scalatest" %% "scalatest" % "3.2.16" % Test | ||
) | ||
) |
Oops, something went wrong.