gov.llnl.babel.backend
Class Dependencies

java.lang.Object
  extended bygov.llnl.babel.backend.Dependencies
All Implemented Interfaces:
BuildGenerator, FileListener

public class Dependencies
extends java.lang.Object
implements FileListener, BuildGenerator

Make depends info calculator for all languages. We have a nested map structure: s_dirMap contains elements indexed by dirname and with hashmaps as values. The hashmap values are themselves hashmaps keyed by filename with a value the vector of filenames of prerequisites. Note on terminology: this is about makefile dependency rules of the form output : input where input and output may be lists and may be path qualified or not. It turns out that without a more restrictive definition of the C/C++/fortran code generation, we cannot determine the directory in which the included headers will exist because, for example, the IOR headers may be kept canonically elsewhere and generated by an alternate invocation of babel. Similarly, headers from other sidl packages not included in the same generation step be be anywhere in the filesystem. Thus, the best dependency we can generate is by filenames only on the rhs of the : in a make rule and the rest of the work must be provided by VPATH in gnu make or equivalent. On the whole, the difficulties stem from a deep inconsistency in how various languages are handled. E.g. xml files can always determine the full path to other xml files at babel invocation time. In python and java there is some package structure, but not enough to guarantee anything. In C, etc, the user can pretty much do anything they want.


Field Summary
static Dependencies s_deps
           
 
Constructor Summary
protected Dependencies()
           
 
Method Summary
static void addInput(java.lang.String input)
           
static void addTargetFile(java.lang.String dirName, java.lang.String fileName)
           
 void createAll()
          Generate the files needed to support the building of Babel generated files.
static void dumpData()
           
static java.util.HashMap getDirectoryData(java.lang.String dirName)
           
 java.util.Set getLanguages()
          Return the set of languages that this build generator serves.
 void newFile(SymbolID id, int type, java.lang.String role, java.lang.String dir, java.lang.String name)
          This method is called by the FileManager for each new file it creates.
static void recordDependency(Symbol symbol)
           
static void recordDependency(SymbolID id)
          Method for recording makefile dependencies.
static void setOutputDir(java.lang.String outdir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_deps

public static Dependencies s_deps
Constructor Detail

Dependencies

protected Dependencies()
Method Detail

setOutputDir

public static void setOutputDir(java.lang.String outdir)

addTargetFile

public static void addTargetFile(java.lang.String dirName,
                                 java.lang.String fileName)

addInput

public static void addInput(java.lang.String input)

getDirectoryData

public static java.util.HashMap getDirectoryData(java.lang.String dirName)

dumpData

public static void dumpData()

recordDependency

public static void recordDependency(SymbolID id)
Method for recording makefile dependencies. Do not use unless you know exactly what you are doing.


recordDependency

public static void recordDependency(Symbol symbol)

newFile

public void newFile(SymbolID id,
                    int type,
                    java.lang.String role,
                    java.lang.String dir,
                    java.lang.String name)
Description copied from interface: FileListener
This method is called by the FileManager for each new file it creates.

Specified by:
newFile in interface FileListener
Parameters:
id - the file is related to this symbol id.
type - this indicates the type of the symbol. A constant from Type.
role - this describes the role the file plays. For example, the file could be a STUBSRCS file or a IMPLSRCS file. The role strings used are determined by the backend.
dir - the path (relative or absolute) of the directory where the file will be created.
name - the name of the file not including any directory information. The complete name of the file should be dir + name.

createAll

public void createAll()
Description copied from interface: BuildGenerator
Generate the files needed to support the building of Babel generated files. For example, this could create babel.make files or a Python setup.py for distutils.

Specified by:
createAll in interface BuildGenerator

getLanguages

public java.util.Set getLanguages()
Description copied from interface: BuildGenerator
Return the set of languages that this build generator serves. Each build generator serves a Set of languages.

Specified by:
getLanguages in interface BuildGenerator
Returns:
a Set of strings. Each string in the set represents a language supported by the build generator.