summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e5183c6)
raw | patch | inline | side by side (parent: e5183c6)
author | ishmal <ishmal@users.sourceforge.net> | |
Fri, 9 May 2008 20:48:24 +0000 (20:48 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Fri, 9 May 2008 20:48:24 +0000 (20:48 +0000) |
buildtool.cpp | patch | blob | history |
diff --git a/buildtool.cpp b/buildtool.cpp
index 9ee051f1aae903472cd3f146781f195ef5d8019e..3bbe13d4499ed0950044d07ea7339b428726b078 100644 (file)
--- a/buildtool.cpp
+++ b/buildtool.cpp
*
*/
-#define BUILDTOOL_VERSION "BuildTool v0.8.3"
+#define BUILDTOOL_VERSION "BuildTool v0.8.4"
#include <stdio.h>
#include <fcntl.h>
*/
String resolve(const String &otherPath);
+ /**
+ * replace variable refs like ${a} with their values
+ */
+ bool eval(const String &s, String &result);
+
/**
* Get an element attribute, performing substitutions if necessary
*/
private:
- /**
- * replace variable refs like ${a} with their values
- */
- bool getSubstitutions(const String &s, String &result);
-
int line;
-
-bool MakeBase::getSubstitutions(const String &str, String &result)
+/**
+ * Analyse a string, looking for any substitutions or other
+ * things that need resilution
+ */
+bool MakeBase::eval(const String &str, String &result)
{
String s = trim(str);
int len = (int)s.size();
String &result)
{
String s = elem->getAttribute(name);
- return getSubstitutions(s, result);
+ return eval(s, result);
}
{
String s = elem->getValue();
//Replace all runs of whitespace with a single space
- return getSubstitutions(s, result);
+ return eval(s, result);
}
TASK_CC,
TASK_COPY,
TASK_DELETE,
+ TASK_ECHO,
TASK_JAR,
TASK_JAVAC,
TASK_LINK,
};
+/**
+ * Send a message to stdout
+ */
+class TaskEcho : public Task
+{
+public:
+
+ TaskEcho(MakeBase &par) : Task(par)
+ { type = TASK_ECHO; name = "echo"; }
+
+ virtual ~TaskEcho()
+ {}
+
+ virtual bool execute()
+ {
+ //let message have priority over text
+ if (message.size() > 0)
+ {
+ String s;
+ if (!parent.eval(message, s))
+ return false;
+ fprintf(stdout, "%s\n", s.c_str());
+ }
+ else if (text.size() > 0)
+ {
+ String s;
+ if (!parent.eval(text, s))
+ return false;
+ fprintf(stdout, "%s\n", s.c_str());
+ }
+ return true;
+ }
+
+ virtual bool parse(Element *elem)
+ {
+ text = elem->getValue();
+ text = leftJustify(text);
+ message = elem->getAttribute("message");
+ return true;
+ }
+
+private:
+
+ String message;
+ String text;
+};
+
+
+
/**
*
*/
/**
- * Create a named directory
+ * Create a named file
*/
class TaskMakeFile : public Task
{
}
}
- taskstatus("%s", ret.c_str());
+ taskstatus("property %s = '%s'", propName.c_str(), ret.c_str());
parent.setProperty(propName, ret);
return true;
}
task = new TaskCopy(parent);
else if (tagName == "delete")
task = new TaskDelete(parent);
+ else if (tagName == "echo")
+ task = new TaskEcho(parent);
else if (tagName == "jar")
task = new TaskJar(parent);
else if (tagName == "javac")