Fixes to make the project compile when using Pill
This commit is contained in:
@@ -85,16 +85,21 @@ fun parse(project: Project, context: ParserContext): PProject = with (context) {
|
||||
return PProject("Kotlin", project.rootProject.projectDir, modules, emptyList())
|
||||
}
|
||||
|
||||
/*
|
||||
Ordering here and below is significant.
|
||||
Placing 'runtime' configuration dependencies on the top make 'idea' tests to run normally.
|
||||
('idea' module has 'intellij-core' as transitive dependency, and we really need to get rid of it.)
|
||||
*/
|
||||
private val CONFIGURATION_MAPPING = mapOf(
|
||||
listOf("runtime") to Scope.RUNTIME,
|
||||
listOf("compile") to Scope.COMPILE,
|
||||
listOf("compileOnly") to Scope.PROVIDED,
|
||||
listOf("runtime") to Scope.RUNTIME
|
||||
listOf("compileOnly") to Scope.PROVIDED
|
||||
)
|
||||
|
||||
private val TEST_CONFIGURATION_MAPPING = mapOf(
|
||||
listOf("runtime", "testRuntime") to Scope.RUNTIME,
|
||||
listOf("compile", "testCompile") to Scope.COMPILE,
|
||||
listOf("compileOnly", "testCompileOnly") to Scope.PROVIDED,
|
||||
listOf("runtime", "testRuntime") to Scope.RUNTIME
|
||||
listOf("compileOnly", "testCompileOnly") to Scope.PROVIDED
|
||||
)
|
||||
|
||||
private val SOURCE_SET_MAPPING = mapOf(
|
||||
@@ -227,8 +232,7 @@ private fun ParserContext.parseDependencies(project: Project, forTests: Boolean)
|
||||
val configurationMapping = if (forTests) TEST_CONFIGURATION_MAPPING else CONFIGURATION_MAPPING
|
||||
|
||||
with(project.configurations) {
|
||||
val moduleRoots = mutableListOf<POrderRoot>()
|
||||
val libraryRoots = mutableListOf<POrderRoot>()
|
||||
val mainRoots = mutableListOf<POrderRoot>()
|
||||
val deferredRoots = mutableListOf<POrderRoot>()
|
||||
|
||||
fun collectConfigurations(): List<Pair<ResolvedConfiguration, Scope>> {
|
||||
@@ -255,9 +259,9 @@ private fun ParserContext.parseDependencies(project: Project, forTests: Boolean)
|
||||
if (mappedDependency != null) {
|
||||
val orderRoot = POrderRoot(mappedDependency.main, scope)
|
||||
if (mappedDependency.main is PDependency.Module) {
|
||||
moduleRoots += orderRoot
|
||||
mainRoots += orderRoot
|
||||
} else {
|
||||
libraryRoots += orderRoot
|
||||
mainRoots += orderRoot
|
||||
}
|
||||
|
||||
for (deferredDep in mappedDependency.deferred) {
|
||||
@@ -270,9 +274,9 @@ private fun ParserContext.parseDependencies(project: Project, forTests: Boolean)
|
||||
}
|
||||
|
||||
if (dependency.configuration == "runtimeElements") {
|
||||
moduleRoots += POrderRoot(PDependency.Module(dependency.moduleName + ".src"), scope)
|
||||
mainRoots += POrderRoot(PDependency.Module(dependency.moduleName + ".src"), scope)
|
||||
} else if (dependency.configuration == "tests-jar") {
|
||||
moduleRoots += POrderRoot(
|
||||
mainRoots += POrderRoot(
|
||||
PDependency.Module(dependency.moduleName + ".test"),
|
||||
scope,
|
||||
isProductionOnTestDependency = true
|
||||
@@ -280,11 +284,11 @@ private fun ParserContext.parseDependencies(project: Project, forTests: Boolean)
|
||||
} else {
|
||||
val classes = dependency.moduleArtifacts.map { it.file }
|
||||
val library = PLibrary(dependency.moduleName, classes)
|
||||
libraryRoots += POrderRoot(PDependency.ModuleLibrary(library), scope)
|
||||
mainRoots += POrderRoot(PDependency.ModuleLibrary(library), scope)
|
||||
}
|
||||
}
|
||||
|
||||
return removeDuplicates(moduleRoots + libraryRoots + deferredRoots)
|
||||
return removeDuplicates(mainRoots + deferredRoots)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class ScriptGenTest : CodegenTestCase() {
|
||||
super.setUp()
|
||||
additionalDependencies =
|
||||
System.getenv("PROJECT_CLASSES_DIRS")?.split(File.pathSeparator)?.map { File(it) }
|
||||
?: listOf("compiler/build/classes/kotlin/test", "build/compiler/classes/kotlin/test")
|
||||
?: listOf("compiler/build/classes/kotlin/test", "build/compiler/classes/kotlin/test", "out/test/compiler.test")
|
||||
.mapNotNull { File(it).canonicalFile.takeIf { it.isDirectory } }
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?: throw IllegalStateException("Unable to get classes output dirs, set PROJECT_CLASSES_DIRS environment variable")
|
||||
|
||||
@@ -37,6 +37,8 @@ dependencies {
|
||||
compile(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false }
|
||||
compile("teamcity:markdown")
|
||||
|
||||
compileOnly(project(":kotlin-daemon-client"))
|
||||
|
||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
compileOnly(intellijDep()) {
|
||||
includeJars("annotations", "openapi", "idea", "velocity", "boot", "gson", "log4j", "asm-all",
|
||||
|
||||
@@ -20,6 +20,7 @@ dependencies {
|
||||
|
||||
compile(androidDxJar())
|
||||
|
||||
compileOnly(project(":kotlin-android-extensions-runtime"))
|
||||
compileOnly(intellijDep()) { includeJars("openapi", "idea", "extensions", "util", "guava", "android-base-common", rootProject = rootProject) }
|
||||
compileOnly(intellijPluginDep("android")) {
|
||||
includeJars("android", "android-common", "sdk-common", "sdklib", "sdk-tools", "layoutlib-api")
|
||||
|
||||
@@ -15,7 +15,7 @@ dependencies {
|
||||
compile(project(":idea:idea-jvm"))
|
||||
compile(project(":idea:idea-jps-common"))
|
||||
compile(project(":plugins:annotation-based-compiler-plugins-ide-support"))
|
||||
compileOnly(intellijDep()) { includeJars("openapi", "idea", "util") }
|
||||
compileOnly(intellijDep()) { includeJars("openapi", "idea", "util", "extensions") }
|
||||
excludeInAndroidStudio(rootProject) { compileOnly(intellijPluginDep("maven")) { includeJars("maven") } }
|
||||
compileOnly(intellijPluginDep("gradle")) { includeJars("gradle-tooling-api", "gradle", rootProject = rootProject) }
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ dependencies {
|
||||
compile(project(":idea:idea-core"))
|
||||
compile(project(":idea:idea-android"))
|
||||
compile(project(":plugins:uast-kotlin"))
|
||||
compileOnly(project(":kotlin-android-extensions-runtime"))
|
||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
compileOnly(intellijDep()) { includeJars("util", "guava", "openapi", "idea", "asm-all", "annotations", rootProject = rootProject) }
|
||||
compileOnly(intellijPluginDep("android")) {
|
||||
|
||||
@@ -16,7 +16,7 @@ dependencies {
|
||||
compile(project(":idea"))
|
||||
compile(project(":idea:idea-jps-common"))
|
||||
compile(project(":plugins:annotation-based-compiler-plugins-ide-support"))
|
||||
compileOnly(intellijDep()) { includeJars("openapi", "idea", "util") }
|
||||
compileOnly(intellijDep()) { includeJars("openapi", "idea", "util", "extensions") }
|
||||
excludeInAndroidStudio(rootProject) { compileOnly(intellijPluginDep("maven")) { includeJars("maven") } }
|
||||
compileOnly(intellijPluginDep("gradle")) { includeJars("gradle-tooling-api", "gradle", rootProject = rootProject) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user