Skip to content

Commit

Permalink
Fix usage of plugin in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
voczi authored and mikehardy committed Jun 26, 2024
1 parent fca8a81 commit 9d0b8b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ internal fun File.classesSequence(): Sequence<Pair<String, File>> {
.filter { it.extension == "class" }
.filterNot { "META-INF" in it.name }
.sortedBy { it.invariantSeparatorsPath }
.map { it.absolutePath.removePrefix(prefix).removePrefix("/") to it }
.map {
it.absolutePath
.removePrefix(prefix)
.removePrefix(File.separator)
.replace(File.separator, "/") to it
}
}

/** Extracts classes from the target [jar] into this archive. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ internal class KeeperFunctionalTest {
projectDir.generatedChild("ExternalStagingAndroidTest/inferredKeepRules.pro")
assertThat(generatedRules.readText().trim())
.isEqualTo(
EXPECTED_TRACE_REFERENCES_CONFIG.map { indentRules(it.key, it.value) }.joinToString("\n")
EXPECTED_TRACE_REFERENCES_CONFIG.map { indentRules(it.key, it.value) }
.joinToString(System.lineSeparator())
)

// Finally - verify our rules were included in the final minification execution.
Expand Down Expand Up @@ -292,7 +293,11 @@ private val EXPECTED_TRACE_REFERENCES_CONFIG: Map<String, List<String>?> =
private fun indentRules(header: String, content: List<String>?) =
if (content == null) header
else {
"$header {\n${content.joinToString("\n") { " $it" }}\n}"
"$header {" +
System.lineSeparator() +
content.joinToString(System.lineSeparator()) { " $it" } +
System.lineSeparator() +
"}"
}

@Language("PROGUARD")
Expand Down Expand Up @@ -399,7 +404,10 @@ private fun buildGradleFile(
id 'com.slack.keeper'
}
java { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } }
// Ideally we use toolchains for a known version; this fails on windows w/WindowsRegistry access issues
// See: https://github.com/gradle/native-platform/issues/274
// So we will just rely on environment JDK
//java { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } }
tasks.withType(KotlinCompile).configureEach { compilerOptions { jvmTarget.set(JvmTarget.JVM_11) } }
Expand Down Expand Up @@ -480,7 +488,7 @@ private fun buildGradleFile(
}
dependencies {
${extraDependencies.entries.joinToString("\n") { " ${it.key} ${it.value}" }}
${extraDependencies.entries.joinToString(System.lineSeparator()) { " ${it.key} ${it.value}" }}
}
"""
.trimIndent()
Expand Down

0 comments on commit 9d0b8b2

Please sign in to comment.