Get the build ready for publishing releases

Not sure this is quite right, but closer than before.
This commit is contained in:
Havoc Pennington 2011-11-30 16:30:03 -05:00
parent 0ff5f1ff8c
commit 2365db970e
7 changed files with 52 additions and 22 deletions

View File

@ -1,11 +1,27 @@
version in GlobalScope := "0.1"
// to release, bump major/minor/micro as appropriate,
// drop SNAPSHOT, tag and publish.
// add snapshot back so git master is previous release
// with -SNAPSHOT.
// when releasing a SNAPSHOT to the repo, bump the micro
// version at least.
// Also, change the version number in the README.md
// Versions and git tags should follow: http://semver.org/
// except using -SNAPSHOT instead of without hyphen.
// no binary for the root project
publishArtifact in (Compile, packageBin) := false
version in GlobalScope := "0.1.0-SNAPSHOT"
// no javadoc for the root project
publishArtifact in (Compile, packageDoc) := false
organization in GlobalScope := "com.typesafe.config"
// no source for the root project
publishArtifact in (Compile, packageSrc) := false
scalacOptions in GlobalScope in Compile := Seq("-unchecked", "-deprecation")
scalacOptions in GlobalScope in Test := Seq("-unchecked", "-deprecation")
publishTo in GlobalScope <<= (isSnapshot) { snapshot =>
import Classpaths._
Some(if (snapshot) typesafeSnapshots else typesafeResolver)
}
publishMavenStyle in GlobalScope := true
credentials in GlobalScope += Credentials(Path.userHome / ".ivy2" / ".typesafe-credentials")

View File

@ -10,6 +10,8 @@ fork in run := true
fork in run in Test := true
autoScalaLibrary := false
libraryDependencies += "net.liftweb" %% "lift-json" % "2.4-SNAPSHOT" % "test"
libraryDependencies += "com.novocode" % "junit-interface" % "0.7" % "test"
@ -28,4 +30,4 @@ seq(javadocSettings: _*)
JavadocKeys.javadocOptions += "-exclude com.typesafe.config.impl"
doc := error("use the 'javadoc' task instead of 'doc'")
doc in Compile <<= JavadocKeys.javadoc

View File

View File

View File

View File

@ -2,21 +2,42 @@ import sbt._
import Keys._
object ConfigBuild extends Build {
val unpublished = Seq(
// no artifacts in this project
publishArtifact := false,
// make-pom has a more specific publishArtifact setting already
// so needs specific override
publishArtifact in makePom := false,
// can't seem to get rid of ivy files except by no-op'ing the entire publish task
publish := {},
publishLocal := {}
)
// this is in newer sbt versions, for now cut-and-pasted
val isSnapshot = SettingKey[Boolean]("is-snapshot", "True if the the version of the project is a snapshot version.")
override val settings = super.settings ++ Seq(isSnapshot <<= isSnapshot or version(_ endsWith "-SNAPSHOT"))
lazy val root = Project(id = "root",
base = file(".")) aggregate(testLib, configLib, simpleLib, simpleApp)
base = file("."),
settings = Project.defaultSettings ++ unpublished) aggregate(testLib, configLib, simpleLib, simpleApp)
lazy val configLib = Project(id = "config",
base = file("config")) dependsOn(testLib % "test->test")
lazy val testLib = Project(id = "test-lib",
base = file("test-lib"))
base = file("test-lib"),
settings = Project.defaultSettings ++ unpublished)
lazy val simpleLib = Project(id = "simple-lib",
base = file("examples/simple-lib")) dependsOn(configLib)
base = file("examples/simple-lib"),
settings = Project.defaultSettings ++ unpublished) dependsOn(configLib)
lazy val simpleApp = Project(id = "simple-app",
base = file("examples/simple-app")) dependsOn(simpleLib)
base = file("examples/simple-app"),
settings = Project.defaultSettings ++ unpublished) dependsOn(simpleLib)
lazy val complexApp = Project(id = "complex-app",
base = file("examples/complex-app")) dependsOn(simpleLib)
base = file("examples/complex-app"),
settings = Project.defaultSettings ++ unpublished) dependsOn(simpleLib)
}

View File

@ -1,9 +0,0 @@
// no binary
publishArtifact in (Compile, packageBin) := false
// no javadoc
publishArtifact in (Compile, packageDoc) := false
// no source
publishArtifact in (Compile, packageSrc) := false