aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-09-21 07:53:31 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-09-21 07:53:31 +0000
commita26404a1a6d7ea9644f967321628b6637d43b24e (patch)
treea762d85e42d042acf8682366a2f9741fa1eb92b9
parent5ce8829c2a79f7222e1886374ffb4b5616f231ab (diff)
parent09ad1f21aedf5dbf4e5e3c1cdba23e78a56f47a4 (diff)
Merge remote-tracking branch 'aosp/upstream' into master am: 38315d2f21 am: 56fa7f0d2c
am: 09ad1f21ae Change-Id: Ibf044ca94fa6b5a1a4ad1c3e962f0e4f53e908ce
-rw-r--r--find.cc16
-rw-r--r--find.h2
-rw-r--r--flags.cc3
-rw-r--r--flags.h1
-rw-r--r--func.cc4
-rw-r--r--ninja.cc3
-rw-r--r--regen.cc10
-rw-r--r--strutil.cc2
-rw-r--r--testcase/phony.mk3
9 files changed, 25 insertions, 19 deletions
diff --git a/find.cc b/find.cc
index 71cc77c..2539212 100644
--- a/find.cc
+++ b/find.cc
@@ -585,7 +585,7 @@ class FindCommandParser {
} else if (tok.find_first_of("|;&><*'\"") != string::npos) {
return false;
} else {
- fc_->finddirs.push_back(tok);
+ fc_->finddirs.push_back(tok.as_string());
}
}
}
@@ -594,7 +594,7 @@ class FindCommandParser {
fc_->type = FindCommandType::FINDLEAVES;
fc_->follows_symlinks = true;
StringPiece tok;
- vector<StringPiece> findfiles;
+ vector<string> findfiles;
while (true) {
if (!GetNextToken(&tok))
return false;
@@ -604,13 +604,13 @@ class FindCommandParser {
if (findfiles.size() < 2)
return false;
fc_->finddirs.swap(findfiles);
- fc_->print_cond.reset(new NameCond(fc_->finddirs.back().as_string()));
+ fc_->print_cond.reset(new NameCond(fc_->finddirs.back()));
fc_->finddirs.pop_back();
} else {
if (findfiles.size() < 1)
return false;
for (auto& file : findfiles) {
- FindCond* cond = new NameCond(file.as_string());
+ FindCond* cond = new NameCond(file);
if (fc_->print_cond.get()) {
cond = new OrCond(fc_->print_cond.release(), cond);
}
@@ -640,12 +640,12 @@ class FindCommandParser {
fc_->mindepth = d;
} else if (HasPrefix(tok, "--dir=")) {
StringPiece dir= tok.substr(strlen("--dir="));
- fc_->finddirs.push_back(dir);
+ fc_->finddirs.push_back(dir.as_string());
} else if (HasPrefix(tok, "--")) {
WARN("Unknown flag in findleaves.py: %.*s", SPF(tok));
return false;
} else {
- findfiles.push_back(tok);
+ findfiles.push_back(tok.as_string());
}
}
}
@@ -788,7 +788,7 @@ class FindEmulatorImpl : public FindEmulator {
}
const size_t orig_out_size = out->size();
- for (StringPiece finddir : fc.finddirs) {
+ for (const string& finddir : fc.finddirs) {
const string dir = ConcatDir(fc.chdir, finddir);
if (!CanHandle(dir)) {
@@ -813,7 +813,7 @@ class FindEmulatorImpl : public FindEmulator {
continue;
}
- string path = finddir.as_string();
+ string path = finddir;
unordered_map<const DirentNode*, string> cur_read_dirs;
if (!base->RunFind(fc, 0, &path, &cur_read_dirs, out)) {
LOG("FindEmulator: RunFind failed: %s", cmd.c_str());
diff --git a/find.h b/find.h
index ccd50e0..ab92e67 100644
--- a/find.h
+++ b/find.h
@@ -41,7 +41,7 @@ struct FindCommand {
FindCommandType type;
string chdir;
string testdir;
- vector<StringPiece> finddirs;
+ vector<string> finddirs;
bool follows_symlinks;
unique_ptr<FindCond> print_cond;
unique_ptr<FindCond> prune_cond;
diff --git a/flags.cc b/flags.cc
index 1ed9afd..3ad8e3c 100644
--- a/flags.cc
+++ b/flags.cc
@@ -86,10 +86,13 @@ void Flags::Parse(int argc, char** argv) {
} else if (!strcmp(arg, "--regen")) {
// TODO: Make this default.
regen = true;
+ } else if (!strcmp(arg, "--regen_debug")) {
+ regen_debug = true;
} else if (!strcmp(arg, "--regen_ignoring_kati_binary")) {
regen_ignoring_kati_binary = true;
} else if (!strcmp(arg, "--dump_kati_stamp")) {
dump_kati_stamp = true;
+ regen_debug = true;
} else if (!strcmp(arg, "--detect_android_echo")) {
detect_android_echo = true;
} else if (!strcmp(arg, "--detect_depfiles")) {
diff --git a/flags.h b/flags.h
index a0c6a3b..d22d0cd 100644
--- a/flags.h
+++ b/flags.h
@@ -36,6 +36,7 @@ struct Flags {
bool is_silent_mode;
bool is_syntax_check_only;
bool regen;
+ bool regen_debug;
bool regen_ignoring_kati_binary;
bool use_find_emulator;
const char* goma_dir;
diff --git a/func.cc b/func.cc
index 9aaa9a2..623e56e 100644
--- a/func.cc
+++ b/func.cc
@@ -533,7 +533,9 @@ static void ShellFuncImpl(const string& shell, const string& cmd,
static vector<CommandResult*> g_command_results;
bool ShouldStoreCommandResult(StringPiece cmd) {
- if (HasWord(cmd, "date") || HasWord(cmd, "echo"))
+ // We really just want to ignore this one, or remove BUILD_DATETIME from
+ // Android completely
+ if (cmd == "date +%s")
return false;
Pattern pat(g_flags.ignore_dirty_pattern);
diff --git a/ninja.cc b/ninja.cc
index acf5293..90fe404 100644
--- a/ninja.cc
+++ b/ninja.cc
@@ -483,6 +483,9 @@ class NinjaGenerator {
string rule_name = "phony";
bool use_local_pool = false;
+ if (node->output.get(0) == '.') {
+ return;
+ }
if (g_flags.enable_debug) {
*o << "# " << (node->loc.filename ? node->loc.filename : "(null)")
<< ':' << node->loc.lineno << "\n";
diff --git a/regen.cc b/regen.cc
index c72bfb6..f5ed50a 100644
--- a/regen.cc
+++ b/regen.cc
@@ -132,7 +132,7 @@ class StampChecker {
const string& stamp_filename = GetNinjaStampFilename();
FILE* fp = fopen(stamp_filename.c_str(), "rb");
if (!fp) {
- if (g_flags.dump_kati_stamp)
+ if (g_flags.regen_debug)
printf("%s: %s\n", stamp_filename.c_str(), strerror(errno));
return true;
}
@@ -145,7 +145,7 @@ class StampChecker {
fprintf(stderr, "incomplete kati_stamp, regenerating...\n");
RETURN_TRUE;
}
- if (g_flags.dump_kati_stamp)
+ if (g_flags.regen_debug)
printf("Generated time: %f\n", gen_time);
string s, s2;
@@ -163,7 +163,7 @@ class StampChecker {
}
}
if (ShouldIgnoreDirty(s)) {
- if (g_flags.dump_kati_stamp)
+ if (g_flags.regen_debug)
printf("file %s: ignored (%f)\n", s.c_str(), ts);
continue;
}
@@ -325,7 +325,7 @@ class StampChecker {
bool CheckShellResult(const ShellResult* sr, string* err) {
if (!ShouldRunCommand(sr)) {
- if (g_flags.dump_kati_stamp)
+ if (g_flags.regen_debug)
printf("shell %s: clean (no rerun)\n", sr->cmd.c_str());
return false;
}
@@ -351,7 +351,7 @@ class StampChecker {
//*err += StringPrintf("%s => %s\n", expected.c_str(), result.c_str());
}
return true;
- } else if (g_flags.dump_kati_stamp) {
+ } else if (g_flags.regen_debug) {
printf("shell %s: clean (rerun)\n", sr->cmd.c_str());
}
return false;
diff --git a/strutil.cc b/strutil.cc
index 8f7ff06..1b99dff 100644
--- a/strutil.cc
+++ b/strutil.cc
@@ -57,7 +57,7 @@ static int SkipUntilSSE42(const char* s, int len,
template <typename Cond>
static int SkipUntil(const char* s, int len,
- const char* ranges, int ranges_size,
+ const char* ranges UNUSED, int ranges_size UNUSED,
Cond cond) {
int i = 0;
#ifdef __SSE4_2__
diff --git a/testcase/phony.mk b/testcase/phony.mk
index 59fb911..64a67bb 100644
--- a/testcase/phony.mk
+++ b/testcase/phony.mk
@@ -11,9 +11,6 @@ baz: foo
test1: foo bar baz
echo PASS test1 from foo bar baz
-# Actually, you can use .PHONY!
-test2: .PHONY
-
test3:
touch test4