Skip to content

Commit

Permalink
Merge pull request #326 from deplinenoise/annotation-output
Browse files Browse the repository at this point in the history
Hush annotations when --quiet is used
  • Loading branch information
deplinenoise authored May 7, 2020
2 parents 2cddb3d + 071ae01 commit 3384818
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/BuildQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ namespace t2
StatCache *stat_cache = queue->m_Config.m_StatCache;
const char *annotation = node_data->m_Annotation;
int job_id = thread_state->m_ThreadIndex;
int echo_annotations = 0 != (queue->m_Config.m_Flags & BuildQueueConfig::kFlagEchoAnnotations);
int echo_cmdline = 0 != (queue->m_Config.m_Flags & BuildQueueConfig::kFlagEchoCommandLines);

// Repack frozen env to pointers on the stack.
Expand Down Expand Up @@ -455,7 +456,7 @@ namespace t2
Log(kSpam, "Launching pre-action process");
TimingScope timing_scope(&g_Stats.m_ExecCount, &g_Stats.m_ExecTimeCycles);
ProfilerScope prof_scope("Pre-build", job_id);
result = ExecuteProcess(pre_cmd_line, env_count, env_vars, job_id, echo_cmdline, "(pre-build command)");
result = ExecuteProcess(pre_cmd_line, env_count, env_vars, job_id, echo_cmdline, echo_annotations ? "(pre-build command)" : nullptr);
Log(kSpam, "Process return code %d", result.m_ReturnCode);
}

Expand All @@ -464,7 +465,7 @@ namespace t2
Log(kSpam, "Launching process");
TimingScope timing_scope(&g_Stats.m_ExecCount, &g_Stats.m_ExecTimeCycles);
ProfilerScope prof_scope(annotation, job_id);
result = ExecuteProcess(cmd_line, env_count, env_vars, job_id, echo_cmdline, annotation);
result = ExecuteProcess(cmd_line, env_count, env_vars, job_id, echo_cmdline, echo_annotations ? annotation : nullptr);
Log(kSpam, "Process return code %d", result.m_ReturnCode);
}

Expand Down
3 changes: 2 additions & 1 deletion src/ExecWin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ static void FreeFd(int job_id, HANDLE h)
{ ".cpp\r\n", 6 },
{ ".c++\r\n", 6 },
{ ".c\r\n", 4 },
{ ".CC\r\n", 5 }
{ ".CC\r\n", 5 },
{ ".cc\r\n", 5 }
};

int ext_index = -1;
Expand Down
25 changes: 14 additions & 11 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,18 +520,21 @@ int main(int argc, char* argv[])
printf(" stat() time: %10.2f ms\n", TimerToSeconds(g_Stats.m_StatTimeCycles) * 1000.0);
}

double total_time = TimerDiffSeconds(start_time, TimerGet());
if (total_time < 60.0)
if (!options.m_Quiet)
{
printf("*** %s (%.2f seconds)\n", BuildResult::Names[build_result], total_time);
}
else
{
int t = (int) total_time;
int h = t / 3600; t -= h * 3600;
int m = t / 60; t -= m * 60;
int s = t;
printf("*** %s (%.2f seconds - %d:%02d:%02d)\n", BuildResult::Names[build_result], total_time, h, m, s);
double total_time = TimerDiffSeconds(start_time, TimerGet());
if (total_time < 60.0)
{
printf("*** %s (%.2f seconds)\n", BuildResult::Names[build_result], total_time);
}
else
{
int t = (int)total_time;
int h = t / 3600; t -= h * 3600;
int m = t / 60; t -= m * 60;
int s = t;
printf("*** %s (%.2f seconds - %d:%02d:%02d)\n", BuildResult::Names[build_result], total_time, h, m, s);
}
}

return build_result == BuildResult::kOk ? 0 : 1;
Expand Down

0 comments on commit 3384818

Please sign in to comment.