Skip to content

Commit

Permalink
Fix windows paths in gradle-plugin/src/test
Browse files Browse the repository at this point in the history
(cherry picked from commit a4281c1)
  • Loading branch information
ting-yuan authored and KSP Auto Pick committed Apr 7, 2022
1 parent f7fccb2 commit afd4091
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.google.devtools.ksp.symbol.KSClassDeclaration
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
import java.io.File

class SourceSetConfigurationsTest {
@Rule
Expand Down Expand Up @@ -200,6 +201,8 @@ class SourceSetConfigurationsTest {
val variantName: String,
val path: String
)

fun String.normalizePath() = replace(File.separatorChar, '/')
// parse output to get variant names and sources
// variant name -> list of sources
val variantSources = mutableListOf<SourceFolder>()
Expand All @@ -213,7 +216,7 @@ class SourceSetConfigurationsTest {
variantSources.add(
SourceFolder(
variantName = currentVariantName,
path = line
path = line.normalizePath()
)
)
}
Expand All @@ -222,7 +225,7 @@ class SourceSetConfigurationsTest {
variantSources.add(
SourceFolder(
variantName = currentVariantName,
path = line
path = line.normalizePath()
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ data class TestConfig(
kspProjectProperties["agpBaseVersion"] as String
}

val mavenRepoPath = mavenRepoDir.path.replace(File.separatorChar, '/')

companion object {
/**
* Loads the test configuration from resources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ class TestProject(
)
)
// add gradle-plugin test classpath as a dependency to be able to load processors.
it.dependencies.add(
DependencyDeclaration.files(
"implementation",
testConfig.processorClasspath
testConfig.processorClasspath.split(File.pathSeparatorChar).forEach { path ->
it.dependencies.add(
DependencyDeclaration.files("implementation", path.replace(File.separatorChar, '/'))
)
)
}
}

val appModule = TestModule(
Expand All @@ -61,7 +60,7 @@ class TestProject(
include("app")
pluginManagement {
repositories {
maven("${testConfig.mavenRepoDir}")
maven("${testConfig.mavenRepoPath}")
gradlePluginPortal()
google()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap/")
Expand Down Expand Up @@ -90,7 +89,7 @@ class TestProject(
appendln(
"""
repositories {
maven("${testConfig.mavenRepoDir}")
maven("${testConfig.mavenRepoPath}")
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap/")
google()
Expand All @@ -104,7 +103,7 @@ class TestProject(
}
subprojects {
repositories {
maven("${testConfig.mavenRepoDir}")
maven("${testConfig.mavenRepoPath}")
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap/")
google()
Expand Down

0 comments on commit afd4091

Please sign in to comment.