resolve transitive aws from all dependencies
All checks were successful
Publish to snapshot maven / build (push) Successful in 26s
All checks were successful
Publish to snapshot maven / build (push) Successful in 26s
This commit is contained in:
parent
41e34721cb
commit
6cd02d95c9
|
@ -7,7 +7,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "dev.frogmc"
|
||||
version = "0.0.1-alpha.4"
|
||||
version = "0.0.1-alpha.5"
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
|
|
|
@ -42,21 +42,21 @@ object AccessWidener {
|
|||
return null
|
||||
}
|
||||
|
||||
private fun findDependencyAWs(project: Project): List<Path> {
|
||||
private fun findDependencyAWs(project: Project): Stream<String> {
|
||||
val conf = project.configurations.getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME)
|
||||
return conf.dependencies.filterIsInstance<ProjectDependency>().map {
|
||||
getAWFile(it.dependencyProject)
|
||||
}.plus(conf.resolvedConfiguration.firstLevelModuleDependencies.flatMap {
|
||||
dep -> dep.moduleArtifacts
|
||||
}.map { it.file.toPath() }.filter { it.exists() && it.isRegularFile() }.map {
|
||||
val projectDeps = conf.dependencies.filterIsInstance<ProjectDependency>()
|
||||
.mapNotNull { getAWFile(it.dependencyProject) }.stream().flatMap { readTransitiveAW(it) }
|
||||
val dependencies = conf.resolvedConfiguration.files.map { it.toPath() }.filter { it.exists() && it.isRegularFile() }.stream().flatMap {
|
||||
FileSystems.newFileSystem(it).use {fs ->
|
||||
val metadata = fs.getPath(Constants.MOD_METADATA_FILE)
|
||||
PARSER.parse(metadata, FileNotFoundAction.READ_NOTHING)
|
||||
.get<String>("frog.extensions.accesswidener")?.let { name ->
|
||||
return@map metadata.resolveSibling(name)
|
||||
return@flatMap readTransitiveAW(metadata.resolveSibling(name))
|
||||
}
|
||||
}
|
||||
}.toList()).filterNotNull()
|
||||
return@flatMap null
|
||||
}.filter { it != null }
|
||||
return Stream.concat(projectDeps, dependencies)
|
||||
}
|
||||
|
||||
fun needsUpdate(project: Project): Boolean {
|
||||
|
@ -81,12 +81,12 @@ object AccessWidener {
|
|||
}
|
||||
|
||||
private fun readTransitiveAW(path: Path): Stream<String> {
|
||||
return path.bufferedReader(StandardCharsets.UTF_8).lines().filter { it.startsWith("transitive-") }
|
||||
return path.bufferedReader(StandardCharsets.UTF_8).takeIf { HEADER.test(it.readLine() ?: "") }?.lines()?.filter { it.startsWith("transitive-") }?: Stream.empty()
|
||||
}
|
||||
|
||||
private fun readAllAWs(project: Project): Stream<Entry> {
|
||||
return Stream.concat(
|
||||
findDependencyAWs(project).stream().flatMap { i -> readTransitiveAW(i) },
|
||||
findDependencyAWs(project),
|
||||
readAW(project)
|
||||
)
|
||||
.filter { it.isNotBlank() }
|
||||
|
|
Loading…
Reference in a new issue