Package io.jenkins.plugins.dotnet
Class DotNetSDK
java.lang.Object
hudson.model.AbstractDescribableImpl<ToolInstallation>
hudson.tools.ToolInstallation
io.jenkins.plugins.dotnet.DotNetSDK
- All Implemented Interfaces:
 ExtensionPoint,Describable<ToolInstallation>,EnvironmentSpecific<DotNetSDK>,NodeSpecific<DotNetSDK>,Serializable
public final class DotNetSDK
extends ToolInstallation
implements NodeSpecific<DotNetSDK>, EnvironmentSpecific<DotNetSDK>
An installation of a .NET SDK as a global tool.
- See Also:
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA descriptor for .NET SDK installations.Nested classes/interfaces inherited from class hudson.tools.ToolInstallation
ToolInstallation.ToolConverterNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson - 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddSdks(ListBoxModel model) Adds the names of all defined .NET SDK installations to a listbox model.voidbuildEnvVars(EnvVars env) Sets up environment variables for this .NET SDK installation.booleancreateGlobalJson(FilePath dir, TaskListener listener) Create aglobal.jsonin the specified location, forcing the use of this .NET SDK's exact version.ensureExecutableExists(Launcher launcher) Ensures that thedotnetexecutable exists in this .NET SDK installation.forEnvironment(EnvVars envVars) Creates a copy of this .NET SDK installation that has the specified environment variables applied.forNode(Node node, TaskListener listener) Creates a copy of this .NET SDK installation for use on the specified node.static StringgetExecutableFileName(Launcher launcher) Returns the file name for thedotnetexecutable on the agent platform.getHomePath(hudson.remoting.VirtualChannel channel) Determines the file path for this SDK's home directory.static booleanDetermines whether any .NET SDKs have been configured.booleanDetermines whether the telemetry opt-out is set.static voidremoveGlobalJson(FilePath dir, TaskListener listener) Removes aglobal.jsonfile (as previously created viacreateGlobalJson(FilePath, TaskListener).voidsetTelemetryOptOut(boolean telemetryOptOut) Determines whether the telemetry opt-out should be set.Methods inherited from class hudson.tools.ToolInstallation
all, getHome, getName, getProperties, readResolve, toString, translate, translate, translateFor, writeReplaceMethods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor 
- 
Field Details
- 
HOME_ENVIRONMENT_VARIABLE
Deprecated.UseROOT_ENVIRONMENT_VARIABLEinstead; that environment variable is also used by the SDK itself.An environment variable that will be set to the full path to the SDK (backward compatibility).- See Also:
 
 - 
ROOT_ENVIRONMENT_VARIABLE
The environment variable that will be set to the full path to the SDK (used by the SDK in some cases).- See Also:
 
 
 - 
 - 
Constructor Details
- 
DotNetSDK
Creates a new .NET SDK installation.- Parameters:
 name- The name for the installation.home- The path to the SDK.
 - 
DotNetSDK
@DataBoundConstructor public DotNetSDK(@NonNull String name, @NonNull String home, @CheckForNull List<? extends ToolProperty<?>> properties) Creates a new .NET SDK installation.- Parameters:
 name- The name for the installation.home- The path to the SDK.properties- Additional properties for the SDK installation.
 
 - 
 - 
Method Details
- 
isTelemetryOptOut
public boolean isTelemetryOptOut()Determines whether the telemetry opt-out is set.- Returns:
 truewhen the telemetry opt-out is set;falseotherwise.
 - 
setTelemetryOptOut
@DataBoundSetter public void setTelemetryOptOut(boolean telemetryOptOut) Determines whether the telemetry opt-out should be set.- Parameters:
 telemetryOptOut-trueto opt out of telemetry;falseotherwise.
 - 
addSdks
Adds the names of all defined .NET SDK installations to a listbox model.- Parameters:
 model- The listbox model to add the .NET SDK installations to.
 - 
buildEnvVars
Sets up environment variables for this .NET SDK installation.- Overrides:
 buildEnvVarsin classToolInstallation- Parameters:
 env- The environment variables to add values to.
 - 
createGlobalJson
Create aglobal.jsonin the specified location, forcing the use of this .NET SDK's exact version.- Parameters:
 dir- The location where theglobal.jsonshould be created.listener- The task listener to use for output- Returns:
 truewhen aglobal.jsonfile was created;falseotherwise.
 - 
ensureExecutableExists
@NonNull public String ensureExecutableExists(@NonNull Launcher launcher) throws IOException, InterruptedException Ensures that thedotnetexecutable exists in this .NET SDK installation.- Parameters:
 launcher- The launcher to use for the verification.- Returns:
 - The full path to the 
dotnetexecutable in this .NET SDK installation. - Throws:
 AbortException- When the executable could not be found.IOException- When an I/O error occurs.InterruptedException- When processing is interrupted.
 - 
forEnvironment
Creates a copy of this .NET SDK installation that has the specified environment variables applied.- Specified by:
 forEnvironmentin interfaceEnvironmentSpecific<DotNetSDK>- Parameters:
 envVars- The environment variables to apply.- Returns:
 - A copy of this .NET SDK installation that has the specified environment variables applied.
 
 - 
forNode
@NonNull public DotNetSDK forNode(@NonNull Node node, @NonNull TaskListener listener) throws IOException, InterruptedException Creates a copy of this .NET SDK installation for use on the specified node.- Specified by:
 forNodein interfaceNodeSpecific<DotNetSDK>- Parameters:
 node- The node to use the .NET SDK installation on.- Returns:
 - A copy of this .NET SDK installation for use on 
node. - Throws:
 IOExceptionInterruptedException
 - 
getExecutableFileName
Returns the file name for thedotnetexecutable on the agent platform.- Parameters:
 launcher- The launcher to use to determine the agent platform.- Returns:
 dotnet.exewhenlauncherrepresents a Windows agent,dotnetotherwise.
 - 
getHomePath
Determines the file path for this SDK's home directory.- Parameters:
 channel- The remote context to use for the file path.- Returns:
 - A file path representing this SDK's home directory, or 
nullif no home directory was set. 
 - 
hasConfiguration
public static boolean hasConfiguration()Determines whether any .NET SDKs have been configured.- Returns:
 truewhen at least one .NET SDK has been configured; otherwise,false.
 - 
removeGlobalJson
Removes aglobal.jsonfile (as previously created viacreateGlobalJson(FilePath, TaskListener).- Parameters:
 dir- The location containing theglobal.jsonfile to remove.listener- The task listener to use for output.
 
 - 
 
ROOT_ENVIRONMENT_VARIABLEinstead; that environment variable is also used by the SDK itself.