Skip to content

Commit

Permalink
migrate to sbt 1.1.4 and scala 2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
caente committed May 8, 2018
1 parent 62d5e2b commit 4216180
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 54 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -16,8 +16,14 @@ If you can't, `.lens` is a nice alternative to `.copy`.

### SBT Dependency

#### Scala 2.11

`"ai.x" %% "lens" % "1.0.0"`

#### Scala 2.12

`"ai.x" %% "lens" % "2.0.0"`

### Usage

```scala
Expand Down
56 changes: 56 additions & 0 deletions build.sbt
@@ -0,0 +1,56 @@
import sbt._
import Keys._
import scalariform.formatter.preferences._
import com.typesafe.sbt.SbtScalariform.{ScalariformKeys, autoImport}
import xerial.sbt.Sonatype._

val projectName = "lens"
version := "2.0.0"
name := projectName
scalaVersion := "2.12.6"
description := "Convenient ad-hoc lens Syntax on top of Monocle"

val monocleVersion = "1.5.0"
libraryDependencies ++= Seq(
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion,
"com.github.julien-truffaut" %% "monocle-generic" % monocleVersion,
"com.github.julien-truffaut" %% "monocle-macro" % monocleVersion,
"org.scalactic" %% "scalactic" % "3.0.5",
"org.scalatest" %% "scalatest" % "3.0.5" % "test"
)
resolvers ++= Seq(Resolver.sonatypeRepo("releases"),Resolver.sonatypeRepo("snapshots"))

testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oSD")
organizationName := "x.ai"
organization := "ai.x"
scalacOptions in (Compile, doc) ++= Seq(
"-doc-footer", projectName+" is developed by Miguel Iglesias.",
"-implicits",
"-groups"
)
scalariformPreferences := scalariformPreferences.value
.setPreference(AlignParameters, true)
.setPreference(AlignArguments, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(MultilineScaladocCommentsStartOnFirstLine, true)
.setPreference(SpaceInsideParentheses, true)
.setPreference(SpacesWithinPatternBinders, true)
.setPreference(SpacesAroundMultiImports, true)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(DoubleIndentConstructorArguments, true)
publishTo := sonatypePublishTo.value
publishMavenStyle := true
publishArtifact in Test := false
pomIncludeRepository := { _ => false }
licenses += ("Apache 2.0", url("http://github.com/xdotai/"+projectName+"/blob/master/LICENSE.txt"))
homepage := Some(url("http://github.com/xdotai/"+projectName))
startYear := Some(2016)
scmInfo := Some(
ScmInfo(
url(s"https://github.com/xdotai/$projectName"),
s"scm:git@github.com:xdotai/$projectName.git"
)
)
developers := List(
Developer(id="caente", name="Miguel Iglesias", email="miguel.iglesias@human.x.ai", url=url("https://github.com/caente"))
)
22 changes: 0 additions & 22 deletions build/build.scala

This file was deleted.

11 changes: 0 additions & 11 deletions build/build/build.scala

This file was deleted.

1 change: 1 addition & 0 deletions project/build.properties
@@ -0,0 +1 @@
sbt.version=1.1.4
4 changes: 4 additions & 0 deletions project/plugins.sbt
@@ -0,0 +1,4 @@
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.3")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
File renamed without changes.
2 changes: 1 addition & 1 deletion package.scala → src/main/scala/package.scala
@@ -1,5 +1,5 @@
package ai.x.lens
object `package`{
object `package` {
implicit class ImplicitBoundLens[T]( v: T ) {
def lens = BoundLens( v )
}
Expand Down
19 changes: 19 additions & 0 deletions src/test/scala/Test.scala
@@ -0,0 +1,19 @@
package ai.x.lens

import org.scalatest.FunSuite

class Test extends FunSuite {

test( "usage example" ) {
case class Inner( i: Int )
case class Outer( inner: Inner, s: String )
val o = Outer( Inner( 5 ), "foo" )

val actual =
o.lens( _.s ).set( "bar" )
.lens( _.inner.i ).modify( _ + 1 ) // .lens calls can be chained nicely

val expected = Outer( Inner( 6 ), "bar" )
assert( expected == actual, s"$expected == $actual" )
}
}
17 changes: 0 additions & 17 deletions test/Test.scala

This file was deleted.

3 changes: 0 additions & 3 deletions test/build/build.scala

This file was deleted.

0 comments on commit 4216180

Please sign in to comment.