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.PublisherList
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
Nested classes/interfaces inherited from interface jenkins.tasks.SimpleBuildStep
SimpleBuildStep.LastBuildAction, SimpleBuildStep.LastBuildActionFactory
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
The name of the SDK to use.protected boolean
Flag indicating whether SDK information should be shown.protected boolean
Flag indicating whether any build servers started by the main command should be shut down.protected boolean
Flag indicating whether the presence of errors makes the build unstable (instead of failed).protected boolean
Flag indicating whether the presence of warnings makes the build unstable (instead of successful).protected String
The working directory to use for the command.Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Adds command line arguments for this invocation of thedotnet
CLI.Gets the specific charset to use for the command's output.getSdk()
Gets the name of the SDK to use.static DotNetSDK.DescriptorImpl
Gets the descriptor for a .NET SDK.Gets the working directory to use for the command.boolean
Determines whether the build should continue when there is an error.boolean
Determines whether SDK information should be shown.boolean
Determines whether a specific SDK version should be used.void
Runs this .NET command.void
setCharset
(String charset) Sets the specific charset to use for the command's output.void
setContinueOnError
(boolean continueOnError) Determines whether the build should continue when there is an error.void
Sets the name of the SDK to use.void
setShowSdkInfo
(boolean showSdkInfo) Determines whether SDK information should be shown.void
setSpecificSdkVersion
(boolean specificSdkVersion) Determines whether a specific SDK version should be used.void
setWorkDirectory
(String workDirectory) Sets the working directory to use for the command.Methods inherited from class hudson.tasks.Builder
all, getRequiredMonitorService, prebuild
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectAction, getProjectActions, perform, perform, prebuild
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, getRequiredMonitorService, perform, prebuild
Methods 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:
getDescriptor
in interfaceDescribable<Builder>
- Overrides:
getDescriptor
in classBuilder
-
addCommandLineArguments
Adds command line arguments for this invocation of thedotnet
CLI.- 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:
perform
in 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
null
to 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, ornull
to 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:
false
if the build should be aborted when there is an error;true
to 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
-false
if the build should be aborted when there is an error;true
if 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
null
to 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, ornull
to use the SDK made available by the parent context (or the system).
-
isShowSdkInfo
public boolean isShowSdkInfo()Determines whether SDK information should be shown.- Returns:
true
if "dotnet --info
" should be run before the main command;false
otherwise.
-
setShowSdkInfo
@DataBoundSetter public void setShowSdkInfo(boolean showSdkInfo) Determines whether SDK information should be shown.- Parameters:
showSdkInfo
-true
if "dotnet --info
" should be run before the main command;false
otherwise.
-
isSpecificSdkVersion
public boolean isSpecificSdkVersion()Determines whether a specific SDK version should be used.- Returns:
true
if aglobal.json
should 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);false
otherwise.
-
setSpecificSdkVersion
@DataBoundSetter public void setSpecificSdkVersion(boolean specificSdkVersion) Determines whether a specific SDK version should be used.- Parameters:
specificSdkVersion
-true
if aglobal.json
should 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);false
otherwise.
-
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.
-