mirror of
https://github.com/reactos/ninja.git
synced 2025-03-04 09:18:44 +00:00
wrap some overlong lines
This commit is contained in:
parent
7d41c2f521
commit
3249938cdf
@ -171,7 +171,9 @@ else:
|
||||
libs.append('-lprofiler')
|
||||
|
||||
def shell_escape(str):
|
||||
"""Escape str such that it's interpreted as a single argument by the shell."""
|
||||
"""Escape str such that it's interpreted as a single argument by
|
||||
the shell."""
|
||||
|
||||
# This isn't complete, but it's just enough to make NINJA_PYTHON work.
|
||||
if platform in ('windows', 'mingw'):
|
||||
return str
|
||||
|
12
src/build.cc
12
src/build.cc
@ -482,8 +482,9 @@ void Plan::CleanNode(DependencyScan* scan, Node* node) {
|
||||
|
||||
// If all non-order-only inputs for this edge are now clean,
|
||||
// we might have changed the dirty state of the outputs.
|
||||
vector<Node*>::iterator begin = (*ei)->inputs_.begin(),
|
||||
end = (*ei)->inputs_.end() - (*ei)->order_only_deps_;
|
||||
vector<Node*>::iterator
|
||||
begin = (*ei)->inputs_.begin(),
|
||||
end = (*ei)->inputs_.end() - (*ei)->order_only_deps_;
|
||||
if (find_if(begin, end, mem_fun(&Node::dirty)) == end) {
|
||||
// Recompute most_recent_input and command.
|
||||
Node* most_recent_input = NULL;
|
||||
@ -771,8 +772,10 @@ bool Builder::StartEdge(Edge* edge, string* err) {
|
||||
// Create response file, if needed
|
||||
// XXX: this may also block; do we care?
|
||||
if (edge->HasRspFile()) {
|
||||
if (!disk_interface_->WriteFile(edge->GetRspFile(), edge->GetRspFileContent()))
|
||||
if (!disk_interface_->WriteFile(edge->GetRspFile(),
|
||||
edge->GetRspFileContent())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// start command computing and run it
|
||||
@ -815,7 +818,8 @@ void Builder::FinishEdge(Edge* edge, bool success, const string& output) {
|
||||
}
|
||||
|
||||
if (restat_mtime != 0 && !edge->rule().depfile().empty()) {
|
||||
TimeStamp depfile_mtime = disk_interface_->Stat(edge->EvaluateDepFile());
|
||||
TimeStamp depfile_mtime =
|
||||
disk_interface_->Stat(edge->EvaluateDepFile());
|
||||
if (depfile_mtime > restat_mtime)
|
||||
restat_mtime = depfile_mtime;
|
||||
}
|
||||
|
@ -62,7 +62,8 @@ struct BuildLog {
|
||||
}
|
||||
|
||||
explicit LogEntry(const string& output);
|
||||
LogEntry(const string& output, uint64_t command_hash, int start_time, int end_time, TimeStamp restat_mtime);
|
||||
LogEntry(const string& output, uint64_t command_hash,
|
||||
int start_time, int end_time, TimeStamp restat_mtime);
|
||||
};
|
||||
|
||||
/// Lookup a previously-run command by its output path.
|
||||
|
@ -147,7 +147,8 @@ TEST_F(BuildLogTest, Truncate) {
|
||||
ASSERT_EQ(0, truncate(kTestFilename, size));
|
||||
#else
|
||||
int fh;
|
||||
fh = _sopen(kTestFilename, _O_RDWR | _O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE);
|
||||
fh = _sopen(kTestFilename, _O_RDWR | _O_CREAT, _SH_DENYNO,
|
||||
_S_IREAD | _S_IWRITE);
|
||||
ASSERT_EQ(0, _chsize(fh, size));
|
||||
_close(fh);
|
||||
#endif
|
||||
|
@ -573,10 +573,12 @@ TEST_F(BuildTest, MakeDirs) {
|
||||
string err;
|
||||
|
||||
#ifdef _WIN32
|
||||
ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build subdir\\dir2\\file: cat in1\n"));
|
||||
ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
|
||||
"build subdir\\dir2\\file: cat in1\n"));
|
||||
EXPECT_TRUE(builder_.AddTarget("subdir\\dir2\\file", &err));
|
||||
#else
|
||||
ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build subdir/dir2/file: cat in1\n"));
|
||||
ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
|
||||
"build subdir/dir2/file: cat in1\n"));
|
||||
EXPECT_TRUE(builder_.AddTarget("subdir/dir2/file", &err));
|
||||
#endif
|
||||
|
||||
|
@ -80,7 +80,8 @@ TimeStamp RealDiskInterface::Stat(const string& path) {
|
||||
// MSDN: "Naming Files, Paths, and Namespaces"
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
|
||||
if (!path.empty() && path[0] != '\\' && path.size() > MAX_PATH) {
|
||||
Error("Stat(%s): Filename longer than %i characters", path.c_str(), MAX_PATH);
|
||||
Error("Stat(%s): Filename longer than %i characters",
|
||||
path.c_str(), MAX_PATH);
|
||||
return -1;
|
||||
}
|
||||
WIN32_FILE_ATTRIBUTE_DATA attrs;
|
||||
@ -116,18 +117,21 @@ TimeStamp RealDiskInterface::Stat(const string& path) {
|
||||
bool RealDiskInterface::WriteFile(const string& path, const string& contents) {
|
||||
FILE * fp = fopen(path.c_str(), "w");
|
||||
if (fp == NULL) {
|
||||
Error("WriteFile(%s): Unable to create file. %s", path.c_str(), strerror(errno));
|
||||
Error("WriteFile(%s): Unable to create file. %s",
|
||||
path.c_str(), strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fwrite(contents.data(), 1, contents.length(), fp) < contents.length()) {
|
||||
Error("WriteFile(%s): Unable to write to the file. %s", path.c_str(), strerror(errno));
|
||||
Error("WriteFile(%s): Unable to write to the file. %s",
|
||||
path.c_str(), strerror(errno));
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fclose(fp) == EOF) {
|
||||
Error("WriteFile(%s): Unable to close the file. %s", path.c_str(), strerror(errno));
|
||||
Error("WriteFile(%s): Unable to close the file. %s",
|
||||
path.c_str(), strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -145,9 +145,10 @@ bool DependencyScan::RecomputeOutputDirty(Edge* edge,
|
||||
if (edge->rule_->restat() && build_log() &&
|
||||
(entry = build_log()->LookupByOutput(output->path()))) {
|
||||
if (entry->restat_mtime < most_recent_stamp) {
|
||||
EXPLAIN("restat of output %s older than most recent input %s (%d vs %d)",
|
||||
output->path().c_str(), most_recent_input->path().c_str(),
|
||||
entry->restat_mtime, most_recent_stamp);
|
||||
EXPLAIN("restat of output %s older than most recent input %s "
|
||||
"(%d vs %d)",
|
||||
output->path().c_str(), most_recent_input->path().c_str(),
|
||||
entry->restat_mtime, most_recent_stamp);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
@ -152,7 +152,7 @@ struct Edge {
|
||||
/// Expand all variables in a command and return it as a string.
|
||||
/// If incl_rsp_file is enabled, the string will also contain the
|
||||
/// full contents of a response file (if applicable)
|
||||
string EvaluateCommand(bool incl_rsp_file = false); // XXX move to env, take env ptr
|
||||
string EvaluateCommand(bool incl_rsp_file = false);
|
||||
string EvaluateDepFile();
|
||||
string GetDescription();
|
||||
|
||||
|
@ -40,7 +40,8 @@ string GetCurDir() {
|
||||
TEST(IncludesNormalize, WithRelative) {
|
||||
string currentdir = IncludesNormalize::ToLower(GetCurDir());
|
||||
EXPECT_EQ("c", IncludesNormalize::Normalize("a/b/c", "a/b"));
|
||||
EXPECT_EQ("a", IncludesNormalize::Normalize(IncludesNormalize::AbsPath("a"), NULL));
|
||||
EXPECT_EQ("a", IncludesNormalize::Normalize(IncludesNormalize::AbsPath("a"),
|
||||
NULL));
|
||||
EXPECT_EQ(string("..\\") + currentdir + string("\\a"),
|
||||
IncludesNormalize::Normalize("a", "../b"));
|
||||
EXPECT_EQ(string("..\\") + currentdir + string("\\a\\b"),
|
||||
@ -69,16 +70,21 @@ TEST(IncludesNormalize, Join) {
|
||||
}
|
||||
|
||||
TEST(IncludesNormalize, Split) {
|
||||
EXPECT_EQ("", IncludesNormalize::Join(IncludesNormalize::Split("", '/'), ':'));
|
||||
EXPECT_EQ("a", IncludesNormalize::Join(IncludesNormalize::Split("a", '/'), ':'));
|
||||
EXPECT_EQ("a:b:c", IncludesNormalize::Join(IncludesNormalize::Split("a/b/c", '/'), ':'));
|
||||
EXPECT_EQ("", IncludesNormalize::Join(IncludesNormalize::Split("", '/'),
|
||||
':'));
|
||||
EXPECT_EQ("a", IncludesNormalize::Join(IncludesNormalize::Split("a", '/'),
|
||||
':'));
|
||||
EXPECT_EQ("a:b:c",
|
||||
IncludesNormalize::Join(
|
||||
IncludesNormalize::Split("a/b/c", '/'), ':'));
|
||||
}
|
||||
|
||||
TEST(IncludesNormalize, ToLower) {
|
||||
EXPECT_EQ("", IncludesNormalize::ToLower(""));
|
||||
EXPECT_EQ("stuff", IncludesNormalize::ToLower("Stuff"));
|
||||
EXPECT_EQ("stuff and things", IncludesNormalize::ToLower("Stuff AND thINGS"));
|
||||
EXPECT_EQ("stuff 3and thin43gs", IncludesNormalize::ToLower("Stuff 3AND thIN43GS"));
|
||||
EXPECT_EQ("stuff 3and thin43gs",
|
||||
IncludesNormalize::ToLower("Stuff 3AND thIN43GS"));
|
||||
}
|
||||
|
||||
TEST(IncludesNormalize, DifferentDrive) {
|
||||
|
@ -177,8 +177,10 @@ bool ManifestParser::ParseRule(string* err) {
|
||||
}
|
||||
}
|
||||
|
||||
if (rule->rspfile_.empty() != rule->rspfile_content_.empty())
|
||||
return lexer_.Error("rspfile and rspfile_content need to be both specified", err);
|
||||
if (rule->rspfile_.empty() != rule->rspfile_content_.empty()) {
|
||||
return lexer_.Error("rspfile and rspfile_content need to be both specified",
|
||||
err);
|
||||
}
|
||||
|
||||
if (rule->command_.empty())
|
||||
return lexer_.Error("expected 'command =' line", err);
|
||||
|
@ -101,14 +101,17 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) {
|
||||
NULL, NULL,
|
||||
&startup_info, &process_info)) {
|
||||
DWORD error = GetLastError();
|
||||
if (error == ERROR_FILE_NOT_FOUND) { // file (program) not found error is treated as a normal build action failure
|
||||
if (error == ERROR_FILE_NOT_FOUND) {
|
||||
// File (program) not found error is treated as a normal build
|
||||
// action failure.
|
||||
if (child_pipe)
|
||||
CloseHandle(child_pipe);
|
||||
CloseHandle(pipe_);
|
||||
CloseHandle(nul);
|
||||
pipe_ = NULL;
|
||||
// child_ is already NULL;
|
||||
buf_ = "CreateProcess failed: The system cannot find the file specified.\n";
|
||||
buf_ = "CreateProcess failed: The system cannot find the file "
|
||||
"specified.\n";
|
||||
return true;
|
||||
} else {
|
||||
Win32Fatal("CreateProcess"); // pass all other errors to Win32Fatal
|
||||
|
@ -64,7 +64,8 @@ TEST_F(SubprocessTest, NoSuchCommand) {
|
||||
EXPECT_EQ(ExitFailure, subproc->Finish());
|
||||
EXPECT_NE("", subproc->GetOutput());
|
||||
#ifdef _WIN32
|
||||
ASSERT_EQ("CreateProcess failed: The system cannot find the file specified.\n", subproc->GetOutput());
|
||||
ASSERT_EQ("CreateProcess failed: The system cannot find the file "
|
||||
"specified.\n", subproc->GetOutput());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,8 @@ void SetCloseOnExec(int fd);
|
||||
|
||||
/// Given a misspelled string and a list of correct spellings, returns
|
||||
/// the closest match or NULL if there is no close enough match.
|
||||
const char* SpellcheckStringV(const string& text, const vector<const char*>& words);
|
||||
const char* SpellcheckStringV(const string& text,
|
||||
const vector<const char*>& words);
|
||||
|
||||
/// Like SpellcheckStringV, but takes a NULL-terminated list.
|
||||
const char* SpellcheckString(const string& text, ...);
|
||||
|
Loading…
x
Reference in New Issue
Block a user