From 85383391e323927fea974543dc18a5529866709c Mon Sep 17 00:00:00 2001 From: Matthew de Detrich Date: Sat, 14 Sep 2024 11:14:10 +0200 Subject: [PATCH] Fix windows support --- .github/workflows/ci.yml | 11 ++++++++++- build.sbt | 7 ++++++- .../coveralls/CoberturaMultiSourceReader.scala | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a7654a..51c998f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,12 +10,21 @@ on: jobs: scala: - runs-on: ubuntu-latest strategy: + fail-fast: false # remove when PR is finished, just to make sure we don't make regression matrix: JDK: [ 8, 17 ] + os: + - ubuntu-latest + - windows-latest + runs-on: ${{ matrix.os }} steps: + - name: Ignore line ending differences in git + if: contains(runner.os, 'windows') + shell: bash + run: git config --global core.autocrlf false + - name: checkout the repo uses: actions/checkout@v4 with: diff --git a/build.sbt b/build.sbt index af4c1ef..6849989 100644 --- a/build.sbt +++ b/build.sbt @@ -7,7 +7,12 @@ lazy val generateXMLFiles = taskKey[Unit]("Generate XML files (for test)") generateXMLFiles := { val log = streams.value.log - s"./src/test/resources/generate.sh" ! log + val dir = (Test / resourceDirectory).value + + if (System.getProperty("os.name").startsWith("windows")) + Process("bash.exe", (dir / "generate.sh").getAbsoluteFile) ! log + else + (dir / "generate.sh").absolutePath ! log } lazy val prepareScripted = diff --git a/src/main/scala/org/scoverage/coveralls/CoberturaMultiSourceReader.scala b/src/main/scala/org/scoverage/coveralls/CoberturaMultiSourceReader.scala index 084871b..259a314 100644 --- a/src/main/scala/org/scoverage/coveralls/CoberturaMultiSourceReader.scala +++ b/src/main/scala/org/scoverage/coveralls/CoberturaMultiSourceReader.scala @@ -114,7 +114,7 @@ class CoberturaMultiSourceReader( protected def lineCoverage(sourceFile: String) = { val filenamePath = - splitPath(new File(sourceFile))._2.replace(File.separator, "/") + splitPath(new File(sourceFile))._2 lineCoverageMap(filenamePath) }