From d774bc2afec6d4878353c3400cf93deb37ae3505 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Thu, 3 Aug 2017 10:43:54 +0100 Subject: [PATCH] Migrate to sbt 0.13.16 --- build.sbt | 65 +++++++++++++++++ config/build.sbt | 2 +- project/Build.scala | 119 -------------------------------- project/PublishToSonatype.scala | 48 +++++++++++++ project/build.properties | 2 +- 5 files changed, 115 insertions(+), 121 deletions(-) delete mode 100644 project/Build.scala create mode 100644 project/PublishToSonatype.scala diff --git a/build.sbt b/build.sbt index 65be9256..1eba6413 100644 --- a/build.sbt +++ b/build.sbt @@ -13,6 +13,58 @@ scalacOptions in GlobalScope in Test := Seq("-unchecked", "-deprecation", "-feat scalaVersion in ThisBuild := "2.10.4" +val sonatype = new PublishToSonatype { + 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" +} + +lazy val commonSettings: Seq[Setting[_]] = Def.settings( + unpublished, + javaVersionPrefix in javaVersionCheck := None +) + +lazy val root = (project in file(".")) + .settings( + commonSettings, + aggregate in doc := false, + doc := (doc in (configLib, Compile)).value, + aggregate in packageDoc := false, + packageDoc := (packageDoc in (configLib, Compile)).value, + aggregate in checkstyle := false, + checkstyle := (checkstyle in (configLib, Compile)).value + ) + .aggregate( + testLib, configLib, + simpleLibScala, simpleAppScala, complexAppScala, + simpleLibJava, simpleAppJava, complexAppJava + ) + +lazy val configLib = Project("config", file("config")) + .settings( + sonatype.settings, + osgiSettings, + OsgiKeys.exportPackage := Seq("com.typesafe.config", "com.typesafe.config.impl"), + publish := sys.error("use publishSigned instead of plain publish"), + publishLocal := sys.error("use publishLocalSigned instead of plain publishLocal") + ) + .enablePlugins(SbtOsgi) + .dependsOn(testLib % "test->test") + +def proj(id: String, base: File) = Project(id, base) settings commonSettings + +lazy val testLib = proj("config-test-lib", file("test-lib")) + +lazy val simpleLibScala = proj("config-simple-lib-scala", file("examples/scala/simple-lib")) dependsOn configLib +lazy val simpleAppScala = proj("config-simple-app-scala", file("examples/scala/simple-app")) dependsOn simpleLibScala +lazy val complexAppScala = proj("config-complex-app-scala", file("examples/scala/complex-app")) dependsOn simpleLibScala + +lazy val simpleLibJava = proj("config-simple-lib-java", file("examples/java/simple-lib")) dependsOn configLib +lazy val simpleAppJava = proj("config-simple-app-java", file("examples/java/simple-app")) dependsOn simpleLibJava +lazy val complexAppJava = proj("config-complex-app-java", file("examples/java/complex-app")) dependsOn simpleLibJava + useGpg := true aggregate in PgpKeys.publishSigned := false @@ -20,3 +72,16 @@ PgpKeys.publishSigned := (PgpKeys.publishSigned in configLib).value aggregate in PgpKeys.publishLocalSigned := false PgpKeys.publishLocalSigned := (PgpKeys.publishLocalSigned in configLib).value + +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, + // no docs to publish + publishArtifact in packageDoc := false, + // can't seem to get rid of ivy files except by no-op'ing the entire publish task + publish := {}, + publishLocal := {} +) diff --git a/config/build.sbt b/config/build.sbt index 7d3fbe21..5249ee59 100644 --- a/config/build.sbt +++ b/config/build.sbt @@ -62,7 +62,7 @@ checkstyle in Compile := { } // add checkstyle as a dependency of doc -doc in Compile <<= (doc in Compile).dependsOn(checkstyle in Compile) +doc in Compile := ((doc in Compile).dependsOn(checkstyle in Compile)).value findbugsSettings findbugsReportType := Some(ReportType.Html) diff --git a/project/Build.scala b/project/Build.scala deleted file mode 100644 index 00d33767..00000000 --- a/project/Build.scala +++ /dev/null @@ -1,119 +0,0 @@ -import sbt._ -import Keys._ -import com.etsy.sbt.checkstyle.CheckstylePlugin.autoImport._ -import com.typesafe.sbt.osgi.SbtOsgi -import com.typesafe.sbt.osgi.SbtOsgi.autoImport._ -import com.typesafe.sbt.JavaVersionCheckPlugin.autoImport._ - -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, - // no docs to publish - publishArtifact in packageDoc := false, - // can't seem to get rid of ivy files except by no-op'ing the entire publish task - publish := {}, - publishLocal := {} - ) - - object sonatype extends PublishToSonatype { - 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" - } - - override val settings = super.settings ++ Seq(isSnapshot <<= isSnapshot or version(_ endsWith "-SNAPSHOT")) - - lazy val commonSettings: Seq[Setting[_]] = unpublished ++ Seq(javaVersionPrefix in javaVersionCheck := None) - - lazy val rootSettings: Seq[Setting[_]] = - commonSettings ++ - Seq(aggregate in doc := false, - doc := (doc in (configLib, Compile)).value, - aggregate in packageDoc := false, - packageDoc := (packageDoc in (configLib, Compile)).value, - aggregate in checkstyle := false, - checkstyle := (checkstyle in (configLib, Compile)).value) - - lazy val root = Project(id = "root", - base = file("."), - settings = rootSettings) aggregate(testLib, configLib, - simpleLibScala, simpleAppScala, complexAppScala, - simpleLibJava, simpleAppJava, complexAppJava) - - lazy val configLib = Project(id = "config", - base = file("config"), - settings = - sonatype.settings ++ - osgiSettings ++ - Seq( - OsgiKeys.exportPackage := Seq("com.typesafe.config", "com.typesafe.config.impl"), - publish := sys.error("use publishSigned instead of plain publish"), - publishLocal := sys.error("use publishLocalSigned instead of plain publishLocal") - )).enablePlugins(SbtOsgi) dependsOn testLib % "test->test" - - def project(id: String, base: File) = Project(id, base, settings = commonSettings) - - lazy val testLib = project("config-test-lib", file("test-lib")) - - 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 - - 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 -} - -// from https://raw.github.com/paulp/scala-improving/master/project/PublishToSonatype.scala - -abstract class PublishToSonatype { - 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 - - def generatePomExtra: xml.NodeSeq = { - { projectUrl } - - - { licenseName } - { licenseUrl } - { licenseDistribution } - - - - { scmUrl } - { scmConnection } - - - - { developerId } - { developerName } - { developerUrl } - - - } - - def settings: Seq[Setting[_]] = Seq( - publishMavenStyle := true, - publishTo <<= isSnapshot { (snapshot) => Some(if (snapshot) ossSnapshots else ossStaging) }, - publishArtifact in Test := false, - pomIncludeRepository := (_ => false), - pomExtra := generatePomExtra - ) -} diff --git a/project/PublishToSonatype.scala b/project/PublishToSonatype.scala new file mode 100644 index 00000000..b6b7ca54 --- /dev/null +++ b/project/PublishToSonatype.scala @@ -0,0 +1,48 @@ +import sbt._, Keys._ + +// from https://raw.github.com/paulp/scala-improving/master/project/PublishToSonatype.scala +abstract class PublishToSonatype { + 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 + + def generatePomExtra: xml.NodeSeq = { + { projectUrl } + + + { licenseName } + { licenseUrl } + { licenseDistribution } + + + + { scmUrl } + { scmConnection } + + + + { developerId } + { developerName } + { developerUrl } + + + } + + def settings: Seq[Setting[_]] = Seq( + publishMavenStyle := true, + publishTo := Some(if (isSnapshot.value) ossSnapshots else ossStaging), + publishArtifact in Test := false, + pomIncludeRepository := (_ => false), + pomExtra := generatePomExtra + ) +} diff --git a/project/build.properties b/project/build.properties index 43b8278c..c091b86c 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.11 +sbt.version=0.13.16