Skip to content

Commit

Permalink
set organization at higher scope for default project
Browse files Browse the repository at this point in the history
  • Loading branch information
harrah committed May 28, 2012
1 parent 1488bf2 commit e8fcdc0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions main/Build.scala
Expand Up @@ -10,8 +10,8 @@ package sbt
import complete.DefaultParsers.validID import complete.DefaultParsers.validID
import Compiler.Compilers import Compiler.Compilers
import Keys.{globalBaseDirectory, globalPluginsDirectory, globalSettingsDirectory, stagingDirectory, Streams} import Keys.{globalBaseDirectory, globalPluginsDirectory, globalSettingsDirectory, stagingDirectory, Streams}
import Keys.{name, organization, thisProject}
import Project.{ScopedKey, Setting} import Project.{ScopedKey, Setting}
import Keys.{globalBaseDirectory, Streams}
import Scope.GlobalScope import Scope.GlobalScope
import scala.annotation.tailrec import scala.annotation.tailrec


Expand Down Expand Up @@ -39,7 +39,10 @@ object Build
{ {
val default: Build = new Build { override def projectDefinitions(base: File) = defaultProject(base) :: Nil } val default: Build = new Build { override def projectDefinitions(base: File) = defaultProject(base) :: Nil }
def defaultID(base: File): String = "default-" + Hash.trimHashString(base.getAbsolutePath, 6) def defaultID(base: File): String = "default-" + Hash.trimHashString(base.getAbsolutePath, 6)
def defaultProject(base: File): Project = Project(defaultID(base), base).settings(Keys.organization := "default") def defaultProject(base: File): Project = Project(defaultID(base), base).settings(
// if the user has overridden the name, use the normal organization that is derived from the name.
organization <<= (thisProject, organization, name) { (p, o, n) => if(p.id == n) "default" else o }
)


def data[T](in: Seq[Attributed[T]]): Seq[T] = in.map(_.data) def data[T](in: Seq[Attributed[T]]): Seq[T] = in.map(_.data)
def analyzed(in: Seq[Attributed[_]]): Seq[inc.Analysis] = in.flatMap{ _.metadata.get(Keys.analysis) } def analyzed(in: Seq[Attributed[_]]): Seq[inc.Analysis] = in.flatMap{ _.metadata.get(Keys.analysis) }
Expand Down

0 comments on commit e8fcdc0

Please sign in to comment.