@groovy.transform.CompileStatic @groovy.util.logging.Slf4j class GenerationUtils extends Object
Helps with generation of source and data files.
| Modifiers | Name | Description |
|---|---|---|
static String |
TESTKIT_PROJECT_LEVEL_SUBDIR |
Subdirectory below build/gradleTest (or similar) where a shared testkit will be placed. |
| Constructor and description |
|---|
GenerationUtils
() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static String |
classNameComponentBase(String name)Sanitized the name of a directory into seomthing that can be used to start a Groovy class name. |
|
static String |
classNameComponentBuildFile(String buildFile)Calcaultes a postfix for a class name based upon the build file type. |
|
static String |
classNameComponentVersion(String gradleVersion)Sanitizes a Gradle version into something that can be used in a class name. |
|
static String |
classNameFrom(BasicTestDefinition btd)Builds a class name from a test definition. |
|
static String |
classNameFromComponents(String sanitizedBase, String sanitizedVersion, String sanitizedBuildFile)Builds a class name from a set of sanitized components. |
|
static void |
generateProject(File targetDir, FullTestDefinition ftd, boolean makeCopies, org.ysb33r.grolifant5.api.core.FileSystemOperations fsOperations)Generates a project structure. |
|
static File |
generateTest(File targetDir, File templateFile, org.ysb33r.grolifant5.api.core.FileSystemOperations fsOperations, FullTestDefinition ftd)Generates a Spock test source file. |
|
static File |
generateTraitsFile(File targetDir, File templateFile, org.ysb33r.grolifant5.api.core.FileSystemOperations fsOperations, String packageName)Generates a traits file that is used by all tests. |
|
static String |
getTestPackagePath(String packageName)Converts a package name to a package path. |
|
static String |
pathAsUriStr(File path)Ensures that files are represented as URIs. |
|
static String |
quoteAndJoin(Iterable<String> c) |
|
static void |
removeOldGeneratedFiles(File targetDir, String packageName, java.util.List<File> generatedFiles)Remove old generated files. |
|
static String |
testKitLocationString(TestKitLocations testKitLocation)Create a string suitable for sending to the Spock template. |
|
static String |
tripleQuoteAndJoin(Iterable<String> c) |
Subdirectory below build/gradleTest (or similar) where a shared testkit will be placed.
Sanitized the name of a directory into seomthing that can be used to start a Groovy class name.
name - Name of a directoryCalcaultes a postfix for a class name based upon the build file type.
buildFile - Build file name.Sanitizes a Gradle version into something that can be used in a class name.
gradleVersion - Gradle versionBuilds a class name from a test definition.
btd - TEst definitionBuilds a class name from a set of sanitized components.
sanitizedBase - Sanitized base namesanitizedVersion - Sanitized Gradle versionsanitizedBuildFile - Sanitized build file typeGenerates a project structure.
Mostly creates a set of symlinks. If not settings file exist in the source, one will be generated into the project directory.
targetDir - Directory to generate intoftd - Test definition.makeCopies - Copy files rather than symlink them.fsOperation - An instance of org.ysb33r.grolifant5.api.core.FileSystemOperations that can be used to manipulate files.Generates a Spock test source file.
targetDir - Top-level directory to generate into.templateFile - Template file to usefsOperations - Grolifant org.ysb33r.grolifant5.api.core.FileSystemOperations instanceftd - Test definitionGenerates a traits file that is used by all tests.
targetDir - Top-level directory to generate into.templateFile - Template file to usefsOperations - Grolifant org.ysb33r.grolifant5.api.core.FileSystemOperations instancepackageName - Package nameConverts a package name to a package path.
packageName - Package nameEnsures that files are represented as URIs. (This helps with compatibility across operating systems).
path - Path to outputRemove old generated files.
targetDir - Targe directorypackageName - Package namegeneratedFiles - List of known generated files.Create a string suitable for sending to the Spock template.