Class CliDependencyResolver

java.lang.Object
software.amazon.smithy.gradle.internal.CliDependencyResolver

public final class CliDependencyResolver extends Object
Utility class used to resolve the CLI version and associated CLI dependencies.
  • Method Details

    • resolve

      public static String resolve(org.gradle.api.Project project)
      Add the CLI to the "smithyCli" dependencies.

      The Smithy CLI is invoked in various ways to perform a build. This method ensures that the JARs needed to invoke the CLI with a custom classpath include the JARs needed to run the CLI.

      The plugin will attempt to detect which version of the Smithy CLI to use when performing validation of the generated JAR. If a CLI version is explicitly defined in the "smithyCli" configuration, then that version is used. Otherwise, a CLI version is inferred by scanning the compileClasspath and runtimeClasspath for instances of the "smithy-model" dependency. If found, the version of smithy-model detected is used for the CLI.

      Parameters:
      project - Project to add dependencies to.
      Returns:
      Returns the resolved CLI version
    • detectCliVersionInRuntimeDependencies

      public static String detectCliVersionInRuntimeDependencies(org.gradle.api.artifacts.ConfigurationContainer configurations)
      Check if there's a dependency on smithy-model somewhere, and assume that version.
      Parameters:
      configurations - Configuration contain to use to search for configurations
      Returns:
      version of cli available in configuration
    • validateCliClasspath

      public static void validateCliClasspath(org.gradle.api.file.FileCollection cliClasspath)
      Checks that the provided classpath contains the smithy cli.
      Parameters:
      cliClasspath - classpath to validate