-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(#198) enabled using a local installed Cake .NET Tool
- Loading branch information
Showing
11 changed files
with
176 additions
and
29 deletions.
There are no files selected for viewing
Binary file removed
BIN
-14.8 KB
docs/input/assets/img/cake-rider/docs/beforeRunAction-ensureTool.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/rider/src/main/kotlin/net/cakebuild/beforeRunner/RestoreNetToolsBeforeRunTaskProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package net.cakebuild.beforeRunner | ||
|
||
import com.intellij.execution.BeforeRunTask | ||
import com.intellij.execution.BeforeRunTaskProvider | ||
import com.intellij.execution.configurations.GeneralCommandLine | ||
import com.intellij.execution.configurations.RunConfiguration | ||
import com.intellij.execution.runners.ExecutionEnvironment | ||
import com.intellij.execution.util.ExecUtil | ||
import com.intellij.openapi.actionSystem.DataContext | ||
import com.intellij.openapi.diagnostic.Logger | ||
import com.intellij.openapi.util.Key | ||
import icons.CakeIcons | ||
import net.cakebuild.run.CakeConfiguration | ||
import net.cakebuild.shared.CakeBalloonNotifications | ||
|
||
@Suppress("DialogTitleCapitalization") | ||
class RestoreNetToolsBeforeRunTaskProvider : | ||
BeforeRunTaskProvider<RestoreNetToolsBeforeRunTaskProvider.RestoreNetToolsBeforeRunTask>() { | ||
companion object { | ||
val providerId = Key.create<RestoreNetToolsBeforeRunTask>("Cake.RestoreNetToolsBeforeRunTask") | ||
} | ||
|
||
private val log = Logger.getInstance(RestoreNetToolsBeforeRunTaskProvider::class.java) | ||
|
||
override fun getId() = providerId | ||
|
||
override fun getName() = "Restore .NET Tools" | ||
|
||
override fun getIcon() = CakeIcons.CakeAction | ||
|
||
override fun createTask(runConfiguration: RunConfiguration): RestoreNetToolsBeforeRunTask? { | ||
if (runConfiguration is CakeConfiguration) { | ||
return RestoreNetToolsBeforeRunTask() | ||
} | ||
|
||
return null | ||
} | ||
|
||
override fun executeTask( | ||
context: DataContext, | ||
configuration: RunConfiguration, | ||
env: ExecutionEnvironment, | ||
task: RestoreNetToolsBeforeRunTask | ||
): Boolean { | ||
val commandLine = GeneralCommandLine() | ||
.withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE) | ||
.withExePath("dotnet") | ||
.withParameters("tool", "restore") | ||
.withWorkDirectory((configuration as CakeConfiguration).getWorkingDirectory()) | ||
val output = ExecUtil.execAndGetOutput(commandLine) | ||
if (output.exitCode != 0) { | ||
val err = "'${commandLine.commandLineString}' exited with unexpected Exitcode. Exitcode: ${output.exitCode}" | ||
log.warn(err) | ||
log.warn(output.stdout) | ||
log.warn(output.stderr) | ||
CakeBalloonNotifications.notifyError(env.project, err) | ||
} | ||
|
||
return output.exitCode == 0 | ||
} | ||
|
||
class RestoreNetToolsBeforeRunTask : | ||
BeforeRunTask<RestoreNetToolsBeforeRunTask>(providerId) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.