diff options
author | Jose <jose@zeroc.com> | 2015-04-13 14:58:28 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2015-04-13 14:58:28 +0200 |
commit | 8cff2a828400acb3769b7b05452ac267725086eb (patch) | |
tree | 3735ea75f8890fcec71909b0ce4cc616bd14d30a /cpp/src/slice2php/Main.cpp | |
parent | ICE-6445 Remove .NET CF support (diff) | |
download | ice-8cff2a828400acb3769b7b05452ac267725086eb.tar.bz2 ice-8cff2a828400acb3769b7b05452ac267725086eb.tar.xz ice-8cff2a828400acb3769b7b05452ac267725086eb.zip |
Add --depend-file/--depend-xml optinos to all Slice compilers
Diffstat (limited to 'cpp/src/slice2php/Main.cpp')
-rw-r--r-- | cpp/src/slice2php/Main.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index bb992c77a96..39f5ecceedc 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -1584,6 +1584,8 @@ usage(const char* n) "-E Print preprocessor output on stdout.\n" "--output-dir DIR Create files in the directory DIR.\n" "--depend Generate Makefile dependencies.\n" + "--depend-xml Generate dependencies in XML format.\n" + "--depend-file FILE Write dependencies to FILE instead of standard output.\n" "-d, --debug Print debug messages.\n" "--ice Permit `Ice' prefix (for building Ice source code only).\n" "--underscore Permit underscores in Slice identifiers.\n" @@ -1605,6 +1607,8 @@ compile(int argc, char* argv[]) opts.addOpt("E"); opts.addOpt("", "output-dir", IceUtilInternal::Options::NeedArg); opts.addOpt("", "depend"); + opts.addOpt("", "depend-xml"); + opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, ""); opts.addOpt("d", "debug"); opts.addOpt("", "ice"); opts.addOpt("", "underscore"); @@ -1661,6 +1665,10 @@ compile(int argc, char* argv[]) bool depend = opts.isSet("depend"); + bool dependxml = opts.isSet("depend-xml"); + + string dependFile = opts.optArg("depend-file"); + bool debug = opts.isSet("debug"); bool ice = opts.isSet("ice"); @@ -1685,6 +1693,12 @@ compile(int argc, char* argv[]) IceUtil::CtrlCHandler ctrlCHandler; ctrlCHandler.setCallback(interruptedCallback); + DependOutputUtil out(dependFile); + if(dependxml) + { + out.os() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl; + } + for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i) { // @@ -1696,13 +1710,14 @@ compile(int argc, char* argv[]) continue; } - if(depend) + if(depend || dependxml) { PreprocessorPtr icecpp = Preprocessor::create(argv[0], *i, cppArgs); FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2PHP__"); if(cppHandle == 0) { + out.cleanup(); return EXIT_FAILURE; } @@ -1712,16 +1727,20 @@ compile(int argc, char* argv[]) if(parseStatus == EXIT_FAILURE) { + out.cleanup(); return EXIT_FAILURE; } - if(!icecpp->printMakefileDependencies(Preprocessor::PHP, includePaths, "-D__SLICE2PHP__")) + if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::PHP : Preprocessor::SliceXML, + includePaths, "-D__SLICE2PHP__")) { + out.cleanup(); return EXIT_FAILURE; } if(!icecpp->close()) { + out.cleanup(); return EXIT_FAILURE; } } @@ -1830,12 +1849,18 @@ compile(int argc, char* argv[]) if(interrupted) { + out.cleanup(); FileTracker::instance()->cleanup(); return EXIT_FAILURE; } } } + if(dependxml) + { + out.os() << "</dependencies>\n"; + } + return status; } |