Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct handling of resolving ThisProject #3609

Merged
merged 1 commit into from
Oct 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
13 changes: 5 additions & 8 deletions main-settings/src/main/scala/sbt/Scope.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 == ".")
Expand All @@ -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 {
Expand Down
6 changes: 0 additions & 6 deletions main/src/main/scala/sbt/internal/Load.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down