Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to sbt 0.13.16 #483

Merged
merged 1 commit into from
Aug 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,75 @@ 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
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 := {}
)
2 changes: 1 addition & 1 deletion config/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
119 changes: 0 additions & 119 deletions project/Build.scala

This file was deleted.

48 changes: 48 additions & 0 deletions project/PublishToSonatype.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import sbt._, Keys._

// from https://raw.github.com/paulp/scala-improving/master/project/PublishToSonatype.scala
abstract class PublishToSonatype {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why an abstract class here?
Shouldn't it be an object or an AutoPlugin?

Copy link
Member Author

@dwijnand dwijnand Aug 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has undefined defs.

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 = {
<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,
publishTo := Some(if (isSnapshot.value) ossSnapshots else ossStaging),
publishArtifact in Test := false,
pomIncludeRepository := (_ => false),
pomExtra := generatePomExtra
)
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.11
sbt.version=0.13.16