Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsacha committed Aug 5, 2021
2 parents 6f148f6 + febbee8 commit d4bb232
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 28 deletions.
50 changes: 35 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import java.net.URL

name := "ijp-toolkit"
organization := "net.sf.ij-plugins"
version := "2.3.0"
version := "2.3.0.1-SNAPSHOT"

homepage := Some(new URL("https://github.com/ij-plugins/ijp-toolkit"))
startYear := Some(2002)
Expand All @@ -22,57 +22,77 @@ description := "<html>" +
"</ul>" +
"</html>"

crossScalaVersions := Seq("2.13.4", "2.12.13")
crossScalaVersions := Seq("2.13.6", "3.0.1", "2.12.14")
scalaVersion := crossScalaVersions.value.head

def isScala2_13plus(scalaVersion: String): Boolean = {
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, n)) if n >= 13 => true
case Some((major, minor)) if major > 2 || (major == 2 && minor >= 13) => true
case _ => false
}
}

libraryDependencies ++= Seq(
"org.apache.commons" % "commons-math3" % "3.6.1",
"com.jgoodies" % "jgoodies-binding" % "2.13.0",
"net.imagej" % "ij" % "1.53g",
"net.imagej" % "ij" % "1.53j",
// Test
"junit" % "junit" % "4.13.2" % "test",
"org.scalatest" %% "scalatest" % "3.2.3" % "test",
"org.scalatest" %% "scalatest" % "3.2.9" % "test",
// JUnit runner SBT plugin
"com.novocode" % "junit-interface" % "0.11" % "test->default"
)

libraryDependencies ++= (
if (isScala2_13plus(scalaVersion.value)) {
Seq("org.scala-lang.modules" %% "scala-parallel-collections" % "0.2.0")
Seq("org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.3")
} else {
Seq.empty[ModuleID]
}
)

// Add example directories to test compilation
unmanagedSourceDirectories in Test += baseDirectory.value / "examples/scala"
unmanagedSourceDirectories in Test += baseDirectory.value / "examples/java"
Test / unmanagedSourceDirectories += baseDirectory.value / "examples/scala"
Test / unmanagedSourceDirectories += baseDirectory.value / "examples/java"

scalacOptions ++= {
Seq(
"-encoding", "UTF-8",
"-feature",
"-language:implicitConversions",
// disabled during the migration
// "-Xfatal-warnings"
) ++
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq(
"-unchecked"
)
case _ => Seq(
"-deprecation",
// "-Xfatal-warnings",
// "-Wunused:imports,privates,locals",
// "-Wvalue-discard"
)
})
}

scalacOptions in(Compile, doc) ++= Seq(
// Options for ScalaDoc
Compile / doc / scalacOptions ++= Seq(
"-doc-title", "IJ-Plugins Toolkit",
"-doc-version", version.value,
"-doc-root-content", baseDirectory.value + "/src/main/scala/overview.txt",
"-doc-footer", s"IJ-Plugins Toolkit API v.${version.value}"
)



// fork a new JVM for 'run' and 'test:run'
fork := true

// add a JVM option to use when forking a JVM for 'run'
javaOptions ++= Seq("-Xmx2G", "-server")
javacOptions in(Compile, compile) ++= Seq("-deprecation", "-Xlint:all", "-source", "1.8", "-target", "1.8")

// Set the prompt (for this build) to include the project id.
shellPrompt in ThisBuild := { state => "sbt:" + Project.extract(state).currentRef.project + "> "}
Compile / compile / javacOptions ++= Seq(
// "-deprecation", "-Xlint:all",
"-source", "1.8", "-target", "1.8")

//
// Setup sbt-imagej plugin
Expand All @@ -83,7 +103,7 @@ ijPluginsSubDir := "ij-plugins"
ijCleanBeforePrepareRun := true
cleanFiles += ijPluginsDir.value

baseDirectory in run := baseDirectory.value / "sandbox"
run / baseDirectory := baseDirectory.value / "sandbox"

//
// Customize Java style publishing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* IJ-Plugins
* Copyright (C) 2002-2021 Jarek Sacha
* Author's email: jpsacha at gmail dot com
* IJ-Plugins
* Copyright (C) 2002-2021 Jarek Sacha
* Author's email: jpsacha at gmail dot com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -42,7 +42,7 @@ object ProgressReporterExample extends App {
*/
class CounterWithProgress(marker: Char) extends ProgressReporter4J {

def count(max: Int) {
def count(max: Int): Unit = {
val progressIncrement = Math.max(max / 10, 1)

println("Counting " + max + " '" + marker + "'.")
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
#
# Latest release available at https://github.com/ij-plugins/ijp-toolkit/
#
sbt.version=1.4.7
sbt.version=1.5.5

8 changes: 4 additions & 4 deletions src/main/scala/ij_plugins/toolkit/util/IJPUtils.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* IJ-Plugins
* Copyright (C) 2002-2021 Jarek Sacha
* Author's email: jpsacha at gmail dot com
* IJ-Plugins
* Copyright (C) 2002-2021 Jarek Sacha
* Author's email: jpsacha at gmail dot com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -191,7 +191,7 @@ object IJPUtils {
private def createTitleLabel(title: String): JLabel = {
val titleLabel = new JLabel(title)
val font = titleLabel.getFont
titleLabel.setFont(font.deriveFont(Font.BOLD, font.getSize * 2))
titleLabel.setFont(font.deriveFont(Font.BOLD, font.getSize * 2f))
titleLabel
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* IJ-Plugins
* Copyright (C) 2002-2021 Jarek Sacha
* Author's email: jpsacha at gmail dot com
* IJ-Plugins
* Copyright (C) 2002-2021 Jarek Sacha
* Author's email: jpsacha at gmail dot com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -31,7 +31,7 @@ import org.scalatest.matchers.should
class ProgressReporterSpec extends AnyFlatSpec with should.Matchers {

private class CounterWithProgress extends ProgressReporter {
def count(max: Int) {
def count(max: Int): Unit = {
for (i <- 1 to max)
notifyProgressListeners(i, max)
}
Expand Down

0 comments on commit d4bb232

Please sign in to comment.