Skip to content

cross compile 2.10, 2.11 and 2.12 #24

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

Closed
Closed
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
76 changes: 38 additions & 38 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
val baseSettings = Seq(
scalaVersion := "2.11.8",
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.0-RC2"),
version := "0.2.0",
name := "sourcecode" ,
organization := "com.lihaoyi",
publishTo := Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"),
scmInfo := Some(ScmInfo(
browseUrl = url("https://github.com/lihaoyi/sourcecode"),
connection = "scm:git:git@github.com:lihaoyi/sourcecode.git"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope this bump does not break anything.

)),
licenses := Seq("MIT" -> url("http://www.opensource.org/licenses/mit-license.html")),
developers += Developer(
email = "haoyi.sg@gmail.com",
id = "lihaoyi",
name = "Li Haoyi",
url = url("https://github.com/lihaoyi")
)
)

baseSettings

crossScalaVersions := Seq("2.10.4", "2.11.7")
def macroDependencies(version: String, binaryVersion: String) = {
val quasiquotes =
if(binaryVersion == "2.10")
Seq(
compilerPlugin("org.scalamacros" % s"paradise" % "2.1.0" cross CrossVersion.full),
"org.scalamacros" %% s"quasiquotes" % "2.1.0"
)
else Seq()

def macroDependencies(version: String) =
Seq(
"org.scala-lang" % "scala-reflect" % version % "provided",
"org.scala-lang" % "scala-compiler" % version % "provided"
) ++
(if (version startsWith "2.10.")
Seq(compilerPlugin("org.scalamacros" % s"paradise" % "2.0.0" cross CrossVersion.full),
"org.scalamacros" %% s"quasiquotes" % "2.0.0")
else
Seq())
) ++ quasiquotes
}

lazy val sourcecode = crossProject.settings(
version := "0.1.2",
scalaVersion := "2.11.7",
name := "sourcecode" ,
organization := "com.lihaoyi",
libraryDependencies ++= macroDependencies(scalaVersion.value),
lazy val sourcecode = crossProject.settings(baseSettings).settings(
libraryDependencies ++= macroDependencies(scalaVersion.value, scalaBinaryVersion.value),
unmanagedSourceDirectories in Compile ++= {
if (scalaVersion.value startsWith "2.10.") Seq(baseDirectory.value / ".."/"shared"/"src"/ "main" / "scala-2.10")
else Seq(baseDirectory.value / ".."/"shared" / "src" / "main" / "scala-2.11")
},
publishTo := Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"),

pomExtra :=
<url>https://github.com/lihaoyi/sourcecode</url>
<licenses>
<license>
<name>MIT license</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>
<scm>
<url>git://github.com/lihaoyi/sourcecode.git</url>
<connection>scm:git://github.com/lihaoyi/sourcecode.git</connection>
</scm>
<developers>
<developer>
<id>lihaoyi</id>
<name>Li Haoyi</name>
<url>https://github.com/lihaoyi</url>
</developer>
</developers>
if (Set("2.11", "2.12.0-RC2").contains(scalaBinaryVersion.value))
Seq(baseDirectory.value / ".." / "shared" / "src" / "main" / "scala-2.11_2.12")
else
Seq()
Copy link
Contributor Author

@MasseGuillaume MasseGuillaume Oct 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the new scala-js plugin it's built-in. we have to specify the directory for 2.11 and 2.12 since it's unconventional

}
)

lazy val js = sourcecode.js
Expand Down
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.9
sbt.version=0.13.11
2 changes: 1 addition & 1 deletion project/build.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.6")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13")
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sourcecode

import language.experimental.macros


object Util{
def isSynthetic(c: Compat.Context)(s: c.Symbol) = isSyntheticName(getName(c)(s))
def isSyntheticName(name: String) = {
Expand Down