From 7b47f86bf3d213789520a16002d88809ec21d19d Mon Sep 17 00:00:00 2001 From: Maciej Kowalski Date: Mon, 11 Mar 2019 22:14:58 +0100 Subject: [PATCH] mill build.sc, cats 1.6 --- .gitignore | 1 + .scalafmt.conf | 3 +- build.gradle.kts | 11 ++-- build.sbt | 2 +- build.sc | 69 ++++++++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- 6 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 build.sc diff --git a/.gitignore b/.gitignore index 498fb7c..c0dd570 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # Simple Build Tool # http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control +.idea_modules/ .idea/ dist/* target/ diff --git a/.scalafmt.conf b/.scalafmt.conf index bdaf49c..97e53ae 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,3 +1,4 @@ +version = "2.0.0-RC4" # # See http://scalameta.org/scalafmt/#Configuration for details # @@ -78,4 +79,4 @@ rewrite { # if your for has more than one single <- then it gets transformed into a multit-line curly brace one # PreferCurlyFors ] -} \ No newline at end of file +} diff --git a/build.gradle.kts b/build.gradle.kts index 8300a97..4e9bea7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,7 +2,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat buildscript { dependencies { - classpath("cz.alenkacz:gradle-scalafmt:1.7.0") + classpath("cz.alenkacz:gradle-scalafmt:1.8.0") } } @@ -11,7 +11,7 @@ plugins { scala application id("maven-publish") - id("com.github.maiflai.scalatest") version "0.23" + id("com.github.maiflai.scalatest") version "0.24" } apply(plugin = "scalafmt") @@ -41,13 +41,13 @@ dependencies { compile(group = "org.springframework.boot", name = "spring-boot-starter-webflux", version = "2.1.0.RELEASE") compile(group = "com.fasterxml.jackson.module", name = "jackson-module-scala_"+scalaVersion, version = "2.9.8") - compile(group = "org.typelevel", name = "cats-core_"+scalaVersion, version = "1.5.0") + compile(group = "org.typelevel", name = "cats-core_"+scalaVersion, version = "1.6.0") compile(group = "com.chuusai", name = "shapeless_"+scalaVersion, version = "2.3.3") compile(group = "com.github.mpilquist", name = "simulacrum_"+scalaVersion, version = "0.15.0") // compile("org.scala-lang:scala-compiler:2.12.8" // testCompile(group = "com.lihaoyi", name = "ammonite_2.12.8", version = "1.6.0" - testCompile(group = "org.scalatest", name = "scalatest_"+scalaVersion, version = "3.0.6-SNAP5") + testCompile(group = "org.scalatest", name = "scalatest_"+scalaVersion, version = "3.0.7-RC1") testRuntime(group = "org.pegdown", name = "pegdown", version = "1.6.0") } @@ -58,7 +58,6 @@ tasks.withType { } tasks.withType { -// scalaCompileOptions.deprecation = false scalaCompileOptions.additionalParameters = listOf( // @see https://tpolecat.github.io/2017/04/25/scalac-flags.html "-deprecation", // Emit warning and location for usages of deprecated APIs. @@ -128,5 +127,5 @@ tasks.withType { //} tasks.withType { - gradleVersion = "5.1" + gradleVersion = "5.2.1" } diff --git a/build.sbt b/build.sbt index b325838..74734f5 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,7 @@ resolvers += Resolver.sonatypeRepo("snapshots") scalaVersion := "2.13.0-M5" -val catsVersion = "1.5.0" +val catsVersion = "1.6.0" libraryDependencies ++= Seq( "org.typelevel" %% "cats-core" % catsVersion, diff --git a/build.sc b/build.sc new file mode 100644 index 0000000..c3e4a17 --- /dev/null +++ b/build.sc @@ -0,0 +1,69 @@ +import mill._, scalalib._, scalafmt._ + +object spring extends ScalaModule with ScalafmtModule { + override def scalaVersion = "2.13.0-M5" + + override def sources = T.sources { millSourcePath / os.up / 'src / 'main / 'scala } + + override def mainClass = Some("fp.spring.spring4.UserApp") + + override def scalacOptions = T { Seq ( + "-deprecation", // Emit warning and location for usages of deprecated APIs. + "-encoding", "utf-8", // Specify character encoding used by source files. + "-explaintypes", // Explain type errors in more detail. + "-feature", // Emit warning and location for usages of features that should be imported explicitly. + "-language:existentials", // Existential types (besides wildcard types) can be written and inferred + "-language:experimental.macros", // Allow macro definition (besides implementation and application) + "-language:higherKinds", // Allow higher-kinded types + "-language:implicitConversions", // Allow definition of implicit functions called views + "-unchecked", // Enable additional warnings where generated code depends on assumptions. + "-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access. + // "-Xfatal-warnings", // Fail the compilation if there are any warnings. + "-Xfuture", // Turn on future language features. + "-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver. + "-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error. + "-Xlint:delayedinit-select", // Selecting member of DelayedInit. + "-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element. + "-Xlint:inaccessible", // Warn about inaccessible types in method signatures. + "-Xlint:infer-any", // Warn when a type argument is inferred to be `Any`. + "-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id. + "-Xlint:nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'. + "-Xlint:nullary-unit", // Warn when nullary methods return Unit. + "-Xlint:option-implicit", // Option.apply used implicit view. + "-Xlint:package-object-classes", // Class or object defined in package object. + "-Xlint:poly-implicit-overload", // Parameterized overloaded implicit methods are not visible as view bounds. + "-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field. + "-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component. + "-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope. + // "-Ywarn-dead-code", // Warn when dead code is identified. + "-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined. + "-Ywarn-numeric-widen", // Warn when numerics are widened. + // "-Ywarn-unused:implicits", // Warn if an implicit parameter is unused. + // "-Ywarn-unused:imports", // Warn if an import selector is not referenced. + "-Ywarn-unused:locals", // Warn if a local definition is unused. + // "-Ywarn-unused:params", // Warn if a value parameter is unused. + "-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused. + "-Ywarn-unused:privates", // Warn if a private member is unused. + "-Ywarn-value-discard", // Warn when non-Unit expression results are unused. + "-Ymacro-annotations" // enable simulacrum typeclass annotations only in 2.13 + )} + + override def ivyDeps = Agg( + ivy"org.springframework.boot:spring-boot-starter-webflux:2.1.0.RELEASE", + ivy"com.fasterxml.jackson.module::jackson-module-scala:2.9.8", + + ivy"org.typelevel::cats-core:1.6.0", + ivy"com.chuusai::shapeless:2.3.3", + ivy"com.github.mpilquist::simulacrum:0.15.0", + ) + + object test extends Tests { + def testFrameworks = T { Seq("org.scalatest.tools.Framework") } + + override def sources = T.sources { millSourcePath / os.up / os.up / 'src / 'test / 'scala } + + override def ivyDeps = Agg( + ivy"org.scalatest::scalatest:3.0.7-RC1" + ) + } +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6b3851a..44e7c4d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists