de.sciss.proc.impl.MacroCompilerImpl.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of soundprocesses-compiler_2.12 Show documentation
Show all versions of soundprocesses-compiler_2.12 Show documentation
Compiler-support for Sound Processes
The newest version!
/*
* MacroCompilerImpl.scala
* (SoundProcesses)
*
* Copyright (c) 2010-2024 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Affero General Public License v3+
*
*
* For further information, please contact Hanns Holger Rutz at
* [email protected]
*/
package de.sciss.proc
package impl
import java.io.File
import scala.tools.nsc.interpreter.IMain
import scala.tools.nsc.{ConsoleWriter, Global, NewLinePrintWriter}
object MacroCompilerImpl {
def apply(peer: Global): IMain = {
// this is the trick to get the right class-path -- we steal it from the macro compiler
val cSet = peer.settings.copy()
cSet.warnUnused.clear()
cSet.classpath.value += File.pathSeparator + sys.props("java.class.path")
val writer = new NewLinePrintWriter(new ConsoleWriter, autoFlush = true)
new IMain(cSet, writer)
}
}