aboutsummaryrefslogtreecommitdiff
path: root/build.sbt
blob: 2b1271f4f5341dbdd2618e01cda05cc4776a6ec4 (plain) (blame)
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
import sbt._
import sbt.Keys._
import sbt.ScriptedPlugin._

import sbtdoge.CrossPerProjectPlugin

import scalariform.formatter.preferences._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys

val commonSettings = Seq(
  organization := "ch.jodersky",
  licenses := Seq(("BSD New", url("http://opensource.org/licenses/BSD-3-Clause"))),
  scalacOptions ++= Seq("-deprecation", "-feature"),
  resolvers += Resolver.sonatypeRepo("releases"),
  ScalariformKeys.preferences := ScalariformKeys.preferences.value
    .setPreference(DoubleIndentClassDeclaration, true)
    .setPreference(DanglingCloseParenthesis, Preserve)
    .setPreference(MultilineScaladocCommentsStartOnFirstLine, true)
    .setPreference(PlaceScaladocAsterisksBeneathSecondAsterisk, true)
)

lazy val root = Project(
  id = "root",
  base = file("."),
  aggregate = Seq(
    macros, plugin
  ),
  settings = commonSettings ++ Seq(
    publish := {},
    publishLocal := {},
    // make sbt-pgp happy
    publishTo := Some(Resolver.file("Unused transient repository", target.value / "unusedrepo"))
  ) ++ addCommandAlias("test-plugin", ";+sbt-jni-macros/publishLocal;scripted")
).enablePlugins(CrossPerProjectPlugin)

lazy val macros = Project(
  id = "sbt-jni-macros",
  base = file("macros"),
  settings = commonSettings ++ Seq(
    scalaVersion := Version.scala.head,
    crossScalaVersions := Version.scala,
    addCompilerPlugin("org.scalamacros" % "paradise" % Version.macrosParadise cross CrossVersion.full),
    libraryDependencies += "org.typelevel" %% "macro-compat" % "1.1.1",
    libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value % Provided,
    libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value
  )
)

lazy val plugin = Project(
  id = "sbt-jni",
  base = file("plugin"),
  settings = commonSettings ++ scriptedSettings ++ Seq(
    sbtPlugin := true,
    publishMavenStyle := false,
    scalaVersion := "2.10.6",
    crossScalaVersions := Seq(scalaVersion.value),

    libraryDependencies += "org.ow2.asm" % "asm" % "5.0.4",

    // make project settings available to source
    sourceGenerators in Compile += Def.task {
      val src = s"""|/* Generated by sbt */
                    |package ch.jodersky.sbt.jni
                    |
                    |private[jni] object ProjectVersion {
                    |  final val MacrosParadise = "${Version.macrosParadise}"
                    |  final val Macros = "${version.value}"
                    |}
                    |""".stripMargin
      val file = sourceManaged.value / "ch" / "jodersky" / "sbt" / "jni" / "ProjectVersion.scala"
      IO.write(file, src)
      Seq(file)
    }.taskValue,
    scriptedLaunchOpts := Seq(
      "-Dplugin.version=" + version.value,
      "-XX:MaxPermSize=256m", "-Xmx2g", "-Xss2m"
    )
  )
)