Skip to content

Commit

Permalink
update sonatype publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
godenji committed Jul 15, 2017
1 parent ad2cead commit d438e49
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 15 deletions.
51 changes: 36 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
val sbtScalariform = Project("sbt-scalariform", file("."))

val projectName = "sbt-scalariform"
val sbtScalariform = Project(projectName, file("."))
sbtPlugin := true
organization := "org.scalariform"
name := "sbt-scalariform"
name := projectName
sonatypeProfileName := organization.value
version in ThisBuild := "1.7.0"
scalaVersion := "2.10.6"

licenses := Seq(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0")))
homepage := scmInfo.value map (_.browseUrl)
scmInfo := Some(ScmInfo(url("https://github.com/sbt/sbt-scalariform"), "scm:git:[email protected]:sbt/sbt-scalariform.git"))
developers := List(
Developer("hseeberger", "Heiko Seeberger", "mail at heikoseeberger de", url("http://blog.heikoseeberger.name/")),
Developer("daniel-trinh", "Daniel Trinh", "daniel s trinh at gmail com", url("http://danieltrinh.com"))
)

sbtPlugin := true
scmInfo :=
Some(
ScmInfo(url("https://github.com/sbt/sbt-scalariform"),
"scm:git:[email protected]:sbt/sbt-scalariform.git")
)
developers := List(
Developer(
"hseeberger", "Heiko Seeberger", "mail at heikoseeberger de",
url("http://blog.heikoseeberger.name/")
),
Developer(
"daniel-trinh", "Daniel Trinh", "daniel s trinh at gmail com",
url("http://danieltrinh.com")
)
)

scalacOptions ++= List(
"-unchecked",
Expand All @@ -23,8 +34,6 @@ scalacOptions ++= List(
"-encoding", "UTF-8"
)

resolvers ++= Seq(sonatypeSnapshots, sonatypeReleases)

libraryDependencies += "org.scalariform" %% "scalariform" % "0.2.1"

com.typesafe.sbt.SbtScalariform.ScalariformKeys.preferences := {
Expand All @@ -37,10 +46,22 @@ com.typesafe.sbt.SbtScalariform.ScalariformKeys.preferences := {
.setPreference(SpacesAroundMultiImports, true)
}

publishTo := Some(if (isSnapshot.value) sonatypeSnapshots else sonatypeReleases)
publishMavenStyle := true
publishArtifact in Test := false
publishArtifact in (Compile, packageDoc) := true
publishArtifact in (Compile, packageSrc) := true
pomIncludeRepository := { _ => false }
buildInfoKeys := Seq[BuildInfoKey](version)
buildInfoPackage := projectName
publishTo := getPublishToRepo.value
credentials ++= {
val creds = Path.userHome / ".m2" / "credentials"
if (creds.exists) Seq(Credentials(creds)) else Nil
}

val sonatypeSnapshots = "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
val sonatypeReleases = "Sonatype OSS Releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def getPublishToRepo = Def.setting {
if (isSnapshot.value)
Some(Opts.resolver.sonatypeSnapshots)
else
Some(Opts.resolver.sonatypeStaging)
}
3 changes: 3 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.6.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")

0 comments on commit d438e49

Please sign in to comment.