Package software.amazon.smithy.gradle
Class SmithyUtils
java.lang.Object
software.amazon.smithy.gradle.SmithyUtils
General utility methods used throughout the plugin.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidexecuteCli(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.static org.gradle.api.artifacts.ConfigurationgetCliConfiguration(org.gradle.api.Project project) 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.static PathgetProjectionPluginPath(File smithyOutputDirectory, String projection, String plugin) Gets the path to a projection plugins output.static FilegetSmithyResourceTempDir(String taskName, File outputDir) Gets the path to the temp directory where Smithy model resources are placed in the generated JAR of a project.static booleanisMatchingDependency(org.gradle.api.artifacts.Dependency dependency, String name) Checks if a dependency matches an expected name.
-
Field Details
-
SMITHY_CLI_CONFIGURATION_NAME
- See Also:
-
-
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 fromprojection- Projection name.plugin- Plugin name.- Returns:
- Returns the resolved path.
-
getSmithyResourceTempDir
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 directoryoutputDir- 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 checkname- Name of expected dependency- Returns:
- true if the dependency matches the expected name
-