From 34cce59b658e828e36dd6067e48130d703e30450 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Tue, 24 Oct 2017 17:47:29 +0200 Subject: [PATCH] Minor tweaks --- build.sbt | 7 +----- project/Publish.scala | 27 ++++++++++++-------- project/Release.scala | 2 +- project/Settings.scala | 56 +++++++++++++++++++++++++++++++----------- 4 files changed, 60 insertions(+), 32 deletions(-) diff --git a/build.sbt b/build.sbt index f1b32d2e2..f8ec4592f 100644 --- a/build.sbt +++ b/build.sbt @@ -454,12 +454,7 @@ lazy val proguardedCli = Seq( Nil }, addBootstrapInProguardedJar, - packagedArtifacts ++= { - if (scalaBinaryVersion.value == "2.11") - Map(proguardedArtifact.value -> proguardedJar.value) - else - Map() - } + addProguardedJar ) lazy val sharedTestResources = { diff --git a/project/Publish.scala b/project/Publish.scala index 50b8a03e4..0f9bda249 100644 --- a/project/Publish.scala +++ b/project/Publish.scala @@ -5,20 +5,27 @@ import sbt.Keys._ object Publish { lazy val dontPublish = Seq( - publish := (), - publishLocal := (), + publish := {}, + publishLocal := {}, publishArtifact := false ) def dontPublishIn(sbv: String*) = Seq( - publish := { - if (!sbv.contains(scalaBinaryVersion.value)) - publish.value - }, - publishLocal := { - if (!sbv.contains(scalaBinaryVersion.value)) - publishLocal.value - }, + // Doesn't work, the second publish or publishLocal seem not to reference the previous implementation of the key. + // This only seems to prevent ivy.xml files to be published locally anyway… + // See also similar case in Settings.scala. + // publish := Def.taskDyn { + // if (sbv.contains(scalaBinaryVersion.value)) + // Def.task(()) + // else + // publish + // }, + // publishLocal := Def.taskDyn { + // if (sbv.contains(scalaBinaryVersion.value)) + // Def.task(()) + // else + // publishLocal + // }, publishArtifact := { !sbv.contains(scalaBinaryVersion.value) && publishArtifact.value } diff --git a/project/Release.scala b/project/Release.scala index 0a05dcff3..6efbd48d5 100644 --- a/project/Release.scala +++ b/project/Release.scala @@ -144,7 +144,7 @@ object Release { val log = toProcessLogger(state) for ((f, output) <- scriptFiles) { - sbt.Process(Seq(f.getAbsolutePath, "-f")).!!(state.log) + sys.process.Process(Seq(f.getAbsolutePath, "-f")).!!(log) vcs.add(output.getAbsolutePath).!!(log) } diff --git a/project/Settings.scala b/project/Settings.scala index 2a9959c59..bff1b25e3 100644 --- a/project/Settings.scala +++ b/project/Settings.scala @@ -48,7 +48,7 @@ object Settings { Seq() } }, - javacOptions in Keys.doc := Seq() + javacOptions.in(Keys.doc) := Seq() ) lazy val shared = javaScalaPluginShared ++ Seq( @@ -113,8 +113,8 @@ object Settings { ) lazy val noTests = Seq( - test in Test := (), - testOnly in Test := () + test.in(Test) := {}, + testOnly.in(Test) := {} ) lazy val utest = Seq( @@ -157,19 +157,28 @@ object Settings { Seq( baseDirectory := { + val baseDir = baseDirectory.value + if (sbtScalaVersionMatch.value) - baseDirectory.value + baseDir else - baseDirectory.value / "target" / "dummy" - }, - publish := { - if (sbtScalaVersionMatch.value) - publish.value - }, - publishLocal := { - if (sbtScalaVersionMatch.value) - publishLocal.value + baseDir / "target" / "dummy" }, + // Doesn't work, the second publish or publishLocal seem not to reference the previous implementation of the key. + // This only seems to prevent ivy.xml files to be published locally anyway… + // See also similar case in Publish.scala. + // publish := Def.taskDyn { + // if (sbtScalaVersionMatch.value) + // publish + // else + // Def.task(()) + // }, + // publishLocal := Def.taskDyn { + // if (sbtScalaVersionMatch.value) + // publishLocal + // else + // Def.task(()) + // }, publishArtifact := { sbtScalaVersionMatch.value && publishArtifact.value } @@ -197,7 +206,7 @@ object Settings { sbtVersion := { scalaBinaryVersion.value match { case "2.10" => "0.13.8" - case "2.12" => "1.0.0-RC3" + case "2.12" => "1.0.1" case _ => sbtVersion.value } }, @@ -213,7 +222,7 @@ object Settings { lazy val shading = inConfig(_root_.coursier.ShadingPlugin.Shading)(PgpSettings.projectSettings) ++ // ytf does this have to be repeated here? - // Can't figure out why configuration get lost without this in particular... + // Can't figure out why configuration gets lost without this in particular... _root_.coursier.ShadingPlugin.projectSettings ++ Seq( shadingNamespace := "coursier.shaded", @@ -245,6 +254,23 @@ object Settings { } } + lazy val addProguardedJar = { + + val extra = Def.taskDyn[Map[Artifact, File]] { + if (scalaBinaryVersion.value == "2.11") + Def.task(Map(proguardedArtifact.value -> proguardedJar.value)) + else + Def.task(Map()) + } + + packagedArtifacts ++= { + if (scalaBinaryVersion.value == "2.11") + extra.value + else + Map() + } + } + lazy val Integration = config("it").extend(Test) }