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

Ported to scala.js, dropped support for scala 2.10, bumped scala, sbt… #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
73 changes: 40 additions & 33 deletions project/Build.scala
Original file line number Diff line number Diff line change
@@ -1,42 +1,22 @@
import sbt._
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbt.Keys._
import xml.Group
import sbt._

object Build extends sbt.Build {
import scala.xml.Group

lazy val buildSettings = Defaults.defaultSettings ++ Seq(
organization := "no.arktekk",
scalaVersion := "2.11.2",
crossScalaVersions := Seq("2.11.2","2.10.1"),
publishTo <<= (version) apply {
(v: String) => if (v.trim().endsWith("SNAPSHOT")) Some(Resolvers.sonatypeNexusSnapshots) else Some(Resolvers.sonatypeNexusStaging)
object Build extends sbt.Build {
val buildSettings = Defaults.coreDefaultSettings ++ Seq(
organization := "no.arktekk",
scalaVersion := "2.11.7",
publishTo <<= isSnapshot {
case true ⇒ Some("Sonatype Nexus Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots")
case false ⇒ Some("Sonatype Nexus Staging" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
},
pomIncludeRepository := { x => false },
credentials += Credentials(Path.userHome / ".sbt" / "arktekk-credentials")
credentials += Credentials(Path.userHome / ".sbt" / "arktekk-credentials")
)

lazy val root = Project(
id = "root",
base = file("."),
settings = buildSettings ++ Seq(
description := "URI Template",
name := "uri-template",
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "2.2.2" % "test"
),
libraryDependencies <++= (scalaBinaryVersion) apply {(sv: String) =>
if(sv == "2.11") Seq("org.scala-lang.modules" % "scala-parser-combinators_2.11" % "1.0.2") else Nil
},
manifestSetting
) ++ mavenCentralFrouFrou
)

object Resolvers {
val sonatypeNexusSnapshots = "Sonatype Nexus Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
val sonatypeNexusStaging = "Sonatype Nexus Staging" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"
}

lazy val manifestSetting = packageOptions <+= (name, version, organization) map {
val manifestSetting = packageOptions <+= (name, version, organization) map {
(title, version, vendor) =>
Package.ManifestAttributes(
"Created-By" -> "Simple Build Tool",
Expand All @@ -53,7 +33,7 @@ object Build extends sbt.Build {
}

// Things we care about primarily because Maven Central demands them
lazy val mavenCentralFrouFrou = Seq(
val mavenCentralFrouFrou = Seq(
homepage := Some(new URL("http://github.com/arktekk/uri-template")),
startYear := Some(2011),
licenses := Seq(("Apache 2", new URL("http://www.apache.org/licenses/LICENSE-2.0.txt"))),
Expand All @@ -72,4 +52,31 @@ object Build extends sbt.Build {
</developers>
)}
)

val sourceMapTransform = (isSnapshot, version) map {
case (true, v) ⇒
val a = new java.io.File("").toURI.toString.replaceFirst("/$", "")
val g = s"https://raw.githubusercontent.com/arktekk/uri-template/$v"
s"-P:scalajs:mapSourceURI:$a->$g/"
case (false, _) ⇒ ""
}

val uriTemplate = crossProject.in(file("."))
.settings(buildSettings ++ mavenCentralFrouFrou :_*)
.settings(
name := "uri-template",
description := "URI Template",
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.0.0-M6" % "test",
manifestSetting
).jsSettings(
scalacOptions <+= sourceMapTransform,
libraryDependencies += "org.scala-js" %%% "scala-parser-combinators" % "1.0.2"
).jvmSettings(
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4"
)

val jvm = uriTemplate.jvm
val js = uriTemplate.js

val root = project.aggregate(jvm, js).settings(publish := {}, publishLocal := {})
}
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.5
sbt.version=0.13.8
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")
resolvers += Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)

addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.4")