Only disable test tasks when a project isn't compatible with toolchain

Disabling compilation means that any downstream project will break.
For example, disabling our Gradle plugin's compileJava task means
that the launch script test app fails to build as it uses our
Gradle plugin and its classes are missing.

See gh-gh-32280
pull/32501/head
Andy Wilkinson 2 years ago
parent 4523f01092
commit 5cb23aeb85

@ -23,8 +23,6 @@ import java.util.List;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.api.tasks.javadoc.Javadoc;
import org.gradle.api.tasks.testing.Test;
import org.gradle.jvm.toolchain.JavaLanguageVersion;
import org.gradle.jvm.toolchain.JavaToolchainSpec;
@ -67,8 +65,6 @@ public class ToolchainPlugin implements Plugin<Project> {
}
private void disableToolchainTasks(Project project) {
project.getTasks().withType(JavaCompile.class, (task) -> task.setEnabled(false));
project.getTasks().withType(Javadoc.class, (task) -> task.setEnabled(false));
project.getTasks().withType(Test.class, (task) -> task.setEnabled(false));
}

Loading…
Cancel
Save