Skip to content

Commit ee114b0

Browse files
committed
Polishing the build
- move to maven group org.scala-lang.modules / scala-async - add config to publish to sonatype OSS - generate a scala-async.properties files (ala the scala-parser-combinators build)
1 parent 0cb09c2 commit ee114b0

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

build.sbt

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
scalaVersion := "2.10.3-RC1"
22

3-
organization := "org.typesafe.async" // TODO new org name under scala-lang.
4-
53
// Uncomment to test with a locally built copy of Scala.
64
// scalaHome := Some(file("/code/scala2/build/pack"))
75

6+
7+
organization := "org.scala-lang.modules.async" // TODO new org name under scala-lang.
8+
89
name := "scala-async"
910

1011
version := "1.0.0-SNAPSHOT"
@@ -45,10 +46,26 @@ libraryDependencies ++= (scalaHome.value match {
4546

4647
scalacOptions += "-P:continuations:enable"
4748

48-
scalacOptions ++= Seq("-deprecation", "-unchecked", "-Xlint", "-feature")
49+
scalacOptions in compile ++= Seq("-optimize", "-deprecation", "-unchecked", "-Xlint", "-feature")
4950

5051
scalacOptions in Test ++= Seq("-Yrangepos")
5152

53+
// Generate $name.properties to store our version as well as the scala version used to build
54+
resourceGenerators in Compile <+= Def.task {
55+
val props = new java.util.Properties
56+
props.put("version.number", version.value)
57+
props.put("scala.version.number", scalaVersion.value)
58+
props.put("scala.binary.version.number", scalaBinaryVersion.value)
59+
val file = (resourceManaged in Compile).value / s"${name.value}.properties"
60+
IO.write(props, null, file)
61+
Seq(file)
62+
}
63+
64+
mappings in (Compile, packageBin) += {
65+
(baseDirectory.value / s"${name.value}.properties") -> s"${name.value}.properties"
66+
}
67+
68+
5269
description := "An asynchronous programming facility for Scala, in the spirit of C# await/async"
5370

5471
homepage := Some(url("http://github.com/scala/async"))
@@ -60,6 +77,22 @@ licenses +=("Scala license", url("https://github.com/scala/async/blob/master/LIC
6077
// Uncomment to disable test compilation.
6178
// (sources in Test) ~= ((xs: Seq[File]) => xs.filter(f => Seq("TreeInterrogation", "package").exists(f.name.contains)))
6279

80+
// maven publishing
81+
publishTo := {
82+
val nexus = "https://oss.sonatype.org/"
83+
val repo = if (version.value.trim.endsWith("SNAPSHOT"))
84+
"snapshots" at nexus + "content/repositories/snapshots"
85+
else
86+
"releases" at nexus + "service/local/staging/deploy/maven2"
87+
Some(repo)
88+
}
89+
90+
publishMavenStyle := true
91+
92+
publishArtifact in Test := false
93+
94+
pomIncludeRepository := { _ => false }
95+
6396
pomExtra := (
6497
<developers>
6598
<developer>

0 commit comments

Comments
 (0)