-
Notifications
You must be signed in to change notification settings - Fork 28
/
build.sbt
90 lines (85 loc) · 2.99 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import scala.sys.process._
val scalaVersions = Seq("3.5.2", "2.13.15", "2.12.20", "2.11.12")
val macrosParadiseVersion = "2.1.1"
ThisBuild / versionScheme := Some("semver-spec")
ThisBuild / organization := "com.github.sbt"
ThisBuild / scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings")
ThisBuild / licenses := Seq(("BSD New", url("http://opensource.org/licenses/BSD-3-Clause")))
ThisBuild / homepage := Some(url("https://github.com/jodersky/sbt-jni"))
ThisBuild / developers := List(
Developer(
"jodersky",
"Jakob Odersky",
"jakob@odersky.com",
url("https://jakob.odersky.com")
),
Developer(
"pomadchin",
"Grigory Pomadchin",
"@pomadchin",
url("https://github.com/pomadchin")
)
)
lazy val root = (project in file("."))
.aggregate(core, plugin)
.settings(
publish := {},
publishLocal := {},
// make sbt-pgp happy
publishTo := Some(Resolver.file("Unused transient repository", target.value / "unusedrepo")),
addCommandAlias("test-plugin", ";+core/publishLocal;scripted")
)
lazy val core = project
.settings(
name := "sbt-jni-core",
scalaVersion := scalaVersions.head,
crossScalaVersions := scalaVersions,
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) =>
Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Provided,
"org.scala-lang" % "scala-reflect" % scalaVersion.value
)
case _ => Seq("org.scala-lang" %% "scala3-compiler" % scalaVersion.value % Provided)
}
},
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n < 13 =>
Seq(compilerPlugin(("org.scalamacros" % "paradise" % macrosParadiseVersion).cross(CrossVersion.full)))
case _ => Seq()
}
},
Compile / scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 13 => Seq("-Ymacro-annotations")
case _ => Seq()
}
}
)
lazy val plugin = project
.enablePlugins(SbtPlugin)
.settings(
name := "sbt-jni",
libraryDependencies ++= Seq("org.ow2.asm" % "asm" % "9.7.1", "org.scalatest" %% "scalatest" % "3.2.19" % Test),
// make project settings available to source
Compile / sourceGenerators += Def.task {
val src = s"""|/* Generated by sbt */
|package com.github.sbt.jni
|
|private[jni] object ProjectVersion {
| final val MacrosParadise = "${macrosParadiseVersion}"
| final val Core = "${version.value}"
|}
|""".stripMargin
val file = sourceManaged.value / "com" / "github" / "sbt" / "jni" / "ProjectVersion.scala"
IO.write(file, src)
Seq(file)
}.taskValue,
scriptedLaunchOpts := Seq(
"-Dplugin.version=" + version.value,
"-Xmx2g",
"-Xss2m"
)
)