1
+ import sbtcrossproject .{crossProject , CrossType }
1
2
import OsgiKeys ._
2
3
3
- crossScalaVersions := Seq (" 2.10.6" , " 2.11.8" , " 2.12.0" )
4
+ val scala210 = " 2.10.6"
5
+ val scala211 = " 2.11.11"
6
+ val scala212 = " 2.12.2"
7
+ val scala213 = " 2.13.0-M1"
8
+ val baseSettings = Seq (
9
+ organization := " com.lihaoyi" ,
10
+ name := " sourcecode" ,
11
+ version := " 0.1.4" ,
12
+ scalaVersion := scala211,
13
+ crossScalaVersions := Seq (scala210, scala211, scala212, scala213),
14
+ scmInfo := Some (ScmInfo (
15
+ browseUrl = url(" https://github.com/lihaoyi/sourcecode" ),
16
+ connection
= " scm:git:[email protected] :lihaoyi/sourcecode.git"
17
+ )),
18
+ homepage := Some (url(" https://github.com/lihaoyi/sourcecode" )),
19
+ licenses := Seq (" MIT" -> url(" http://www.opensource.org/licenses/mit-license.html" )),
20
+ developers += Developer (
21
+
22
+ id = " lihaoyi" ,
23
+ name = " Li Haoyi" ,
24
+ url = url(" https://github.com/lihaoyi" )
25
+ ),
26
+ publishTo := Some (" releases" at " https://oss.sonatype.org/service/local/staging/deploy/maven2" )
27
+ )
28
+ lazy val noPublish = Seq (
29
+ publishArtifact := false ,
30
+ publish := {},
31
+ publishLocal := {}
32
+ )
33
+
34
+ baseSettings
35
+ noPublish
4
36
5
37
def macroDependencies (version : String ) =
6
38
Seq (
@@ -13,46 +45,33 @@ def macroDependencies(version: String) =
13
45
else
14
46
Seq ())
15
47
16
- lazy val sourcecode = crossProject.settings(
17
- version := " 0.1.4" ,
18
- scalaVersion := " 2.11.8" ,
19
- name := " sourcecode" ,
20
- organization := " com.lihaoyi" ,
21
- libraryDependencies ++= macroDependencies(scalaVersion.value),
22
- unmanagedSourceDirectories in Compile ++= {
23
- CrossVersion .partialVersion(scalaVersion.value) match {
24
- case Some ((2 , n)) if n >= 12 =>
25
- Seq (baseDirectory.value / " .." / " shared" / " src" / " main" / " scala-2.11" )
26
- case _ =>
27
- Seq ()
28
- }
29
- },
30
- publishTo := Some (" releases" at " https://oss.sonatype.org/service/local/staging/deploy/maven2" ),
31
-
32
- pomExtra :=
33
- <url >https:// github.com/ lihaoyi/ sourcecode</url >
34
- <licenses >
35
- <license >
36
- <name >MIT license</name >
37
- <url >http:// www.opensource.org/ licenses/ mit- license.php</url >
38
- </license >
39
- </licenses >
40
- <scm >
41
- <url >git:// github.com/ lihaoyi/ sourcecode.git</url >
42
- <connection >scm: git:// github.com/ lihaoyi/ sourcecode.git</connection >
43
- </scm >
44
- <developers >
45
- <developer >
46
- <id >lihaoyi</id >
47
- <name >Li Haoyi </name >
48
- <url >https:// github.com/ lihaoyi</url >
49
- </developer >
50
- </developers >
51
- ).enablePlugins(SbtOsgi ).settings(osgiSettings).settings(
52
- exportPackage := Seq (" sourcecode.*" ),
53
- privatePackage := Seq (),
54
- dynamicImportPackage := Seq (" *" )
55
- )
48
+ lazy val sourcecode = crossProject(JSPlatform , JVMPlatform , NativePlatform )
49
+ .settings(
50
+ baseSettings,
51
+ libraryDependencies ++= macroDependencies(scalaVersion.value),
52
+ test in Test := (run in Test ).toTask(" " ).value,
53
+ unmanagedSourceDirectories in Compile ++= {
54
+ CrossVersion .partialVersion(scalaVersion.value) match {
55
+ case Some ((2 , n)) if n >= 12 =>
56
+ Seq (baseDirectory.value / " .." / " shared" / " src" / " main" / " scala-2.11" )
57
+ case _ =>
58
+ Seq ()
59
+ }
60
+ },
61
+ // Osgi settings
62
+ osgiSettings,
63
+ exportPackage := Seq (" sourcecode.*" ),
64
+ privatePackage := Seq (),
65
+ dynamicImportPackage := Seq (" *" )
66
+ )
67
+ .enablePlugins(SbtOsgi )
68
+ .jsSettings(
69
+ scalaJSUseMainModuleInitializer in Test := true // use JVM-style main.
70
+ )
71
+ .nativeSettings(
72
+ crossScalaVersions := Seq (scala211)
73
+ )
56
74
57
75
lazy val js = sourcecode.js
58
76
lazy val jvm = sourcecode.jvm
77
+ lazy val native = sourcecode.native
0 commit comments