From 77af39c6265828e301178847dbf948a19427cea6 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Sat, 8 Oct 2022 14:24:36 +1100 Subject: [PATCH] Make build Windows compatible --- .github/workflows/pre-merge.yaml | 1 - plugin-build/build.gradle.kts | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pre-merge.yaml b/.github/workflows/pre-merge.yaml index 4cdb064..f1d6cb4 100644 --- a/.github/workflows/pre-merge.yaml +++ b/.github/workflows/pre-merge.yaml @@ -56,7 +56,6 @@ jobs: - name: Run smoke test run: ./gradlew -p plugin-build testPluginKotlinc - if: ${{ runner.os != 'Windows' }} - name: Run the compiler plugin diff --git a/plugin-build/build.gradle.kts b/plugin-build/build.gradle.kts index ad25124..ebad1de 100644 --- a/plugin-build/build.gradle.kts +++ b/plugin-build/build.gradle.kts @@ -87,13 +87,14 @@ val unzipKotlinCompiler by tasks.registering(Copy::class) { val testPluginKotlinc by tasks.registering(RunTestExecutable::class) { dependsOn(unzipKotlinCompiler, tasks.shadowJar) - executable(file("${unzipKotlinCompiler.get().destinationDir}/kotlinc/bin/kotlinc")) + val targetFile = if (org.apache.tools.ant.taskdefs.condition.Os.isFamily("windows")) "kotlinc.bat" else "kotlinc" + executable(file("${unzipKotlinCompiler.get().destinationDir}/kotlinc/bin/$targetFile")) args( listOf( "$rootDir/src/test/resources/hello.kt", "-Xplugin=${tasks.shadowJar.get().archiveFile.get().asFile.absolutePath}", "-P", - "plugin:detekt-compiler-plugin:debug=true" + "\"plugin:detekt-compiler-plugin:debug=true\"" ) ) errorOutput = ByteArrayOutputStream()