Get parent metadata prior to requiring import dependencies

This commit is contained in:
Alexandre Archambault 2017-05-11 17:48:43 +02:00
parent bb4fcfceb6
commit 83e04a8e45
3 changed files with 42 additions and 21 deletions

View File

@ -785,31 +785,42 @@ final case class Resolution(
project: Project
): Set[ModuleVersion] = {
val approxProperties0 =
project.parent
.flatMap(projectCache.get)
.map(_._2.properties)
.fold(project.properties)(project.properties ++ _)
val needsParent =
project.parent.exists { par =>
val parentFound = projectCache.contains(par) || errorCache.contains(par)
!parentFound
}
val approxProperties = propertiesMap(approxProperties0) ++ projectProperties(project)
if (needsParent)
project.parent.toSet
else {
val profileDependencies =
profiles(
project,
approxProperties,
osInfo,
jdkVersion,
userActivations
).flatMap(p => p.dependencies ++ p.dependencyManagement)
val approxProperties0 =
project.parent
.flatMap(projectCache.get)
.map(_._2.properties)
.fold(project.properties)(project.properties ++ _)
val modules = withProperties(
project.dependencies ++ project.dependencyManagement ++ profileDependencies,
approxProperties
).collect {
case ("import", dep) => dep.moduleVersion
val approxProperties = propertiesMap(approxProperties0) ++ projectProperties(project)
val profileDependencies =
profiles(
project,
approxProperties,
osInfo,
jdkVersion,
userActivations
).flatMap(p => p.dependencies ++ p.dependencyManagement)
val modules = withProperties(
project.dependencies ++ project.dependencyManagement ++ profileDependencies,
approxProperties
).collect {
case ("import", dep) => dep.moduleVersion
}
modules.toSet
}
modules.toSet ++ project.parent
}
/**

View File

@ -0,0 +1,2 @@
org.kie:kie-api:6.5.0.Final:compile
org.slf4j:slf4j-api:1.7.2:compile

View File

@ -607,6 +607,14 @@ object CentralTests extends TestSuite {
}
}
}
'parentBeforeImports - {
* - resolutionCheck(
Module("org.kie", "kie-api"),
"6.5.0.Final",
extraRepo = Some(MavenRepository("https://repository.jboss.org/nexus/content/repositories/public"))
)
}
}
}