Skip to content

Commit

Permalink
Fix RIDER-57482: enable common Rider build throttling (#457)
Browse files Browse the repository at this point in the history
* Fix RIDER-57482: enable common Rider build throttling

Rider cannot run several builds simultaneously, so there's a special
component that orchestrates the build throttling in pre-launch tasks.
The plugin should call this component when scheduling a build task,
otherwise, the builds started from plugin won't work well inside of a
compound task.

* Update plugin.xml

Co-authored-by: Maarten Balliauw <maarten@maartenballiauw.be>
  • Loading branch information
ForNeVeR and maartenba authored Mar 19, 2021
1 parent b9615a1 commit 13143be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<ul>
<li>Compatibility with Rider 2021.1 EAP8</li>
<li>Allow publishing to App Service with kind "API" (<a href="https://github.com/JetBrains/azure-tools-for-intellij/issues/149">#149</a>)</li>
<li>Enable build-throttling and support compound run configurations (<a href="https://youtrack.jetbrains.com/issue/RIDER-57482">RIDER-57482</a>)</li>
</ul>
<h4>Fixed bugs:</h4>
<ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2019-2020 JetBrains s.r.o.
* Copyright (c) 2019-2021 JetBrains s.r.o.
* <p/>
* All rights reserved.
* <p/>
Expand Down Expand Up @@ -34,6 +34,7 @@ import com.jetbrains.rd.platform.util.application
import com.jetbrains.rd.platform.util.getComponent
import com.jetbrains.rider.build.BuildHost
import com.jetbrains.rider.build.BuildParameters
import com.jetbrains.rider.build.tasks.BuildTaskThrottler
import com.jetbrains.rider.model.BuildResultKind
import com.jetbrains.rider.model.BuildTarget
import org.jetbrains.plugins.azure.RiderAzureBundle.message
Expand Down Expand Up @@ -84,17 +85,8 @@ class BuildFunctionsProjectBeforeRunTaskProvider : BeforeRunTaskProvider<BuildFu
}
if (!buildHost.ready.value)
return false
val finished = Semaphore()
finished.down()
var result = false
// when false returned build was not started because another is in progress, we should not run task
application.invokeLater {
result = buildHost.requestBuild(BuildParameters(BuildTarget(), selectedProjectsForBuild)) {
result = it == BuildResultKind.Successful || it == BuildResultKind.HasWarnings
finished.up()
}
}
finished.waitFor()
return result

val throttler = BuildTaskThrottler.getInstance(project)
return throttler.runBuildWithThrottling(BuildParameters(BuildTarget(), selectedProjectsForBuild)).get()
}
}

0 comments on commit 13143be

Please sign in to comment.