Commit 29dc236b authored by Andy Wilkinson's avatar Andy Wilkinson

Broaden deprecation warning check in Gradle Plugin's tests

Closes gh-21111
parent 581ce09f
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -81,7 +81,7 @@ public class GradleBuild { ...@@ -81,7 +81,7 @@ public class GradleBuild {
} }
void after() { void after() {
GradleBuild.this.script = null; this.script = null;
FileSystemUtils.deleteRecursively(this.projectDir); FileSystemUtils.deleteRecursively(this.projectDir);
} }
...@@ -113,8 +113,8 @@ public class GradleBuild { ...@@ -113,8 +113,8 @@ public class GradleBuild {
public BuildResult build(String... arguments) { public BuildResult build(String... arguments) {
try { try {
BuildResult result = prepareRunner(arguments).build(); BuildResult result = prepareRunner(arguments).build();
if (this.gradleVersion != null && this.expectDeprecationWarnings != null if (this.expectDeprecationWarnings == null || (this.gradleVersion != null
&& this.expectDeprecationWarnings.compareTo(GradleVersion.version(this.gradleVersion)) > 0) { && this.expectDeprecationWarnings.compareTo(GradleVersion.version(this.gradleVersion)) > 0)) {
assertThat(result.getOutput()).doesNotContain("Deprecated").doesNotContain("deprecated"); assertThat(result.getOutput()).doesNotContain("Deprecated").doesNotContain("deprecated");
} }
return result; return result;
...@@ -149,13 +149,16 @@ public class GradleBuild { ...@@ -149,13 +149,16 @@ public class GradleBuild {
if (this.gradleVersion != null) { if (this.gradleVersion != null) {
gradleRunner.withGradleVersion(this.gradleVersion); gradleRunner.withGradleVersion(this.gradleVersion);
} }
else if (this.dsl == Dsl.KOTLIN) { else {
gradleRunner.withGradleVersion("4.10.3"); File settingsFile = new File(this.projectDir, "settings" + this.dsl.getExtension());
FileCopyUtils.copy("enableFeaturePreview(\"STABLE_PUBLISHING\")", new FileWriter(settingsFile));
} }
List<String> allArguments = new ArrayList<>(); List<String> allArguments = new ArrayList<>();
allArguments.add("-PbootVersion=" + getBootVersion()); allArguments.add("-PbootVersion=" + getBootVersion());
allArguments.add("--stacktrace"); allArguments.add("--stacktrace");
allArguments.addAll(Arrays.asList(arguments)); allArguments.addAll(Arrays.asList(arguments));
allArguments.add("--warning-mode");
allArguments.add("all");
return gradleRunner.withArguments(allArguments); return gradleRunner.withArguments(allArguments);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment