Pill: Fix compilation, forcibly move the annotations-13 dependency to the end of classpath

This commit is contained in:
Yan Zhulanow
2018-06-04 17:40:55 +03:00
parent 769a0d7701
commit 42d00c144b
3 changed files with 13 additions and 2 deletions
+2 -1
View File
@@ -7,9 +7,10 @@ class DependencyMapper(
val group: String, val group: String,
val module: String, val module: String,
vararg val configurations: String, vararg val configurations: String,
val version: String? = null,
val mapping: (ResolvedDependency) -> MappedDependency? val mapping: (ResolvedDependency) -> MappedDependency?
) )
class MappedDependency(val main: PDependency, val deferred: List<PDependency> = emptyList()) class MappedDependency(val main: PDependency?, val deferred: List<PDependency> = emptyList())
class ParserContext(val dependencyMappers: List<DependencyMapper>, val variant: PillExtension.Variant) class ParserContext(val dependencyMappers: List<DependencyMapper>, val variant: PillExtension.Variant)
+5 -1
View File
@@ -366,11 +366,15 @@ private fun ParserContext.parseDependencies(project: Project, forTests: Boolean)
if (dependency.moduleGroup == mapper.group if (dependency.moduleGroup == mapper.group
&& dependency.moduleName == mapper.module && dependency.moduleName == mapper.module
&& dependency.configuration in mapper.configurations && dependency.configuration in mapper.configurations
&& (mapper.version == null || dependency.moduleVersion == mapper.version)
) { ) {
val mappedDependency = mapper.mapping(dependency) val mappedDependency = mapper.mapping(dependency)
if (mappedDependency != null) { if (mappedDependency != null) {
mainRoots += POrderRoot(mappedDependency.main, scope) val mainDependency = mappedDependency.main
if (mainDependency != null) {
mainRoots += POrderRoot(mainDependency, scope)
}
for (deferredDep in mappedDependency.deferred) { for (deferredDep in mappedDependency.deferred) {
deferredRoots += POrderRoot(deferredDep, scope) deferredRoots += POrderRoot(deferredDep, scope)
+6
View File
@@ -36,6 +36,12 @@ class JpsCompatiblePlugin : Plugin<Project> {
listOf(PDependency.Library("annotations-13.0")) listOf(PDependency.Library("annotations-13.0"))
) )
}, },
DependencyMapper("org.jetbrains", "annotations", "default", version = "13.0") {
MappedDependency(
null,
listOf(PDependency.Library("annotations-13.0"))
)
},
DependencyMapper("org.jetbrains.kotlin", "kotlin-reflect-api", "runtimeElements") { DependencyMapper("org.jetbrains.kotlin", "kotlin-reflect-api", "runtimeElements") {
MappedDependency(PDependency.Library("kotlin-reflect")) MappedDependency(PDependency.Library("kotlin-reflect"))
}, },