public class JkComputedDependency extends java.lang.Object implements JkFileDependency
JkFileDependency
on files that might not
be present at the time of the build and that has to be generated. Instances of this class are
responsible to generate the missing files.
Computed dependencies are instantiated by providing expected files and a Runnable
that
generates these files in case one of them is missing.
This is yet simple but quite powerful mechanism, cause the runnable can be anything as a Maven or an ANT build of another project, a Jeka build of another project, ...
This is the way to create multi-projects (and multi-techno) builds.
Modifier and Type | Field and Description |
---|---|
protected java.lang.Iterable<java.nio.file.Path> |
files |
protected java.lang.Runnable |
runnable |
Modifier | Constructor and Description |
---|---|
protected |
JkComputedDependency(java.lang.Runnable runnable,
java.nio.file.Path ideProjectBaseDir,
java.lang.Iterable<java.nio.file.Path> files)
Constructs a computed dependency to the specified files and the specified
Runnable to run for
generating them. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.util.List<java.nio.file.Path> |
getFiles() |
java.nio.file.Path |
getIdeProjectDir()
If this dependency can be represented as a project dependency in an IDE,
this field mentions the baseTree dir of the project.
|
java.util.Set<java.nio.file.Path> |
getMissingFilesOrEmptyDirs()
Returns the missing files or empty directory for this dependency.
|
int |
hashCode() |
boolean |
hasMissingFilesOrEmptyDirs()
Returns
true if at least one of these files is missing or one of these directory is empty. |
static JkComputedDependency |
of(java.lang.Iterable<java.nio.file.Path> files,
JkJavaProcess process)
Same as
of(Path, JkJavaProcess) but you must specify a set of files
instead of a single one. |
static JkComputedDependency |
of(JkProcess process,
java.nio.file.Path... files)
Creates a computed dependency to the specified files and
JkProcess to run for
generating them. |
static JkComputedDependency |
of(java.nio.file.Path file,
JkJavaProcess process)
Creates a computed dependency to the specified file and the specified java program to run for
generating them.
|
static JkComputedDependency |
of(java.lang.Runnable runnable,
java.nio.file.Path... files)
Creates a computed dependency to the specified files and the specified
Runnable to run for
generating them. |
java.lang.String |
toString() |
JkComputedDependency |
withIdeProjectDir(java.nio.file.Path path)
Returns a dependency identical to this one but with the specified project base dir.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isCoordinate, matches, of, of
protected final java.lang.Runnable runnable
protected final java.lang.Iterable<java.nio.file.Path> files
protected JkComputedDependency(java.lang.Runnable runnable, java.nio.file.Path ideProjectBaseDir, java.lang.Iterable<java.nio.file.Path> files)
Runnable
to run for
generating them.public static JkComputedDependency of(JkProcess process, java.nio.file.Path... files)
JkProcess
to run for
generating them.public static JkComputedDependency of(java.lang.Runnable runnable, java.nio.file.Path... files)
Runnable
to run for
generating them.public static JkComputedDependency of(java.lang.Iterable<java.nio.file.Path> files, JkJavaProcess process)
of(Path, JkJavaProcess)
but you must specify a set of files
instead of a single one.public static JkComputedDependency of(java.nio.file.Path file, JkJavaProcess process)
public final boolean hasMissingFilesOrEmptyDirs()
true
if at least one of these files is missing or one of these directory is empty.public final java.util.Set<java.nio.file.Path> getMissingFilesOrEmptyDirs()
public java.util.List<java.nio.file.Path> getFiles()
getFiles
in interface JkFileDependency
public java.nio.file.Path getIdeProjectDir()
getIdeProjectDir
in interface JkDependency
public JkComputedDependency withIdeProjectDir(java.nio.file.Path path)
JkDependency
withIdeProjectDir
in interface JkDependency
JkDependency.getIdeProjectDir()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object