summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c260721)
raw | patch | inline | side by side (parent: c260721)
author | ishmal <ishmal@users.sourceforge.net> | |
Sat, 3 Mar 2007 19:23:27 +0000 (19:23 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Sat, 3 Mar 2007 19:23:27 +0000 (19:23 +0000) |
build.xml | patch | blob | history | |
buildtool.cpp | patch | blob | history |
diff --git a/build.xml b/build.xml
index 30c9549ef09a72b1a85d9a366c66eff5e105becd..843b24c46af247362662aa141b7242417d5da68c 100644 (file)
--- a/build.xml
+++ b/build.xml
+ <!--
+ ########################################################################
+ ## T A R G E T : T O U C H A B O U T
+ ########################################################################
+ -->
+ <target name="touchabout"
+ description="update the modification time of aboutdialog.cpp">
+ <touch file="${src}/ui/dialog/aboutdialog.cpp"/>
+ </target>
<!--
diff --git a/buildtool.cpp b/buildtool.cpp
index 5a53f745a97ed3f17d8bb7a4b2f051cd47b665eb..34d801c5776bd0a073b233a8ff29d9e851ef2e7b 100644 (file)
--- a/buildtool.cpp
+++ b/buildtool.cpp
*
*/
-#define BUILDTOOL_VERSION "BuildTool v0.6.2, 2007 Bob Jamison"
+#define BUILDTOOL_VERSION "BuildTool v0.6.3, 2007 Bob Jamison"
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <time.h>
#include <sys/time.h>
+#include <utime.h>
#include <dirent.h>
#include <string>
return n;
}
-
-
//########################################################################
//########################################################################
//## E N D X M L
//########################################################################
+
+
+
+
//########################################################################
//########################################################################
//## U R I
}
+
/**
* This follows the Java URI algorithm:
* 1. All "." segments are removed.
+
//#########################################################################
//# P A R S I N G
//#########################################################################
{
//trace("## stderr");
DWORD avail;
- if (!PeekNamedPipe(stderrRead, NULL, 0, NULL, &avail, NULL))
- break;
+ PeekNamedPipe(stderrRead, NULL, 0, NULL, &avail, NULL);
if (avail > 0)
{
DWORD bytesRead = 0;
char readBuf[1025];
if (avail>1024) avail = 1024;
- if (!ReadFile(stderrRead, readBuf, avail, &bytesRead, NULL)
- || bytesRead == 0)
+ ReadFile(stderrRead, readBuf, avail, &bytesRead, NULL);
+ if (bytesRead > 0)
{
- break;
+ for (unsigned int i=0 ; i<bytesRead ; i++)
+ errbuf.push_back(readBuf[i]);
}
- for (unsigned int i=0 ; i<bytesRead ; i++)
- errbuf.push_back(readBuf[i]);
}
- }
- while (true)
- {
+
//trace("## stdout");
- DWORD avail;
- if (!PeekNamedPipe(stdoutRead, NULL, 0, NULL, &avail, NULL))
- break;
+ PeekNamedPipe(stdoutRead, NULL, 0, NULL, &avail, NULL);
if (avail > 0)
{
DWORD bytesRead = 0;
char readBuf[1025];
if (avail>1024) avail = 1024;
- if (!ReadFile(stdoutRead, readBuf, avail, &bytesRead, NULL)
- || bytesRead==0)
+ ReadFile(stdoutRead, readBuf, avail, &bytesRead, NULL);
+ if (bytesRead > 0)
{
- break;
+ for (unsigned int i=0 ; i<bytesRead ; i++)
+ outbuf.push_back(readBuf[i]);
}
- for (unsigned int i=0 ; i<bytesRead ; i++)
- outbuf.push_back(readBuf[i]);
}
DWORD exitCode;
GetExitCodeProcess(piProcessInfo.hProcess, &exitCode);
TASK_SHAREDLIB,
TASK_STATICLIB,
TASK_STRIP,
+ TASK_TOUCH,
TASK_TSTAMP
} TaskType;
};
+
/**
* Run the "ar" command to archive .o's into a .a
*/
return true;
}
+
virtual bool parse(Element *elem)
{
String s;
};
+
+
/**
* Strip an executable
*/
};
+/**
+ *
+ */
+class TaskTouch : public Task
+{
+public:
+
+ TaskTouch(MakeBase &par) : Task(par)
+ { type = TASK_TOUCH; name = "touch"; }
+
+ virtual ~TaskTouch()
+ {}
+
+ virtual bool execute()
+ {
+ String fullName = parent.resolve(fileName);
+ String nativeFile = getNativePath(fullName);
+ if (!isRegularFile(fullName) && !isDirectory(fullName))
+ {
+ // S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH
+ int ret = creat(nativeFile.c_str(), 0666);
+ if (ret != 0)
+ {
+ error("<touch> could not create '%s' : %s",
+ nativeFile.c_str(), strerror(ret));
+ return false;
+ }
+ return true;
+ }
+ int ret = utime(nativeFile.c_str(), (struct utimbuf *)0);
+ if (ret != 0)
+ {
+ error("<touch> could not update the modification time for '%s' : %s",
+ nativeFile.c_str(), strerror(ret));
+ return false;
+ }
+ return true;
+ }
+
+ virtual bool parse(Element *elem)
+ {
+ //trace("touch parse");
+ if (!parent.getAttribute(elem, "file", fileName))
+ return false;
+ if (fileName.size() == 0)
+ {
+ error("<touch> requires 'file=\"fileName\"' attribute");
+ return false;
+ }
+ return true;
+ }
+
+ String fileName;
+};
+
+
/**
*
*/
task = new TaskStaticLib(parent);
else if (tagName == "strip")
task = new TaskStrip(parent);
+ else if (tagName == "touch")
+ task = new TaskTouch(parent);
else if (tagName == "tstamp")
task = new TaskTstamp(parent);
else