-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sbt
164 lines (150 loc) · 4.91 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
import xerial.sbt.Sonatype.GitHubHosting
import java.net.URL
name := "ijp-debayer2sx"
ThisBuild / version := "1.3.4.1-SNAPSHOT"
ThisBuild / organization := "net.sf.ij-plugins"
ThisBuild / sonatypeProfileName := "net.sf.ij-plugins"
ThisBuild / homepage := Some(new URL("https://github.com/ij-plugins/ijp-color"))
ThisBuild / startYear := Some(2002)
ThisBuild / licenses := Seq(("LGPL-2.1", new URL("https://opensource.org/licenses/LGPL-2.1")))
ThisBuild / scalaVersion := "3.2.1"
ThisBuild / crossScalaVersions := Seq("3.2.1", "2.13.10", "2.12.17")
publishArtifact := false
publish / skip := true
/** Return `true` if scala version corresponds to Scala 2, `false` otherwise */
def isScala2(scalaVersion: String): Boolean = {
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, _)) => true
case _ => false
}
}
val commonSettings = Seq(
scalacOptions ++= Seq(
"-encoding",
"UTF-8",
"-unchecked",
"-deprecation",
"-feature",
"-release",
"8"
) ++ (
if (isScala2(scalaVersion.value))
Seq(
"-Xlint",
"-explaintypes",
"-Xsource:3"
)
else
Seq(
"-explain"
)
),
Compile / doc / scalacOptions ++= Opts.doc.title("IJP Debayer2SX API"),
Compile / doc / scalacOptions ++= Opts.doc.version(version.value),
Compile / doc / scalacOptions ++= Seq(
"-doc-footer",
s"IJP Debayer2SX API v.${version.value}",
"-doc-root-content",
baseDirectory.value + "/src/main/scala/root-doc.creole"
),
Compile / doc / scalacOptions ++= (
Option(System.getenv("GRAPHVIZ_DOT_PATH")) match {
case Some(path) => Seq("-diagrams", "-diagrams-dot-path", path, "-diagrams-debug")
case None => Seq.empty[String]
}
),
Compile / compile / javacOptions ++= Seq("-deprecation", "-Xlint", "--release", "8"),
//
libraryDependencies ++= Seq(
"net.imagej" % "ij" % "1.54b",
"org.scalatest" %% "scalatest" % "3.2.15" % "test"
),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
//
exportJars := true,
//
autoCompilerPlugins := true,
// Fork a new JVM for 'run' and 'test:run'
fork := true,
// Add a JVM option to use when forking a JVM for 'run'
javaOptions += "-Xmx1G",
// Instruct `clean` to delete created plugins subdirectory created by `ijRun`/`ijPrepareRun`.
cleanFiles += ijPluginsDir.value,
//
manifestSetting,
// Setup publishing
publishMavenStyle := true,
sonatypeProjectHosting := Some(GitHubHosting("ij-plugins", "ijp-debayer2sx", "[email protected]")),
publishTo := sonatypePublishToBundle.value,
developers := List(
Developer(
id = "jpsacha",
name = "Jarek Sacha",
email = "[email protected]",
url = url("https://github.com/jpsacha")
)
)
)
lazy val ijp_debayer2sx_core = project.in(file("ijp-debayer2sx-core"))
.settings(
name := "ijp-debayer2sx-core",
description := "IJP DeBayer2SX Core",
commonSettings,
libraryDependencies += "io.github.metarank" %% "cfor" % "0.3",
libraryDependencies ++= {
if (isScala2(scalaVersion.value)) {
Seq(
"com.beachape" %% "enumeratum" % "1.7.2"
)
} else {
Seq.empty[ModuleID]
}
}
)
lazy val ijp_debayer2sx_plugins = project.in(file("ijp-debayer2sx-plugins"))
.settings(
name := "ijp-debayer2sx-plugins",
description := "IJP DeBayer2SX ImageJ Plugins",
commonSettings
)
.dependsOn(ijp_debayer2sx_core)
lazy val ijp_debayer2sx_demos = project.in(file("ijp-debayer2sx-demos"))
.settings(
commonSettings,
name := "ijp-debayer2sx-demos",
description := "IJP DeBayer2SX Demos",
publishArtifact := false,
publish / skip := true
)
.dependsOn(ijp_debayer2sx_core)
lazy val ijp_debayer2sx_experimental = project.in(file("ijp-debayer2sx-experimental"))
.settings(
commonSettings,
name := "ijp-debayer2sx-experimental",
description := "Experimental Features",
publishArtifact := false,
publish / skip := true
)
.dependsOn(ijp_debayer2sx_core)
lazy val manifestSetting = packageOptions += {
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" -> name.value,
"Specification-Version" -> version.value,
"Specification-Vendor" -> organization.value,
"Implementation-Title" -> name.value,
"Implementation-Version" -> version.value,
"Implementation-Vendor-Id" -> organization.value,
"Implementation-Vendor" -> organization.value
)
}
// Enable and customize `sbt-imagej` plugin
enablePlugins(SbtImageJ)
ijRuntimeSubDir := "sandbox"
ijPluginsSubDir := "ij-plugins"
ijCleanBeforePrepareRun := true
// Instruct `clean` to delete created plugins subdirectory created by `ijRun`/`ijPrepareRun`.
cleanFiles += ijPluginsDir.value
addCommandAlias("ijRun", "ijp_debayer2sx_plugins/ijRun")