diff --git a/src/main/scala/com/github/ghik/sbt/nosbt/Macros.scala b/src/main/scala/com/github/ghik/sbt/nosbt/Macros.scala index 59fc805..89e5212 100644 --- a/src/main/scala/com/github/ghik/sbt/nosbt/Macros.scala +++ b/src/main/scala/com/github/ghik/sbt/nosbt/Macros.scala @@ -6,6 +6,7 @@ class Macros(val c: blackbox.Context) { import c.universe.* private def ScalaPkg = q"_root_.scala" + private def NosbtPkg = q"_root_.com.github.ghik.sbt.nosbt" private def classBeingConstructed: ClassSymbol = { val ownerConstr = c.internal.enclosingOwner @@ -58,4 +59,7 @@ class Macros(val c: blackbox.Context) { def mkCrossSubProjectImpl(platforms: c.Tree*): Tree = q"${c.prefix}.mkCrossSubProject($enclosingValName)(..$platforms)" + + def enclosingValNameImpl: Tree = + q"$NosbtPkg.util.EnclosingValName($enclosingValName)" } diff --git a/src/main/scala/com/github/ghik/sbt/nosbt/util/EnclosingValName.scala b/src/main/scala/com/github/ghik/sbt/nosbt/util/EnclosingValName.scala new file mode 100644 index 0000000..f6566a2 --- /dev/null +++ b/src/main/scala/com/github/ghik/sbt/nosbt/util/EnclosingValName.scala @@ -0,0 +1,7 @@ +package com.github.ghik.sbt.nosbt +package util + +final case class EnclosingValName(name: String) +object EnclosingValName { + implicit def materialize: EnclosingValName = macro Macros.enclosingValNameImpl +}