Merge pull request #1378 from sbt/wip/fix-default-generated-projects

Allow autogenerated projects to have overridden organization.
This commit is contained in:
eugene yokota
2014-05-29 14:32:17 -04:00
5 changed files with 24 additions and 9 deletions
+6 -6
View File
@@ -4,7 +4,7 @@
package sbt
import java.io.File
import Keys.{ name, organization, thisProject }
import Keys.{ name, organization, thisProject, autoGeneratedProject }
import Def.{ ScopedKey, Setting }
// name is more like BuildDefinition, but that is too long
@@ -49,13 +49,13 @@ object Build {
// TODO - Can we move this somewhere else? ordering of settings is causing this to get borked.
// if the user has overridden the name, use the normal organization that is derived from the name.
organization := {
val overridden = thisProject.value.id == name.value
def isDefault(o: String) = thisProject.value.id == o
organization.?.value match {
case Some(o) if !overridden => o
case _ => "default"
case Some(o) if !isDefault(o) => o
case _ => "default"
}
//(thisProject, organization, name) { (p, o, n) => if(p.id == n) "default" else o }
}
},
autoGeneratedProject := true
)
def defaultAggregatedProject(id: String, base: File, agg: Seq[ProjectRef]): Project =
defaultProject(id, base).aggregate(agg: _*)
+1
View File
@@ -36,6 +36,7 @@ object Keys {
val sLog = SettingKey[Logger]("setting-logger", "Logger usable by settings during project loading.", CSetting)
// Project keys
val autoGeneratedProject = SettingKey[Boolean]("autogeneratedProject", "If it exists, represents that the project (and name) were automaticlaly craeted, rather than user specified.", DSetting)
val projectCommand = AttributeKey[Boolean]("project-command", "Marks Commands that were registered for the current Project.", Invisible)
val sessionSettings = AttributeKey[SessionSettings]("session-settings", "Tracks current build, project, and setting modifications.", DSetting)
val stateBuildStructure = AttributeKey[BuildStructure]("build-structure", "Data structure containing all information about the build definition.", BSetting)