Skip to content

Commit

Permalink
= Sanitize build, use SBT 0.13.0 goodness
Browse files Browse the repository at this point in the history
  • Loading branch information
stanch committed Jan 12, 2014
1 parent 1804c2e commit 0195efb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 83 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target/
*.iml
.idea
.idea_modules
local-*
95 changes: 12 additions & 83 deletions project/build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,95 +7,30 @@ object build extends Build {
crossVersion := CrossVersion.full,
version := "0.0.1-SNAPSHOT",
organization := "org.dslparadise",
resolvers += Resolver.sonatypeRepo("snapshots"),
resolvers += Resolver.sonatypeRepo("releases"),
publishMavenStyle := true,
publishArtifact in Test := false,
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases")
),
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
scalacOptions ++= Seq("-deprecation", "-feature"),
parallelExecution in Test := false, // hello, reflection sync!!
logBuffered := false,
scalaHome := {
val scalaHome = System.getProperty("dslparadise.scala.home")
if (scalaHome != null) {
println(s"Going for custom scala home at $scalaHome")
Some(file(scalaHome))
} else None
}
logBuffered := false
)

def loadCredentials(): List[Credentials] = {
val mavenSettingsFile = System.getProperty("maven.settings.file")
if (mavenSettingsFile != null) {
println("Loading Sonatype credentials from " + mavenSettingsFile)
try {
import scala.xml._
val settings = XML.loadFile(mavenSettingsFile)
def readServerConfig(key: String) = (settings \\ "settings" \\ "servers" \\ "server" \\ key).head.text
List(Credentials(
"Sonatype Nexus Repository Manager",
"oss.sonatype.org",
readServerConfig("username"),
readServerConfig("password")
))
} catch {
case ex: Exception =>
println("Failed to load Maven settings from " + mavenSettingsFile + ": " + ex)
Nil
}
} else {
// println("Sonatype credentials cannot be loaded: -Dmaven.settings.file is not specified.")
Nil
}
}

lazy val plugin = Project(
id = "dslparadise",
base = file("plugin")
) settings (
sharedSettings : _*
) settings (
resourceDirectory in Compile <<= baseDirectory(_ / "src" / "main" / "scala" / "org" / "dslparadise" / "embedded"),
libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-library" % _),
libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-reflect" % _),
libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-compiler" % _),
resourceDirectory in Compile := baseDirectory.value / "src" / "main" / "scala" / "org" / "dslparadise" / "embedded",
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-library" % scalaVersion.value,
"org.scala-lang" % "scala-compiler" % scalaVersion.value
)
// TODO: how to I make this recursion work?
// run <<= run in Compile in sandbox,
// test <<= test in Test in tests
publishMavenStyle := true,
publishArtifact in Test := false,
publishTo <<= version { v: String =>
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
pomIncludeRepository := { x => false },
pomExtra := (
<description>Compiler support for spores</description>
<url>https://github.com/stanch/dsl-paradise</url>
<inceptionYear>2014</inceptionYear>
<licenses>
<license>
<name>BSD-like</name>
<url>http://www.scala-lang.org/downloads/license.html
</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>git://github.com/stanch/dsl-paradise.git</url>
<connection>scm:git:git://github.com/stanch/dsl-paradise.git</connection>
</scm>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/heathermiller/dsl-paradise/issues</url>
</issueManagement>
<developers>
</developers>
)
// TODO: uncomment this to enable publishing
// credentials ++= loadCredentials()
)

lazy val usePluginSettings = Seq(
Expand All @@ -115,9 +50,6 @@ object build extends Build {
base = file("sandbox")
) settings (
sharedSettings ++ usePluginSettings: _*
) settings (
libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-reflect" % _),
publishArtifact in Compile := false
)

lazy val tests = Project(
Expand All @@ -126,13 +58,10 @@ object build extends Build {
) settings (
sharedSettings ++ usePluginSettings: _*
) settings (
libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-reflect" % _),
libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-compiler" % _),
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value
// TODO: dunno what are the versions of scalatest and scalacheck for 2.11.0-SNAPSHOT
// libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test",
// libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.10.1" % "test",
publishArtifact in Compile := false,
scalacOptions ++= Seq()
// scalacOptions ++= Seq("-Xprint:typer")
// scalacOptions ++= Seq("-Xlog-implicits")
)
Expand Down

0 comments on commit 0195efb

Please sign in to comment.