mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-22 08:02:06 +02:00
rename some of the new Environment methods, make PocoDoc config changes backwards-compatible, revert PocoDoc config changes, make doc build scripts work on macos
This commit is contained in:
@@ -60,7 +60,6 @@ using Poco::Util::OptionCallback;
|
||||
using Poco::Util::HelpFormatter;
|
||||
using Poco::Util::AbstractConfiguration;
|
||||
|
||||
static std::string osName = Environment::osName();
|
||||
|
||||
class Preprocessor
|
||||
{
|
||||
@@ -77,12 +76,12 @@ public:
|
||||
_file(file)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::istream& stream()
|
||||
{
|
||||
return *_pStream;
|
||||
}
|
||||
|
||||
|
||||
~Preprocessor()
|
||||
{
|
||||
int c = _pStream->get();
|
||||
@@ -101,7 +100,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
ProcessHandle _proc;
|
||||
std::istream* _pStream;
|
||||
@@ -112,7 +111,7 @@ private:
|
||||
class PocoDocApp: public Application
|
||||
{
|
||||
public:
|
||||
PocoDocApp():
|
||||
PocoDocApp():
|
||||
_helpRequested(false),
|
||||
_writeEclipseTOC(false)
|
||||
{
|
||||
@@ -123,23 +122,23 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void initialize(Application& self)
|
||||
{
|
||||
loadConfiguration(); // load default configuration files, if present
|
||||
Application::initialize(self);
|
||||
}
|
||||
|
||||
|
||||
void uninitialize()
|
||||
{
|
||||
Application::uninitialize();
|
||||
}
|
||||
|
||||
|
||||
void reinitialize(Application& self)
|
||||
{
|
||||
Application::reinitialize(self);
|
||||
}
|
||||
|
||||
|
||||
void defineOptions(OptionSet& options)
|
||||
{
|
||||
Application::defineOptions(options);
|
||||
@@ -163,14 +162,14 @@ protected:
|
||||
.repeatable(false)
|
||||
.callback(OptionCallback<PocoDocApp>(this, &PocoDocApp::handleEclipse)));
|
||||
}
|
||||
|
||||
|
||||
void handleHelp(const std::string& name, const std::string& value)
|
||||
{
|
||||
_helpRequested = true;
|
||||
displayHelp();
|
||||
stopOptionsProcessing();
|
||||
}
|
||||
|
||||
|
||||
void handleEclipse(const std::string& name, const std::string& value)
|
||||
{
|
||||
_writeEclipseTOC = true;
|
||||
@@ -180,7 +179,7 @@ protected:
|
||||
{
|
||||
loadConfiguration(value, -200);
|
||||
}
|
||||
|
||||
|
||||
void displayHelp()
|
||||
{
|
||||
HelpFormatter helpFormatter(options());
|
||||
@@ -189,7 +188,7 @@ protected:
|
||||
helpFormatter.setHeader("Applied Informatics' super duper documentation builder.");
|
||||
helpFormatter.format(std::cout);
|
||||
}
|
||||
|
||||
|
||||
void buildFileList(std::set<std::string>& files)
|
||||
{
|
||||
std::set<std::string> temp;
|
||||
@@ -215,20 +214,23 @@ protected:
|
||||
files.insert(*it);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Preprocessor* preprocess(const std::string& file)
|
||||
{
|
||||
Path pp(file);
|
||||
pp.setExtension("i");
|
||||
std::string comp = "PocoDoc.compiler";
|
||||
if (Environment::osFamilyWindows())
|
||||
comp += ".windows";
|
||||
std::string platformComp(comp);
|
||||
|
||||
if (Environment::isWindows())
|
||||
platformComp += ".windows";
|
||||
else
|
||||
comp += ".unix";
|
||||
std::string exec = config().getString(comp + ".exec");
|
||||
std::string opts = config().getString(comp + ".options");
|
||||
std::string path = config().getString(comp + ".path", "");
|
||||
bool usePipe = config().getBool(comp + ".usePipe", false);
|
||||
platformComp += ".unix";
|
||||
|
||||
std::string exec = config().getString(platformComp + ".exec", config().getString(comp + ".exec"));
|
||||
std::string opts = config().getString(platformComp + ".options", config().getString(comp + ".options"));
|
||||
std::string path = config().getString(platformComp + ".path", config().getString(comp + ".path", ""));
|
||||
bool usePipe = config().getBool(platformComp + ".usePipe", config().getBool(comp + ".usePipe", false));
|
||||
|
||||
std::string popts;
|
||||
for (std::string::const_iterator it = opts.begin(); it != opts.end(); ++it)
|
||||
@@ -241,7 +243,7 @@ protected:
|
||||
StringTokenizer tokenizer(popts, ",\n", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
|
||||
std::vector<std::string> args(tokenizer.begin(), tokenizer.end());
|
||||
args.push_back(file);
|
||||
|
||||
|
||||
if (!path.empty())
|
||||
{
|
||||
std::string newPath(Environment::get("PATH"));
|
||||
@@ -249,16 +251,16 @@ protected:
|
||||
newPath += path;
|
||||
Environment::set("PATH", path);
|
||||
}
|
||||
|
||||
|
||||
if (usePipe)
|
||||
{
|
||||
Poco::Pipe inPipe;
|
||||
ProcessHandle proc = Process::launch(exec, args, 0, &inPipe, 0);
|
||||
ProcessHandle proc = Process::launch(exec, args, 0, &inPipe, 0);
|
||||
return new Preprocessor(proc, new Poco::PipeInputStream(inPipe));
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessHandle proc = Process::launch(exec, args);
|
||||
ProcessHandle proc = Process::launch(exec, args);
|
||||
proc.wait();
|
||||
return new Preprocessor(proc, new std::ifstream(pp.getFileName().c_str()), pp.getFileName());
|
||||
}
|
||||
@@ -300,7 +302,7 @@ protected:
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
|
||||
|
||||
void fixup()
|
||||
{
|
||||
logger().information("Fixing-up class hierarchies");
|
||||
@@ -313,7 +315,7 @@ protected:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void writeDoc()
|
||||
{
|
||||
logger().information("Generating documentation");
|
||||
@@ -321,9 +323,9 @@ protected:
|
||||
path.makeDirectory();
|
||||
File file(path);
|
||||
file.createDirectories();
|
||||
|
||||
|
||||
DocWriter writer(_gst, path.toString(), config().getBool("PocoDoc.prettifyCode", false), _writeEclipseTOC);
|
||||
|
||||
|
||||
if (config().hasProperty("PocoDoc.pages"))
|
||||
{
|
||||
std::string pages = config().getString("PocoDoc.pages");
|
||||
@@ -339,13 +341,13 @@ protected:
|
||||
}
|
||||
}
|
||||
writer.write();
|
||||
|
||||
|
||||
if (_writeEclipseTOC)
|
||||
{
|
||||
writer.writeEclipseTOC();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void copyResources()
|
||||
{
|
||||
logger().information("Copying resources");
|
||||
@@ -373,7 +375,7 @@ protected:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void copyResource(const Path& source, const Path& dest)
|
||||
{
|
||||
logger().information(std::string("Copying resource ") + source.toString() + " to " + dest.toString());
|
||||
@@ -383,7 +385,7 @@ protected:
|
||||
else
|
||||
copyFile(source, dest);
|
||||
}
|
||||
|
||||
|
||||
void copyFile(const Path& source, const Path& dest)
|
||||
{
|
||||
Path dd(dest);
|
||||
@@ -409,7 +411,7 @@ protected:
|
||||
sf.copyTo(dd.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void copyDirectory(const Path& source, const Path& dest)
|
||||
{
|
||||
Path src(source);
|
||||
@@ -453,7 +455,7 @@ protected:
|
||||
}
|
||||
return Application::EXIT_OK;
|
||||
}
|
||||
|
||||
|
||||
std::string generateGoogleAnalyticsCode()
|
||||
{
|
||||
std::stringstream ostr;
|
||||
@@ -474,7 +476,7 @@ protected:
|
||||
}
|
||||
return ostr.str();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
bool _helpRequested;
|
||||
bool _writeEclipseTOC;
|
||||
|
Reference in New Issue
Block a user