Skip to content

Commit

Permalink
introduced EnclosingValName util
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Janusz committed Mar 19, 2023
1 parent 99ee6c3 commit aa58829
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/scala/com/github/ghik/sbt/nosbt/Macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)"
}
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit aa58829

Please sign in to comment.