Skip to content
This repository has been archived by the owner on Sep 12, 2021. It is now read-only.

split silhoutte in two projects #256

Merged
merged 1 commit into from Jan 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
129 changes: 0 additions & 129 deletions build.sbt

This file was deleted.

22 changes: 22 additions & 0 deletions project/Build.scala
@@ -0,0 +1,22 @@
import sbt._

object Build extends Build {

val silhouette = Project(
id = "silhouette",
base = file("silhouette")
)

val silhouetteTestkit = Project(
id = "silhouette-testkit",
base = file("silhouette-testkit"),
dependencies = Seq(silhouette)
)

val root = Project(
id = "root",
base = file("."),
aggregate = Seq(silhouette, silhouetteTestkit)
)

}
127 changes: 127 additions & 0 deletions project/BuildSettings.scala
@@ -0,0 +1,127 @@
import sbt.Keys._
import sbt._

object BasicSettings extends AutoPlugin {
override def trigger = allRequirements

override def projectSettings = Seq(
organization := "com.mohiva",
version := "2.0-SNAPSHOT",
resolvers ++= Dependencies.resolvers,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rfranco The resolver "Atlassian Releases" at "https://maven.atlassian.com/public/" must be the first because of this bug: https://groups.google.com/forum/#!topic/sbt-dev/EQVZGcYtBp0

scalaVersion := Dependencies.Versions.scalaVersion,
crossScalaVersions := Dependencies.Versions.crossScala,
scalacOptions ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xfatal-warnings", // Fail the compilation if there are any warnings.
"-Xlint", // Enable recommended additional warnings.
"-Ywarn-adapted-args", // Warn if an argument list is modified to match the receiver.
"-Ywarn-dead-code", // Warn when dead code is identified.
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
"-Ywarn-nullary-override", // Warn when non-nullary overrides nullary, e.g. def foo() over def foo.
"-Ywarn-numeric-widen" // Warn when numerics are widened.
),
scalacOptions in Test ~= { (options: Seq[String]) =>
options filterNot (_ == "-Ywarn-dead-code") // Allow dead code in tests (to support using mockito).
},
parallelExecution in Test := false
)
}

////*******************************
//// Scalariform settings
////*******************************
object CodeFormatter extends AutoPlugin {

import com.typesafe.sbt.SbtScalariform._
import scalariform.formatter.preferences.{DoubleIndentClassDeclaration, FormatXml, PreserveDanglingCloseParenthesis}

override def trigger = allRequirements

override def projectSettings = defaultScalariformSettings ++ Seq(
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(FormatXml, false)
.setPreference(DoubleIndentClassDeclaration, false)
.setPreference(PreserveDanglingCloseParenthesis, true)
)
}

////*******************************
//// ScalaDoc settings
////*******************************
object Doc extends AutoPlugin {

import play.core.PlayVersion

override def projectSettings = Seq(
autoAPIMappings := true,
apiURL := Some(url(s"http://silhouette.mohiva.com/api/$version/")),
apiMappings ++= {
implicit val cp = (fullClasspath in Compile).value
Map(
jarFor("com.typesafe.play", "play") -> url(s"http://www.playframework.com/documentation/${PlayVersion.current}/api/scala/"),
scalaInstance.value.libraryJar -> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/")
)
}
)

/**
* Gets the JAR file for a package.
*
* @param organization The organization name.
* @param name The name of the package.
* @param cp The class path.
* @return The file which points to the JAR.
* @see http://stackoverflow.com/a/20919304/2153190
*/
private def jarFor(organization: String, name: String)(implicit cp: Seq[Attributed[File]]): File = {
(for {
entry <- cp
module <- entry.get(moduleID.key)
if module.organization == organization
if module.name.startsWith(name)
jarFile = entry.data
} yield jarFile).head
}
}

////*******************************
//// Maven settings
////*******************************
object Publish extends AutoPlugin {

import xerial.sbt.Sonatype._

override def trigger = allRequirements

private val pom = {
<scm>
<url>git@github.com:mohiva/play-silhouette.git</url>
<connection>scm:git:git@github.com:mohiva/play-silhouette.git</connection>
</scm>
<developers>
<developer>
<id>akkie</id>
<name>Christian Kaps</name>
<url>http://mohiva.com</url>
</developer>
<developer>
<id>fernandoacorreia</id>
<name>Fernando Correia</name>
<url>http://www.fernandocorreia.info/</url>
</developer>
</developers>
}

override def projectSettings = sonatypeSettings ++ Seq(
description := "Authentication library for Play Framework applications that supports several authentication methods, including OAuth1, OAuth2, OpenID, Credentials or custom authentication schemes",
homepage := Some(url("http://silhouette.mohiva.com/")),
licenses := Seq("Apache License" -> url("https://github.com/mohiva/play-silhouette/blob/master/LICENSE")),
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ => false},
pomExtra := pom,
credentials += Credentials(Path.userHome / ".sbt" / "sonatype.credentials")
)
}
31 changes: 31 additions & 0 deletions project/Dependencies.scala
@@ -0,0 +1,31 @@
import sbt._

object Dependencies {

object Versions {
val crossScala = Seq("2.11.4", "2.10.4")
val scalaVersion = crossScala.head
}

val resolvers = Seq(
"Atlassian Releases" at "https://maven.atlassian.com/public/"
)

object Library {

object Play {
val version = play.core.PlayVersion.current
val ws = "com.typesafe.play" %% "play-ws" % version
val cache = "com.typesafe.play" %% "play-cache" % version
val test = "com.typesafe.play" %% "play-test" % version
}

val jbcrypt = "org.mindrot" % "jbcrypt" % "0.3m"
val jwtCore = "com.atlassian.jwt" % "jwt-core" % "1.2.3"
val jwtApi = "com.atlassian.jwt" % "jwt-api" % "1.2.3"
val mockito = "org.mockito" % "mockito-core" % "1.9.5"
val scalaGuice = "net.codingwell" %% "scala-guice" % "4.0.0-beta5"
val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % "2.3.3"
}

}
44 changes: 0 additions & 44 deletions project/Helper.scala

This file was deleted.

2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version=0.13.5
sbt.version=0.13.7
9 changes: 9 additions & 0 deletions silhouette-testkit/build.sbt
@@ -0,0 +1,9 @@
import Dependencies._

libraryDependencies ++= Seq(
Library.Play.test,
Library.mockito % Test,
Library.akkaTestkit % Test
)

enablePlugins(PlayScala, Doc)
15 changes: 15 additions & 0 deletions silhouette/build.sbt
@@ -0,0 +1,15 @@
import Dependencies._

libraryDependencies ++= Seq(
Library.Play.cache,
Library.Play.ws,
Library.jbcrypt,
Library.jwtCore,
Library.jwtApi,
Library.mockito % Test,
Library.scalaGuice % Test,
Library.akkaTestkit % Test
)

enablePlugins(PlayScala, Doc)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.