Last active
July 31, 2020 16:08
-
-
Save kthompson/a0ae71e9a11675653dcd9f4791cd2827 to your computer and use it in GitHub Desktop.
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
import $ivy.`com.lihaoyi::mill-contrib-artifactory:$MILL_VERSION` | |
import $ivy.`com.lihaoyi::mill-contrib-scoverage:$MILL_VERSION` | |
import $file.build_lib.AnalyticsLibrary, AnalyticsLibrary._ | |
import $file.build_lib.Dependencies, Dependencies._ | |
import mill._, contrib._, scalalib._, publish._ | |
/** NOTES: | |
* | |
* run scoverage with: | |
* | |
* mill lib.filters.scoverage.compile | |
* mill lib.filters.test | |
* mill lib.filters.scoverage.htmlReport | |
* | |
* TODO: | |
* - scalastyle | |
* - max warnings | |
*/ | |
object lib extends Module { | |
object filters extends AnalyticsLibraryModule { | |
def ivyDeps = Agg[Dep]( | |
droste, | |
elastic4sCore, | |
geotrellisVector, | |
scalaLogging, | |
circeCore, | |
circeGeneric, | |
circeParser | |
) | |
} | |
object imagery extends AnalyticsLibraryModule { | |
def ivyDeps = Agg[Dep]( | |
macros, | |
velarium, | |
Dep.parse(persist).exclude( | |
("org.locationtech.geotrellis" , "geotrellis-spark"), | |
("com.github.mpilquist" , "simulacrum"), | |
("io.kamon" , "kamon-prometheus"), // domain | |
("io.kamon" , "kamon-core"), //domain | |
("commons-logging" , "commons-logging"), | |
("com.github.julien-truffaut" , "monocle-macro"), // domain | |
("com.github.julien-truffaut" , "monocle-macro") | |
), | |
sparkCore, // % Provided).intransitive(), | |
awsS3, | |
catsCore, | |
catsEffect, | |
commonsIo, | |
monocleCore, | |
monocleMacro, | |
scalaCache, | |
scalacheckShapeless, | |
silencer, | |
// silencerPlugin, | |
simulacrum, // % Provided, | |
geotrellis(geotrellisProj), | |
geotrellis(geotrellisRaster), | |
geotrellis(geotrellisS3), | |
geotrellis(geotrellisSpark), | |
geotrellis(geotrellisVector) | |
) | |
override def testIvyDeps: Seq[Dep] = Seq(scalaCheck, geotrellisRasterTest, betterFiles) | |
} | |
} |
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
import $ivy.`com.lihaoyi::mill-contrib-artifactory:$MILL_VERSION` | |
import $ivy.`com.lihaoyi::mill-contrib-scoverage:$MILL_VERSION` | |
import $file.Dependencies, Dependencies._ | |
import mill._, contrib._, scalalib._, publish._ | |
import scoverage.ScoverageModule | |
import artifactory.ArtifactoryPublishModule | |
import scalafmt.ScalafmtModule | |
import coursier.Repository | |
import coursier.maven.MavenRepository | |
trait AnalyticsLibraryModule extends SbtModule with ArtifactoryPublishModule with ScoverageModule with ScalafmtModule { | |
// TODO: make this work like sbt | |
val publishVersion = s"2020.08.07" | |
def scalaVersion = "2.12.11" | |
def scoverageVersion = "1.4.1" | |
def scalacOptions = Seq( | |
"-Xlint", | |
"-Yno-adapted-args", | |
"-Ypartial-unification", | |
"-Ywarn-dead-code", | |
"-Ywarn-unused", | |
"-Ywarn-unused-import", | |
"-Ywarn-unused:explicits", | |
"-Ywarn-unused:implicits", | |
"-Ywarn-unused:imports", | |
"-Ywarn-unused:locals", | |
"-Ywarn-unused:patvars", | |
"-Ywarn-unused:privates", | |
"-deprecation", | |
"-feature", | |
"-language:existentials", | |
"-language:higherKinds", | |
"-language:implicitConversions", | |
"-language:postfixOps", | |
"-language:reflectiveCalls", | |
"-unchecked" | |
) | |
def scalacPluginIvyDeps = Agg(ivy"org.typelevel:::kind-projector:0.11.0", ivy"org.scalamacros:::paradise:2.1.1") | |
val artifactory = "http://artifactory/artifactory" | |
def artifactoryUri: String = s"$artifactory/sbt-release-local" | |
def artifactorySnapshotUri: String = s"$artifactory/sbt-dev-local;build.timestamp=" + new java.util.Date().getTime | |
override def repositories: Seq[Repository] = { | |
Seq( | |
coursier.LocalRepositories.ivy2Local, | |
MavenRepository("https://repo1.maven.org/maven2") | |
) | |
} | |
def pomSettings = PomSettings( | |
description = "", | |
organization = "com.github", | |
url = "https://bitbucket.org/github", | |
licenses = Nil, | |
versionControl = VersionControl( | |
browsableRepository = Some(s"https://bitbucket.org/github"), | |
connection = Some(VersionControlConnection.gitGit("bitbucket.org", s"github.git")), | |
developerConnection = | |
Some(VersionControlConnection.gitSsh("bitbucket.org", s":github.git", username = Some("git"))), | |
tag = None | |
), | |
developers = Nil | |
) | |
def testModuleDeps: Seq[TestModule] = Nil | |
def testIvyDeps: Seq[Dep] = Nil | |
object test extends Tests with ScoverageTests { | |
def moduleDeps = super.moduleDeps ++ testModuleDeps | |
def ivyDeps = Agg.from(Seq[Dep](Dependencies.scalaTest, Dependencies.scalamock) ++ testIvyDeps) | |
def testFrameworks = Seq("org.scalatest.tools.Framework") | |
} | |
} |
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
import $file.Version | |
import mill._, contrib._, scalalib._, publish._ | |
def withoutJCL(dep: Dep) = dep.exclude(("commons-logging", "commons-logging")) | |
def geotrellis(d: Dep) = | |
d.exclude(("com.github.julien-truffaut", "monocle-macro"), ("org.spire-math", "spire-macros")) | |
// dependencies | |
lazy val macros = s"com.github::macros:${Version.macros}" | |
lazy val filters = s"com.github::filters:${Version.filters}" | |
lazy val imagery = s"com.github::imagery:${Version.imagery}" | |
lazy val persist = s"com.github::persist:${Version.persist}" | |
lazy val velarium = s"com.github::velarium:${Version.velarium}" | |
// Third party dependencies | |
lazy val akkaActor = s"com.typesafe.akka::akka-actor:${Version.akka}" | |
lazy val akkaHttp = s"com.typesafe.akka::akka-http:${Version.akkaHttp}" | |
lazy val akkaStream = s"com.typesafe.akka::akka-stream:${Version.akka}" | |
lazy val awsS3 = withoutJCL(s"com.amazonaws:aws-java-sdk-s3:${Version.aws}") | |
lazy val cats = s"org.typelevel::cats-core:${Version.cats}" | |
lazy val catsCore = s"org.typelevel::cats-core:${Version.cats}" | |
lazy val catsEffect = s"org.typelevel::cats-effect:${Version.cats}" | |
lazy val chronoscala = s"jp.ne.opt::chronoscala:${Version.chronoscala}" | |
//lazy val circe = Seq("io.circe::circe-core", "io.circe::circe-generic", "io.circe::circe-parser").map[Dep]( | |
// dep => s"$dep:${Version.circe}" | |
//) | |
lazy val circeCore = s"io.circe::circe-core:${Version.circe}" | |
lazy val circeGeneric = s"io.circe::circe-generic:${Version.circe}" | |
lazy val circeParser = s"io.circe::circe-parser:${Version.circe}" | |
lazy val commonsIo = s"commons-io:commons-io:2.4" | |
lazy val droste = s"io.higherkindness::droste-core:${Version.droste}" | |
lazy val elastic4sCore = withoutJCL(s"com.sksamuel.elastic4s::elastic4s-core:${Version.elastic4s}") | |
lazy val elastic4sEffectCats = withoutJCL(s"com.sksamuel.elastic4s::elastic4s-effect-cats:${Version.elastic4s}") | |
lazy val geotrellisProj = withoutJCL(s"org.locationtech.geotrellis::geotrellis-proj4:${Version.geotrellis}") | |
lazy val geotrellisRaster = withoutJCL(s"org.locationtech.geotrellis::geotrellis-raster:${Version.geotrellis}") | |
lazy val geotrellisS3 = withoutJCL(s"org.locationtech.geotrellis::geotrellis-s3:${Version.geotrellis}") | |
lazy val geotrellisSpark = withoutJCL(s"org.locationtech.geotrellis::geotrellis-spark:${Version.geotrellis}") | |
lazy val geotrellisVector = withoutJCL(s"org.locationtech.geotrellis::geotrellis-vector:${Version.geotrellis}") | |
lazy val monocleCore = s"com.github.julien-truffaut::monocle-core:${Version.monocle}" | |
lazy val monocleMacro = s"com.github.julien-truffaut::monocle-macro:${Version.monocle}" | |
lazy val opRabbit = s"com.spingo::op-rabbit-akka-stream:${Version.opRabbit}" | |
lazy val scalaCache = s"com.github.cb372::scalacache-guava:${Version.scalaCache}" | |
lazy val scalaJsonapi = s"io.kontainers::scala-jsonapi:${Version.scalaJsonapi}" | |
lazy val scalaLogging = s"com.typesafe.scala-logging::scala-logging:${Version.scalaLogging}" | |
lazy val scalaXml = s"org.scala-lang.modules::scala-xml:${Version.scalaXml}" | |
lazy val silencer = s"com.github.ghik::silencer-plugin:${Version.silencer}" | |
lazy val simulacrum = s"com.github.mpilquist::simulacrum:${Version.simulacrum}" | |
lazy val sparkCore = s"org.apache.spark::spark-core:${Version.spark}" | |
// compiler plugins | |
// lazy val kindProjector = compilerPlugin("org.typelevel:kind-projector:0.11.0" cross CrossVersion.full) | |
// lazy val paradise = compilerPlugin("org.scalamacros:paradise:2.1.1" cross CrossVersion.full) | |
// lazy val silencerPlugin = compilerPlugin(silencer) | |
// Test dependencies | |
lazy val betterFiles = s"com.github.pathikrit::better-files:${Version.betterFiles}" | |
lazy val geotrellisRasterTest = withoutJCL( | |
s"org.locationtech.geotrellis::geotrellis-raster-testkit:${Version.geotrellis}" | |
) | |
lazy val mockito = s"org.mockito:mockito-core:${Version.mockito}" | |
lazy val scalaCheck = s"org.scalacheck::scalacheck:${Version.scalacheck}" | |
lazy val scalaTest = s"org.scalatest::scalatest:${Version.scalatest}" | |
lazy val scalacheckShapeless = s"com.github.alexarchambault::scalacheck-shapeless_1.14:${Version.scalacheckShapeless}" | |
lazy val scalamock = s"org.scalamock::scalamock:${Version.scalamock}" | |
// Project dependencies | |
//lazy val imageryDependencies = Seq[Dep]( | |
// Dependencies.macros, | |
// Dependencies.velarium, | |
// Dep.parse(Dependencies.persist).exclude( | |
// ("org.locationtech.geotrellis" , "geotrellis-spark"), | |
// ("com.github.mpilquist" , "simulacrum"), | |
// ("io.kamon" , "kamon-prometheus"), // domain | |
// ("io.kamon" , "kamon-core"), //domain | |
// ("commons-logging" , "commons-logging"), | |
// ("com.github.julien-truffaut" , "monocle-macro"), // domain | |
// ("com.github.julien-truffaut" , "monocle-macro") | |
// ), | |
// | |
// sparkCore, // % Provided).intransitive(), | |
// awsS3, | |
// catsCore, | |
// catsEffect, | |
// commonsIo, | |
// monocleCore, | |
// monocleMacro, | |
// scalaCache, | |
// scalacheckShapeless, | |
// silencer, | |
// // silencerPlugin, | |
// simulacrum, // % Provided, | |
// geotrellis(geotrellisProj), | |
// geotrellis(geotrellisRaster), | |
// geotrellis(geotrellisS3), | |
// geotrellis(geotrellisSpark), | |
// geotrellis(geotrellisVector) | |
//) | |
// | |
// lazy val jsonApiDependencies = | |
// Seq( | |
// akkaStream, | |
// akkaHttp, | |
// cats, | |
// elastic4sEffectCats, | |
// kindProjector, | |
// mockito, | |
// paradise, | |
// scalaJsonapi, | |
// scalaLogging, | |
// scalamock, | |
// scalaTest, | |
// simulacrum | |
// ) ++ circe | |
// | |
// lazy val modusDependencies = Seq(commonsIo, kindProjector, paradise, scalaTest, scalaLogging, scalaXml) ++ circe | |
// | |
// lazy val opsDependencies = Seq(kindProjector, paradise, scalaTest, scalaLogging) | |
// | |
// lazy val streamsDependencies = Seq( | |
// akkaActor, | |
// akkaHttp, | |
// akkaStream, | |
// chronoscala, | |
// kindProjector, | |
// opRabbit, | |
// paradise, | |
// scalaLogging | |
// ) ++ circe | |
// | |
// lazy val akkaCommonDependencies = Seq(akkaHttp) |
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
import $file.VersionHelpers, VersionHelpers._ | |
val patchRelease: String = "" | |
val project: String = s"2020.08.07$patchRelease$projectSha" | |
// dependencies | |
val autograph = "0.6.1" | |
val domain = "3.21.0" | |
val infra = "2.6.0" | |
val ogffp = "1.7.6" | |
val persist = "2.24.0" | |
val sentry = "0.4.0" | |
val vault = "0.6.0" | |
val velarium = "1.5.0" | |
// dependencies with sources in this repo | |
val filters = tryGetVersion("filters").getOrElse(project) | |
val imagery = tryGetVersion("imagery").getOrElse(project) | |
val macros = tryGetVersion("macros").getOrElse("0.1.0") | |
// third party dependencies | |
val airbrake = "0.1.6" | |
val akka = "2.5.31" | |
val akkaHttp = "10.1.8" | |
val alpakka = "1.0-M1" | |
val aws = "1.11.790" | |
val betterFiles = "2.17.1" | |
val cats = "2.0.0" | |
val catsEffect = "2.0.0" | |
val chronoscala = "0.1.3" | |
val circe = "0.12.2" | |
val circeOptics = "0.12.0" | |
val config = "1.3.3" | |
val diffson = "2.2.2" | |
val droste = "0.8.0" | |
val elastic4s = "7.1.0" | |
val geotrellis = "2.3.1" | |
val httpCirce = "1.31.0" | |
val jsonLenses = "0.6.2" | |
val logback = "1.2.3" | |
val mockito = "2.3.11" | |
val monocle = "1.5.1-cats" | |
val opRabbit = "2.0.0" | |
//val paradise = "2.1.1" | |
//val pureconfig = "0.9.2" | |
//val s3mock = "0.1.10" | |
//val scala = "2.12.11" | |
val scalaCache = "0.9.3" | |
val scalaJsonapi = "0.8.0" | |
//val scalaKml = "1.3" | |
val scalaLogging = "3.9.0" | |
val scalaXml = "1.2.0" | |
val scalacheck = "1.14.1" | |
val scalacheckShapeless = "1.2.3" | |
//val scalajHttp = "2.3.0" | |
val scalamock = "4.1.0" | |
val scalatest = "3.0.5" | |
//val scrimage = "2.1.8" | |
val silencer = "1.2.1" | |
val simulacrum = "0.19.0" | |
//val slf4j = "1.7.26" | |
val spark = "2.4.0" | |
//val spray = "1.3.5" | |
//val squants = "1.3.0" | |
//val stamina = "0.1.4" | |
//val wiremock = "1.33" |
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
import scala.util.Try | |
import scala.io.Source | |
import java.io.File | |
def projectSha: String = { | |
sys.env.get("TEAMCITY_BUILD_BRANCH") match { | |
case Some(branch) => | |
// builds that will go to the release repo | |
val releaseBuild = branch == "develop" || branch == "master" || branch.startsWith("release/") | |
if (releaseBuild) { | |
sys.env | |
.get("BUILD_VCS_NUMBER") | |
.filter(_.nonEmpty) | |
.map(sha => s"-${sha.substring(0, 7)}") | |
.getOrElse("-SNAPSHOT") | |
} else { | |
// branch builds go to snapshot repo add branch tag as to not clobber other branches | |
s"-${branch.split('/').last}-SNAPSHOT" | |
} | |
case None => "-dev-SNAPSHOT" // not on team city | |
} | |
} | |
def tryGetVersion(moduleName: String): Option[String] = { | |
val file = new File(s"..${File.pathSeparator}${moduleName}_version.txt") | |
if (file.exists()) { | |
Try { | |
val source = Source.fromFile(file) | |
try { | |
source.mkString.trim | |
} finally { | |
source.close() | |
} | |
}.toOption.filter(_.nonEmpty) | |
} else { | |
None | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment