From 041b9624e7422eaca83a80a4d3dd854c1deaf3d0 Mon Sep 17 00:00:00 2001 From: Willi Raschkowski Date: Wed, 28 Oct 2020 23:33:23 +0000 Subject: [PATCH] Don't set scalac -target paremeter --- .../baseline/plugins/BaselineScalastyle.java | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineScalastyle.java b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineScalastyle.java index 44c30880c4..0dd1b4bce4 100644 --- a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineScalastyle.java +++ b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineScalastyle.java @@ -16,7 +16,6 @@ package com.palantir.baseline.plugins; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import groovy.util.Node; import groovy.xml.QName; @@ -30,7 +29,6 @@ import org.gradle.api.tasks.ScalaSourceSet; import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.TaskCollection; -import org.gradle.api.tasks.scala.ScalaCompile; import org.gradle.plugins.ide.idea.model.IdeaModel; public final class BaselineScalastyle extends AbstractBaselinePlugin { @@ -39,10 +37,6 @@ public void apply(Project project) { this.project = project; project.getPluginManager().withPlugin("scala", plugin -> { JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class); - project.getTasks().withType(ScalaCompile.class).configureEach(scalaCompile -> scalaCompile - .getScalaCompileOptions() - .setAdditionalParameters(ImmutableList.of("-target:jvm-" - + javaConvention.getTargetCompatibility().toString()))); project.getRootProject().getPluginManager().withPlugin("idea", ideaPlugin -> project.getRootProject() .getExtensions() .configure( @@ -83,8 +77,6 @@ private void configureIdeaPlugin(IdeaModel ideaModel, SourceSet mainSourceSet, S ? "JavaThenScala" : "Mixed"; ideaModel.getProject().getIpr().withXml(xmlProvider -> { - // configure target jvm mode - String targetJvmVersion = "-target:jvm-" + javaVersion; Node rootNode = xmlProvider.asNode(); Node scalaCompilerConf = (Node) rootNode.getAt(new QName("component")).stream() .filter(o -> ((Node) o).attributes().get("name").equals("ScalaCompilerConfiguration")) @@ -98,14 +90,6 @@ private void configureIdeaPlugin(IdeaModel ideaModel, SourceSet mainSourceSet, S .orElseGet(() -> scalaCompilerConf.appendNode("option")); compilerOrder.attributes().put("name", "compileOrder"); compilerOrder.attributes().put("value", compilerMode); - Node parametersNode = (Node) scalaCompilerConf.getAt(new QName("parameters")).stream() - .findFirst() - .orElseGet(() -> scalaCompilerConf.appendNode("parameters")); - Node parameter = (Node) parametersNode.getAt(new QName("parameter")).stream() - .filter(o -> ((Node) o).attributes().get("value").equals(targetJvmVersion)) - .findFirst() - .orElseGet(() -> parametersNode.appendNode("parameter")); - parameter.attributes().put("value", targetJvmVersion); }); } }