|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gradle.api.tasks.ScalaRuntime
@Incubating class ScalaRuntime
Provides information related to the Scala runtime(s) used in a project. Added by the 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.
Field Summary | |
---|---|
protected Project |
project
|
Constructor Summary | |
ScalaRuntime(Project project)
|
Method Summary | |
---|---|
File
|
findScalaJar(Iterable classpath, 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.). |
String
|
getScalaVersion(File scalaJar)
Determines the version of a Scala Jar file (scala-compiler, scala-library, scala-jdbc, etc.). |
FileCollection
|
inferScalaClasspath(Iterable 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. |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Field Detail |
---|
protected final Project project
Constructor Detail |
---|
ScalaRuntime(Project project)
Method Detail |
---|
@Nullable File findScalaJar(Iterable classpath, String appendix)
classpath
- the class path to searchappendix
- the appendix to search for
@Nullable String getScalaVersion(File scalaJar)
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
FileCollection inferScalaClasspath(Iterable classpath)
If the (deprecated) 'scalaTools' configuration is explicitly configured, no repository is declared for the project, no 'scala-library' Jar is found on the specified class path, or its version cannot be determined, a class path with the contents of the 'scalaTools' configuration is returned.
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
Gradle API 1.12