All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xsbt.Command.scala Maven / Gradle / Ivy

There is a newer version: 0.13.15
Show newest version
/* sbt -- Simple Build Tool
 * Copyright 2010  Jason Zaugg
 */
package xsbt

	import scala.tools.nsc.{CompilerCommand, Settings}

object Command
{
	/**
	 * Construct a CompilerCommand using reflection, to be compatible with Scalac before and after
	 * r21274
	 */
	def apply(arguments: List[String], settings: Settings): CompilerCommand = {
		def constr(params: Class[_]*) = classOf[CompilerCommand].getConstructor(params: _*)
		try {
			constr(classOf[List[_]], classOf[Settings]).newInstance(arguments, settings)
		} catch {
		case e: NoSuchMethodException =>
			constr(classOf[List[_]], classOf[Settings], classOf[Function1[_, _]], classOf[Boolean]).newInstance(arguments, settings, (s: String) => throw new RuntimeException(s), false.asInstanceOf[AnyRef])
		}
	}
	
	def getWarnFatal(settings: Settings): Boolean =
		settings.Xwarnfatal.value

	def getNoWarn(settings: Settings): Boolean =
		settings.nowarn.value
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy