Skip to content

Commit

Permalink
#36 - migrated to sbt 0.13, latest jacoco and docs build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-twiner committed Sep 29, 2014
1 parent 9f54404 commit 682418d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 36 deletions.
14 changes: 7 additions & 7 deletions project/FullDocProject.scala
Expand Up @@ -2,9 +2,9 @@ import sbt._
import Keys._
import sbt.Package._
import java.util.jar.Attributes.Name._
import Defaults._

import Path.{flatRebase => flatR}
import scales.sbtplugins._
import scala.language.implicitConversions

object FullDocs {

Expand Down Expand Up @@ -37,10 +37,10 @@ object FullDocs {
// Include a root folder in the generated archive.
val newBase = "scalaz_%s-%s".format(scalaVersion, version)

val jarsAndPomMappings = artifacts.flatMap(_.values) x flatRebase(newBase)
val etcMappings = ((rootBaseDir / "etc" ** "*") +++ Seq(rootBaseDir / "README")) x rebase(rootBaseDir, newBase)
val fullDocMappings = (fullDocDir ** "*") x rebase(fullDocDir.getParentFile, newBase)
val sxrDocMappings = (sxrDocDirectory ** "*") x rebase(sxrDocDirectory.getParentFile, newBase)
val jarsAndPomMappings = (artifacts.flatMap( x => x.values): PathFinder ) pair flatR(newBase)
val etcMappings = ((rootBaseDir / "etc" ** "*") +++ Seq(rootBaseDir / "README")) pair rebase(rootBaseDir, newBase)
val fullDocMappings = (fullDocDir ** "*") pair rebase(fullDocDir.getParentFile, newBase)
val sxrDocMappings = (sxrDocDirectory ** "*") pair rebase(sxrDocDirectory.getParentFile, newBase)
jarsAndPomMappings ++ etcMappings ++ fullDocMappings ++ sxrDocMappings
}

Expand Down Expand Up @@ -114,7 +114,7 @@ object FullDocs {
// Use `LocalProject("scalaz")` rather than `scalaz` to avoid a circular reference.
(mappings in packageBin in Compile) <<= (
baseDirectory in LocalProject(rootProjectId), baseDirectory, scalaVersion, version,
docDirectory in Compile, allPackagedArtifacts) map artifactMappings
target in Compile in doc, allPackagedArtifacts) map artifactMappings
)
)
}
Expand Down
17 changes: 8 additions & 9 deletions project/ScalesXmlRoot.scala
Expand Up @@ -10,8 +10,8 @@ import SiteKeys.{siteCSS, siteResourceDir,
siteMarkupDocHeaders,
menuBarTitle}

//import de.johoop.jacoco4sbt._
//import JacocoPlugin._
import de.johoop.jacoco4sbt._
import JacocoPlugin._

