public class CheckDependencyFile
extends java.lang.Object
#processIncludeLine(String, String, AddDependency_InfoFileDependencies, ObjectFileDeps, TreeMap, String, int)
,
which returns the boolean value need or doesn't need a translation.
#include "file.h" #include "path/file.h"For all included files, which are found in the common include path, an index is filled. In that kind an included file, which was found and processed one time, can be re-found with a short index access and can be detected as 'already processed'. An instance
InfoFileDependencies
are related to it.
Included files, which are not found in the common include path, should be searched in the additional path.
Then the absolute path is known and that included files can be found with its absolute path in the same list.Modifier and Type | Class and Description |
---|---|
private static class |
CheckDependencyFile.NextCodeLine
Helper class to get the next line in a source file without comment.
|
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
bExc
If true then an IllegalArgumentException will be thrown instead text return.
|
(package private) CfgData |
cfgData
Some paths etc.
|
(package private) CheckData |
checkData
Contains all dependencies, read from file and processed.
|
(package private) MainCmdLogging_ifc |
console |
(package private) java.util.List<java.lang.String> |
dirObjRoots |
(package private) java.io.File |
dirSrcMirrorRoot
The dirSrcMirror refers to the build root directory.
|
(package private) CheckAllDepFile |
readerInputDepFile
Junction between the dependency data in
checkData and the dependency input and output textual file. |
(package private) java.lang.String |
sDbgLocalFile |
(package private) java.lang.String |
sFileDeps
The dependency-file which war read.
|
static java.lang.String |
version
Version, history and license.
|
(package private) java.io.File |
XXXdirObjRoot
The dirObj refers to the object root directory.
|
Constructor and Description |
---|
CheckDependencyFile(MainCmdLogging_ifc log,
boolean bExc)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
(package private) InfoFileDependencies |
checkDependenciesInputDepFile(java.lang.String sPathSrcCanonical,
ObjectFileDeps objDeps,
int nRecursion,
java.util.Map<java.lang.String,java.lang.String> idxOnce) |
(package private) InfoFileDependencies |
checkSource(java.io.File fileSrcGen,
java.lang.String sFileSrgGenAbs,
java.io.File fileSrcMirror,
java.util.TreeMap<java.lang.String,java.io.File> checkedFiles,
ObjectFileDeps objDeps,
int recursion,
java.util.Map<java.lang.String,java.lang.String> idxOnce)
Checks the File for equality and process all include statements,
process recursively all included files.
|
void |
close() |
(package private) void |
copyToMirror(java.io.File fileSrcGen,
java.io.File fileSrcMirror,
java.lang.String sTest)
Copies the original source file to the build box, saves the last file if such parameters are given.
|
(package private) void |
deleteResultFile(java.lang.String localName) |
(package private) java.io.File |
getFileSrcMirror(java.lang.String sLocalPath)
Builds the mirror of the primary source file for compare and build.
|
(package private) void |
processIncludeLine(java.lang.String sDirCurrentFile,
java.lang.String sLine,
AddDependency_InfoFileDependencies infoFileParent,
ObjectFileDeps objDeps,
java.util.TreeMap<java.lang.String,java.io.File> checkedFiles,
java.lang.String sSrcPath,
int recursion,
java.util.Map<java.lang.String,java.lang.String> idxOnce)
Processes a line which contains an #include-statement.
|
(package private) InfoFileDependencies |
processSrcfile(java.io.File fileSrc,
ObjectFileDeps objDeps,
int recursiveCt,
java.util.Map<java.lang.String,java.lang.String> idxOnce)
Check of one source file for newly against the associated result file of translation (object-file for C-compilation).
|
InfoFileDependencies |
processSrcfile(java.io.File fileSrc,
java.lang.String sLocalPathName)
Check of one source file for newly against the associated result file of translation (object-file for C-compilation).
|
InfoFileDependencies |
processSrcfile(java.io.File fileSrc,
java.lang.String sLocalPathName,
java.io.File dirObjRoot,
java.lang.String sObjExt)
Check of one source file for newly against the associated result file of translation (object-file for C-compilation).
|
InfoFileDependencies |
processSrcfile(java.io.File fileSrc,
java.lang.String sLocalPathName,
java.lang.String sObjExt)
Deprecated.
|
InfoFileDependencies |
processSrcfile(java.lang.String src) |
java.lang.String |
readCfgData(java.lang.String sFileCfgData,
java.io.File currdir)
This routine must be called after construction to supply the configuration data.
|
java.lang.String |
readDependencies(java.lang.String sFileDepenencies)
This routine can be called after construction to supply the configuration data.
|
(package private) void |
reportIncludesOfFile(InfoFileDependencies infoFile,
int recursionCt,
java.util.Map<java.lang.String,InfoFileDependencies> indexMainCmdLogging_ifced) |
(package private) java.io.File |
searchInclFileInIncludePath(java.lang.String sPathInIncludeLine,
java.util.List<java.io.File> src) |
(package private) java.io.File |
searchInclFileInIncludePath(java.lang.String sPathInIncludeLine,
java.lang.String sDirCurrentFile,
boolean includeFromCurrent,
char[] typeInclude)
Searches the file in the include path respectively from the current file.
|
void |
setDebugLocalFileContains(java.lang.String part) |
java.lang.String |
setDirObj(java.lang.String sDirObjExt)
Set an object directory.
|
java.lang.String |
setDirSrcMirror(java.lang.String sDirSrcMirror) |
(package private) void |
stop() |
java.lang.String |
writeDependencies()
Writes the dependencies which are checked after creation of this class in the given file.
|
java.lang.String |
writeDependencies(java.lang.String sFileDependencies)
Writes the dependencies which are checked after creation of this class in the given file.
|
public static final java.lang.String version
setDirObj(String)
throws an Exception this behavior is set by bExc
.
processSrcfile(File, String)
only with this 2 arguments should be used in zmake, see new documentation.
processSrcfile(File, String, File, String)
with given Object file.
Therefore the routine setDirObj(String)
is not necessary to call before. Any file can have its object directory.
#processSrcfile(File, ObjectFileDeps, int)
. It's a fix change.
setDirObj(String)
is changed in parameter form.
searchInclFileInIncludePath(String, List)
, not at last 'y'.
Elsewhere not founded includefiles are not reported.
CheckDeps_Old
. It should be used
to check file by file. All other classes are adapted.
final CheckData checkData
final boolean bExc
final CheckAllDepFile readerInputDepFile
checkData
and the dependency input and output textual file.final CfgData cfgData
final MainCmdLogging_ifc console
java.io.File dirSrcMirrorRoot
java.io.File XXXdirObjRoot
java.lang.String sFileDeps
java.util.List<java.lang.String> dirObjRoots
java.lang.String sDbgLocalFile
public CheckDependencyFile(MainCmdLogging_ifc log, boolean bExc)
log
- for logging outputbExc
- If true then errors throws an exception. false then errors results in an return string which should be test by the application.
See description of the methods.public java.lang.String setDirSrcMirror(java.lang.String sDirSrcMirror)
public java.lang.String setDirObj(java.lang.String sDirObjExt)
sDirObjExt
- Should have the form "path/*.objExt"public void setDebugLocalFileContains(java.lang.String part)
public java.lang.String readCfgData(java.lang.String sFileCfgData, java.io.File currdir)
sFileCfgData
- The filecurrdir
- the directory which is used as base to build the path if the config file contains relative paths.public java.lang.String readDependencies(java.lang.String sFileDepenencies)
sFileDepenencies
- The last created dependency file.java.io.File getFileSrcMirror(java.lang.String sLocalPath)
fileSrc
- The primary source filesLocalPath
- The local "path.name.ext" of the file.
It is used to build the second source file with the appropriate name
in the appropriate sub-directory.public InfoFileDependencies processSrcfile(java.io.File fileSrc, java.lang.String sLocalPathName, java.io.File dirObjRoot, java.lang.String sObjExt)
fileSrc
- The source filesLocalPathName
- The local part of name, it is the name of the object filesObjExt
- extension of the object filewriteDependencies(String)
line for this file.public InfoFileDependencies processSrcfile(java.io.File fileSrc, java.lang.String sLocalPathName) throws java.io.FileNotFoundException
fileSrc
- The source filesLocalPathName
- The local part of name, it is the name of the object filesObjExt
- extension of the object filewriteDependencies(String)
line for this file.java.io.FileNotFoundException
public InfoFileDependencies processSrcfile(java.lang.String src) throws java.io.FileNotFoundException
java.io.FileNotFoundException
@Deprecated public InfoFileDependencies processSrcfile(java.io.File fileSrc, java.lang.String sLocalPathName, java.lang.String sObjExt) throws java.io.FileNotFoundException
sObjExt
- This attribute is unnecessaryjava.io.FileNotFoundException
InfoFileDependencies processSrcfile(java.io.File fileSrc, ObjectFileDeps objDeps, int recursiveCt, java.util.Map<java.lang.String,java.lang.String> idxOnce)
fileSrc
- The source file itselfobjDeps
- Accumulator for the dependencies of the top-level-file. This instance is created in the first level
of recursion. It is filled while all depending files are processed.recursiveCt
- A recursion counter. This method may be called recursively to check depending files in recursion.InfoFileDependencies checkDependenciesInputDepFile(java.lang.String sPathSrcCanonical, ObjectFileDeps objDeps, int nRecursion, java.util.Map<java.lang.String,java.lang.String> idxOnce) throws java.io.FileNotFoundException
java.io.FileNotFoundException
InfoFileDependencies checkSource(java.io.File fileSrcGen, java.lang.String sFileSrgGenAbs, java.io.File fileSrcMirror, java.util.TreeMap<java.lang.String,java.io.File> checkedFiles, ObjectFileDeps objDeps, int recursion, java.util.Map<java.lang.String,java.lang.String> idxOnce) throws java.io.FileNotFoundException
#processIncludeLine(String, String, InfoFileDependencies, ObjectFileDeps, TreeMap, String, int)
fileSrcGen
- The sourcefile, may be re-generated without changed substantiate content.sFileSrgGenAbs
- The absolute path of the sourcefile, how used in the indices.fileSrcMirror
- The sourcefile for build process, the content will be compared with fileSrcGen.
It may be null, then the no comparison is executed, only dependency evaluation.objDeps
- This instance is created in the level of processing the c-file, where an obj-file
is associated. In deeper levels the dependencies where noted there.
Last not least in the c-file-level it will be checked whether the obj-file is to delete.infoFile
- Container for dependencies for this file. The container was created from the caller.
It is only for this file. It accumulates all dependencies.sDirCurrentFile
- The directory of the fileSrcGen, to support include "relativePath"checkedFiles
- List of all checked included files to prevent checking twice.recursion
- recursion counter.java.io.FileNotFoundException
void processIncludeLine(java.lang.String sDirCurrentFile, java.lang.String sLine, AddDependency_InfoFileDependencies infoFileParent, ObjectFileDeps objDeps, java.util.TreeMap<java.lang.String,java.io.File> checkedFiles, java.lang.String sSrcPath, int recursion, java.util.Map<java.lang.String,java.lang.String> idxOnce) throws java.io.FileNotFoundException
#indexAllInclFilesShortPath
.
If it is found there, the file is processed already. Its InfoFileDependencies
are known already. The timestamp of the file is known, it is compared with the Obj-file-timestamp
calling ObjectFileDeps#checkedNewer(long, String)
.
#listInclPaths
. If the file isn't found, an error message is outputted.
Then the include path should be corrected.
#indexAllInclFilesAbsPath
. It is possible that the same file is included
with different relative pathes, but it is the same absolute path. If the file is found there,
it is processed already. Then the same procedure is done if it was found in the relative path.
#processSrcfile(File, ObjectFileDeps, int)
if the included file isn't processed yet and it is a generated source.
There checkFile or #checkDependencyFile(File, ObjectFileDeps, InfoFileDependencies, int)
will be called.
#checkFile(File, String, File, ObjectFileDeps, InfoFileDependencies, String, TreeMap, int)
if the include file isn't processed yet and it is a external source.
#checkDependencyFile(File, ObjectFileDeps, InfoFileDependencies, int)
if the include file isn't processed yet and the dependency file exists and is not older.
NOTE: This is not done yet, because there isn't a concept of saving the dependency file
for external files. Only for generated sources it is given. Idea: One file for all dependencies.
InfoFileDependencies
in #indexAllInclFilesAbsPath
.
sDirCurrentFile
- Absolute path of the current file, to support relative includesLine
- The line with #include -statementinfoFileParent
- The container of dependencies of the calling level.objDeps
- This instance is created in the level of processing the c-file, where an obj-file
is associated. In deeper levels the dependencies where noted there.
Last not least in the c-file-level it will be checked whether the obj-file is to delete.checkedFiles
- index of all checked files of thissSrcPath
- The path of the source of calling level (the file which contains the include-line),
only for reportrecursion
- recursion count.java.io.FileNotFoundException
java.io.File searchInclFileInIncludePath(java.lang.String sPathInIncludeLine, java.lang.String sDirCurrentFile, boolean includeFromCurrent, char[] typeInclude) throws java.io.FileNotFoundException
#listSystemInclPaths
and a user include path list #listInclPaths
.sPathInIncludeLine
- The file name maybe with a path from the include statement.sDirCurrentFile
- The directory of the current file to search from there.includeFromCurrent
- true if it is a #include "file.h"-statement. false if it is a #include typeInclude
- Return charjava.io.FileNotFoundException
java.io.File searchInclFileInIncludePath(java.lang.String sPathInIncludeLine, java.util.List<java.io.File> src)
void copyToMirror(java.io.File fileSrcGen, java.io.File fileSrcMirror, java.lang.String sTest) throws java.io.FileNotFoundException
fileSrcGen
- The originalfileSrcMirror
- The copyjava.io.FileNotFoundException
void reportIncludesOfFile(InfoFileDependencies infoFile, int recursionCt, java.util.Map<java.lang.String,InfoFileDependencies> indexMainCmdLogging_ifced)
void deleteResultFile(java.lang.String localName)
public java.lang.String writeDependencies(java.lang.String sFileDependencies)
sFileDeps
- The file to write into.public java.lang.String writeDependencies()
sFileDeps
- The file to write into.public void close()
void stop()