public abstract class ScalaRuntime
extends java.lang.Object
org.gradle.api.plugins.scala.ScalaBasePlugin
as a project extension named scalaRuntime
.
Example usage:
plugins { id 'scala' } repositories { mavenCentral() } dependencies { implementation "org.scala-lang:scala-library:2.10.1" } def scalaClasspath = scalaRuntime.inferScalaClasspath(configurations.compileClasspath) // 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.
Constructor | Description |
---|---|
ScalaRuntime(Project project) |
Modifier and Type | Method | Description |
---|---|---|
java.io.File |
findScalaJar(java.lang.Iterable<java.io.File> classpath,
java.lang.String appendix) |
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.).
|
java.lang.String |
getScalaVersion(java.io.File scalaJar) |
Determines the version of a Scala Jar file (scala-compiler, scala-library,
scala-jdbc, etc.).
|
FileCollection |
inferScalaClasspath(java.lang.Iterable<java.io.File> classpath) |
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.
|
public ScalaRuntime(Project project)
public FileCollection inferScalaClasspath(java.lang.Iterable<java.io.File> classpath)
The returned class path may be empty, or may fail to resolve when asked for its contents.
classpath
- a class path containing a 'scala-library' Jar@Nullable public java.io.File findScalaJar(java.lang.Iterable<java.io.File> classpath, java.lang.String appendix)
null
is returned.classpath
- the class path to searchappendix
- the appendix to search for@Nullable public java.lang.String getScalaVersion(java.io.File scalaJar)
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'.
scalaJar
- a Scala Jar file