[gnome-builder] pipeline: check stdout/stderr before performing checks
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] pipeline: check stdout/stderr before performing checks
- Date: Sat, 25 Mar 2017 02:51:45 +0000 (UTC)
commit 0f49d2e81df1f0d29b46003e1036f53d96dc78c4
Author: Christian Hergert <chergert redhat com>
Date: Fri Mar 24 19:49:57 2017 -0700
pipeline: check stdout/stderr before performing checks
We can reduce how much work we do here by first checking which stream we
are logging to. No need to do regex checks on stdout, and no need to do
directory checks on stderr.
https://bugzilla.gnome.org/show_bug.cgi?id=780467
libide/buildsystem/ide-build-pipeline.c | 75 ++++++++++++++++--------------
1 files changed, 40 insertions(+), 35 deletions(-)
---
diff --git a/libide/buildsystem/ide-build-pipeline.c b/libide/buildsystem/ide-build-pipeline.c
index 32a8a19..763e331 100644
--- a/libide/buildsystem/ide-build-pipeline.c
+++ b/libide/buildsystem/ide-build-pipeline.c
@@ -484,52 +484,57 @@ ide_build_pipeline_log_observer (IdeBuildLogStream stream,
filtered_message = ide_build_utils_color_codes_filtering (message);
- /*
- * This expects LANG=C, which is defined in the autotools Builder.
- * Not the most ideal decoupling of logic, but we don't have a whole
- * lot to work with here.
- */
- if (NULL != (enterdir = strstr (filtered_message, ENTERING_DIRECTORY_BEGIN)) &&
- g_str_has_suffix (enterdir, ENTERING_DIRECTORY_END))
+ if (stream == IDE_BUILD_LOG_STDOUT)
{
- gssize len;
+ /*
+ * This expects LANG=C, which is defined in the autotools Builder.
+ * Not the most ideal decoupling of logic, but we don't have a whole
+ * lot to work with here.
+ */
+ if (NULL != (enterdir = strstr (filtered_message, ENTERING_DIRECTORY_BEGIN)) &&
+ g_str_has_suffix (enterdir, ENTERING_DIRECTORY_END))
+ {
+ gssize len;
- enterdir += IDE_LITERAL_LENGTH (ENTERING_DIRECTORY_BEGIN);
+ enterdir += IDE_LITERAL_LENGTH (ENTERING_DIRECTORY_BEGIN);
- /* Translate to relative paths for out-of-tree builds */
- if (g_str_has_prefix (enterdir, self->builddir))
- {
- enterdir += strlen (self->builddir);
- if (*enterdir == G_DIR_SEPARATOR)
- enterdir++;
- }
+ /* Translate to relative paths for out-of-tree builds */
+ if (g_str_has_prefix (enterdir, self->builddir))
+ {
+ enterdir += strlen (self->builddir);
+ if (*enterdir == G_DIR_SEPARATOR)
+ enterdir++;
+ }
- len = strlen (enterdir) - IDE_LITERAL_LENGTH (ENTERING_DIRECTORY_END);
+ len = strlen (enterdir) - IDE_LITERAL_LENGTH (ENTERING_DIRECTORY_END);
- if (len > 0)
- {
- g_free (self->errfmt_current_dir);
- self->errfmt_current_dir = g_strndup (enterdir, len);
- if (self->errfmt_top_dir == NULL)
- self->errfmt_top_dir = g_strndup (enterdir, len);
- }
+ if (len > 0)
+ {
+ g_free (self->errfmt_current_dir);
+ self->errfmt_current_dir = g_strndup (enterdir, len);
+ if (self->errfmt_top_dir == NULL)
+ self->errfmt_top_dir = g_strndup (enterdir, len);
+ }
- return;
+ return;
+ }
}
-
- for (guint i = 0; i < self->errfmts->len; i++)
+ else if (stream == IDE_BUILD_LOG_STDERR)
{
- const ErrorFormat *errfmt = &g_array_index (self->errfmts, ErrorFormat, i);
- g_autoptr(GMatchInfo) match_info = NULL;
-
- if (g_regex_match (errfmt->regex, filtered_message, 0, &match_info))
+ for (guint i = 0; i < self->errfmts->len; i++)
{
- g_autoptr(IdeDiagnostic) diagnostic = create_diagnostic (self, match_info);
+ const ErrorFormat *errfmt = &g_array_index (self->errfmts, ErrorFormat, i);
+ g_autoptr(GMatchInfo) match_info = NULL;
- if (diagnostic != NULL)
+ if (g_regex_match (errfmt->regex, filtered_message, 0, &match_info))
{
- ide_build_pipeline_emit_diagnostic (self, diagnostic);
- return;
+ g_autoptr(IdeDiagnostic) diagnostic = create_diagnostic (self, match_info);
+
+ if (diagnostic != NULL)
+ {
+ ide_build_pipeline_emit_diagnostic (self, diagnostic);
+ return;
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]