From ceb9b97a62780ab7aef6ec4c03f20d776368a112 Mon Sep 17 00:00:00 2001 From: ishmal Date: Mon, 31 Mar 2008 18:14:58 +0000 Subject: [PATCH] Add simple task. Separate "builddist" target --- build.xml | 68 ++++++++++++++++++++++++++++++++++----------------- buildtool.cpp | 40 ++++++++++++++++++++++++++++-- 2 files changed, 83 insertions(+), 25 deletions(-) diff --git a/build.xml b/build.xml index 25a1a2c96..82b9e719d 100644 --- a/build.xml +++ b/build.xml @@ -323,17 +323,6 @@ - - - - - - - - @@ -648,39 +634,75 @@ + + + + - - - - + + + + + + + + + - + + + + + + + + + + + + - diff --git a/buildtool.cpp b/buildtool.cpp index 24de41077..f912ebdea 100644 --- a/buildtool.cpp +++ b/buildtool.cpp @@ -38,7 +38,7 @@ * */ -#define BUILDTOOL_VERSION "BuildTool v0.7.6, 2007-2008 Bob Jamison" +#define BUILDTOOL_VERSION "BuildTool v0.7.7, 2007-2008 Bob Jamison" #include #include @@ -6650,20 +6650,56 @@ class TaskJar : public Task public: TaskJar(MakeBase &par) : Task(par) - { type = TASK_JAR; name = "jar"; } + { type = TASK_JAR; name = "jar"; command = "jar";} virtual ~TaskJar() {} virtual bool execute() { + String cmd = command; + cmd.append(" -cf "); + cmd.append(destfile); + cmd.append(" -C "); + cmd.append(basedir); + cmd.append(" ."); + + String execCmd = cmd; + + String outString, errString; + bool ret = executeCommand(execCmd.c_str(), "", outString, errString); + if (!ret) + { + error(" command '%s' failed :\n %s", + execCmd.c_str(), errString.c_str()); + return false; + } return true; } 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, "basedir", basedir)) + return false; + if (!parent.getAttribute(elem, "destfile", destfile)) + return false; + if (basedir.size() == 0 || destfile.size() == 0) + { + error(" required both basedir and destfile attributes to be set"); + return false; + } return true; } + +private: + String command; + String basedir; + String destfile; }; -- 2.30.2