rename accesswidener extension, actually test for the aw header
All checks were successful
Publish to snapshot maven / build (push) Successful in 18s

This commit is contained in:
moehreag 2024-06-10 11:24:21 +02:00
parent 41505068a2
commit a862a16e80

View file

@ -10,7 +10,6 @@ import java.nio.charset.StandardCharsets
import java.nio.file.FileSystems import java.nio.file.FileSystems
import java.nio.file.Path import java.nio.file.Path
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ConcurrentSkipListSet
import java.util.regex.Pattern import java.util.regex.Pattern
import java.util.stream.Stream import java.util.stream.Stream
import kotlin.io.path.bufferedReader import kotlin.io.path.bufferedReader
@ -34,7 +33,7 @@ object AccessWidener {
return null return null
} }
return PARSER.parse(it, FileNotFoundAction.READ_NOTHING) return PARSER.parse(it, FileNotFoundAction.READ_NOTHING)
.get<String>("frog.extensions.frog_aw")?.let { name -> .get<String>("frog.extensions.accesswidener")?.let { name ->
return it.resolveSibling(name).toPath() return it.resolveSibling(name).toPath()
} }
} }
@ -63,7 +62,8 @@ object AccessWidener {
private fun readAW(project: Project): Stream<String> { private fun readAW(project: Project): Stream<String> {
val awFile = getAWFile(project) val awFile = getAWFile(project)
println("Found accesswidener in project: $awFile") println("Found accesswidener in project: $awFile")
return awFile?.bufferedReader(StandardCharsets.UTF_8)?.lines()?.map { it.replace("transitive-", "") } return awFile?.bufferedReader(StandardCharsets.UTF_8).takeIf { HEADER.test(readlnOrNull()) }?.lines()
?.map { it.replace("transitive-", "") }
?: Stream.empty() ?: Stream.empty()
} }
@ -174,8 +174,8 @@ data class Entry(
AccessType.of(line[0]), AccessType.of(line[0]),
line[1], line[1],
line[2], line[2],
line.getOrElse(3) {_ -> null}, line.getOrElse(3) { _ -> null },
line.getOrElse(4) {_ -> null}, line.getOrElse(4) { _ -> null },
) )
fun isAccessGreaterThan(other: Entry): Boolean { fun isAccessGreaterThan(other: Entry): Boolean {