Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make the unit tests work under Windows #210

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions src/test/groovy/com/gorylenko/BuildSrcFunctionalTest.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gorylenko

import com.gorylenko.properties.GitRepositoryBuilder
import groovy.json.JsonOutput
import org.gradle.testkit.runner.GradleRunner
import org.gradle.testkit.runner.TaskOutcome
import org.junit.Rule
Expand All @@ -19,24 +20,21 @@ public class BuildSrcFunctionalTest {
def projectDir = temporaryFolder.newFolder()
def runner = GradleRunner.create()
.withPluginClasspath()
.withArguments("check")
.withProjectDir(projectDir)

def classpathString = runner.pluginClasspath
.collect { "'$it'" }
.join(", ")
runner.withArguments('check', "-Dcom.gorylenko.gradle-git-properties.unit-test-classpath=${JsonOutput.toJson(runner.pluginClasspath*.path)}")

def buildSrcDir = new File(projectDir, "buildSrc")
buildSrcDir.mkdirs()
new File(buildSrcDir, "build.gradle") << """\
import groovy.json.JsonSlurper
plugins {
id("groovy-gradle-plugin")
}
repositories {
gradlePluginPortal()
}
dependencies {
runtimeClasspath files($classpathString)
runtimeClasspath files(new JsonSlurper().parseText(System.getProperty('com.gorylenko.gradle-git-properties.unit-test-classpath')))
}
"""
def pluginSourceDir = buildSrcDir.toPath().resolve("src").resolve("main").resolve("groovy").toFile()
Expand Down Expand Up @@ -77,24 +75,22 @@ public class BuildSrcFunctionalTest {
.withPluginClasspath()
.withArguments("check")
.withProjectDir(projectDir)

def classpathString = runner.pluginClasspath
.collect { "'$it'" }
.join(", ")
runner.withArguments('check', "-Dcom.gorylenko.gradle-git-properties.unit-test-classpath=${JsonOutput.toJson(runner.pluginClasspath*.path)}")

def buildSrcDir = new File(projectDir, "buildSrc")
buildSrcDir.mkdirs()
def gitPropDir = new File(projectDir, "gitProp")
gitPropDir.mkdirs()
new File(buildSrcDir, "build.gradle") << """\
import groovy.json.JsonSlurper
plugins {
id("groovy-gradle-plugin")
}
repositories {
gradlePluginPortal()
}
dependencies {
runtimeClasspath files($classpathString)
runtimeClasspath files(new JsonSlurper().parseText(System.getProperty('com.gorylenko.gradle-git-properties.unit-test-classpath')))
}
"""
def pluginSourceDir = buildSrcDir.toPath().resolve("src").resolve("main").resolve("groovy").toFile()
Expand Down