summaryrefslogtreecommitdiffstats
path: root/tools/atree
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2014-07-15 17:22:00 -0700
committerDeepanshu Gupta <deepanshu@google.com>2014-07-15 17:26:56 -0700
commit9c5564e060b019d154b07fca3513443039266145 (patch)
treefae23a2da098b60a1a635b0382f0ff962780a3b8 /tools/atree
parentf6771f631b814189d83b9b16cfa73d1466f932af (diff)
downloadbuild-9c5564e060b019d154b07fca3513443039266145.zip
build-9c5564e060b019d154b07fca3513443039266145.tar.gz
build-9c5564e060b019d154b07fca3513443039266145.tar.bz2
Fix incremental builds for SDK.
Atree used to output files without escaping the filenames. This resulted in breaks for incremental builds when filenames contained '$' symbol. The change fixes this by escaping the filename properly. Change-Id: I957787b1b3536c64ba6fcb5b4bb5fc60e8b04452
Diffstat (limited to 'tools/atree')
-rw-r--r--tools/atree/atree.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/atree/atree.cpp b/tools/atree/atree.cpp
index 2ba284f..b134e01 100644
--- a/tools/atree/atree.cpp
+++ b/tools/atree/atree.cpp
@@ -90,6 +90,26 @@ debug_printf(const char* format, ...)
}
}
+// Escape the filename so that it can be added to the makefile properly.
+static string
+escape_filename(const string name)
+{
+ ostringstream new_name;
+ for (string::const_iterator iter = name.begin(); iter != name.end(); ++iter)
+ {
+ switch (*iter)
+ {
+ case '$':
+ new_name << "$$";
+ break;
+ default:
+ new_name << *iter;
+ break;
+ }
+ }
+ return new_name.str();
+}
+
int
main(int argc, char* const* argv)
{
@@ -324,7 +344,8 @@ main(int argc, char* const* argv)
for (vector<FileRecord>::iterator it=files.begin();
it!=files.end(); it++) {
if (!it->sourceIsDir) {
- fprintf(f, "%s \\\n", it->sourcePath.c_str());
+ fprintf(f, "%s \\\n",
+ escape_filename(it->sourcePath).c_str());
}
}
fprintf(f, "\n");