8000 Initial commit of empty project config. · randomcoding/scala-utilities@96bdd7a · GitHub
[go: up one dir, main page]

Skip to content

Commit 96bdd7a

Browse files
committed
Initial commit of empty project config.
1 parent 404b65c commit 96bdd7a

File tree

8 files changed

+226
-0
lines changed

8 files changed

+226
-0
lines changed

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.scala_dependencies
2+
target/
3+
.target/
4+
bin/
5+
*.class
6+
*.jar
7+
*.swap
8+
.~lock
9+
*.ser
10+
.scala_dependencies
11+
.bak
12+
.old
13+
*~
14+
*swp
15+
build/
16+
temp/
17+
tmp/
18+
*.o
19+
.cache
20+
21+
# SBT Generated project stuff
22+
project/project/
23+

project/BuildSettings.scala

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import sbt._
2+
import Keys._
3+
4+
import com.typesafe.sbteclipse.core.EclipsePlugin._
5+
6+
/**
7+
* Common build settings for projects.
8+
*/
9+
object BuildSettings {
10+
11+
val buildOrganization = "uk.co.randomcoding"
12+
val buildVersion = "0.1.0-SNAPSHOT"
13+
val buildScalaVersion = "2.9.2"
14+
15+
val buildSettings = Defaults.defaultSettings ++ Seq(
16+
organization := buildOrganization,
17+
version := buildVersion,
18+
scalaVersion := buildScalaVersion,
19+
parallelExecution in Test := false,
20+
shellPrompt := ShellPrompt.buildShellPrompt,
21+
scalacOptions := Seq("-deprecation", "-unchecked"),
22+
EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Resource,
23+
unmanagedSourceDirectories in Compile <<= (scalaSource in Compile)(Seq(_)),
24+
unmanagedSourceDirectories in Test <<= (scalaSource in Test)(Seq(_))
25+
)
26+
27+
}

project/Dependencies.scala

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import sbt._
2+
3+
/**
4+
* Declaration of dependencies, library versions etc.
5+
*/
6+
object Dependencies {
7+
// Common Versions for libraries
8+
val liftVersion = "2.4"
9+
10+
// Functions to create dependencies
11+
val liftDep = (componentId: String, scope: String ) => "net.liftweb" %% componentId % liftVersion % scope
12+
13+
// Actual dependencies
14+
// liftweb
15+
val liftUtil = liftDep("lift-util", "compile")
16+
val liftCommon = liftDep("lift-common", "compile")
17+
val liftWebkit = liftDep("lift-webkit", "compile")
18+
val liftMongoRecord = liftDep("lift-mongodb-record", "compile")
19+
20+
// Rogue - used for Mongo DB Queries
21+
val rogue = "com.foursquare" %% "rogue" % "1.1.1" intransitive()
22+
23+
// Joda time
24+
val jodaTime = "joda-time" % "joda-time" % "2.0"
25+
val jodaConvert = "org.joda" % "joda-convert" % "1.2"
26+
27+
// jetty
28+
val jettyVersion = "8.0.3.v20111011"
29+
val jetty = "org.eclipse.jetty" % "jetty-webapp" % jettyVersion % "container"
30+
val logback = "ch.qos.logback" % "logback-classic" % "1.0.0"
31+
32+
val scalatest = "org.scalatest" %% "scalatest" % "1.8" % "test"
33+
34+
val groovy = "org.codehaus.groovy" % "groovy" % "2.0.0"
35+
36+
// Dependency groups
37+
val testDeps = Seq(scalatest)
38+
val liftDeps = Seq(liftUtil, liftCommon, liftWebkit, liftMongoRecord, rogue)
39+
val loggingDeps = Seq(logback, groovy, liftCommon)
40+
val jettyDeps = Seq(jetty)
41+
val jodaDeps = Seq(jodaTime, jodaConvert)
42+
}
43+

project/ProjectBuild.scala

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import sbt._
2+
import Keys._
3+
4+
import com.typesafe.sbteclipse.core.EclipsePlugin._
5+
6+
object ProjectBuild extends Build {
7+
import BuildSettings._
8+
import ShellPrompt._
9+
import Dependencies._
10+
11+
lazy val root = Project("root",
12+
file("."),
13+
settings = buildSettings ++ Unidoc.settings ++ Seq (
14+
scaladocOptions := Seq(),
15+
// Disable publish and publish-local for empty root project
16+
publish := {},
17+
publishLocal := {}
18+
)
19+
) aggregate(coreProject, liftProject)
20+
21+
lazy val coreProject: Project = Project("core",
22+
file("scala-utilities-core"),
23+
delegates = root :: Nil,
24+
settings = buildSettings ++ Seq(libraryDependencies ++= coreProjectDeps,
25+
name := "scala-utilities-core"
26+
)
27+
)
28+
29+
lazy val liftProject: Project = Project("lift",
30+
file("scala-utilities-lift"),
31+
settings = buildSettings ++ Seq(libraryDependencies ++= liftProjectDeps,
32+
name := "scala-utilities-lift"
33+
)
34+
) dependsOn(coreProject)
35+
36+
val commonDeps = testDeps ++ jodaDeps
37+
val coreProjectDeps = commonDeps
38+
val liftProjectDeps = commonDeps ++ liftDeps ++ jettyDeps
39+
}
40+

