|
1 | 1 | /*
|
2 |
| - * Copyright 2016-2023 DiffPlug |
| 2 | + * Copyright 2016-2024 DiffPlug |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
43 | 43 |
|
44 | 44 | public class GradleIntegrationHarness extends ResourceHarness {
|
45 | 45 | public enum GradleVersionSupport {
|
46 |
| - JRE_11("5.0"), MINIMUM(SpotlessPlugin.VER_GRADLE_min), |
| 46 | + JRE_11("5.0"), MINIMUM(SpotlessPlugin.VER_GRADLE_min), CUSTOM_STEPS(SpotlessPlugin.VER_GRADLE_minVersionForCustom), |
47 | 47 | // technically, this API exists in 6.5, but the flags for it change in 6.6, so we build to that
|
48 | 48 | CONFIGURATION_CACHE("6.6"),
|
49 | 49 | // https://docs.gradle.org/7.5/userguide/configuration_cache.html#config_cache:stable
|
@@ -116,8 +116,14 @@ void gitAttributes() throws IOException {
|
116 | 116 | }
|
117 | 117 |
|
118 | 118 | protected GradleRunner gradleRunner() throws IOException {
|
| 119 | + GradleVersionSupport version; |
| 120 | + if (newFile("build.gradle").exists() && read("build.gradle").contains("custom")) { |
| 121 | + version = GradleVersionSupport.CUSTOM_STEPS; |
| 122 | + } else { |
| 123 | + version = GradleVersionSupport.MINIMUM; |
| 124 | + } |
119 | 125 | return GradleRunner.create()
|
120 |
| - .withGradleVersion(GradleVersionSupport.MINIMUM.version) |
| 126 | + .withGradleVersion(version.version) |
121 | 127 | .withProjectDir(rootFolder())
|
122 | 128 | .withTestKitDir(getTestKitDir())
|
123 | 129 | .withPluginClasspath();
|
|
0 commit comments