in gradle-runner-agent/src/main/java/jetbrains/buildServer/gradle/agent/GradleLaunchModeSelector.java [42:76]
private Optional<GradleLaunchModeSelectionResult> tryToIdentifyModeIndirectly(@NotNull Parameters parameters,
@NotNull String configuredLaunchMode) {
BuildProgressLogger logger = parameters.getLogger();
DefaultGradleVersion gradleVersion = parameters.getGradleVersion();
if (!isVersionToolingApiCompatible(gradleVersion)) {
return Optional.empty();
}
if (!parameters.isConfigurationCacheEnabled()) {
return Optional.empty();
}
if (parameters.isConfigurationCacheProblemsIgnored()) {
logger.warning(
"The \"--configuration-cache-problems\" command line argument or the \"org.gradle.configuration-cache.problems\" property is set to \"warn\". " +
"This causes the build to run in legacy mode with the non-functional configuration-cache when the Tooling API (required to utilize configuration-cache) detects a problem.\n" +
"If you want to ensure the build uses configuration-cache, switch the argument/property to the default \"fail\" value.");
return Optional.empty();
}
if (!parameters.getUnsupportedByToolingArgs().isEmpty()) {
String message = String.format("This build can only be run in legacy mode. " +
"Using configuration-cache requires launching the build via the Gradle Tooling API that is not compatible with the following Gradle argument(s): %s.\n" +
"Remove the unsupported argument(s) or disable the configuration-cache.",
String.join(", ", parameters.getUnsupportedByToolingArgs()));
logger.warning(message);
return Optional.empty();
}
return Optional.of(GradleLaunchModeSelectionResult.builder()
.withLaunchMode(GradleLaunchMode.TOOLING_API)
.withReason(composeLaunchingViaToolingApiReason(configuredLaunchMode, true, true))
.build());
}