object ScalesXmlRoot extends Build {

Expand Down Expand Up @@ -67,8 +67,8 @@ object ScalesXmlRoot extends Build {
projects = Seq(core, jaxen), projectId = "site",
projectRoot = file("site"),
sxrVersionMap = {
case v : String if v.startsWith("2.9") =>
"org.scala-tools.sxr" % "sxr_2.9.0" % "0.2.7"
case v : String if v.startsWith("2.10") =>
"org.scala-sbt.sxr" %% "sxr" % "0.3.0"
},
rootProjectId = "scales-xml-root", projectDependencies = Seq(core, jaxen),
standardSettings = standardSettings ++ Utils.resourceSettings ++
Expand Down Expand Up @@ -108,6 +108,8 @@ object ScalesXmlRoot extends Build {
}*/

lazy val standardSettings = Defaults.defaultSettings ++ Seq(
resolvers += Resolver.url("Typesafe Releases", url("http://repo.typesafe.com/typesafe/ivy-releases"))(Resolver.ivyStylePatterns),

/* shellPrompt := { state =>
"sbt (%s)$$$-".format(Project.extract(state).currentProject.id)
},
Expand All @@ -129,10 +131,7 @@ object ScalesXmlRoot extends Build {
//,(SEALED, "true")
)
),
/* requires many other command line options and installations for windows:
-Ddot_exe=%dot_exe%
* against - no spaces
set dot_exe=c:/PROGRA~2/GRAPHV~1.28/bin/dot.exe
/* only works in windows when dot.exe is on the windows PATH
*/
scalacOptions in (Compile, doc) <++= (scalaVersion).map{(v: String) =>
if (v.startsWith("2.10"))
Expand All @@ -146,7 +145,7 @@ object ScalesXmlRoot extends Build {
scalaBinaryVersion <<= scalaVersion(sV => if (CrossVersion.isStable(sV)) CrossVersion.binaryScalaVersion(sV) else sV)
//,
// parallelExecution in jacoco.Config := false
) ++ sonatype.settings// ++ jacoco.settings
) ++ sonatype.settings ++ jacoco.settings
// ++ crazyness

val reconPerf = TaskKey[Unit]("recon-perf")
Expand Down
28 changes: 13 additions & 15 deletions project/Utils.scala
Expand Up @@ -9,7 +9,6 @@ import Defaults._
import java.io.File

import IO._
import Path._

object Utils {

Expand All @@ -24,7 +23,8 @@ object Utils {

new ForkRun(
ForkOptions
(scalaJars = si.jars, javaHome = javaHomeDir, outputStrategy = strategy,
(bootJars = si.jars,
javaHome = javaHomeDir, outputStrategy = strategy,
runJVMOptions = options ++ cp,
workingDirectory = Some(base)) )
} else
Expand All @@ -34,16 +34,14 @@ object Utils {
/**
* Runner that can run caliper tasks or any others requiring the classpath be specified on the forked app
*/
def caliperRunTask(scoped: ScopedTask[Unit], config: sbt.Configuration, arguments: String*): Setting[Task[Unit]] =
scoped <<= ( initScoped(scoped.scopedKey, cpRunnerInit(config)) zipWith (fullClasspath in config, streams).identityMap ) { case (rTask, t) =>
(t :^: rTask :^: KNil) map { case (cp, s) :+: r :+: HNil =>
sbt.toError(r.run( "com.google.caliper.Runner", Build.data(cp),
arguments, s.log))
def caliperRunTask(task: TaskKey[Unit], config: sbt.Configuration, arguments: String*): Setting[Task[Unit]] =
task :=
{
val scoped = initScoped(Scoped.taskScopedToKey(task), cpRunnerInit(config)).value
val cp = (fullClasspath in config).value
sbt.toError(scoped.run( "com.google.caliper.Runner", Attributed.data(cp),
arguments, streams.value.log))
}
}

// provided by IO now
// lazy val utf8 = java.nio.charset.Charset.forName("UTF-8")

/**
* I don't find the orElse helps with reading ~> seems to indicate flow more
Expand Down Expand Up @@ -73,7 +71,7 @@ object Utils {
try {
t
} catch {
case e => log.error("Could not perform io because of " + e.getMessage)
case e: Throwable => log.error("Could not perform io because of " + e.getMessage)
Some(e.getMessage)
}
}
Expand All @@ -82,7 +80,7 @@ object Utils {
try {
Right(t)
} catch {
case e => log.error("Could not perform io because of " + e.getMessage)
case e: Throwable => log.error("Could not perform io because of " + e.getMessage)
Left(e.getMessage)
}
}
Expand Down Expand Up @@ -335,13 +333,13 @@ object Utils {
try{
Some(new java.io.FileInputStream(f))
} catch {
case e => None
case _: Throwable => None
}

def getOStream( f : File ) : Option[java.io.FileOutputStream] =
try{
Some(new java.io.FileOutputStream(f))
} catch {
case e => None
case _: Throwable => None
}
}
2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version=0.12.1
sbt.version=0.13.6
10 changes: 6 additions & 4 deletions project/plugins.sbt
Expand Up @@ -5,13 +5,15 @@ libraryDependencies ++= Seq(
"org.eclipse.mylyn.wikitext.mediawiki" % "mw.core" % "1.4.0-I20110104-0100-e3x",
"scales.sbtplugins" % "resources" % "0.1",
// markdown lib
"com.tristanhunt" % "knockoff_2.9.1" % "0.8.0-16",
"com.tristanhunt" % "knockoff_2.9.1" % "0.8.0-16"
/*,
"org.jacoco" % "org.jacoco.core" % "0.5.7.201204190339" artifacts(Artifact("org.jacoco.core", "jar", "jar")),
"org.jacoco" % "org.jacoco.report" % "0.5.7.201204190339" artifacts(Artifact("org.jacoco.report", "jar", "jar"))
"org.jacoco" % "org.jacoco.report" % "0.5.7.201204190339" artifacts(Artifact("org.jacoco.report", "jar", "jar"))*/
)

resolvers += Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)

addSbtPlugin("com.jsuereth" % "xsbt-gpg-plugin" % "0.6")
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")
//addSbtPlugin("com.jsuereth" % "xsbt-gpg-plugin" % "0.6")

//addSbtPlugin("de.johoop" % "jacoco4sbt" % "1.2.3")
addSbtPlugin("de.johoop" % "jacoco4sbt" % "2.1.6")

0 comments on commit 682418d

Please sign in to comment.