Class SmithyUtils

java.lang.Object
software.amazon.smithy.gradle.SmithyUtils

public final class SmithyUtils extends Object
General utility methods used throughout the plugin.
  • Field Details

  • Method Details

    • getProjectionPluginPath

      public static Path getProjectionPluginPath(File smithyOutputDirectory, String projection, String plugin)
      Gets the path to a projection plugins output.
      Parameters:
      smithyOutputDirectory - output directory to get plugin path from
      projection - Projection name.
      plugin - Plugin name.
      Returns:
      Returns the resolved path.
    • getSmithyResourceTempDir

      public static File getSmithyResourceTempDir(String taskName, File outputDir)
      Gets the path to the temp directory where Smithy model resources are placed in the generated JAR of a project.

      The name of the task is used so that multiple staging directories can be created without conflicts. The task name must uniquely identify the task within a project so there is no concern of task naming collision.

      Parameters:
      taskName - name of the task using this Temp directory
      outputDir - output directory to inspect.
      Returns:
      Returns the classpath.
    • getProjectionOutputDirProperty

      public static org.gradle.api.provider.Provider<org.gradle.api.file.Directory> getProjectionOutputDirProperty(org.gradle.api.Project project)
      Gets the provider for the default output directory of projections.
      Parameters:
      project - Project to inspect.
      Returns:
      Returns the default output directory.
    • executeCli

      public static void executeCli(org.gradle.workers.WorkerExecutor executor, List<String> arguments, org.gradle.api.file.FileCollection cliClasspath, boolean fork)
      Executes the Smithy CLI in a separate thread or process.
      Parameters:
      executor - WorkerExecutor to use for executing CLI command.
      arguments - CLI arguments.
      cliClasspath - Classpath to use when running the CLI.
      fork - whether to fork a new process or not
    • getCliConfiguration

      public static org.gradle.api.artifacts.Configuration getCliConfiguration(org.gradle.api.Project project)
    • isMatchingDependency

      public static boolean isMatchingDependency(org.gradle.api.artifacts.Dependency dependency, String name)
      Checks if a dependency matches an expected name.
      Parameters:
      dependency - Dependency to check
      name - Name of expected dependency
      Returns:
      true if the dependency matches the expected name