Class Command
java.lang.Object
hudson.tasks.BuildStepCompatibilityLayer
hudson.tasks.Builder
io.jenkins.plugins.dotnet.commands.Command
- All Implemented Interfaces:
ExtensionPoint,Describable<Builder>,BuildStep,SimpleBuildStep
- Direct Known Subclasses:
ListPackage,MSBuildCommand,NuGetCommand,Restore,ToolCommand
A build step executing a .NET CLI command.
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherListNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudsonNested classes/interfaces inherited from interface jenkins.tasks.SimpleBuildStep
SimpleBuildStep.LastBuildAction, SimpleBuildStep.LastBuildActionFactory -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe name of the SDK to use.protected booleanFlag indicating whether SDK information should be shown.protected booleanFlag indicating whether any build servers started by the main command should be shut down.protected booleanFlag indicating whether the presence of errors makes the build unstable (instead of failed).protected booleanFlag indicating whether the presence of warnings makes the build unstable (instead of successful).protected StringThe working directory to use for the command.Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds command line arguments for this invocation of thedotnetCLI.Gets the specific charset to use for the command's output.getSdk()Gets the name of the SDK to use.static DotNetSDK.DescriptorImplGets the descriptor for a .NET SDK.Gets the working directory to use for the command.booleanDetermines whether the build should continue when there is an error.booleanDetermines whether SDK information should be shown.booleanDetermines whether a specific SDK version should be used.voidRuns this .NET command.voidsetCharset(String charset) Sets the specific charset to use for the command's output.voidsetContinueOnError(boolean continueOnError) Determines whether the build should continue when there is an error.voidSets the name of the SDK to use.voidsetShowSdkInfo(boolean showSdkInfo) Determines whether SDK information should be shown.voidsetSpecificSdkVersion(boolean specificSdkVersion) Determines whether a specific SDK version should be used.voidsetWorkDirectory(String workDirectory) Sets the working directory to use for the command.Methods inherited from class hudson.tasks.Builder
all, getRequiredMonitorService, prebuildMethods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectAction, getProjectActions, perform, perform, prebuildMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, getRequiredMonitorService, perform, prebuildMethods inherited from interface jenkins.tasks.SimpleBuildStep
perform, perform, requiresWorkspace
-
Field Details
-
sdk
The name of the SDK to use. -
showSdkInfo
protected boolean showSdkInfoFlag indicating whether SDK information should be shown. -
shutDownBuildServers
protected boolean shutDownBuildServersFlag indicating whether any build servers started by the main command should be shut down. -
unstableIfErrors
protected boolean unstableIfErrorsFlag indicating whether the presence of errors makes the build unstable (instead of failed). -
unstableIfWarnings
protected boolean unstableIfWarningsFlag indicating whether the presence of warnings makes the build unstable (instead of successful). -
workDirectory
The working directory to use for the command. This directory is not created by the command execution.
-
-
Constructor Details
-
Command
public Command()
-
-
Method Details
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<Builder>- Overrides:
getDescriptorin classBuilder
-
addCommandLineArguments
Adds command line arguments for this invocation of thedotnetCLI.- Parameters:
args- The current set of arguments.- Throws:
AbortException- When something goes wrong.
-
getSdkDescriptor
Gets the descriptor for a .NET SDK.- Returns:
- The descriptor for a .NET SDK.
- Throws:
AbortException- When the descriptor could not be found.
-
perform
public void perform(@NonNull Run<?, ?> run, @NonNull FilePath workspace, @NonNull EnvVars env, @NonNull Launcher launcher, @NonNull TaskListener listener) throws InterruptedException, IOExceptionRuns this .NET command.- Specified by:
performin interfaceSimpleBuildStep- Parameters:
run- The run context for the command.workspace- The base working directory for the command.env- The environment variables that apply for the command.launcher- The launcher to use to execute the command.listener- The listener to report command output to.- Throws:
InterruptedException- When execution is interrupted.IOException- When an I/O error occurs.
-
getCharset
Gets the specific charset to use for the command's output.- Returns:
- The specific charset to use for the command's output, or
nullto indicate that the build's default charset should be used.
-
setCharset
Sets the specific charset to use for the command's output.- Parameters:
charset- The specific charset to use for the command's output, ornullto indicate that the build's default charset should be used.
-
isContinueOnError
public boolean isContinueOnError()Determines whether the build should continue when there is an error.- Returns:
falseif the build should be aborted when there is an error;trueto set build status to failed or unstable, based on configuration, but allow the next build step to execute.
-
setContinueOnError
@DataBoundSetter public void setContinueOnError(boolean continueOnError) Determines whether the build should continue when there is an error.- Parameters:
continueOnError-falseif the build should be aborted when there is an error;trueif the build status should be set to failed or unstable, based on configuration, allowing the next build step to execute.
-
getSdk
Gets the name of the SDK to use.- Returns:
- The name of the SDK to use, or
nullto use the SDK made available by the parent context (or the system).
-
setSdk
Sets the name of the SDK to use.- Parameters:
sdk- The name of the SDK to use, ornullto use the SDK made available by the parent context (or the system).
-
isShowSdkInfo
public boolean isShowSdkInfo()Determines whether SDK information should be shown.- Returns:
trueif "dotnet --info" should be run before the main command;falseotherwise.
-
setShowSdkInfo
@DataBoundSetter public void setShowSdkInfo(boolean showSdkInfo) Determines whether SDK information should be shown.- Parameters:
showSdkInfo-trueif "dotnet --info" should be run before the main command;falseotherwise.
-
isSpecificSdkVersion
public boolean isSpecificSdkVersion()Determines whether a specific SDK version should be used.- Returns:
trueif aglobal.jsonshould be created to force the use of the configured .NET SDK (as opposed to a more recent one that happens to be installed on the build agent);falseotherwise.
-
setSpecificSdkVersion
@DataBoundSetter public void setSpecificSdkVersion(boolean specificSdkVersion) Determines whether a specific SDK version should be used.- Parameters:
specificSdkVersion-trueif aglobal.jsonshould be created to force the use of the configured .NET SDK (as opposed to a more recent one that happens to be installed on the build agent);falseotherwise.
-
getWorkDirectory
Gets the working directory to use for the command.- Returns:
- The working directory to use for the command.
-
setWorkDirectory
Sets the working directory to use for the command.- Parameters:
workDirectory- The working directory to use for the command.
-