Merge pull request #3609 from dwijnand/ref

Correct handling of resolving ThisProject
This commit is contained in:
eugene yokota 2017-10-05 15:39:24 -04:00 committed by GitHub
commit 201a8031de
3 changed files with 7 additions and 14 deletions

View File

@ -391,6 +391,8 @@ lazy val mainProj = (project in file("main"))
exclude[DirectMissingMethodProblem]("sbt.internal.KeyIndex.*"),
// Removed unused val. internal.
exclude[DirectMissingMethodProblem]("sbt.internal.RelayAppender.jsonFormat"),
// Removed unused def. internal.
exclude[DirectMissingMethodProblem]("sbt.internal.Load.isProjectThis"),
)
)
.configure(

View File

@ -97,8 +97,7 @@ object Scope {
case LocalProject(id) => ProjectRef(current, id)
case RootProject(uri) => RootProject(resolveBuild(current, uri))
case ProjectRef(uri, id) => ProjectRef(resolveBuild(current, uri), id)
case ThisProject =>
RootProject(current) // Is this right? It was an inexhaustive match before..
case ThisProject => ThisProject // haven't exactly "resolved" anything..
}
def resolveBuild(current: URI, uri: URI): URI =
if (!uri.isAbsolute && current.isOpaque && uri.getSchemeSpecificPart == ".")
@ -118,13 +117,11 @@ object Scope {
rootProject: URI => String,
ref: ProjectReference): ProjectRef =
ref match {
case LocalRootProject => ProjectRef(current, rootProject(current))
case LocalProject(id) => ProjectRef(current, id)
case RootProject(uri) =>
val res = resolveBuild(current, uri); ProjectRef(res, rootProject(res))
case LocalRootProject => ProjectRef(current, rootProject(current))
case LocalProject(id) => ProjectRef(current, id)
case RootProject(uri) => val u = resolveBuild(current, uri); ProjectRef(u, rootProject(u))
case ProjectRef(uri, id) => ProjectRef(resolveBuild(current, uri), id)
case ThisProject =>
ProjectRef(current, rootProject(current)) // Is this right? It was an inexhaustive match before..
case ThisProject => sys.error("Cannot resolve ThisProject w/o the current project")
}
def resolveBuildRef(current: URI, ref: BuildReference): BuildRef =
ref match {

View File

@ -363,12 +363,6 @@ private[sbt] object Load {
)
}
def isProjectThis(s: Setting[_]): Boolean =
s.key.scope.project match {
case This | Select(ThisProject) => true
case _ => false
}
def buildConfigurations(
loaded: LoadedBuild,
rootProject: URI => String,