Pill: Exclude 'build' dirs from excluded projects
This commit is contained in:
@@ -48,6 +48,15 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pill {
|
||||||
|
excludedDirs(
|
||||||
|
"out",
|
||||||
|
"buildSrc/build",
|
||||||
|
"buildSrc/prepare-deps/android-dx/build",
|
||||||
|
"buildSrc/prepare-deps/intellij-sdk/build"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
buildScan {
|
buildScan {
|
||||||
setTermsOfServiceUrl("https://gradle.com/terms-of-service")
|
setTermsOfServiceUrl("https://gradle.com/terms-of-service")
|
||||||
setTermsOfServiceAgree("yes")
|
setTermsOfServiceAgree("yes")
|
||||||
|
|||||||
@@ -48,6 +48,15 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pill {
|
||||||
|
excludedDirs(
|
||||||
|
"out",
|
||||||
|
"buildSrc/build",
|
||||||
|
"buildSrc/prepare-deps/android-dx/build",
|
||||||
|
"buildSrc/prepare-deps/intellij-sdk/build"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
buildScan {
|
buildScan {
|
||||||
setTermsOfServiceUrl("https://gradle.com/terms-of-service")
|
setTermsOfServiceUrl("https://gradle.com/terms-of-service")
|
||||||
setTermsOfServiceAgree("yes")
|
setTermsOfServiceAgree("yes")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
package org.jetbrains.kotlin.pill
|
package org.jetbrains.kotlin.pill
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import org.gradle.api.Project
|
||||||
|
|
||||||
open class PillExtension {
|
open class PillExtension {
|
||||||
enum class Variant {
|
enum class Variant {
|
||||||
@@ -24,6 +25,12 @@ open class PillExtension {
|
|||||||
|
|
||||||
open var importAsLibrary: Boolean = false
|
open var importAsLibrary: Boolean = false
|
||||||
|
|
||||||
|
open var excludedDirs: List<File> = emptyList()
|
||||||
|
|
||||||
|
fun Project.excludedDirs(vararg dirs: String) {
|
||||||
|
excludedDirs = excludedDirs + dirs.map { File(projectDir, it) }
|
||||||
|
}
|
||||||
|
|
||||||
open var libraryPath: File? = null
|
open var libraryPath: File? = null
|
||||||
set(v) {
|
set(v) {
|
||||||
importAsLibrary = true
|
importAsLibrary = true
|
||||||
|
|||||||
@@ -86,9 +86,10 @@ fun parse(project: Project, libraries: List<PLibrary>, context: ParserContext):
|
|||||||
return projectVariant in context.variant.includes
|
return projectVariant in context.variant.includes
|
||||||
}
|
}
|
||||||
|
|
||||||
val modules = project.allprojects
|
val (includedProjects, excludedProjects) = project.allprojects
|
||||||
.filter { it.plugins.hasPlugin(JpsCompatiblePlugin::class.java) && it.matchesSelectedVariant() }
|
.partition { it.plugins.hasPlugin(JpsCompatiblePlugin::class.java) && it.matchesSelectedVariant() }
|
||||||
.flatMap { parseModules(it) }
|
|
||||||
|
val modules = includedProjects.flatMap { parseModules(it, excludedProjects) }
|
||||||
|
|
||||||
return PProject("Kotlin", project.projectDir, modules, libraries)
|
return PProject("Kotlin", project.projectDir, modules, libraries)
|
||||||
}
|
}
|
||||||
@@ -116,7 +117,7 @@ private val SOURCE_SET_MAPPING = mapOf(
|
|||||||
"test" to Kind.TEST
|
"test" to Kind.TEST
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun ParserContext.parseModules(project: Project): List<PModule> {
|
private fun ParserContext.parseModules(project: Project, excludedProjects: List<Project>): List<PModule> {
|
||||||
val (productionContentRoots, testContentRoots) = parseContentRoots(project).partition { !it.forTests }
|
val (productionContentRoots, testContentRoots) = parseContentRoots(project).partition { !it.forTests }
|
||||||
|
|
||||||
val modules = mutableListOf<PModule>()
|
val modules = mutableListOf<PModule>()
|
||||||
@@ -124,7 +125,10 @@ private fun ParserContext.parseModules(project: Project): List<PModule> {
|
|||||||
fun getJavaExcludedDirs() = project.plugins.findPlugin(IdeaPlugin::class.java)
|
fun getJavaExcludedDirs() = project.plugins.findPlugin(IdeaPlugin::class.java)
|
||||||
?.model?.module?.excludeDirs?.toList() ?: emptyList()
|
?.model?.module?.excludeDirs?.toList() ?: emptyList()
|
||||||
|
|
||||||
val allExcludedDirs = getJavaExcludedDirs() + project.buildDir
|
fun getPillExcludedDirs() = project.extensions.getByType(PillExtension::class.java).excludedDirs
|
||||||
|
|
||||||
|
val allExcludedDirs = getPillExcludedDirs() + getJavaExcludedDirs() + project.buildDir +
|
||||||
|
(if (project == project.rootProject) excludedProjects.map { it.buildDir } else emptyList())
|
||||||
|
|
||||||
var productionSourcesModule: PModule? = null
|
var productionSourcesModule: PModule? = null
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user