api / org.gradle.api.tasks / ScalaRuntime

ScalaRuntime

@Incubating open class ScalaRuntime

Provides information related to the Scala runtime(s) used in a project. Added by the org.gradle.api.plugins.scala.ScalaBasePlugin as a project extension named scalaRuntime.

Example usage:

 apply plugin: "scala" repositories { mavenCentral() } dependencies { compile "org.scala-lang:scala-library:2.10.1" } def scalaClasspath = scalaRuntime.inferScalaClasspath(configurations.compile) // The returned class path can be used to configure the 'scalaClasspath' property of tasks // such as 'ScalaCompile' or 'ScalaDoc', or to execute these and other Scala tools directly. 

Constructors

<init>

ScalaRuntime(project: Project)

Functions

findScalaJar

open fun findScalaJar(classpath: MutableIterable<File>, appendix: String): File

Searches the specified class path for a Scala Jar file (scala-compiler, scala-library, scala-jdbc, etc.) with the specified appendix (compiler, library, jdbc, etc.). If no such file is found, null is returned.

getScalaVersion

open fun getScalaVersion(scalaJar: File): String

Determines the version of a Scala Jar file (scala-compiler, scala-library, scala-jdbc, etc.). If the version cannot be determined, or the file is not a Scala Jar file, null is returned.

Implementation note: The version is determined by parsing the file name, which is expected to match the pattern 'scala-[component]-[version].jar'.

inferScalaClasspath

open fun inferScalaClasspath(classpath: MutableIterable<File>): FileCollection

Searches the specified class path for a 'scala-library' Jar, and returns a class path containing a corresponding (same version) 'scala-compiler' Jar and its dependencies.

The returned class path may be empty, or may fail to resolve when asked for its contents.

Extension Properties

ext

val ScalaRuntime.ext: ExtraPropertiesExtension

Retrieves the ext extension.

Extension Functions

ext

fun ScalaRuntime.ext(configure: ExtraPropertiesExtension.() -> Unit): Unit

Configures the ext extension.