builder: Pass down keep-build-dirs via BuildContext

tingping/wmclass
Alexander Larsson 2016-01-11 10:29:44 +01:00
parent 825611a758
commit 5896b5ae08
7 changed files with 22 additions and 7 deletions

View File

@ -43,6 +43,7 @@ struct BuilderContext {
GFile *cache_dir;
BuilderOptions *options;
gboolean keep_build_dirs;
};
typedef struct {
@ -253,6 +254,19 @@ builder_context_get_n_cpu (BuilderContext *self)
return (int)sysconf (_SC_NPROCESSORS_ONLN);
}
void
builder_context_set_keep_build_dirs (BuilderContext *self,
gboolean keep_build_dirs)
{
self->keep_build_dirs = keep_build_dirs;
}
gboolean
builder_context_get_keep_build_dirs (BuilderContext *self)
{
return self->keep_build_dirs;
}
BuilderContext *
builder_context_new (GFile *base_dir,
GFile *app_dir)

View File

@ -45,6 +45,9 @@ const char * builder_context_get_arch (BuilderContext *self);
void builder_context_set_arch (BuilderContext *self,
const char *arch);
int builder_context_get_n_cpu (BuilderContext *self);
void builder_context_set_keep_build_dirs (BuilderContext *self,
gboolean keep_build_dirs);
gboolean builder_context_get_keep_build_dirs (BuilderContext *self);
BuilderOptions *builder_context_get_options (BuilderContext *self);
void builder_context_set_options (BuilderContext *self,
BuilderOptions *option);

View File

@ -675,7 +675,6 @@ builder_manifest_download (BuilderManifest *self,
gboolean
builder_manifest_build (BuilderManifest *self,
gboolean keep_build_dir,
BuilderCache *cache,
BuilderContext *context,
GError **error)
@ -696,7 +695,7 @@ builder_manifest_build (BuilderManifest *self,
{
g_autofree char *body =
g_strdup_printf ("Built %s\n", builder_module_get_name (m));
if (!builder_module_build (m, keep_build_dir, cache, context, error))
if (!builder_module_build (m, cache, context, error))
return FALSE;
if (!builder_cache_commit (cache, body, error))
return FALSE;

View File

@ -52,7 +52,6 @@ gboolean builder_manifest_download (BuilderManifest *self,
BuilderContext *context,
GError **error);
gboolean builder_manifest_build (BuilderManifest *self,
gboolean keep_build_dir,
BuilderCache *cache,
BuilderContext *context,
GError **error);

View File

@ -695,7 +695,6 @@ builder_module_handle_debuginfo (BuilderModule *self,
gboolean
builder_module_build (BuilderModule *self,
gboolean keep_build_dir,
BuilderCache *cache,
BuilderContext *context,
GError **error)
@ -928,7 +927,7 @@ builder_module_build (BuilderModule *self,
/* Clean up build dir */
if (keep_build_dir)
if (builder_context_get_keep_build_dirs (context))
{
g_autofree char *buildname_link = g_strdup_printf ("build-%s", self->name);
g_autoptr(GFile) build_link = g_file_get_child (builder_context_get_state_dir (context),

View File

@ -54,7 +54,6 @@ gboolean builder_module_extract_sources (BuilderModule *self,
BuilderContext *context,
GError **error);
gboolean builder_module_build (BuilderModule *self,
gboolean keep_build_dir,
BuilderCache *cache,
BuilderContext *context,
GError **error);

View File

@ -159,6 +159,8 @@ main (int argc,
build_context = builder_context_new (base_dir, app_dir);
builder_context_set_keep_build_dirs (build_context, opt_keep_build_dirs);
if (!opt_disable_download)
{
if (!builder_manifest_download (manifest, !opt_disable_updates, build_context, &error))
@ -203,7 +205,7 @@ main (int argc,
}
}
if (!builder_manifest_build (manifest, opt_keep_build_dirs, cache, build_context, &error))
if (!builder_manifest_build (manifest, cache, build_context, &error))
{
g_print ("error: %s\n", error->message);
return 1;