From 34424024c25a43748622942a6817e04723bc56ba Mon Sep 17 00:00:00 2001 From: Jarek Sacha Date: Wed, 12 Dec 2018 14:18:32 -0500 Subject: [PATCH] Enable plugin by default [#5]. --- README.md | 7 +------ example/build.sbt | 3 +-- example/project/plugin.sbt | 2 +- .../scala/net/ij_plugins/sf/sbt/imagej/SbtImageJ.scala | 5 +++++ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 08e2adb..893a9e9 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,7 @@ Add `sbt-imagej` as a dependency in `project/imagej.sbt`: addSbtPlugin("net.sf.ij-plugins" % "sbt-imagej" % "2.0.1") ``` -To use `sbt-imagej` you need to enable it in your project configuration, -if you're using `build.sbt` add this: - -```scala -enablePlugins(SbtImageJ) -``` +Once added to the project the plugin will be enabled by default. Now you'll have a new `ijRun` task which will compile your project, pack your class files and resources in a jar, copy that jar and dependencies to local diff --git a/example/build.sbt b/example/build.sbt index 53c4fec..76a7431 100644 --- a/example/build.sbt +++ b/example/build.sbt @@ -8,8 +8,7 @@ libraryDependencies += "net.imagej" % "ij" % "1.52i" fork := true -// Enable and customize `sbt-imagej` plugin -enablePlugins(SbtImageJ) +// Customize `sbt-imagej` plugin ijRuntimeSubDir := "sandbox" ijPluginsSubDir := "ij-plugins" ijCleanBeforePrepareRun := true diff --git a/example/project/plugin.sbt b/example/project/plugin.sbt index a35e408..b02aa93 100644 --- a/example/project/plugin.sbt +++ b/example/project/plugin.sbt @@ -1,3 +1,3 @@ resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots" -addSbtPlugin("net.sf.ij-plugins" % "sbt-imagej" % "2.0.1") \ No newline at end of file +addSbtPlugin("net.sf.ij-plugins" % "sbt-imagej" % "2.0.2-SNAPSHOT") \ No newline at end of file diff --git a/src/main/scala/net/ij_plugins/sf/sbt/imagej/SbtImageJ.scala b/src/main/scala/net/ij_plugins/sf/sbt/imagej/SbtImageJ.scala index 3d8dab8..d48763d 100644 --- a/src/main/scala/net/ij_plugins/sf/sbt/imagej/SbtImageJ.scala +++ b/src/main/scala/net/ij_plugins/sf/sbt/imagej/SbtImageJ.scala @@ -139,6 +139,9 @@ object SbtImageJ extends sbt.AutoPlugin { ) ) + + override def trigger = allRequirements + /** * Run ImageJ; pointing it to created plugins. */ @@ -147,6 +150,7 @@ object SbtImageJ extends sbt.AutoPlugin { runtimeDir: String, classpath: Classpath, taskStreams: TaskStreams) { + // val logger = sbt.Keys.streams.value.log val logger = taskStreams.log val userDir = (base / runtimeDir).getCanonicalPath logger.debug("Run ImageJ with -ijpath " + userDir) @@ -165,6 +169,7 @@ object SbtImageJ extends sbt.AutoPlugin { dependencies: Seq[Attributed[File]], taskStreams: TaskStreams ): Seq[java.io.File] = { + // val logger = sbt.Keys.streams.value.log val logger = taskStreams.log val pluginsDir = base / runtimeDir / "plugins" / pluginsSubDir logger.debug("Preparing ImageJ plugin directory: " + pluginsDir.getCanonicalPath)