public abstract class JkScaffold
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
JkScaffold.JkFileEntry |
Modifier and Type | Field and Description |
---|---|
protected java.nio.file.Path |
baseDir |
java.util.List<JkScaffold.JkFileEntry> |
fileEntries |
static java.lang.String |
UNSPECIFIED_JEKA_VERSION |
Modifier | Constructor and Description |
---|---|
protected |
JkScaffold(java.nio.file.Path baseDir) |
protected |
JkScaffold(java.nio.file.Path baseDir,
JkRepoSet downloadRepos) |
Modifier and Type | Method and Description |
---|---|
void |
addFileEntry(java.lang.String relativePath,
java.lang.String content)
Adds a file entry to the list of file entries in the scaffold.
|
JkScaffold |
addJekaPropsContent(java.lang.String extraContent) |
JkScaffold |
addJekaPropValue(java.lang.String propValue)
Adds a property to scaffolded jeka.properties by specifying a string with format "prop.name=prop.value".
|
static void |
createShellScripts(java.nio.file.Path baseDir)
Creates or replaces shell scripts in the specified base directory, meaning jeka.ps1 and jeka bash scripts.
|
java.lang.String |
findLatestStableVersion(java.lang.String moduleCoordinate,
java.lang.String defaultVersion)
Finds the latest version for a given module coordinate.
|
protected java.lang.String |
getJekaVersion() |
protected java.util.List<java.lang.String> |
getJUnitDeps() |
java.lang.String |
lastJekaVersion()
Returns the last version of the Jeka module.
|
static java.lang.String |
readResource(java.lang.Class<?> clazz,
java.lang.String resourceName)
Returns the content of a resource file as a string.
|
void |
removeFileEntriesStartingWith(java.nio.file.Path pathPrefix)
Removes the file entries that start with the specified path prefix.
|
protected void |
run()
Runs the scaffolding, meaning folder structure, build class, props file and .gitignore
|
JkScaffold |
setJekaDistribLocation(java.lang.String jekaDistribLocation) |
JkScaffold |
setJekaDistribRepo(java.lang.String jekaDistribRepo) |
JkScaffold |
setJekaPropsCustomizer(java.util.function.UnaryOperator<java.lang.String> customizer)
Gives a chance to override the final jeka.properties file
|
JkScaffold |
setJekaVersion(java.lang.String jekaVersion) |
JkScaffold |
setRawJekaPropsPath(java.nio.file.Path rawJekaPropsPath)
Sets the path of a file that will be copied to jeka.properties.
|
public static final java.lang.String UNSPECIFIED_JEKA_VERSION
protected final java.nio.file.Path baseDir
public final java.util.List<JkScaffold.JkFileEntry> fileEntries
protected JkScaffold(java.nio.file.Path baseDir, JkRepoSet downloadRepos)
protected JkScaffold(java.nio.file.Path baseDir)
public JkScaffold addJekaPropsContent(java.lang.String extraContent)
public JkScaffold addJekaPropValue(java.lang.String propValue)
public JkScaffold setJekaVersion(java.lang.String jekaVersion)
public JkScaffold setRawJekaPropsPath(java.nio.file.Path rawJekaPropsPath)
If such a path is set, all other settings related to jeka.properties generation are ignored and the content of jeka.properties will be exactly the same as the specified file.
public JkScaffold setJekaDistribRepo(java.lang.String jekaDistribRepo)
public JkScaffold setJekaDistribLocation(java.lang.String jekaDistribLocation)
public java.lang.String findLatestStableVersion(java.lang.String moduleCoordinate, java.lang.String defaultVersion)
moduleCoordinate
- the coordinate of the module for which to find the latest versiondefaultVersion
- the default version to be returned if the latest version cannot be foundprotected java.util.List<java.lang.String> getJUnitDeps()
protected java.lang.String getJekaVersion()
protected void run()
public final java.lang.String lastJekaVersion()
This method searches for versions of the Jeka module in the specified download repositories. It filters out any snapshot versions and returns the last non-snapshot version found. If no versions are found, it logs a warning message and returns the current Jeka version.
public JkScaffold setJekaPropsCustomizer(java.util.function.UnaryOperator<java.lang.String> customizer)
public final void addFileEntry(java.lang.String relativePath, java.lang.String content)
public final void removeFileEntriesStartingWith(java.nio.file.Path pathPrefix)
public static java.lang.String readResource(java.lang.Class<?> clazz, java.lang.String resourceName)
public static void createShellScripts(java.nio.file.Path baseDir)
baseDir
- the base directory where the shell scripts will be created or replaced.