Skip to content

Instantly share code, notes, and snippets.

@gkossakowski
Last active December 10, 2015 19:29
Show Gist options
  • Save gkossakowski/4482007 to your computer and use it in GitHub Desktop.
Save gkossakowski/4482007 to your computer and use it in GitHub Desktop.
Settings needed to release your sbt-based Scala project against Scala 2.11.0-M1.
// release-against-scala-milestone v0.1
// ALTERED SETTINGS START
scalaVersion := "2.11.0-M1"
// disable cross building completely for releasing against milestones
crossScalaVersions := Seq.empty
scalaBinaryVersion in Global <<= scalaVersion.identity
resolvers += "Sonatype Release" at "https://oss.sonatype.org/content/repositories/releases"
// ALTERED SETTINGS END
// Cosmetics, info, etc. below
// some constatns are duplicated below because sbt 0.12.x doesn't allow to declare vals in .sbt files
onLoadMessage <<= (scalaVersion, name, version) apply { (sv: String, name: String, version: String) =>
val magnetText = "\033[35m"
val defaultText = "\033[39m"
val reset = "\033[0m"
val boldOn = "\033[1m"
val boldOff = "\033[22m"
def colorize(s: String) = Predef.augmentString(s).lines.map(line => magnetText + line + defaultText).mkString("\n")
// I wish I could use Scala's string interpolation below...
colorize {
"""|
| /
| ,.. /
| ,' ';
| ,,.__ _,' /'; .
| :',' ~~~~ '. '~ %1$sThe release-against-scala-milestone v0.1
|:' ( ) ):, %1$sis %2$senabled%3$s.
|'. '. .=----=..-~ .;'
| ' ;' :: ':. '"
| (: ': ;)
| \\ '" ./
| '" '"
| (by DR J)
|""".format(defaultText, boldOn, boldOff).stripMargin
} +
"""|
|
|Your project %1$s-%2$s
|is configured to be released against Scala-%3$s.
|
|Type %4$srelease-against-scala-milestone-info%5$s for more information.
|
|""".format(name, version, sv, boldOn, boldOff).stripMargin
}
commands += Command.command("release-against-scala-milestone-info") { state =>
val msg =
"""|
|Your build settings has been altered by `release-against-scala-2.11-M1.sbt` file.
|Once you are done with releasing against Scala milestone simply remove that file.
|
|The following settings has been altered:
| crossScalaVersions, scalaBinaryVersion, resolvers
|
|In the future we'll fix sbt so it handles milestones correctly out of the box.
|The file has been brought to you by Typesafe. If it doesn't work, feel free to ping
|us at scala-internals mailing list.
|
|KNOWN ISSUES
|
| 1. Prints a warning about mismatching binary versions for Scala dependencies like
| library, actors or compiler. This is a bug in sbt 0.12.x that you can safely
| ignore.
|""".stripMargin
state.log.info(msg)
state
}
@retronym
Copy link

retronym commented Jan 8, 2013

Changing shellPrompt breaks idea-sbt-plugin which sort of 'screen scrapes' the output looking for the standard prompt. Maybe that's not such a big problem, just something to consider.

@gkossakowski
Copy link
Author

@retronym: thanks for letting me know. I probably will drop shellPrompt change as there's enough of info printed on other occasions.

I'm wondering why idea-sbt-plugin is doing it that why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment