summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5ef7a75)
raw | patch | inline | side by side (parent: 5ef7a75)
author | ishmal <ishmal@users.sourceforge.net> | |
Fri, 4 Apr 2008 15:42:56 +0000 (15:42 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Fri, 4 Apr 2008 15:42:56 +0000 (15:42 +0000) |
build.xml | patch | blob | history | |
buildtool.cpp | patch | blob | history |
diff --git a/build.xml b/build.xml
index 1014fc36e1bf9ab94518c49fc93c8490e1546d9f..432fcdd38241ab6b491369caa00af437105fe98f 100644 (file)
--- a/build.xml
+++ b/build.xml
<exclude name="removeoverlap/remove_rectangle_overlap-test.cpp"/>
<exclude name="removeoverlap/remove_rectangle_overlap-test.h"/>
</fileset>
+ <excludeinc dir="${src}">
+ <file name="extension/param"/>
+ </excludeinc>
<flags>
-Wall -Wformat-security -W -Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch
-O2
diff --git a/buildtool.cpp b/buildtool.cpp
index f912ebdeaf23d262c7b4cde3c4213218defdd49b..edf73826993c2e24209e9c13509f8fe4c448d906 100644 (file)
--- a/buildtool.cpp
+++ b/buildtool.cpp
*
*/
-#define BUILDTOOL_VERSION "BuildTool v0.7.7, 2007-2008 Bob Jamison"
+#define BUILDTOOL_VERSION "BuildTool v0.8, 2007-2008 Bob Jamison"
#include <stdio.h>
#include <fcntl.h>
};
+//########################################################################
+//# F I L E L I S T
+//########################################################################
+/**
+ * This is a simpler, explicitly-named list of files
+ */
+class FileList
+{
+public:
+
+ /**
+ *
+ */
+ FileList()
+ {}
+
+ /**
+ *
+ */
+ FileList(const FileList &other)
+ { assign(other); }
+
+ /**
+ *
+ */
+ FileList &operator=(const FileList &other)
+ { assign(other); return *this; }
+
+ /**
+ *
+ */
+ virtual ~FileList()
+ {}
+
+ /**
+ *
+ */
+ String getDirectory()
+ { return directory; }
+
+ /**
+ *
+ */
+ void setDirectory(const String &val)
+ { directory = val; }
+
+ /**
+ *
+ */
+ void setFiles(const std::vector<String> &val)
+ { files = val; }
+
+ /**
+ *
+ */
+ std::vector<String> getFiles()
+ { return files; }
+
+ /**
+ *
+ */
+ unsigned int size()
+ { return files.size(); }
+
+ /**
+ *
+ */
+ String operator[](int index)
+ { return files[index]; }
+
+ /**
+ *
+ */
+ void clear()
+ {
+ directory = "";
+ files.clear();
+ }
+
+
+private:
+
+ void assign(const FileList &other)
+ {
+ directory = other.directory;
+ files = other.files;
+ }
+
+ String directory;
+ std::vector<String> files;
+};
+
+
//########################################################################
bool parseFileSet(Element *elem,
MakeBase &propRef,
FileSet &fileSet);
+ /**
+ * Parse a <filelist> entry
+ */
+ bool parseFileList(Element *elem,
+ MakeBase &propRef,
+ FileList &fileList);
/**
* Return this object's property list
return true;
}
+/**
+ * Parse a <filelist> entry. This is far simpler than FileSet,
+ * since no directory scanning is needed. The file names are listed
+ * explicitly.
+ */
+bool MakeBase::parseFileList(Element *elem,
+ MakeBase &propRef,
+ FileList &fileList)
+{
+ std::vector<String> fnames;
+ //Look for child tags, namely "file"
+ std::vector<Element *> children = elem->getChildren();
+ for (unsigned int i=0 ; i<children.size() ; i++)
+ {
+ Element *child = children[i];
+ String tagName = child->getName();
+ if (tagName == "file")
+ {
+ String fname = child->getAttribute("name");
+ if (fname.size()==0)
+ {
+ error("<file> element requires name="" attribute");
+ return false;
+ }
+ fnames.push_back(fname);
+ }
+ else
+ {
+ error("tag <%s> not allowed in <fileset>", tagName.c_str());
+ return false;
+ }
+ }
+
+ String dir;
+ //Get the base directory for reading file names
+ if (!propRef.getAttribute(elem, "dir", dir))
+ return false;
+ fileList.setDirectory(dir);
+ fileList.setFiles(fnames);
+
+ return true;
+}
+
/**
defines = "";
includes = "";
fileSet.clear();
+ excludeInc.clear();
}
virtual ~TaskCC()
{}
- virtual bool needsCompiling(const FileRec &depRec,
- const String &src, const String &dest)
+ virtual bool isExcludedInc(const String &dirname)
{
+ for (unsigned int i=0 ; i<excludeInc.size() ; i++)
+ {
+ String fname = excludeInc[i];
+ if (fname == dirname)
+ return true;
+ }
return false;
- }
+ }
virtual bool execute()
{
std::set<String>::iterator setIter;
for (setIter=paths.begin() ; setIter!=paths.end() ; setIter++)
{
+ String dirName = *setIter;
+ //check excludeInc to see if we dont want to include this dir
+ if (isExcludedInc(dirName))
+ continue;
incs.append(" -I");
String dname;
if (source.size()>0)
dname.append(source);
dname.append("/");
}
- dname.append(*setIter);
+ dname.append(dirName);
incs.append(parent.resolve(dname));
}
std::vector<String> cfiles;
return false;
source = fileSet.getDirectory();
}
+ else if (tagName == "excludeinc")
+ {
+ if (!parseFileList(child, parent, excludeInc))
+ return false;
+ }
}
return true;
protected:
- String ccCommand;
- String cxxCommand;
- String source;
- String dest;
- String flags;
- String defines;
- String includes;
- FileSet fileSet;
+ String ccCommand;
+ String cxxCommand;
+ String source;
+ String dest;
+ String flags;
+ String lastflags;
+ String defines;
+ String includes;
+ FileSet fileSet;
+ FileList excludeInc;
};