Class ListPackage

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

public final class ListPackage extends Command
A build step to run "dotnet list package", showing a project's package dependencies.
  • Constructor Details

    • ListPackage

      @DataBoundConstructor public ListPackage()
      Creates a new "dotnet list package" build step.
  • Method Details

    • addCommandLineArguments

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

      This adds:

      1. list
      2. The project specified via setProject(String).
      3. package
      4. --deprecated, if requested via setDeprecated(boolean).
      5. --outdated, if requested via setOutdated(boolean).
      6. --framework xxx for each target framework moniker specified via setFramework(String), setFrameworks(String...) or setFrameworksString(String).
      7. --include-transitive, if requested via setIncludeTransitive(boolean).
      8. -v:xxx, if a verbosity has been specified via setVerbosity(String).
      If either outdated or deprecated packages are requested, this also adds:
      1. --include-prerelease, if requested via setIncludePrerelease(boolean).
      2. --highest-minor, if requested via setHighestMinor(boolean).
      3. --highest-patch, if requested via setHighestPatch(boolean).
      4. --config xxx, if a configuration file was specified via setConfig(String).
      5. --source xxx for each source specified via setSource(String), setSources(String...) or setSourcesString(String).
      Overrides:
      addCommandLineArguments in class Command
      Parameters:
      args - The current set of arguments.
    • getConfig

      @CheckForNull public String getConfig()
      Gets the NuGet.config file to use.
      Returns:
      The NuGet.config file to use.
    • setConfig

      @DataBoundSetter public void setConfig(@CheckForNull String config)
      Sets the NuGet.config file to use.
      Parameters:
      config - The NuGet.config file to use.
    • isDeprecated

      public boolean isDeprecated()
      Determines whether deprecated packages should be shown.
      Returns:
      true if deprecated packages should be shown; false otherwise.
    • setDeprecated

      @DataBoundSetter public void setDeprecated(boolean deprecated)
      Determines whether deprecated packages should be shown.
      Parameters:
      deprecated - true to show deprecated packages; false otherwise.
    • getFramework

      @CheckForNull public String getFramework()
      Gets the sole target framework moniker to use.
      Returns:
      The sole target framework moniker to use, or null when there is not exactly one target framework moniker set.
    • setFramework

      @DataBoundSetter public void setFramework(@CheckForNull String framework)
      Sets the sole target framework moniker to use.

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

      Parameters:
      framework - The sole target framework moniker to use.
    • getFrameworks

      @CheckForNull public String[] getFrameworks()
      Gets the target framework monikers to use.
      Returns:
      The target framework monikers to use.
    • setFrameworks

      @DataBoundSetter public void setFrameworks(@CheckForNull String... frameworks)
      Sets the target framework monikers to use.
      Parameters:
      frameworks - The target framework monikers to use.
    • getFrameworksString

      @CheckForNull public String getFrameworksString()
      Gets the target framework monikers to use.
      Returns:
      The target framework monikers to use.
    • setFrameworksString

      @DataBoundSetter public void setFrameworksString(@CheckForNull String frameworks)
      Sets the target framework monikers to use.
      Parameters:
      frameworks - The target framework monikers to use.
    • isHighestMinor

      public boolean isHighestMinor()
      Determines whether to consider only packages where at most the minor version has changed.
      Returns:
      true if only packages where at most the minor version has changed are considered; false otherwise.
    • setHighestMinor

      @DataBoundSetter public void setHighestMinor(boolean highestMinor)
      Determines whether to consider only packages where at most the minor version has changed.
      Parameters:
      highestMinor - true to only consider packages where at most the minor version has changed; false otherwise.
    • isHighestPatch

      public boolean isHighestPatch()
      Determines whether to consider only packages where at most the patch version has changed.
      Returns:
      true if only packages where at most the patch version has changed are considered; false otherwise.
    • setHighestPatch

      @DataBoundSetter public void setHighestPatch(boolean highestPatch)
      Determines whether to consider only packages where at most the patch version has changed.
      Parameters:
      highestPatch - true to only consider packages where at most the patch version has changed; false otherwise.
    • isIncludePrerelease

      public boolean isIncludePrerelease()
      Determines whether to consider prerelease packages.
      Returns:
      true if prerelease packages are considered; false otherwise.
    • setIncludePrerelease

      @DataBoundSetter public void setIncludePrerelease(boolean includePrerelease)
      Determines whether to consider prerelease packages.
      Parameters:
      includePrerelease - true to consider prerelease packages; false otherwise.
    • isIncludeTransitive

      public boolean isIncludeTransitive()
      Determines whether to show transitive dependencies.
      Returns:
      true if transitive dependencies are shown; false otherwise.
    • setIncludeTransitive

      @DataBoundSetter public void setIncludeTransitive(boolean includeTransitive)
      Determines whether to show transitive dependencies.
      Parameters:
      includeTransitive - true to show transitive dependencies; false otherwise.
    • isOutdated

      public boolean isOutdated()
      Determines whether outdated packages should be shown.
      Returns:
      true if outdated packages should be shown; false otherwise.
    • setOutdated

      @DataBoundSetter public void setOutdated(boolean outdated)
      Determines whether outdated packages should be shown.
      Parameters:
      outdated - true to show outdated packages; false otherwise.
    • getProject

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

      @DataBoundSetter public void setProject(@CheckForNull String project)
      Sets the project to list packages for.
      Parameters:
      project - The project to list packages for.
    • 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.
    • 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.
    • isVulnerable

      public boolean isVulnerable()
      Determines whether packages with known vulnerabilities should be shown.
      Returns:
      true if packages with known vulnerabilities should be shown; false otherwise.
    • setVulnerable

      @DataBoundSetter public void setVulnerable(boolean vulnerable)
      Determines whether packages with known vulnerabilities should be shown.
      Parameters:
      vulnerable - true to show packages with known vulnerabilities; false otherwise.