[Pill] Remove 'excludedDirs' usage from Pill extension
As it was the last usage of the Pill extension, it is going to be removed in subsequent commits.
This commit is contained in:
@@ -70,6 +70,8 @@ class JpsCompatiblePluginTasks(
|
||||
Regex("kotlin_test_wasm_js_[\\d_]+_SNAPSHOT\\.xml"),
|
||||
Regex("kotlin_dom_api_compat_[\\d_]+_SNAPSHOT\\.xml")
|
||||
)
|
||||
|
||||
private val EXCLUDED_DIRECTORY_PATHS = listOf("out")
|
||||
}
|
||||
|
||||
private lateinit var projectDir: File
|
||||
@@ -92,7 +94,8 @@ class JpsCompatiblePluginTasks(
|
||||
rootProject.logger.lifecycle("Pill: Setting up project...")
|
||||
|
||||
val modulePrefix = System.getProperty("pill.module.prefix", "")
|
||||
val modelParser = ModelParser(modulePrefix)
|
||||
val globalExcludedDirectories = EXCLUDED_DIRECTORY_PATHS.map { File(rootProject.projectDir, it) }
|
||||
val modelParser = ModelParser(modulePrefix, globalExcludedDirectories)
|
||||
|
||||
val dependencyPatcher = DependencyPatcher(rootProject)
|
||||
val dependencyMappers = listOf(dependencyPatcher, ::attachPlatformSources, ::attachAsmSources)
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.*
|
||||
typealias OutputDir = String
|
||||
typealias GradleProjectPath = String
|
||||
|
||||
class ModelParser(private val modulePrefix: String) {
|
||||
class ModelParser(private val modulePrefix: String, private val globalExcludedDirectories: List<File>) {
|
||||
fun parse(project: Project): PProject {
|
||||
if (project != project.rootProject) {
|
||||
error("$project is not a root project")
|
||||
@@ -182,7 +182,7 @@ class ModelParser(private val modulePrefix: String) {
|
||||
forTests = false,
|
||||
rootDirectory = project.projectDir,
|
||||
moduleFile = mainModuleFileRelativePath,
|
||||
contentRoots = listOf(PContentRoot(project.projectDir, listOf(), getExcludedDirs(project, excludedProjects))),
|
||||
contentRoots = listOf(PContentRoot(project.projectDir, listOf(), computeAllExcludedDirectories(project, excludedProjects))),
|
||||
orderRoots = emptyList(),
|
||||
javaLanguageVersion = null,
|
||||
kotlinOptions = null,
|
||||
@@ -199,14 +199,13 @@ class ModelParser(private val modulePrefix: String) {
|
||||
return javaToolchainService.launcherFor(javaPluginExtension.toolchain).orNull?.metadata?.languageVersion?.asInt()
|
||||
}
|
||||
|
||||
private fun getExcludedDirs(project: Project, excludedProjects: List<Project>): List<File> {
|
||||
fun getJavaExcludedDirs() = project.plugins.findPlugin(IdeaPlugin::class.java)
|
||||
?.model?.module?.excludeDirs?.toList() ?: emptyList()
|
||||
private fun computeAllExcludedDirectories(project: Project, excludedProjects: List<Project>): List<File> {
|
||||
val javaExcludedDirectories = project.plugins.findPlugin(IdeaPlugin::class.java)
|
||||
?.model?.module?.excludeDirs?.toList().orEmpty()
|
||||
|
||||
fun getPillExcludedDirs() = project.findPillExtensionMirror()?.excludedDirs ?: emptyList()
|
||||
val excludedProjectDirectories = if (project == project.rootProject) excludedProjects.map { it.buildDir } else emptyList()
|
||||
|
||||
return getPillExcludedDirs() + getJavaExcludedDirs() + project.buildDir +
|
||||
(if (project == project.rootProject) excludedProjects.map { it.buildDir } else emptyList())
|
||||
return globalExcludedDirectories + javaExcludedDirectories + project.buildDir + excludedProjectDirectories
|
||||
}
|
||||
|
||||
private fun parseSourceSets(project: Project): List<PSourceSet> {
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.pill
|
||||
|
||||
import java.io.File
|
||||
import org.gradle.api.Project
|
||||
|
||||
open class PillExtensionMirror(val excludedDirs: List<File>)
|
||||
|
||||
fun Project.findPillExtensionMirror(): PillExtensionMirror? {
|
||||
val ext = extensions.findByName("pill") ?: return null
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val serialized = ext::class.java.getMethod("serialize").invoke(ext) as Map<String, Any>
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val excludedDirs = serialized["excludedDirs"] as List<File>
|
||||
|
||||
return PillExtensionMirror(excludedDirs)
|
||||
}
|
||||
Reference in New Issue
Block a user