gradle
8.5

# ScalaRuntime

abstract class ScalaRuntime(source)

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:

        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.

Content copied to clipboard

## Constructors

ScalaRuntime
Link copied to clipboard
constructor(project: Project)

## Functions

findScalaJar
Link copied to clipboard
@Nullable
open fun findScalaJar(classpath: Iterable<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.).
getScalaVersion
Link copied to clipboard
@Nullable
open fun getScalaVersion(scalaJar: File): String
Determines the version of a Scala Jar file (scala-compiler, scala-library, scala-jdbc, etc.).
inferScalaClasspath
Link copied to clipboard
open fun inferScalaClasspath(classpath: Iterable<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.