File tree 3 files changed +39
-1
lines changed
resources/hello-world-macros/core/src
3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,8 @@ trait ScalaModule extends JavaModule { outer =>
129
129
if p.isFile
130
130
} yield p.toNIO.toString
131
131
132
- val options = Seq (" -d" , javadocDir.toNIO.toString, " -usejavacp" )
132
+ val pluginOptions = scalacPluginClasspath().map(pluginPathRef => s " -Xplugin: ${pluginPathRef.path}" )
133
+ val options = Seq (" -d" , javadocDir.toNIO.toString, " -usejavacp" ) ++ pluginOptions
133
134
134
135
if (files.nonEmpty) subprocess(
135
136
" scala.tools.nsc.ScalaDoc" ,
Original file line number Diff line number Diff line change
1
+ import monocle .macros ._
2
+ @ Lenses case class Foo (bar : String )
3
+ object Main extends App {
4
+ println(Foo .bar.get(Foo (" bar" )))
5
+ }
Original file line number Diff line number Diff line change @@ -116,6 +116,20 @@ object HelloWorldTests extends TestSuite {
116
116
)
117
117
}
118
118
}
119
+
120
+ object HelloWorldMacros extends HelloBase {
121
+ object core extends ScalaModule {
122
+ def scalaVersion = " 2.11.8"
123
+
124
+ def ivyDeps = Agg (
125
+ ivy " com.github.julien-truffaut::monocle-macro::1.4.0 "
126
+ )
127
+ def scalacPluginIvyDeps = super .scalacPluginIvyDeps() ++ Agg (
128
+ ivy " org.scalamacros:::paradise:2.1.0 "
129
+ )
130
+ }
131
+ }
132
+
119
133
val resourcePath = pwd / ' scalalib / ' test / ' resources / " hello-world"
120
134
121
135
def jarMainClass (jar : JarFile ): Option [String ] = {
@@ -475,5 +489,23 @@ object HelloWorldTests extends TestSuite {
475
489
)
476
490
}
477
491
}
492
+ ' macros - {
493
+ // make sure macros are applied when compiling/running
494
+ ' runMain - workspaceTest(
495
+ HelloWorldMacros ,
496
+ resourcePath = pwd / ' scalalib / ' test / ' resources / " hello-world-macros"
497
+ ){ eval =>
498
+ val Right ((_, evalCount)) = eval.apply(HelloWorldMacros .core.runMain(" Main" ))
499
+ assert(evalCount > 0 )
500
+ }
501
+ // make sure macros are applied when compiling during scaladoc generation
502
+ ' docJar - workspaceTest(
503
+ HelloWorldMacros ,
504
+ resourcePath = pwd / ' scalalib / ' test / ' resources / " hello-world-macros"
505
+ ){ eval =>
506
+ val Right ((_, evalCount)) = eval.apply(HelloWorldMacros .core.docJar)
507
+ assert(evalCount > 0 )
508
+ }
509
+ }
478
510
}
479
511
}
You can’t perform that action at this time.
0 commit comments