Skip to content

Commit 0e9d93e

Browse files
authored
Merge pull request #227 from eed3si9n/wip/semi
fix: Always use semicolon
2 parents 49f6a4c + e23533d commit 0e9d93e

10 files changed

Lines changed: 24 additions & 30 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ jobs:
6666

6767
- name: Check that workflows are up to date
6868
shell: bash
69-
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
69+
run: sbt '++ ${{ matrix.scala }}; githubWorkflowCheck'
7070

7171
- if: matrix.java != 'zulu@8'
7272
shell: bash
73-
run: sbt '++ ${{ matrix.scala }}' '+ test' '+ scripted'
73+
run: sbt '++ ${{ matrix.scala }}; + test; + scripted'
7474

7575
- if: matrix.java == 'zulu@8'
7676
shell: bash
77-
run: sbt '++ ${{ matrix.scala }}' test scripted
77+
run: sbt '++ ${{ matrix.scala }}; test; scripted'
7878

7979
- name: Clean up Ivy Local repo
8080
shell: bash

src/main/scala/sbtghactions/GenerativePlugin.scala

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -281,18 +281,12 @@ ${indent(rendered.mkString("\n"), 1)}"""
281281
case sbtStep: Sbt =>
282282
import sbtStep.commands
283283

284-
val sbtClientMode = sbt.matches("""sbt.* --client($| .*)""")
285-
val safeCommands = if (sbtClientMode)
286-
s"'${(sbtStepPreamble ::: commands).mkString("; ")}'"
287-
else (sbtStepPreamble ::: commands).map { c =>
288-
if (c.indexOf(' ') >= 0)
289-
s"'$c'"
290-
else
291-
c
292-
}.mkString(" ")
293-
284+
val multi = (sbtStepPreamble ::: commands) match {
285+
case x :: Nil => x
286+
case xs => s"'${xs.mkString("; ")}'"
287+
}
294288
renderRunBody(
295-
commands = List(s"$sbt $safeCommands"),
289+
commands = List(s"$sbt $multi"),
296290
params = sbtStep.params,
297291
renderedShell = renderedShell
298292
)

src/sbt-test/sbtghactions/allow-hashes/.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ jobs:
4343
uses: sbt/setup-sbt@v1
4444

4545
- name: Check that workflows are up to date
46-
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
46+
run: sbt '++ ${{ matrix.scala }}; githubWorkflowCheck'
4747

4848
- name: Build project
49-
run: sbt '++ ${{ matrix.scala }}' test
49+
run: sbt '++ ${{ matrix.scala }}; test'
5050

5151
- name: Compress target directories
5252
run: tar cf targets.tar target project/target

src/sbt-test/sbtghactions/check-and-regenerate/expected-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ jobs:
6363
uses: sbt/setup-sbt@v1
6464

6565
- name: Check that workflows are up to date
66-
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
66+
run: sbt '++ ${{ matrix.scala }}; githubWorkflowCheck'
6767

6868
- name: Build project
69-
run: sbt '++ ${{ matrix.scala }}' test
69+
run: sbt '++ ${{ matrix.scala }}; test'
7070

7171
- run: echo yo
7272

src/sbt-test/sbtghactions/githubworkflowoses-clean-publish/.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ jobs:
5757

5858
- name: Check that workflows are up to date
5959
shell: bash
60-
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
60+
run: sbt '++ ${{ matrix.scala }}; githubWorkflowCheck'
6161

6262
- name: Build project
6363
shell: bash
64-
run: sbt '++ ${{ matrix.scala }}' test
64+
run: sbt '++ ${{ matrix.scala }}; test'
6565

6666
- name: Compress target directories
6767
shell: bash

src/sbt-test/sbtghactions/no-clean/.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ jobs:
4343
uses: sbt/setup-sbt@v1
4444

4545
- name: Check that workflows are up to date
46-
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
46+
run: sbt '++ ${{ matrix.scala }}; githubWorkflowCheck'
4747

4848
- name: Build project
49-
run: sbt '++ ${{ matrix.scala }}' test
49+
run: sbt '++ ${{ matrix.scala }}; test'
5050

5151
- name: Compress target directories
5252
run: tar cf targets.tar target project/target

src/sbt-test/sbtghactions/non-existent-target/.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ jobs:
4343
uses: sbt/setup-sbt@v1
4444

4545
- name: Check that workflows are up to date
46-
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
46+
run: sbt '++ ${{ matrix.scala }}; githubWorkflowCheck'
4747

48-
- run: sbt '++ ${{ matrix.scala }}' withTarget/compile
48+
- run: sbt '++ ${{ matrix.scala }}; withTarget/compile'
4949

5050
- name: Compress target directories
5151
run: tar cf targets.tar target withTarget/target project/target

src/sbt-test/sbtghactions/sbt-native-thin-client/.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,4 @@ jobs:
111111
rm targets.tar
112112
113113
- name: Publish project
114-
run: sbt --client '+publish'
114+
run: sbt --client +publish

src/sbt-test/sbtghactions/suppressed-scala-version/expected-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ jobs:
4444
uses: sbt/setup-sbt@v1
4545

4646
- name: Check that workflows are up to date
47-
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
47+
run: sbt '++ ${{ matrix.scala }}; githubWorkflowCheck'
4848

4949
- name: Build project
50-
run: sbt '++ ${{ matrix.scala }}' test
50+
run: sbt '++ ${{ matrix.scala }}; test'
5151

5252
- name: Compress target directories
5353
run: tar cf targets.tar target project/target

src/test/scala/sbtghactions/GenerativePluginSpec.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ class GenerativePluginSpec extends Specification {
431431
"compile sbt using the command provided" in {
432432
compileStep(
433433
Sbt(List("show scalaVersion", "compile", "test")),
434-
"$SBT") mustEqual s"- run: $$SBT '++ $${{ matrix.scala }}' 'show scalaVersion' compile test"
434+
"$SBT") mustEqual s"- run: $$SBT '++ $${{ matrix.scala }}; show scalaVersion; compile; test'"
435435
}
436436

437437
"compile sbt without switch command" in {
@@ -444,7 +444,7 @@ class GenerativePluginSpec extends Specification {
444444
"compile sbt with parameters" in {
445445
compileStep(
446446
Sbt(List("compile", "test"), params = Map("abc" -> "def", "cafe" -> "@42")),
447-
"$SBT") mustEqual s"""- run: $$SBT '++ $${{ matrix.scala }}' compile test
447+
"$SBT") mustEqual s"""- run: $$SBT '++ $${{ matrix.scala }}; compile; test'
448448
| with:
449449
| abc: def
450450
| cafe: '@42'""".stripMargin
@@ -699,7 +699,7 @@ class GenerativePluginSpec extends Specification {
699699
env:
700700
not: now
701701
steps:
702-
- run: csbt '++ $${{ matrix.scala }}' +compile"""
702+
- run: csbt '++ $${{ matrix.scala }}; +compile'"""
703703
}
704704

705705
"compile a job with an environment" in {

0 commit comments

Comments
 (0)