Search in sources :

Example 1 with ScalaPlatform

use of org.gradle.language.scala.ScalaPlatform in project gradle by gradle.

the class PlayPlatformResolver method resolve.

private PlayPlatform resolve(String name, String playVersion, String scalaVersion, String javaVersion) {
    PlayMajorVersion playMajorVersion = PlayMajorVersion.forPlayVersion(playVersion);
    JavaPlatform javaPlatform = getJavaPlatform(javaVersion);
    ScalaPlatform scalaPlatform = getScalaPlatform(playMajorVersion, scalaVersion);
    return new DefaultPlayPlatform(name, playVersion, scalaPlatform, javaPlatform);
}
Also used : DefaultJavaPlatform(org.gradle.jvm.platform.internal.DefaultJavaPlatform) JavaPlatform(org.gradle.jvm.platform.JavaPlatform) ScalaPlatform(org.gradle.language.scala.ScalaPlatform) DefaultScalaPlatform(org.gradle.language.scala.internal.DefaultScalaPlatform) PlayMajorVersion(org.gradle.play.internal.platform.PlayMajorVersion)

Example 2 with ScalaPlatform

use of org.gradle.language.scala.ScalaPlatform in project gradle by gradle.

the class PlayPlatformResolver method getScalaPlatform.

private ScalaPlatform getScalaPlatform(PlayMajorVersion playMajorVersion, String preferredScalaVersion) {
    String scalaVersion = GUtil.elvis(preferredScalaVersion, playMajorVersion.getDefaultScalaPlatform());
    ScalaPlatform scalaPlatform = createScalaPlatform(scalaVersion);
    playMajorVersion.validateCompatible(scalaPlatform);
    return scalaPlatform;
}
Also used : ScalaPlatform(org.gradle.language.scala.ScalaPlatform) DefaultScalaPlatform(org.gradle.language.scala.internal.DefaultScalaPlatform)

Example 3 with ScalaPlatform

use of org.gradle.language.scala.ScalaPlatform in project gradle by gradle.

the class IdeaScalaConfigurer method createScalaSdkLibrary.

private static ProjectLibrary createScalaSdkLibrary(Project scalaProject, Iterable<File> files, boolean useScalaSdk, IdeaModule ideaModule) {
    ScalaRuntime runtime = scalaProject.getExtensions().findByType(ScalaRuntime.class);
    if (runtime != null) {
        // Old Scala Plugin does not specify a ScalaPlatform
        FileCollection scalaClasspath = runtime.inferScalaClasspath(files);
        File compilerJar = runtime.findScalaJar(scalaClasspath, "compiler");
        ScalaPlatform scalaPlatform = compilerJar != null ? new DefaultScalaPlatform(runtime.getScalaVersion(compilerJar)) : new DefaultScalaPlatform();
        return createScalaSdkFromPlatform(scalaPlatform, scalaClasspath, useScalaSdk);
    } else if (ideaModule.getScalaPlatform() != null) {
        // TODO: Wrong, using the full classpath of the application
        return createScalaSdkFromPlatform(ideaModule.getScalaPlatform(), scalaProject.files(files), useScalaSdk);
    } else {
        // we can't create a Scala SDK without either one
        return null;
    }
}
Also used : ScalaRuntime(org.gradle.api.tasks.ScalaRuntime) FileCollection(org.gradle.api.file.FileCollection) DefaultScalaPlatform(org.gradle.language.scala.internal.DefaultScalaPlatform) File(java.io.File) ScalaPlatform(org.gradle.language.scala.ScalaPlatform) DefaultScalaPlatform(org.gradle.language.scala.internal.DefaultScalaPlatform)

Aggregations

ScalaPlatform (org.gradle.language.scala.ScalaPlatform)3 DefaultScalaPlatform (org.gradle.language.scala.internal.DefaultScalaPlatform)3 File (java.io.File)1 FileCollection (org.gradle.api.file.FileCollection)1 ScalaRuntime (org.gradle.api.tasks.ScalaRuntime)1 JavaPlatform (org.gradle.jvm.platform.JavaPlatform)1 DefaultJavaPlatform (org.gradle.jvm.platform.internal.DefaultJavaPlatform)1 PlayMajorVersion (org.gradle.play.internal.platform.PlayMajorVersion)1