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"
|
group = "dev.frogmc"
|
||||||
version = "0.0.1-alpha.4"
|
version = "0.0.1-alpha.5"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
|
|
@ -42,21 +42,21 @@ object AccessWidener {
|
||||||
return null
|
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)
|
val conf = project.configurations.getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME)
|
||||||
return conf.dependencies.filterIsInstance<ProjectDependency>().map {
|
val projectDeps = conf.dependencies.filterIsInstance<ProjectDependency>()
|
||||||
getAWFile(it.dependencyProject)
|
.mapNotNull { getAWFile(it.dependencyProject) }.stream().flatMap { readTransitiveAW(it) }
|
||||||
}.plus(conf.resolvedConfiguration.firstLevelModuleDependencies.flatMap {
|
val dependencies = conf.resolvedConfiguration.files.map { it.toPath() }.filter { it.exists() && it.isRegularFile() }.stream().flatMap {
|
||||||
dep -> dep.moduleArtifacts
|
FileSystems.newFileSystem(it).use {fs ->
|
||||||
}.map { it.file.toPath() }.filter { it.exists() && it.isRegularFile() }.map {
|
val metadata = fs.getPath(Constants.MOD_METADATA_FILE)
|
||||||
FileSystems.newFileSystem(it).use {fs ->
|
PARSER.parse(metadata, FileNotFoundAction.READ_NOTHING)
|
||||||
val metadata = fs.getPath(Constants.MOD_METADATA_FILE)
|
.get<String>("frog.extensions.accesswidener")?.let { name ->
|
||||||
PARSER.parse(metadata, FileNotFoundAction.READ_NOTHING)
|
return@flatMap readTransitiveAW(metadata.resolveSibling(name))
|
||||||
.get<String>("frog.extensions.accesswidener")?.let { name ->
|
}
|
||||||
return@map metadata.resolveSibling(name)
|
}
|
||||||
}
|
return@flatMap null
|
||||||
}
|
}.filter { it != null }
|
||||||
}.toList()).filterNotNull()
|
return Stream.concat(projectDeps, dependencies)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun needsUpdate(project: Project): Boolean {
|
fun needsUpdate(project: Project): Boolean {
|
||||||
|
@ -81,12 +81,12 @@ object AccessWidener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun readTransitiveAW(path: Path): Stream<String> {
|
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> {
|
private fun readAllAWs(project: Project): Stream<Entry> {
|
||||||
return Stream.concat(
|
return Stream.concat(
|
||||||
findDependencyAWs(project).stream().flatMap { i -> readTransitiveAW(i) },
|
findDependencyAWs(project),
|
||||||
readAW(project)
|
readAW(project)
|
||||||
)
|
)
|
||||||
.filter { it.isNotBlank() }
|
.filter { it.isNotBlank() }
|
||||||
|
|
Loading…
Reference in a new issue