From faa1540009058685cd954fdbe1e8ecfe5b1649c0 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Tue, 17 Dec 2019 12:52:18 -0500 Subject: [PATCH] workaround client / clean problem Ref https://github.com/sbt/sbt/issues/5314 Ref https://github.com/sbt/sbt/pull/5265 In sbt 1.3.4, it's possible to define a subproject named `client`. The current parser behaves differently whether we calll `client/clean` or `client / clean` with whitespaces. The one with the whitespace invokes `client` command (as in thin client). This gets triggered by `+clean` because the new implementation uses whitespace. --- main/src/main/scala/sbt/Cross.scala | 2 +- .../sbt-test/actions/cross-test-only/build.sbt | 18 ++++++++++++++++-- .../actions/cross-test-only/foo/build.sbt | 3 --- sbt/src/sbt-test/actions/cross-test-only/test | 2 ++ 4 files changed, 19 insertions(+), 6 deletions(-) delete mode 100644 sbt/src/sbt-test/actions/cross-test-only/foo/build.sbt diff --git a/main/src/main/scala/sbt/Cross.scala b/main/src/main/scala/sbt/Cross.scala index a37e8bbc7..ca2e8974a 100644 --- a/main/src/main/scala/sbt/Cross.scala +++ b/main/src/main/scala/sbt/Cross.scala @@ -183,7 +183,7 @@ object Cross { val parts = project(k).map(_.project) ++ k.scope.config.toOption.map { case ConfigKey(n) => n.head.toUpper + n.tail } ++ k.scope.task.toOption.map(_.label) ++ Some(k.key.label) - Some(v -> parts.mkString("", " / ", fullArgs)) + Some(v -> parts.mkString("", "/", fullArgs)) } else None } } diff --git a/sbt/src/sbt-test/actions/cross-test-only/build.sbt b/sbt/src/sbt-test/actions/cross-test-only/build.sbt index 687731363..3ee0818a7 100644 --- a/sbt/src/sbt-test/actions/cross-test-only/build.sbt +++ b/sbt/src/sbt-test/actions/cross-test-only/build.sbt @@ -1,2 +1,16 @@ -val foo = project -val root = (project in file(".")).aggregate(foo) \ No newline at end of file +lazy val root = (project in file(".")) + .aggregate(foo, client) + .settings( + crossScalaVersions := Nil + ) + +lazy val foo = project + .settings( + crossScalaVersions := Seq("2.12.10", "2.13.1"), + libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0", + ) + +lazy val client = project + .settings( + crossScalaVersions := Seq("2.12.10", "2.13.1"), + ) diff --git a/sbt/src/sbt-test/actions/cross-test-only/foo/build.sbt b/sbt/src/sbt-test/actions/cross-test-only/foo/build.sbt deleted file mode 100644 index c7126a4fc..000000000 --- a/sbt/src/sbt-test/actions/cross-test-only/foo/build.sbt +++ /dev/null @@ -1,3 +0,0 @@ -crossScalaVersions := Seq("2.12.10", "2.13.1") - -libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0" \ No newline at end of file diff --git a/sbt/src/sbt-test/actions/cross-test-only/test b/sbt/src/sbt-test/actions/cross-test-only/test index 3183628c0..fa3b4e0a4 100644 --- a/sbt/src/sbt-test/actions/cross-test-only/test +++ b/sbt/src/sbt-test/actions/cross-test-only/test @@ -1,3 +1,5 @@ +> + clean + > + foo / testOnly foo.FooSpec > + testOnly foo.FooSpec