project/Resolvers.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import sbt._
2+
import Keys._
3+
4+
object Resolvers {
5+
val snapshotsRepo = ScalaToolsSnapshots
6+
7+
val snapshots = Seq(snapshotsRepo)
8+
}

project/ShellPrompt.scala

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import sbt._
2+
3+
/**
4+
* Shell prompt which show the current project,
5+
* git branch and build version
6+
*/
7+
object ShellPrompt {
8+
object devnull extends ProcessLogger {
9+
def info (s: => String) {}
10+
def error (s: => String) { }
11+
def buffer[T] (f: => T): T = f
12+
}
13+
def currBranch = (
14+
("git status -sb" lines_! devnull headOption)
15+
getOrElse "-" stripPrefix "## "
16+
)
17+
18+
val buildShellPrompt = {
19+
(state: State) => {
20+
val currProject = Project.extract (state).currentProject.id
21+
"%s:%s:%s> ".format (
22+
currProject, currBranch, BuildSettings.buildVersion
23+
)
24+
}
25+
}
26+
}
27+

project/Unidoc.scala

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import sbt._
2+
import Keys._
3+
import Project.Initialize
4+
5+
/**
6+
* Originally from https://github.com/jboner/akka/blob/master/project/Unidoc.scala
7+
*/
8+
object Unidoc {
9+
val unidocDirectory = SettingKey[File]("unidoc-directory")
10+
val unidocExclude = SettingKey[Seq[String]]("unidoc-exclude")
11+
val unidocAllSources = TaskKey[Seq[Seq[File]]]("unidoc-all-sources")
12+
val unidocSources = TaskKey[Seq[File]]("unidoc-sources")
13+
val unidocAllClasspaths = TaskKey[Seq[Classpath]]("unidoc-all-classpaths")
14+
val unidocClasspath = TaskKey[Seq[File]]("unidoc-classpath")
15+
val unidoc = TaskKey[File]("unidoc", "Create unified scaladoc for all aggregates")
16+
17+
lazy val settings = Seq(
18+
unidocDirectory <<= crossTarget / "unidoc",
19+
unidocExclude := Seq.empty,
20+
unidocAllSources <<= (thisProjectRef, buildStructure, unidocExclude) flatMap allSources,
21+
unidocSources <<= unidocAllSources map { _.flatten },
22+
unidocAllClasspaths <<= (thisProjectRef, buildStructure, unidocExclude) flatMap allClasspaths,
23+
unidocClasspath <<= unidocAllClasspaths map { _.flatten.map(_.data).distinct },
24+
unidoc <<= unidocTask
25+
)
26+
27+
def allSources(projectRef: ProjectRef, structure: Load.BuildStructure, exclude: Seq[String]): Task[Seq[Seq[File]]] = {
28+
val projects = aggregated(projectRef, structure, exclude)
29+
projects flatMap { sources in Compile in LocalProject(_) get structure.data } join
30+
}
31+
32+
def allClasspaths(projectRef: ProjectRef, structure: Load.BuildStructure, exclude: Seq[String]): Task[Seq[Classpath]] = {
33+
val projects = aggregated(projectRef, structure, exclude)
34+
projects flatMap { dependencyClasspath in Compile in LocalProject(_) get structure.data } join
35+
}
36+
37+
def aggregated(projectRef: ProjectRef, structure: Load.BuildStructure, exclude: Seq[String]): Seq[String] = {
38+
val aggregate = Project.getProject(projectRef, structure).toSeq.flatMap(_.aggregate)
39+
aggregate flatMap { ref =>
40+
if (exclude contains ref.project) Seq.empty
41+
else ref.project +: aggregated(ref, structure, exclude)
42+
}
43+
}
44+
45+
def unidocTask: Initialize[Task[File]] = {
46+
(compilers, cacheDirectory, unidocSources, unidocClasspath, unidocDirectory, scaladocOptions in Compile, streams) map {
47+
(compilers, cache, sources, classpath, target, options, s) => {
48+
val scaladoc = new Scaladoc(100, compilers.scalac)
49+
scaladoc.cached(cache / "unidoc", "main", sources, classpath, target, options, s.log)
50+
target
51+
}
52+
}
53+
}
54+
}
55+

project/plugins.sbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Eclipse SBT
2+
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1")
3+

0 commit comments

Comments
 (0)
0