Skip to content

Commit

Permalink
move top-level settingKey,taskKey,inputKey objects to Def and package…
Browse files Browse the repository at this point in the history
… object

avoids class file name collision on case insensitive filesystem
  • Loading branch information
harrah committed Dec 4, 2012
1 parent b7250bb commit cdd2e72
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
5 changes: 5 additions & 0 deletions main/settings/Def.scala
Expand Up @@ -64,6 +64,11 @@ object Def extends Init[Scope] with TaskMacroExtra
// be used in the inputTask macro as an input with an ultimate result of type T
implicit def parserInitToInput[T](p: Initialize[Parser[T]]): InitParserInput[T] = ???
implicit def parserInitStateToInput[T](p: Initialize[State => Parser[T]]): StateParserInput[T] = ???

import language.experimental.macros
def settingKey[T](description: String): SettingKey[T] = macro std.KeyMacro.settingKeyImpl[T]
def taskKey[T](description: String): TaskKey[T] = macro std.KeyMacro.taskKeyImpl[T]
def inputKey[T](description: String): TaskKey[T] = macro std.KeyMacro.taskKeyImpl[T]
}
// these need to be mixed into the sbt package object because the target doesn't involve Initialize or anything in Def
trait TaskMacroExtra
Expand Down
13 changes: 0 additions & 13 deletions main/settings/Structure.scala
Expand Up @@ -500,16 +500,3 @@ object SettingKey

def local[T: Manifest]: SettingKey[T] = apply[T](AttributeKey.local[T])
}

object settingKey
{
def apply[T](description: String): SettingKey[T] = macro std.KeyMacro.settingKeyImpl[T]
}
object taskKey
{
def apply[T](description: String): TaskKey[T] = macro std.KeyMacro.taskKeyImpl[T]
}
object inputKey
{
def apply[T](description: String): TaskKey[T] = macro std.KeyMacro.taskKeyImpl[T]
}
1 change: 1 addition & 0 deletions main/settings/src/test/scala/UsageTest.scala
Expand Up @@ -21,6 +21,7 @@ package std
object Assign
{
import java.io.File
import Def.{inputKey,settingKey,taskKey}
import Def.{Initialize,macroValueT,parserToInput}
// import UseTask.{x,y,z,a,set,plain}

Expand Down
5 changes: 5 additions & 0 deletions sbt/package.scala
Expand Up @@ -50,4 +50,9 @@ package object sbt extends sbt.std.TaskExtra with sbt.Types with sbt.ProcessExtr
// final val System = C.System
final val Optional = C.Optional
def config(s: String): Configuration = Configurations.config(s)

import language.experimental.macros
def settingKey[T](description: String): SettingKey[T] = macro std.KeyMacro.settingKeyImpl[T]
def taskKey[T](description: String): TaskKey[T] = macro std.KeyMacro.taskKeyImpl[T]
def inputKey[T](description: String): TaskKey[T] = macro std.KeyMacro.taskKeyImpl[T]
}

0 comments on commit cdd2e72

Please sign in to comment.