scalamacros / paradise

(No longer actively maintained.)
http://scalamacros.org/
BSD 3-Clause "New" or "Revised" License
158 stars 53 forks source link

Require paradise plugin in tools.reflect.toolbox #83

Closed cornerman closed 8 years ago

cornerman commented 8 years ago

In a project, I want to expand macros in tests using tools.reflect.toolbox. In order to be able to use the paradise compiler plugin, I need to specify the -Xplugin and -Xplugin-require options when creating the toolbox. The latter option needs a path to the paradise.jar, currently I still use this code. This is a hardcoded path with a specific scala as well as paradise version.

Is there a more generic way to require currently enabled compiler plugins or to get the path to their jar files?

xeno-by commented 8 years ago

You could try writing a macro that inspects compilation arguments: https://github.com/scala/scala/blob/1706a37eb84ec252aea77bccebad3e48448534ad/src/compiler/scala/reflect/macros/contexts/Infrastructure.scala#L13. Then, the path to the compiler plugin will be compiled into executable code.

cornerman commented 8 years ago

Thank you! That works, I have created a small macro that just returns the compilersettings. From there I can just filter all -Xplugin options.