diff --git a/build.sbt b/build.sbt
index c43e18f..44fd898 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,13 +1,32 @@
-git.baseVersion := "1.0"
+import bintray.Keys._
+
+git.baseVersion := "1.0.0"
versionWithGit
-name := "scala-module-plugin"
+name := "scala-module-plugin"
+
+organization := "org.scala-lang.modules"
+
+sbtPlugin := true
-organization := "org.scala-lang.modules"
+// sbtVersion in Global := "0.13.1"
-sbtPlugin := true
+// scalaVersion in Global := "2.10.3"
-publishTo := Some(Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns))
+// publishTo := Some(if (version.value.trim.endsWith("SNAPSHOT")) Classpaths.sbtPluginSnapshots else Classpaths.sbtPluginReleases)
publishMavenStyle := false
+
+bintrayPublishSettings
+
+resolvers += Classpaths.sbtPluginReleases
+
+licenses := Seq("BSD" -> url("http://opensource.org/licenses/BSD"))
+
+repository in bintray := "sbt-plugins"
+
+bintrayOrganization in bintray := None
+
+// this plugin depends on the sbt-osgi plugin -- 2-for-1!
+addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.7.0")
diff --git a/project/build.properties b/project/build.properties
index 0974fce..37b489c 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version=0.13.0
+sbt.version=0.13.1
diff --git a/project/plugins.sbt b/project/plugins.sbt
index f4fa202..54862d5 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1 +1,4 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.6.2")
+
+// incompatible with sbt-gpg (https://github.com/softprops/bintray-sbt/pull/10)
+addSbtPlugin("me.lessis" % "bintray-sbt" % "0.1.1")
diff --git a/src/main/scala/ScalaModulePlugin.scala b/src/main/scala/ScalaModulePlugin.scala
index 6dd31c1..1d2721a 100644
--- a/src/main/scala/ScalaModulePlugin.scala
+++ b/src/main/scala/ScalaModulePlugin.scala
@@ -1,100 +1,102 @@
import sbt._
import Keys._
+import com.typesafe.sbt.osgi.{OsgiKeys, SbtOsgi}
object ScalaModulePlugin extends Plugin {
+ val snapshotScalaBinaryVersion = settingKey[String]("The Scala binary version to use when building against Scala SNAPSHOT.")
+ val repoName = settingKey[String]("The name of the repository under github.com/scala/.")
- val includeTestDependencies = settingKey[Boolean]("Include testing dependencies when building. Used to break cycles when doing full builds.")
- val partestVersion = settingKey[String]("the partest version we want to use.")
-
- def scalaModuleSettings: Seq[Setting[_]] =
- Seq(
- partestVersion := "1.0-RC5",
- organization := "org.scala-lang.modules",
- // don't use for doc scope, scaladoc warnings are not to be reckoned with
- scalacOptions in (Compile, compile) ++= Seq("-optimize", "-Xfatal-warnings", "-feature", "-deprecation", "-unchecked", "-Xlint"),
- // Generate $name.properties to store our version as well as the scala version used to build
- resourceGenerators in Compile <+= Def.task {
- val props = new java.util.Properties
- props.put("version.number", version.value)
- props.put("scala.version.number", scalaVersion.value)
- props.put("scala.binary.version.number", scalaBinaryVersion.value)
- val file = (resourceManaged in Compile).value / s"${name.value}.properties"
- IO.write(props, null, file)
- Seq(file)
- },
- mappings in (Compile, packageBin) += {
- (baseDirectory.value / s"${name.value}.properties") -> s"${name.value}.properties"
- },
- // maven publishing
- publishTo := {
- val nexus = "https://oss.sonatype.org/"
- if (version.value.trim.endsWith("SNAPSHOT"))
- Some("snapshots" at nexus + "content/repositories/snapshots")
- else
- Some("releases" at nexus + "service/local/staging/deploy/maven2")
- },
- publishMavenStyle := true,
- publishArtifact in Test := false,
- pomIncludeRepository := { _ => false },
- pomExtra := (
- http://www.scala-lang.org/
- 2002
-
-
- repo
- BSD 3-Clause
- https://github.com/scala/{name.value}/blob/master/LICENSE.md
-
-
-
- scm:git:git://github.com/scala/{name.value}.git
- https://github.com/scala/{name.value}
-
-
- JIRA
- https://issues.scala-lang.org/
-
-
-
- epfl
- EPFL
-
-
- Typesafe
- Typesafe, Inc.
-
-
- ),
- // default value must be set here
- includeTestDependencies := true,
- // the actual partest the interface calls into -- must be binary version close enough to ours
- // so that it can link to the compiler/lib we're using (testing)
- libraryDependencies ++= (
- if (includeTestDependencies.value)
- Seq("org.scala-lang.modules" %% "scala-partest-interface" % "0.2" % "test",
- "org.scala-lang.modules" %% "scala-partest" % partestVersion.value % "test")
- else Seq.empty
- ),
- // necessary for partest -- see comments in its build.sbt
- conflictWarning ~= { _.copy(failOnConflict = false) },
- fork in Test := true,
- javaOptions in Test += "-Xmx1G",
- testFrameworks += new TestFramework("scala.tools.partest.Framework"),
- definedTests in Test += (
- new sbt.TestDefinition(
- "partest",
- // marker fingerprint since there are no test classes
- // to be discovered by sbt:
- new sbt.testing.AnnotatedFingerprint {
- def isModule = true
- def annotationName = "partest"
- }, true, Array())
- )
-
- // TODO: mima
- // import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
- // import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
- // previousArtifact := Some(organization.value %% name.value % binaryReferenceVersion.value)
- )
+ def deriveBinaryVersion(sv: String, snapshotScalaBinaryVersion: String) = sv match {
+ case snap_211 if snap_211.startsWith("2.11") &&
+ snap_211.contains("-SNAPSHOT") => snapshotScalaBinaryVersion
+ case sv => sbt.CrossVersion.binaryScalaVersion(sv)
+ }
+ // a setting-transform to turn the regular version into something osgi can deal with
+ val osgiVersion = version(_.replace('-', '.'))
+
+ lazy val scalaModuleSettings = Seq(
+ repoName := name.value,
+
+ organization := "org.scala-lang.modules",
+
+ scalaBinaryVersion := deriveBinaryVersion(scalaVersion.value, snapshotScalaBinaryVersion.value),
+
+ // so we don't have to wait for sonatype to synch to maven central when deploying a new module
+ resolvers += Resolver.sonatypeRepo("releases"),
+
+ // to allow compiling against snapshot versions of Scala
+ resolvers += Resolver.sonatypeRepo("snapshots"),
+
+ // don't use for doc scope, scaladoc warnings are not to be reckoned with
+ // TODO: turn on for nightlies, but don't enable for PR validation... "-Xfatal-warnings"
+ scalacOptions in compile ++= Seq("-optimize", "-feature", "-deprecation", "-unchecked", "-Xlint"),
+
+ // Generate $name.properties to store our version as well as the scala version used to build
+ resourceGenerators in Compile <+= Def.task {
+ val props = new java.util.Properties
+ props.put("version.number", version.value)
+ props.put("scala.version.number", scalaVersion.value)
+ props.put("scala.binary.version.number", scalaBinaryVersion.value)
+ val file = (resourceManaged in Compile).value / s"${name.value}.properties"
+ IO.write(props, null, file)
+ Seq(file)
+ },
+
+ mappings in (Compile, packageBin) += {
+ (baseDirectory.value / s"${name.value}.properties") -> s"${name.value}.properties"
+ },
+
+ publishArtifact in Test := false,
+
+ // maven publishing
+ publishTo := Some(
+ if (version.value.trim.endsWith("SNAPSHOT")) Resolver.sonatypeRepo("snapshots")
+ else Opts.resolver.sonatypeStaging
+ ),
+ credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"),
+
+ publishMavenStyle := true,
+ scmInfo := Some(ScmInfo(url(s"https://github.com/scala/${repoName.value}"),s"scm:git:git://github.com/scala/${repoName.value}.git")),
+ homepage := Some(url("http://www.scala-lang.org/")),
+ organizationHomepage := Some(url("http://www.scala-lang.org/")),
+ licenses := Seq("BSD 3-clause" -> url("http://opensource.org/licenses/BSD-3-Clause")),
+ startYear := Some(2002),
+ pomIncludeRepository := { _ => false },
+ pomExtra := (
+
+ JIRA
+ https://issues.scala-lang.org/
+
+
+
+ epfl
+ EPFL
+
+
+ Typesafe
+ Typesafe, Inc.
+
+
+ ),
+
+ OsgiKeys.bundleSymbolicName := s"${organization.value}.${name.value}",
+ OsgiKeys.bundleVersion := osgiVersion.value,
+
+ // Sources should also have a nice MANIFEST file
+ packageOptions in packageSrc := Seq(Package.ManifestAttributes(
+ ("Bundle-SymbolicName", s"${organization.value}.${name.value}.source"),
+ ("Bundle-Name", s"${name.value} sources"),
+ ("Bundle-Version", osgiVersion.value),
+ ("Eclipse-SourceBundle", s"""${organization.value}.${name.value};version="${osgiVersion.value}";roots:="."""")
+ ))
+
+
+ // TODO: mima
+ // resolvers += Classpaths.typesafeResolver
+ // addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.5")
+ // import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
+ // import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
+ // previousArtifact := Some(organization.value %% name.value % binaryReferenceVersion.value)
+ )
}