-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build setup and changes needed to compile with Scala 3
- Loading branch information
Showing
13 changed files
with
721 additions
and
302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version = 3.2.0 | ||
|
||
runner.dialect = scala213source3 | ||
fileOverride { | ||
"glob:**/src/main/scala-3/**" { | ||
runner.dialect = scala3 | ||
} | ||
} | ||
|
||
preset = IntelliJ | ||
align.preset = more | ||
maxColumn = 120 | ||
docstrings.style = Asterisk | ||
docstrings.blankFirstLine = yes | ||
docstrings.wrap = no | ||
importSelectors = singleLine | ||
newlines.source = keep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,61 +2,75 @@ import xerial.sbt.Sonatype.GitHubHosting | |
|
||
import java.net.URL | ||
|
||
// @formatter:off | ||
|
||
name := "ijp-debayer2sx" | ||
|
||
val _version = "1.3.0.1-SNAPSHOT" | ||
val _scalaVersions = Seq("2.13.5", "2.12.13") | ||
val _scalaVersion = _scalaVersions.head | ||
ThisBuild / version := "1.3.0.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("http://opensource.org/licenses/LGPL-2.1"))) | ||
|
||
ThisBuild / scalaVersion := "2.13.7" | ||
ThisBuild / crossScalaVersions := Seq("2.13.7", "2.12.15", "3.0.2") | ||
|
||
version := _version | ||
scalaVersion := _scalaVersion | ||
publishArtifact := false | ||
publish / skip := true | ||
sonatypeProfileName := "net.sf.ij-plugins" | ||
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( | ||
version := _version, | ||
organization := "net.sf.ij-plugins", | ||
homepage := Some(new URL("https://github.com/ij-plugins/ijp-color")), | ||
startYear := Some(2002), | ||
licenses := Seq(("LGPL-2.1", new URL("http://opensource.org/licenses/LGPL-2.1"))), | ||
// | ||
crossScalaVersions := _scalaVersions, | ||
scalaVersion := _scalaVersion, | ||
// | ||
scalacOptions ++= Seq( | ||
"-encoding", "UTF-8", | ||
"-unchecked", | ||
"-deprecation", | ||
"-Xlint", | ||
"-encoding", | ||
"UTF-8", | ||
"-unchecked", | ||
"-deprecation", | ||
"-feature", | ||
"-explaintypes", | ||
"-release", "8", | ||
), | ||
"-release", | ||
"8" | ||
) ++ ( | ||
if (isScala2(scalaVersion.value)) | ||
Seq( | ||
"-Xlint", | ||
"-explaintypes", | ||
"-Xsource:3" | ||
) | ||
else | ||
Seq( | ||
"-explain" | ||
) | ||
), | ||
scalacOptions ++= { | ||
CrossVersion.partialVersion(scalaVersion.value) match { | ||
case Some((2, 13)) => Seq("-target:8") | ||
case _ => Seq.empty[String] | ||
} | ||
}, | ||
Compile / doc / scalacOptions ++= Opts.doc.title("IJP Debayer2SX API"), | ||
Compile / doc / scalacOptions ++= Opts.doc.version(_version), | ||
Compile / doc / scalacOptions ++= Opts.doc.version(version.value), | ||
Compile / doc / scalacOptions ++= Seq( | ||
"-doc-footer", s"IJP Debayer2SX API v.${_version}", | ||
"-doc-root-content", baseDirectory.value + "/src/main/scala/root-doc.creole" | ||
"-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", "-source", "1.8", "-target", "1.8"), | ||
} | ||
), | ||
Compile / compile / javacOptions ++= Seq("-deprecation", "-Xlint", "-source", "1.8", "-target", "1.8"), | ||
// | ||
libraryDependencies ++= Seq( | ||
"net.imagej" % "ij" % "1.53i", | ||
"org.scalatest" %% "scalatest" % "3.2.8" % "test", | ||
"net.imagej" % "ij" % "1.53i", | ||
"org.scalatest" %% "scalatest" % "3.2.10" % "test" | ||
), | ||
resolvers += Resolver.sonatypeRepo("snapshots"), | ||
// | ||
|
@@ -71,59 +85,75 @@ val commonSettings = Seq( | |
manifestSetting, | ||
// Setup publishing | ||
publishMavenStyle := true, | ||
sonatypeProfileName := "net.sf.ij-plugins", | ||
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")) | ||
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", | ||
name := "ijp-debayer2sx-core", | ||
description := "IJP DeBayer2SX Core", | ||
commonSettings, | ||
libraryDependencies += "com.beachape" %% "enumeratum" % "1.6.1", | ||
libraryDependencies += "io.github.metarank" %% "cfor" % "0.2" | ||
libraryDependencies ++= { | ||
if (isScala2(scalaVersion.value)) { | ||
Seq( | ||
"com.beachape" %% "enumeratum" % "1.6.1", | ||
"io.github.metarank" %% "cfor" % "0.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, | ||
commonSettings | ||
) | ||
.dependsOn(ijp_debayer2sx_core) | ||
|
||
lazy val ijp_debayer2sx_demos = project.in(file("ijp-debayer2sx-demos")) | ||
.settings(commonSettings, | ||
name := "ijp-debayer2sx-demos", | ||
.settings( | ||
commonSettings, | ||
name := "ijp-debayer2sx-demos", | ||
description := "IJP DeBayer2SX Demos", | ||
publishArtifact := false, | ||
publish / skip := true) | ||
publish / skip := true | ||
) | ||
.dependsOn(ijp_debayer2sx_core) | ||
|
||
lazy val ijp_debayer2sx_experimental = project.in(file("ijp-debayer2sx-experimental")) | ||
.settings(commonSettings, | ||
name := "ijp-debayer2sx-experimental", | ||
.settings( | ||
commonSettings, | ||
name := "ijp-debayer2sx-experimental", | ||
description := "Experimental Features", | ||
publishArtifact := false, | ||
publish / skip := true) | ||
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")), | ||
"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, | ||
"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 | ||
"Implementation-Vendor" -> organization.value | ||
) | ||
} | ||
|
||
|
@@ -135,5 +165,4 @@ ijCleanBeforePrepareRun := true | |
// Instruct `clean` to delete created plugins subdirectory created by `ijRun`/`ijPrepareRun`. | ||
cleanFiles += ijPluginsDir.value | ||
|
||
|
||
addCommandAlias("ijRun", "ijp_debayer2sx_plugins/ijRun") | ||
addCommandAlias("ijRun", "ijp_debayer2sx_plugins/ijRun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.