forked from haraldmaida/ScalaTestFX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
178 lines (161 loc) · 5.19 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
import java.net.URL
import scala.xml._
import sbtrelease._
//
// Environment variables used by the build:
// JAR_BUILT_BY - Name to be added to Jar metadata field "Built-By" (defaults to System.getProperty("user.name")
//
name := "scalatestfx-build"
val projectInfo = Seq(
organization := "io.scalatestfx",
homepage := Some(url("https://github.com/haraldmaida/ScalaTestFX")),
startYear := Some(2016),
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html"))
)
crossScalaVersions := Seq("2.11.8", "2.12.1")
scalaVersion <<= crossScalaVersions { versions => versions.head }
// ScalaTestFX project
lazy val scalatestfx = Project(
id = "scalatestfx",
base = file("scalatestfx"),
settings = commonSettings ++ ghpages.settings ++ Seq(
description := "The ScalaTestFX Framework",
publishArtifact := true,
fork in run := true,
libraryDependencies ++= Seq(
scalatest,
testfxCore,
scalafx
)
)
).enablePlugins(
SiteScaladocPlugin
)
// ScalaTestFX Demos project
lazy val scalatestfxDemos = Project(
id = "scalatestfx-demos",
base = file("scalatestfx-demos"),
settings = commonSettings ++ Seq(
description := "The ScalaTestFX Demonstrations",
publishArtifact := false,
fork in run := true,
javaOptions ++= Seq(
"-Xmx512M",
"-Djavafx.verbose"
),
libraryDependencies ++= Seq(
scalafx
)
)
) dependsOn (scalatestfx % "compile;test->test")
//
// Dependencies
//
lazy val scalatest = "org.scalatest" %% "scalatest" % "3.0.0"
lazy val testfxCore = "org.testfx" % "testfx-core" % "4.0.4-alpha"
lazy val scalafx = "org.scalafx" %% "scalafx" % "8.0.102-R11"
//
// 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
// Root project is never published
publishArtifact := false
//
// Plugins
//
enablePlugins(
GitBranchPrompt,
GitVersioning
// JekyllPlugin
)
// Common settings
lazy val commonSettings = Seq(
// version := buildVersion,
scalacOptions ++= Seq("-unchecked", "-deprecation", "-Xcheckinit", "-encoding", "utf8", "-feature"),
// scalacOptions in(Compile, doc) ++= Opts.doc.title("ScalaTestFX API"),
// scalacOptions in(Compile, doc) ++= Opts.doc.version(buildVersion),
// 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"ScalaTestFX API v.$buildVersion"),
javacOptions ++= Seq(
"-target", "1.8",
"-source", "1.8",
"-Xlint:deprecation"
),
autoAPIMappings := true,
fork in Test := true,
parallelExecution in Test := false,
manifestSetting,
publishArtifact in Test := false,
git.remoteRepo := "[email protected]:haraldmaida/ScalaTestFX.git"
) ++ mavenCentralSettings ++ bintraySettings
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
)
}
//
// Git Versioning
//
git.baseVersion := "0.0.0"
val VersionTagRegex = "^v([0-9]+.[0-9]+.[0-9]+)(-.*)?$".r
git.gitTagToVersionNumber := {
case VersionTagRegex(v,"") => Some(v)
case VersionTagRegex(v,s) => Some(s"$v$s")
case _ => None
}
git.useGitDescribe := true
//
// Release Process
//
releaseCrossBuild := true
releaseProcess := ReleaseProcess.steps
releasePublishArtifactsAction := PgpKeys.publishSigned.value
// use next version instead of current developer version
releaseVersion <<= (releaseVersionBump)(bumper => {
ver => Version(ver).map(_.withoutQualifier).map(_.bump(bumper).string).getOrElse(versionFormatError)
})
//
// Publishing
//
lazy val bintraySettings = Seq(
publishMavenStyle := true,
bintrayReleaseOnPublish := false,
bintrayOrganization in bintray := None
)
// Metadata needed by Maven Central
// See also http://maven.apache.org/pom.html#Developers
lazy val mavenCentralSettings = projectInfo ++ Seq(
pomExtra <<= (pomExtra, name, description) {
(pom, name, desc) => pom ++ Group(
<scm>
<url>https://github.com/haraldmaida/ScalaTestFX</url>
<connection>scm:git:https://github.com/haraldmaida/ScalaTestFX.git</connection>
</scm>
<developers>
<developer>
<id>haraldmaida</id>
<name>Harald Maida</name>
<url>https://github.com/haraldmaida</url>
</developer>
</developers>
)
}
)
//
// Project website
//
//sourceDirectory in Jekyll := baseDirectory.value / "website"