summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d589d7c)
raw | patch | inline | side by side (parent: d589d7c)
author | ishmal <ishmal@users.sourceforge.net> | |
Wed, 15 Nov 2006 18:14:06 +0000 (18:14 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Wed, 15 Nov 2006 18:14:06 +0000 (18:14 +0000) |
build.xml | patch | blob | history | |
buildtool.cpp | patch | blob | history |
diff --git a/build.xml b/build.xml
index 9881363a47486161e261e4fc0d64ebc10720d587..00894d92f9c3c3b65b6e5b65bf40e558c6e22c8d 100644 (file)
--- a/build.xml
+++ b/build.xml
<exclude name="dialogs/filedialog-win32.cpp"/>\r
<exclude name="display/testnr.cpp"/>\r
<exclude name="display/bezier-utils-test.cpp"/>\r
+ <exclude name="dom/jsdombind.cpp"/>\r
<exclude name="dom/work"/>\r
<exclude name="dom/odf/SvgOdg.cpp"/>\r
<exclude name="extension/api.cpp"/>\r
diff --git a/buildtool.cpp b/buildtool.cpp
index a92ae8befb7b950c781b7fc6189366b62153a9a1..a0f5e16303fc6f265177d3c8f519e70f2b109a89 100644 (file)
--- a/buildtool.cpp
+++ b/buildtool.cpp
{
va_list args;
va_start(args,fmt);
- fprintf(stdout, "Make: ");
+ fprintf(stdout, "-");
vfprintf(stdout, fmt, args);
fprintf(stdout, "\n");
va_end(args) ;
{
DWORD bytesRead = 0;
char readBuf[1025];
- if (avail>1024) avail = 1024;
+ if (avail>1024) avail = 1024;
if (!ReadFile(stdoutRead, readBuf, avail, &bytesRead, NULL)
|| bytesRead==0)
{
GetExitCodeProcess(piProcessInfo.hProcess, &exitCode);
if (exitCode != STILL_ACTIVE)
break;
- Sleep(500);
+ Sleep(100);
}
//trace("outbuf:%s", outbuf.c_str());
if (!CloseHandle(stdoutRead))
if (isNewerThan(fullName, fullOut))
doit = true;
}
- trace("Needs it:%d", doit);
+ //trace("Needs it:%d", doit);
if (!doit)
{
return true;
cmd.append(" ");
cmd.append(fullName);
}
- trace("AR %d: %s", fileSet.size(), cmd.c_str());
+ //trace("AR %d: %s", fileSet.size(), cmd.c_str());
String outString, errString;
if (!executeCommand(cmd.c_str(), "", outString, errString))
{
}
cmd.append(" ");
cmd.append(libs);
- trace("LINK cmd:%s", cmd.c_str());
if (!doit)
{
- trace("link not needed");
+ //trace("link not needed");
return true;
}
+ //trace("LINK cmd:%s", cmd.c_str());
String outString, errString;
if (!executeCommand(cmd.c_str(), "", outString, errString))
/**
*
*/
- bool run(const std::vector<String> &targets);
+ bool run(const String &target);
/**
*
*/
- bool executeTarget(Target &target);
+ bool executeTarget(Target &target,
+ std::set<String> &targetsCompleted);
/**
String projectName;
+ String currentTarget;
+
String defaultTarget;
- String currentTarget;
+ String specifiedTarget;
String baseDir;
String envAlias;
-
- std::vector<String> specifiedTargets;
-
//std::vector<Property> properties;
std::map<String, Target> targets;
{
uri = "build.xml";
projectName = "";
- defaultTarget = "";
currentTarget = "";
+ defaultTarget = "";
+ specifiedTarget = "";
baseDir = "";
description = "";
envAlias = "";
- specifiedTargets.clear();
properties.clear();
- targets.clear();
for (unsigned int i = 0 ; i < allTasks.size() ; i++)
delete allTasks[i];
allTasks.clear();
{
uri = other.uri;
projectName = other.projectName;
- specifiedTargets = other.specifiedTargets;
- defaultTarget = other.defaultTarget;
currentTarget = other.currentTarget;
+ defaultTarget = other.defaultTarget;
+ specifiedTarget = other.specifiedTarget;
baseDir = other.baseDir;
description = other.description;
properties = other.properties;
- targets = other.targets;
}
/**
*
*/
-bool Make::executeTarget(Target &target)
+bool Make::executeTarget(Target &target,
+ std::set<String> &targetsCompleted)
{
String name = target.getName();
for (unsigned int i=0 ; i<deps.size() ; i++)
{
String dep = deps[i];
+ //Did we do it already? Skip
+ if (targetsCompleted.find(dep)!=targetsCompleted.end())
+ continue;
+
std::map<String, Target> &tgts =
target.getParent().getTargets();
std::map<String, Target>::iterator iter =
return false;
}
Target depTarget = iter->second;
- if (!executeTarget(depTarget))
+ if (!executeTarget(depTarget, targetsCompleted))
{
return false;
}
}
- trace("##### Target : %s", name.c_str());
+ status("##### Target : %s", name.c_str());
//Now let's do the tasks
std::vector<Task *> &tasks = target.getTasks();
for (unsigned int i=0 ; i<tasks.size() ; i++)
{
Task *task = tasks[i];
- trace("----- Task : %s", task->getName().c_str());
+ status("----- Task : %s", task->getName().c_str());
if (!task->execute())
{
return false;
}
}
+
+ targetsCompleted.insert(name);
+
return true;
}
/**
- *
+ * Main execute() method. Start here and work
+ * up the dependency tree
*/
bool Make::execute()
{
- trace("##### EXECUTE");
- //# First let us list what targets have been requested
- std::vector<String> tgts = specifiedTargets;
- if (tgts.size() == 0)
+ status("######## EXECUTE");
+
+ //Determine initial target
+ if (specifiedTarget.size()>0)
{
- trace("getting default targets");
- if (defaultTarget.size() == 0)
- {
- error("No target specified");
- return false;
- }
- else
- tgts.push_back(defaultTarget);
+ currentTarget = specifiedTarget;
+ }
+ else if (defaultTarget.size()>0)
+ {
+ currentTarget = defaultTarget;
+ }
+ else
+ {
+ error("execute: no specified or default target requested");
+ return false;
}
- //# Now let us execute them (probably just 1)
- for (unsigned int i=0 ; i<tgts.size() ; i++)
+ std::map<String, Target>::iterator iter =
+ targets.find(currentTarget);
+ if (iter == targets.end())
{
- currentTarget = tgts[i];
- std::map<String, Target>::iterator iter = targets.find(currentTarget);
- if (iter == targets.end())
- {
- error("Target '%s' not found", currentTarget.c_str());
- return false;
- }
- Target target = iter->second;
- if (!executeTarget(target))
- {
- return false;
- }
+ error("Initial target '%s' not found",
+ currentTarget.c_str());
+ return false;
+ }
+
+ //Now run
+ Target target = iter->second;
+ std::set<String> targetsCompleted;
+ if (!executeTarget(target, targetsCompleted))
+ {
+ return false;
}
- status("Done executing");
+ status("######## EXECUTE COMPLETE");
return true;
}
*/
bool Make::parseFile()
{
+ status("######## PARSE");
+
Parser parser;
Element *root = parser.parseFile(uri.getNativePath());
if (!root)
delete root;
- status("Done parsing");
+ status("######## PARSE COMPLETE");
return true;
}
/**
*
*/
-bool Make::run(const std::vector<String> &targets)
+bool Make::run(const String &target)
{
- specifiedTargets = targets;
+ status("##################################");
+ status("# BuildTool");
+ status("# version 0.2");
+ status("##################################");
+ specifiedTarget = target;
if (!run())
return false;
+ status("##################################");
+ status("# BuildTool Completed");
+ status("##################################");
return true;
}
}
buildtool::String buildFile;
- std::vector<buildtool::String> targets;
+ buildtool::String target;
//char *progName = argv[0];
for (int i=1 ; i<argc ; i++)
}
else
{
- buildtool::String target = arg;
- targets.push_back(target);
+ target = arg;
}
}
{
make.setURI(buildFile);
}
- if (!make.run(targets))
+ if (!make.run(target))
return false;
return true;