config macro

This commit is contained in:
Eugene Yokota 2022-12-09 03:12:50 -05:00
parent d4dc90efd9
commit 5bbb671341
3 changed files with 7 additions and 6 deletions

View File

@ -10,7 +10,7 @@ import sjsonnew.JsonFormat
import java.nio.file.{ Path => NioPath }
import sbt.internal.FileChangesMacro
import sbt.librarymanagement.{ Configuration, ConfigurationMacro }
import scala.language.experimental.macros
package object sbt
@ -59,6 +59,7 @@ package object sbt
final val Global = Scope.Global
final val GlobalScope = Scope.GlobalScope
// def config(name: String): Configuration =
// macro sbt.librarymanagement.ConfigurationMacro.configMacroImpl
inline def config(name: String): Configuration = ${
ConfigurationMacro.configMacroImpl('{ name })
}
}

View File

@ -53,9 +53,9 @@ check := {
same(globalValue, "global 0", "demo in Global")
val projValue = (projC / demo).?.value
same(projValue, Some("project projC Q R"), "demo in projC")
val qValue = (Quux / del in projC)(projC / del).?.value
val qValue = (projC / Quux / del).?.value
same(qValue, Some(" Q R"), "del in projC in Quux")
val optInValue = (Quux / del in projE)(projE / del).value
val optInValue = (projE / Quux / del).value
same(optInValue, " Q S R", "del in projE in Quux")
val overrideOrgValue = (projE / organization).value
same(overrideOrgValue, "S", "organization in projE")

View File

@ -75,7 +75,7 @@ object R extends AutoPlugin {
// tests proper ordering: R requires Q, so Q settings should come first
Quux / del += " R",
// tests that configurations are properly registered, enabling delegation from p to q
demo += (del in Pippy).value
demo += (Pippy / del).value
)
}