"\nFor documentation on many of these parameters, see the documentation for Utility.getPackageDependencies().",
true);
CommandLine cl = ucl.getCommandLine(as_cmdLineParams);
Outputter optrDbg = ucl.getOSDOOrOSDOAndFile("dbgfile", false);
String sOutputFile = cl.getOptionValue("outfile");
String sDirToAnalyze = cl.getOptionValue("dir2nlz");
int iSubDirLevels = ucl.getInt("subdirlvls", -1);
String sTmplDir = cl.getOptionValue("tmpldir");
String sPkgPrefixes = cl.getOptionValue("pkgprfxs");
//Prepare for testing and get command line parameters...END
if(iSubDirLevels == 0) {
throwAXS(sAXS_PRE + "SUB_DIR_LEVELS (" + iSubDirLevels + ") must equal -1, or be greater than zero.");
}
String[] asPkgPrefixes = null;
if(!sPkgPrefixes.equals(sZERO)) {
StringTokenizer stPkgPrefixes = new StringTokenizer(sPkgPrefixes, "/");
asPkgPrefixes = new String[stPkgPrefixes.countTokens()];
for(int i = 0; i < asPkgPrefixes.length; i++) {
asPkgPrefixes[i] = stPkgPrefixes.nextToken();
}
}
optrDbg.write("Reporting all dependencies...START");
TOGOne tog1Overall = null;
TOGThree tog3Pkg = null;
TOGOne tog1DOSection = null;
TOGOne tog1DOSRow = null;
TOGOne tog1DOBSection = null;
TOGOne tog1DOBSRow = null;
String sDOSctnNothing = null;
String sDOBSctnNothing = null;
String sDOSRNewline = null;
String sDOBSRNewline = null;
if(sTmplDir.equals(sZERO)) {
optrDbg.write("No templates supplied. Will output plain text only...");
} else {
optrDbg.write("Templates exist in '" + sTmplDir + "'. Loading...");
SOBStringBuffer ssb = new SOBStringBuffer(sES);
util.appendFileText(ssb, sTmplDir + sTMPL_DOS_NOTHING);
sDOSctnNothing = ssb.toString();
ssb.deleteAll();
util.appendFileText(ssb, sTmplDir + sTMPL_DOBS_NOTHING);
sDOBSctnNothing = ssb.toString();
ssb.deleteAll();
util.appendFileText(ssb, sTmplDir + sTMPL_DOS_ROW_NEWLINE);
sDOSRNewline = ssb.toString();
ssb.deleteAll();
util.appendFileText(ssb, sTmplDir + sTMPL_DOBS_ROW_NEWLINE);
sDOBSRNewline = ssb.toString();
try {
tog3Pkg = (new GetTOG3FFile(
sTmplDir + sTMPL_PACKAGE,
sTMPL_PKG_package_name,
sTMPL_PKG_depends_on_section,
sTMPL_PKG_depended_on_by_section,
optrDbg)).getTOGThree();
} catch(AssertException ax) {
String sErr = sAXS_PRE + "Attempting to load " + sTMPL_PACKAGE + ". " + ax.toString();
optrDbg.write(sErr);
throwAXS(sErr);
}
tog1Overall = getTOG1FFile(sTmplDir + sTMPL_OVERALL, sTMPL_PKG_all_dependency_lists, optrDbg);
tog1DOSection = getTOG1FFile(sTmplDir + sTMPL_DEPENDS_ON_SCTN, sTMPL_DOS_all_depends_on_rows, optrDbg);
tog1DOSRow = getTOG1FFile(sTmplDir + sTMPL_DOS_ROW, sTMPL_DOSR_package_name, optrDbg);
tog1DOBSection = getTOG1FFile(sTmplDir + sTMPL_DEPENDED_ON_BY_SCTN, sTMPL_DOBS_all_depended_on_by_rows, optrDbg);
tog1DOBSRow = getTOG1FFile(sTmplDir + sTMPL_DOBS_ROW, sTMPL_DOBSR_package_name, optrDbg);
}
optrDbg.write("...SUCCESS: Templates loaded.");
Outputter optrOutput = null;
if(sOutputFile.equals(sZERO)) {
//Output will only go to screen.
optrDbg.write("Outputting to screen (and file, if debugging output goes there, too)...");
optrOutput = optrDbg;
} else {
optrDbg.write("Outputting to '" + sOutputFile + "'...");
optrOutput = new Outputter(new OWFile(sOutputFile, false));
}
s_acs_acs[] aSacsacs = util.getPackageDependencies(sDirToAnalyze, iSubDirLevels, optrDbg, asPkgPrefixes, true, null);
optrDbg.write("Reporting all dependencies...START");
if(sTmplDir.equals(sZERO)) {
optrDbg.write("No templates supplied. Outputting text only...");
for(int i = 0; i < aSacsacs.length; i++) {
optrDbg.write(aSacsacs[i].s + "\n Depends on:");
for(int j = 0; j < aSacsacs[i].acs1.size(); j++) {
optrDbg.write(" " + aSacsacs[i].acs1.getString(j));
}
optrDbg.write(" Depended on by:");
for(int j = 0; j < aSacsacs[i].acs2.size(); j++) {
optrDbg.write(" " + aSacsacs[i].acs2.getString(j));
}
}
} else {
optrDbg.write("Templates exist in '" + sTmplDir + "'");
TemplateFiller tf = new TemplateFiller(false);
StringBuffer sbAllPackageLists = new StringBuffer(sES);
for(int i = 0; i < aSacsacs.length; i++) {
String sDOSection = getSection(tf, aSacsacs[i].acs1,
tog1DOSection, sTMPL_DOS_all_depends_on_rows,
tog1DOSRow, sTMPL_DOSR_package_name,
sDOSRNewline, sDOSctnNothing);
String sDOBSection = getSection(tf, aSacsacs[i].acs2,
tog1DOBSection, sTMPL_DOBS_all_depended_on_by_rows,
tog1DOBSRow, sTMPL_DOBSR_package_name,
sDOBSRNewline, sDOBSctnNothing);
tf.setTemplate(tog3Pkg);
tf.fill(sTMPL_PKG_package_name, aSacsacs[i].s);
tf.fill(sTMPL_PKG_depends_on_section, sDOSection);
tf.fill(sTMPL_PKG_depended_on_by_section, sDOBSection);
sbAllPackageLists.append(tf.getResult());
}
tf.setOWriter(optrOutput.getOWriter());
tf.setTemplate(tog1Overall);
tf.fill(sTMPL_PKG_all_dependency_lists, sbAllPackageLists.toString());
optrDbg.write("Output exists in '" + sOutputFile + "'...");
}