mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Gradle|Exec] fix: reuse already collected Gradle build environment for configuring operation for execution
Issues IDEA-363359, IDEA-344664 GitOrigin-RevId: 8da1caff1aeafeb44f3ff25f60eaa4996b320882
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b7efc9b41c
commit
551779eae8
+2
-4
@@ -116,19 +116,17 @@ public final class GradleExecutionHelper {
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void prepareForExecution(
|
||||
@NotNull ProjectConnection connection,
|
||||
@NotNull LongRunningOperation operation,
|
||||
@NotNull CancellationToken cancellationToken,
|
||||
@NotNull ExternalSystemTaskId id,
|
||||
@NotNull GradleExecutionSettings settings,
|
||||
@NotNull ExternalSystemTaskNotificationListener listener
|
||||
@NotNull ExternalSystemTaskNotificationListener listener,
|
||||
@Nullable BuildEnvironment buildEnvironment
|
||||
) {
|
||||
clearSystemProperties(operation);
|
||||
|
||||
applyIdeaParameters(settings);
|
||||
|
||||
BuildEnvironment buildEnvironment = getBuildEnvironment(connection, id, listener, null, settings);
|
||||
|
||||
setupJvmArguments(operation, settings, buildEnvironment);
|
||||
|
||||
setupLogging(settings, buildEnvironment);
|
||||
|
||||
+8
-1
@@ -133,11 +133,18 @@ object GradleWrapperHelper {
|
||||
cancellationToken: CancellationToken
|
||||
) {
|
||||
SystemPropertiesAdjuster.executeAdjusted(projectPath) {
|
||||
|
||||
/**
|
||||
* Don't reuse this build environment for the main execution process, because the wrapper task changes used Gradle distribution.
|
||||
* It affects [org.gradle.tooling.model.build.GradleEnvironment] in [org.gradle.tooling.model.build.BuildEnvironment].
|
||||
*/
|
||||
val buildEnvironment = GradleExecutionHelper.getBuildEnvironment(connection, id, listener, cancellationToken, settings)
|
||||
|
||||
val launcher = connection.newBuild()
|
||||
val wrapperSettings = GradleExecutionSettings(settings).apply {
|
||||
tasks = listOf("wrapper")
|
||||
}
|
||||
GradleExecutionHelper.prepareForExecution(connection, launcher, cancellationToken, id, wrapperSettings, listener)
|
||||
GradleExecutionHelper.prepareForExecution(launcher, cancellationToken, id, wrapperSettings, listener, buildEnvironment)
|
||||
ExternalSystemTelemetryUtil.getTracer(GradleConstants.SYSTEM_ID)
|
||||
.spanBuilder("ExecuteWrapperTask")
|
||||
.use { launcher.run() }
|
||||
|
||||
+2
-2
@@ -88,12 +88,12 @@ class GradleModelFetchActionRunner private constructor(
|
||||
|
||||
private fun <T : LongRunningOperation> T.prepareOperationForSync(): T {
|
||||
GradleExecutionHelper.prepareForExecution(
|
||||
resolverContext.connection,
|
||||
this,
|
||||
resolverContext.cancellationToken,
|
||||
resolverContext.externalSystemTaskId,
|
||||
resolverContext.settings,
|
||||
resolverContext.listener
|
||||
resolverContext.listener,
|
||||
resolverContext.buildEnvironment
|
||||
)
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class GradleTaskManager implements ExternalSystemTaskManager<GradleExecut
|
||||
var operation = isApplicableTestLauncher(id, projectPath, settings, gradleVersion)
|
||||
? connection.newTestLauncher()
|
||||
: connection.newBuild();
|
||||
GradleExecutionHelper.prepareForExecution(connection, operation, cancellationToken, id, settings, listener);
|
||||
GradleExecutionHelper.prepareForExecution(operation, cancellationToken, id, settings, listener, buildEnvironment);
|
||||
if (operation instanceof BuildLauncher) {
|
||||
((BuildLauncher)operation).run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user