From 392efbf5bb185209a1cd4d688b36a8a541eaaf35 Mon Sep 17 00:00:00 2001 From: ishmal Date: Sat, 15 Dec 2007 19:00:40 +0000 Subject: [PATCH] Add initial support for . Also fix str compare bug --- buildtool.cpp | 80 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/buildtool.cpp b/buildtool.cpp index da437fae1..2b589c3d1 100644 --- a/buildtool.cpp +++ b/buildtool.cpp @@ -38,7 +38,7 @@ * */ -#define BUILDTOOL_VERSION "BuildTool v0.7.3, 2007 Bob Jamison" +#define BUILDTOOL_VERSION "BuildTool v0.7.4, 2007 Bob Jamison" #include #include @@ -3885,7 +3885,7 @@ bool MakeBase::getSubstitutions(const String &str, String &result) { std::map::iterator iter; varname = trim(varname); - if (varname.compare(0, envPrefix.size(), envPrefix) == 0) + if (envPrefix.size() > 0 && varname.compare(0, envPrefix.size(), envPrefix) == 0) { varname = varname.substr(envPrefix.size()); char *envstr = getenv(varname.c_str()); @@ -6675,20 +6675,88 @@ class TaskJavac : public Task public: TaskJavac(MakeBase &par) : Task(par) - { type = TASK_JAVAC; name = "javac"; } + { + type = TASK_JAVAC; name = "javac"; + command = "javac"; + } virtual ~TaskJavac() {} virtual bool execute() { - return true; + std::vector fileList; + if (!listFiles(srcdir, "", fileList)) + { + return false; + } + String cmd = command; + cmd.append(" -d "); + cmd.append(destdir); + cmd.append(" -sourcepath "); + cmd.append(srcdir); + cmd.append(" "); + for (unsigned int i=0 ; i command '%s' failed :\n %s", + execCmd.c_str(), errString.c_str()); + return false; + } + } } virtual bool parse(Element *elem) { + String s; + if (!parent.getAttribute(elem, "command", s)) + return false; + if (s.size() > 0) + command = s; + if (!parent.getAttribute(elem, "srcdir", srcdir)) + return false; + if (!parent.getAttribute(elem, "destdir", destdir)) + return false; + if (srcdir.size() == 0 || destdir.size() == 0) + { + error(" required both srcdir and destdir attributes to be set"); + return false; + } return true; } + +private: + + String command; + String srcdir; + String destdir; + }; @@ -6704,8 +6772,8 @@ public: type = TASK_LINK; name = "link"; command = "g++"; doStrip = false; - stripCommand = "strip"; - objcopyCommand = "objcopy"; + stripCommand = "strip"; + objcopyCommand = "objcopy"; } virtual ~TaskLink() -- 2.30.2