forked from scalafx/scalafx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
188 lines (176 loc) · 6.68 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
import java.net.URL
import scala.xml._
//
// Environment variables used by the build:
// GRAPHVIZ_DOT_PATH - Full path to Graphviz dot utility. If not defined Scaladocs will be build without diagrams.
// JAR_BUILT_BY - Name to be added to Jar metadata field "Built-By" (defaults to System.getProperty("user.name")
//
val scalafxVersion = "8.0.40-R9-SNAPSHOT"
val versionTagDir = if (scalafxVersion.endsWith("SNAPSHOT")) "master" else "v" + scalafxVersion
// ScalaFX project
lazy val scalafx = Project(
id = "scalafx",
base = file("scalafx"),
settings = scalafxSettings ++ Seq(
description := "The ScalaFX framework",
fork in run := true,
scalacOptions in(Compile, doc) ++= Seq(
"-sourcepath", baseDirectory.value.toString,
"-doc-root-content", baseDirectory.value + "/src/main/scala/root-doc.md",
"-doc-source-url", "https://github.com/scalafx/scalafx/blob/" + versionTagDir + "/scalafx/€{FILE_PATH}.scala"
) ++ (Option(System.getenv("GRAPHVIZ_DOT_PATH")) match {
case Some(path) => Seq("-diagrams", "-diagrams-dot-path", path)
case None => Seq.empty[String]
})
) ++ sonatypeSettings
)
// ScalaFX Demos project
lazy val scalafxDemos = Project(
id = "scalafx-demos",
base = file("scalafx-demos"),
settings = scalafxSettings ++ Seq(
description := "The ScalaFX demonstrations",
fork in run := true,
javaOptions ++= Seq(
"-Xmx512M",
"-Djavafx.verbose"
),
publishArtifact := false
)
) dependsOn (scalafx % "compile;test->test")
// Dependencies
lazy val junit = "junit" % "junit" % "4.12"
lazy val scalatest = "org.scalatest" %% "scalatest" % "2.2.4"
// Resolvers
lazy val sonatypeNexusSnapshots = "Sonatype Nexus Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
lazy val sonatypeNexusStaging = "Sonatype Nexus Staging" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"
// Add snapshots to root project to enable compilation with Scala SNAPSHOT compiler,
// e.g., 2.11.0-SNAPSHOT
resolvers += sonatypeNexusSnapshots
// Common settings
lazy val scalafxSettings = Seq(
organization := "org.scalafx",
version := scalafxVersion,
crossScalaVersions := Seq("2.10.5", "2.11.6"),
scalaVersion <<= crossScalaVersions { versions => versions.head},
scalacOptions ++= Seq("-unchecked", "-deprecation", "-Xcheckinit", "-encoding", "utf8", "-feature"),
scalacOptions in(Compile, doc) ++= Opts.doc.title("ScalaFX API"),
scalacOptions in(Compile, doc) ++= Opts.doc.version(scalafxVersion),
scalacOptions in(Compile, doc) += s"-doc-external-doc:${scalaInstance.value.libraryJar}#http://www.scala-lang.org/api/${scalaVersion.value}/",
scalacOptions in(Compile, doc) ++= Seq("-doc-footer", s"ScalaFX API v.$scalafxVersion"),
javacOptions ++= Seq(
"-target", "1.8",
"-source", "1.8",
"-Xlint:deprecation"),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
scalatest % "test",
junit % "test"),
// ScalaTest needs Scala XML, in Scala 2.11 the XML library has been factored out to the `scala-xml` module
libraryDependencies ++= (
if (scalaVersion.value.startsWith("2.11."))
Seq("org.scala-lang.modules" %% "scala-xml" % "1.0.1" % "test")
else
Seq.empty[ModuleID]),
autoAPIMappings := true,
manifestSetting,
publishSetting,
fork in Test := true,
parallelExecution in Test := false,
resolvers += sonatypeNexusSnapshots,
// print junit-style XML for CI
testOptions in Test <+= (target in Test) map {
t => Tests.Argument(TestFrameworks.ScalaTest, "-u", "%s" format (t / "junitxmldir"))
},
shellPrompt in ThisBuild := { state => "sbt:" + Project.extract(state).currentRef.project + "> "}
) ++ mavenCentralSettings
lazy val manifestSetting = packageOptions <+= (name, version, organization) map {
(title, version, vendor) =>
Package.ManifestAttributes(
"Created-By" -> "Simple Build Tool",
"Built-By" -> Option(System.getenv("JAR_BUILT_BY")).getOrElse(System.getProperty("user.name")),
"Build-Jdk" -> System.getProperty("java.version"),
"Specification-Title" -> title,
"Specification-Version" -> version,
"Specification-Vendor" -> vendor,
"Implementation-Title" -> title,
"Implementation-Version" -> version,
"Implementation-Vendor-Id" -> vendor,
"Implementation-Vendor" -> vendor
)
}
lazy val publishSetting = publishTo <<= version {
version: String =>
if (version.trim.endsWith("SNAPSHOT"))
Some(sonatypeNexusSnapshots)
else
Some(sonatypeNexusStaging)
}
// Metadata needed by Maven Central
// See also http://maven.apache.org/pom.html#Developers
lazy val mavenCentralSettings = Seq(
homepage := Some(new URL("https://code.google.com/p/scalafx/")),
startYear := Some(2011),
licenses := Seq(("BSD", new URL("https://code.google.com/p/scalafx/source/browse/LICENSE.txt"))),
pomExtra <<= (pomExtra, name, description) {
(pom, name, desc) => pom ++ Group(
<scm>
<url>https://code.google.com/p/scalafx</url>
<connection>scm:hg:https://code.google.com/p/scalafx</connection>
</scm>
<developers>
<developer>
<id>rafael.afonso</id>
<name>Rafael Afonso</name>
<url>https://github.com/rafonso</url>
</developer>
<developer>
<name>Mike Allen</name>
</developer>
<developer>
<id>Alain.Fagot.Bearez</id>
<name>Alain Béarez</name>
<url>http://cua.li/TI/</url>
</developer>
<developer>
<id>steveonjava</id>
<name>Stephen Chin</name>
<url>http://www.nighthacking.com/</url>
</developer>
<developer>
<id>KevinCoghlan</id>
<name>Kevin Coghlan</name>
<url>http://www.kevincoghlan.com</url>
</developer>
<developer>
<id>akauppi</id>
<name>Asko Kauppi</name>
</developer>
<developer>
<id>rladstaetter</id>
<name>Robert Ladstätter</name>
</developer>
<developer>
<id>peter.pilgrim</id>
<name>Peter Pilgrim</name>
<url>http://www.xenonique.co.uk/blog/</url>
</developer>
<developer>
<name>Matthew Pocock</name>
</developer>
<developer>
<id>sven.reimers</id>
<name>Sven Reimers</name>
<url>http://wiki.netbeans.org/SvenReimers/</url>
</developer>
<developer>
<id>jpsacha</id>
<name>Jarek Sacha</name>
</developer>
<developer>
<name>Curtis Stanford</name>
</developer>
</developers>
)
}
)