Class Restore

All Implemented Interfaces:
ExtensionPoint, Describable<Builder>, BuildStep, SimpleBuildStep

public final class Restore extends Command
A build step to run "dotnet restore", restoring packages for a project.
  • Constructor Details

    • Restore

      @DataBoundConstructor public Restore()
      Creates a new "dotnet restore" build step.
  • Method Details

    • addCommandLineArguments

      protected void addCommandLineArguments(@NonNull DotNetArguments args)
      Adds command line arguments for this "dotnet restore" invocation.

      This adds:

      1. restore
      2. The project specified via setProject(String).
      3. --configfile xxx, if a config file was specified via setConfigfile(String).
      4. --disable-parallel, if requested via setDisableParallel(boolean).
      5. --force, if requested via setForce(boolean).
      6. --force-evaluate, if requested via setForceEvaluate(boolean).
      7. --ignore-failed-sources, if requested via setIgnoreFailedSources(boolean).
      8. --lock-file-path xxx, if a lock file path was specified via setLockFilePath(String).
      9. --locked-mode, if requested via setLockedMode(boolean).
      10. --no-cache, if requested via setNoCache(boolean).
      11. --no-dependencies, if requested via setNoDependencies(boolean).
      12. --packages xxx, if a package directory was specified via setPackages(String).
      13. -r:xxx for each runtime identifier specified via setRuntime(String), setRuntimes(String...) or setRuntimesString(String).
      14. -s:xxx for each source specified via setSourcesString(String), setSources(String...) or setSourcesString(String).
      15. --use-lock-file, if requested via setUseLockFile(boolean).
      16. -v:xxx, if a verbosity has been specified via setVerbosity(String).
      Overrides:
      addCommandLineArguments in class Command
      Parameters:
      args - The current set of arguments.
    • getConfigfile

      public String getConfigfile()
      Gets the NuGet configuration (nuget.config) file to use.
      Returns:
      The NuGet configuration (nuget.config) file to use.
    • setConfigfile

      @DataBoundSetter public void setConfigfile(String configfile)
      Sets the NuGet configuration (nuget.config) file to use.
      Parameters:
      configfile - The NuGet configuration (nuget.config) file to use.
    • isDisableParallel

      public boolean isDisableParallel()
      Determines whether multiple projects can be restored in parallel.
      Returns:
      true when multiple projects are restored one by one; false otherwise.
    • setDisableParallel

      @DataBoundSetter public void setDisableParallel(boolean disableParallel)
      Determines whether multiple projects can be restored in parallel.
      Parameters:
      disableParallel - true to restore multiple projects one by one; false otherwise.
    • isForce

      public boolean isForce()
      Determines whether dependency resolution should be forced.
      Returns:
      true when all dependencies should be resolved even if the last restore was successful; false otherwise.
    • setForce

      @DataBoundSetter public void setForce(boolean force)
      Determines whether dependency resolution should be forced.
      Parameters:
      force - true to resolve all dependencies even if the last restore was successful; false otherwise.
    • isForceEvaluate

      public boolean isForceEvaluate()
      Determines whether all dependencies should be re-evaluated even when a lock file exists.
      Returns:
      true when all dependencies are re-evaluated even when a lock file exists; false otherwise.
    • setForceEvaluate

      @DataBoundSetter public void setForceEvaluate(boolean forceEvaluate)
      Determines whether all dependencies should be re-evaluated even when a lock file exists.
      Parameters:
      forceEvaluate - true to re-evaluate all dependencies even when a lock file exists; false otherwise.
    • isIgnoreFailedSources

      public boolean isIgnoreFailedSources()
      Determines whether failed sources should be ignored.
      Returns:
      true when failed sources are ignored; false otherwise.
    • setIgnoreFailedSources

      @DataBoundSetter public void setIgnoreFailedSources(boolean ignoreFailedSources)
      Determines whether failed sources should be ignored.
      Parameters:
      ignoreFailedSources - true to ignore failed sources; false otherwise.
    • getLockFilePath

      @CheckForNull public String getLockFilePath()
      Gets the path to the lock file.
      Returns:
      The path to the lock file.
    • setLockFilePath

      @DataBoundSetter public void setLockFilePath(@CheckForNull String lockFilePath)
      Sets the path to the lock file.
      Parameters:
      lockFilePath - The path to the lock file.
    • isLockedMode

      public boolean isLockedMode()
      Determines whether updating the project lock file is allowed.
      Returns:
      true when updating the project lock file is not allowed; false otherwise.
    • setLockedMode

      @DataBoundSetter public void setLockedMode(boolean lockedMode)
      Determines whether updating the project lock file is allowed.
      Parameters:
      lockedMode - true to disallow updating the project lock file; false otherwise.
    • isNoCache

      public boolean isNoCache()
      Determines whether HTTP requests should be cached.
      Returns:
      true when HTTP requests are not cached; false otherwise.
    • setNoCache

      @DataBoundSetter public void setNoCache(boolean noCache)
      Determines whether HTTP requests should be cached.
      Parameters:
      noCache - true not to cache HTTP requests; false otherwise.
    • isNoDependencies

      public boolean isNoDependencies()
      Determines whether to ignore project-to-project dependencies.
      Returns:
      true when project-to-project dependencies are ignored; false otherwise.
    • setNoDependencies

      @DataBoundSetter public void setNoDependencies(boolean noDependencies)
      Determines whether to ignore project-to-project dependencies.
      Parameters:
      noDependencies - true when project-to-project dependencies should be ignored; false otherwise.
    • getPackages

      @CheckForNull public String getPackages()
      Gets the directory to use for restored packages.
      Returns:
      The directory to use for restored packages.
    • setPackages

      @DataBoundSetter public void setPackages(@CheckForNull String packages)
      Sets the directory to use for restored packages.
      Parameters:
      packages - The directory to use for restored packages.
    • getProject

      @CheckForNull public String getProject()
      Gets the project to restore.
      Returns:
      The project to restore.
    • setProject

      @DataBoundSetter public void setProject(@CheckForNull String project)
      Sets the project to restore.
      Parameters:
      project - The project to restore.
    • getRuntime

      @CheckForNull public String getRuntime()
      Gets the runtime identifiers to use.
      Returns:
      The runtime identifiers to use.
    • setRuntime

      @DataBoundSetter public void setRuntime(@CheckForNull String runtime)
      Sets the sole runtime identifier to use.

      To set more than one, use setRuntimes(String...) instead.

      Parameters:
      runtime - The sole runtime identifier to use.
    • getRuntimes

      @CheckForNull public String[] getRuntimes()
      Gets the runtime identifiers to use.
      Returns:
      The runtime identifiers to use.
    • setRuntimes

      @DataBoundSetter public void setRuntimes(@CheckForNull String... runtimes)
      Sets the runtime identifiers to use.
      Parameters:
      runtimes - The runtime identifiers to use.
    • getRuntimesString

      @CheckForNull public String getRuntimesString()
      Gets the runtime identifiers to use.
      Returns:
      The runtime identifiers to use.
    • setRuntimesString

      @DataBoundSetter public void setRuntimesString(@CheckForNull String runtimes)
      Sets the runtime identifiers to use.
      Parameters:
      runtimes - The runtime identifiers to use.
    • getSource

      @CheckForNull public String getSource()
      Gets the sole package source to use.
      Returns:
      The sole package source to use, or null when there is not exactly one package source set.
    • setSource

      @DataBoundSetter public void setSource(@CheckForNull String source)
      Sets the sole package source to use.

      To set more than one, use setSources(String...) instead.

      Parameters:
      source - The sole package source to use.
    • getSources

      @CheckForNull public String[] getSources()
      Gets the package sources to use.
      Returns:
      The package sources to use.
    • setSources

      @DataBoundSetter public void setSources(@CheckForNull String... sources)
      Sets the package sources to use.
      Parameters:
      sources - The package sources to use.
    • getSourcesString

      @CheckForNull public String getSourcesString()
      Gets the package sources to use.
      Returns:
      The package sources to use.
    • setSourcesString

      @DataBoundSetter public void setSourcesString(@CheckForNull String sources)
      Sets the package sources to use.
      Parameters:
      sources - The package sources to use.
    • isUseLockFile

      public boolean isUseLockFile()
      Determines whether a project lock file should be generated and used.
      Returns:
      true when a project lock file is generated and used; false otherwise.
    • setUseLockFile

      @DataBoundSetter public void setUseLockFile(boolean useLockFile)
      Determines whether a project lock file should be generated and used.
      Parameters:
      useLockFile - true to generate and use a project lock file; false otherwise.
    • getVerbosity

      @CheckForNull public String getVerbosity()
      Gets the verbosity to use for the command.
      Returns:
      The verbosity to use for the command.
    • setVerbosity

      @DataBoundSetter public void setVerbosity(@CheckForNull String verbosity)
      Sets the verbosity to use for the command.
      Parameters:
      verbosity - The verbosity to use for the command.