From b964497f1c105cc39e6984725d5dac3e344b5ffd Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Wed, 7 Jun 2017 14:41:14 +0200 Subject: [PATCH] Add workaround for sbt 1.0.0-M6 --- project/Settings.scala | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/project/Settings.scala b/project/Settings.scala index d35bae7bc..9a7b09dee 100644 --- a/project/Settings.scala +++ b/project/Settings.scala @@ -178,11 +178,70 @@ object Settings { ) } + lazy val scripted100M6Workaround = { + + // see https://github.com/sbt/sbt/issues/3245#issuecomment-306045952 + + ScriptedPlugin.scripted := Def.inputTask { + + val args = ScriptedPlugin + .asInstanceOf[{ + def scriptedParser(f: File): complete.Parser[Seq[String]] + }] + .scriptedParser(sbtTestDirectory.value) + .parsed + + val prereq: Unit = scriptedDependencies.value + val scriptedTests = ScriptedPlugin.scriptedTests.value + + try { + if(sbtVersion.in(pluginCrossBuild).value == "1.0.0-M6") + scriptedTests.asInstanceOf[{ + def run( + x1: File, + x2: Boolean, + x3: Array[String], + x4: File, + x5: Array[String], + x6: java.util.List[File] + ): Unit + }].run( + sbtTestDirectory.value, + scriptedBufferLog.value, + args.toArray, + sbtLauncher.value, + scriptedLaunchOpts.value.toArray, + new java.util.ArrayList() + ) + else + scriptedTests.asInstanceOf[{ + def run( + x1: File, + x2: Boolean, + x3: Array[String], + x4: File, + x5: Array[String] + ): Unit + }].run( + sbtTestDirectory.value, + scriptedBufferLog.value, + args.toArray, + sbtLauncher.value, + scriptedLaunchOpts.value.toArray + ) + } catch { + case e: java.lang.reflect.InvocationTargetException => + throw e.getCause + } + }.evaluated + } + lazy val plugin = javaScalaPluginShared ++ divertThingsPlugin ++ withScriptedTests ++ Seq( + scripted100M6Workaround, scriptedLaunchOpts ++= Seq( "-Xmx1024M", "-Dplugin.version=" + version.value,