2011-11-27 07:58:23 +08:00
|
|
|
import sbt._
|
|
|
|
import Keys._
|
2015-01-27 08:31:48 +08:00
|
|
|
import com.typesafe.sbt.osgi.SbtOsgi.{ OsgiKeys, osgiSettings }
|
2015-01-27 08:26:31 +08:00
|
|
|
import com.typesafe.sbt.JavaVersionCheckPlugin.autoImport._
|
2011-11-27 07:58:23 +08:00
|
|
|
|
|
|
|
object ConfigBuild extends Build {
|
2011-12-01 05:30:03 +08:00
|
|
|
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,
|
2014-01-03 22:47:46 +08:00
|
|
|
// no docs to publish
|
|
|
|
publishArtifact in packageDoc := false,
|
2011-12-01 05:30:03 +08:00
|
|
|
// can't seem to get rid of ivy files except by no-op'ing the entire publish task
|
|
|
|
publish := {},
|
2014-01-07 03:55:20 +08:00
|
|
|
publishLocal := {}
|
2011-12-01 05:30:03 +08:00
|
|
|
)
|
|
|
|
|
2015-01-27 08:31:48 +08:00
|
|
|
object sonatype extends PublishToSonatype {
|
2012-04-13 03:21:06 +08:00
|
|
|
def projectUrl = "https://github.com/typesafehub/config"
|
|
|
|
def developerId = "havocp"
|
|
|
|
def developerName = "Havoc Pennington"
|
|
|
|
def developerUrl = "http://ometer.com/"
|
|
|
|
def scmUrl = "git://github.com/typesafehub/config.git"
|
|
|
|
}
|
2011-12-01 05:30:03 +08:00
|
|
|
|
|
|
|
override val settings = super.settings ++ Seq(isSnapshot <<= isSnapshot or version(_ endsWith "-SNAPSHOT"))
|
|
|
|
|
2015-01-27 08:26:31 +08:00
|
|
|
lazy val commonSettings: Seq[Setting[_]] = unpublished ++ Seq(javaVersionPrefix in javaVersionCheck := None)
|
|
|
|
|
2014-01-03 22:47:46 +08:00
|
|
|
lazy val rootSettings: Seq[Setting[_]] =
|
2015-01-27 08:26:31 +08:00
|
|
|
commonSettings ++
|
2014-01-03 22:47:46 +08:00
|
|
|
Seq(aggregate in doc := false,
|
|
|
|
doc := (doc in (configLib, Compile)).value,
|
|
|
|
aggregate in packageDoc := false,
|
|
|
|
packageDoc := (packageDoc in (configLib, Compile)).value)
|
|
|
|
|
2011-11-27 08:42:52 +08:00
|
|
|
lazy val root = Project(id = "root",
|
2011-12-01 05:30:03 +08:00
|
|
|
base = file("."),
|
2014-01-03 22:47:46 +08:00
|
|
|
settings = rootSettings) aggregate(testLib, configLib,
|
|
|
|
simpleLibScala, simpleAppScala, complexAppScala,
|
|
|
|
simpleLibJava, simpleAppJava, complexAppJava)
|
2011-11-27 08:42:52 +08:00
|
|
|
|
|
|
|
lazy val configLib = Project(id = "config",
|
2012-04-13 03:21:06 +08:00
|
|
|
base = file("config"),
|
2012-05-21 17:51:08 +08:00
|
|
|
settings =
|
|
|
|
sonatype.settings ++
|
|
|
|
osgiSettings ++
|
|
|
|
Seq(
|
2014-01-15 22:57:42 +08:00
|
|
|
OsgiKeys.exportPackage := Seq("com.typesafe.config", "com.typesafe.config.impl"),
|
2012-05-21 17:51:08 +08:00
|
|
|
packagedArtifact in (Compile, packageBin) <<= (artifact in (Compile, packageBin), OsgiKeys.bundle).identityMap,
|
2014-01-07 03:39:21 +08:00
|
|
|
artifact in (Compile, packageBin) ~= { _.copy(`type` = "bundle") },
|
2015-01-27 08:31:48 +08:00
|
|
|
publish := sys.error("use publishSigned instead of plain publish"),
|
|
|
|
publishLocal := sys.error("use publishLocalSigned instead of plain publishLocal")
|
|
|
|
)) dependsOn testLib % "test->test"
|
2011-11-27 09:33:27 +08:00
|
|
|
|
2015-01-27 08:26:31 +08:00
|
|
|
def project(id: String, base: File) = Project(id, base, settings = commonSettings)
|
2011-11-29 01:23:21 +08:00
|
|
|
|
2015-01-27 08:31:48 +08:00
|
|
|
lazy val testLib = project("config-test-lib", file("test-lib"))
|
2011-11-29 01:23:21 +08:00
|
|
|
|
2015-01-27 08:31:48 +08:00
|
|
|
lazy val simpleLibScala = project("config-simple-lib-scala", file("examples/scala/simple-lib")) dependsOn configLib
|
|
|
|
lazy val simpleAppScala = project("config-simple-app-scala", file("examples/scala/simple-app")) dependsOn simpleLibScala
|
|
|
|
lazy val complexAppScala = project("config-complex-app-scala", file("examples/scala/complex-app")) dependsOn simpleLibScala
|
2011-11-29 01:23:21 +08:00
|
|
|
|
2015-01-27 08:31:48 +08:00
|
|
|
lazy val simpleLibJava = project("config-simple-lib-java", file("examples/java/simple-lib")) dependsOn configLib
|
|
|
|
lazy val simpleAppJava = project("config-simple-app-java", file("examples/java/simple-app")) dependsOn simpleLibJava
|
|
|
|
lazy val complexAppJava = project("config-complex-app-java", file("examples/java/complex-app")) dependsOn simpleLibJava
|
2011-11-27 07:58:23 +08:00
|
|
|
}
|
2012-04-13 03:21:06 +08:00
|
|
|
|
|
|
|
// from https://raw.github.com/paulp/scala-improving/master/project/PublishToSonatype.scala
|
|
|
|
|
2015-01-27 08:31:48 +08:00
|
|
|
abstract class PublishToSonatype {
|
2012-04-13 03:21:06 +08:00
|
|
|
val ossSnapshots = "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
|
|
val ossStaging = "Sonatype OSS Staging" at "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
|
|
|
|
|
|
|
|
def projectUrl: String
|
|
|
|
def developerId: String
|
|
|
|
def developerName: String
|
|
|
|
def developerUrl: String
|
|
|
|
|
|
|
|
def licenseName = "Apache License, Version 2.0"
|
|
|
|
def licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
|
|
|
|
def licenseDistribution = "repo"
|
|
|
|
def scmUrl: String
|
|
|
|
def scmConnection = "scm:git:" + scmUrl
|
|
|
|
|
2015-01-27 08:31:48 +08:00
|
|
|
def generatePomExtra: xml.NodeSeq = {
|
2012-04-13 03:21:06 +08:00
|
|
|
<url>{ projectUrl }</url>
|
|
|
|
<licenses>
|
|
|
|
<license>
|
|
|
|
<name>{ licenseName }</name>
|
|
|
|
<url>{ licenseUrl }</url>
|
|
|
|
<distribution>{ licenseDistribution }</distribution>
|
|
|
|
</license>
|
|
|
|
</licenses>
|
|
|
|
<scm>
|
|
|
|
<url>{ scmUrl }</url>
|
|
|
|
<connection>{ scmConnection }</connection>
|
|
|
|
</scm>
|
|
|
|
<developers>
|
|
|
|
<developer>
|
|
|
|
<id>{ developerId }</id>
|
|
|
|
<name>{ developerName }</name>
|
|
|
|
<url>{ developerUrl }</url>
|
|
|
|
</developer>
|
|
|
|
</developers>
|
|
|
|
}
|
|
|
|
|
|
|
|
def settings: Seq[Setting[_]] = Seq(
|
|
|
|
publishMavenStyle := true,
|
2015-01-27 08:31:48 +08:00
|
|
|
publishTo <<= isSnapshot { (snapshot) => Some(if (snapshot) ossSnapshots else ossStaging) },
|
2012-04-13 03:21:06 +08:00
|
|
|
publishArtifact in Test := false,
|
|
|
|
pomIncludeRepository := (_ => false),
|
2015-01-27 08:31:48 +08:00
|
|
|
pomExtra := generatePomExtra
|
2012-04-13 03:21:06 +08:00
|
|
|
)
|
|
|
|
}
|