Pill, Small: Pass libraries to 'parse()' directly
This commit is contained in:
@@ -78,7 +78,7 @@ data class PLibrary(
|
||||
}
|
||||
}
|
||||
|
||||
fun parse(project: Project, context: ParserContext): PProject = with (context) {
|
||||
fun parse(project: Project, libraries: List<PLibrary>, context: ParserContext): PProject = with (context) {
|
||||
if (project != project.rootProject) {
|
||||
error("$project is not a root project")
|
||||
}
|
||||
@@ -87,7 +87,7 @@ fun parse(project: Project, context: ParserContext): PProject = with (context) {
|
||||
.filter { it.plugins.hasPlugin(JpsCompatiblePlugin::class.java) }
|
||||
.flatMap { parseModules(it) }
|
||||
|
||||
return PProject("Kotlin", project.projectDir, modules, emptyList())
|
||||
return PProject("Kotlin", project.projectDir, modules, libraries)
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -42,9 +42,9 @@ class JpsCompatibleRootPlugin : Plugin<Project> {
|
||||
DependencyMapper("org.jetbrains.kotlin", "compiler", "runtimeElements") { null }
|
||||
)
|
||||
|
||||
fun getProjectLibraries(project: PProject): List<PLibrary> {
|
||||
fun distJar(name: String) = File(project.rootDirectory, "dist/kotlinc/lib/$name.jar")
|
||||
fun projectFile(path: String) = File(project.rootDirectory, path)
|
||||
fun getProjectLibraries(project: Project): List<PLibrary> {
|
||||
fun distJar(name: String) = File(project.projectDir, "dist/kotlinc/lib/$name.jar")
|
||||
fun projectFile(path: String) = File(project.projectDir, path)
|
||||
|
||||
return listOf(
|
||||
PLibrary(
|
||||
@@ -116,12 +116,12 @@ class JpsCompatibleRootPlugin : Plugin<Project> {
|
||||
private fun pill(project: Project) {
|
||||
initEnvironment(project)
|
||||
|
||||
val jpsProject = parse(project, ParserContext(dependencyMappers))
|
||||
val jpsProject = parse(project, getProjectLibraries(project), ParserContext(dependencyMappers))
|
||||
.mapLibraries(this::attachPlatformSources, this::attachAsmSources)
|
||||
|
||||
generateKotlinPluginArtifactFile(project).write()
|
||||
|
||||
val files = render(jpsProject, getProjectLibraries(jpsProject))
|
||||
val files = render(jpsProject)
|
||||
|
||||
removeExistingIdeaLibrariesAndModules()
|
||||
removeJpsRunConfigurations()
|
||||
|
||||
@@ -12,12 +12,12 @@ class PFile(val path: File, val text: String) {
|
||||
|
||||
fun PFile(path: File, xml: xml) = PFile(path, xml.toString())
|
||||
|
||||
fun render(project: PProject, extraLibraries: List<PLibrary> = emptyList()): List<PFile> {
|
||||
fun render(project: PProject): List<PFile> {
|
||||
val files = mutableListOf<PFile>()
|
||||
|
||||
files += renderModulesFile(project)
|
||||
project.modules.forEach { files += renderModule(project, it) }
|
||||
(project.libraries + extraLibraries).forEach { files += renderLibrary(project, it) }
|
||||
project.libraries.forEach { files += renderLibrary(project, it) }
|
||||
|
||||
return files
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user