builder: Initial version of extension building support

tingping/wmclass
Alexander Larsson 2017-01-27 15:27:55 +01:00
parent b8c3b5aa44
commit e38d980bca
5 changed files with 55 additions and 3 deletions

View File

@ -54,6 +54,7 @@ struct BuilderContext
char **cleanup_platform;
gboolean use_ccache;
gboolean build_runtime;
gboolean build_extension;
gboolean separate_locales;
gboolean sandboxed;
};
@ -361,6 +362,19 @@ builder_context_set_build_runtime (BuilderContext *self,
self->build_runtime = !!build_runtime;
}
gboolean
builder_context_get_build_extension (BuilderContext *self)
{
return self->build_extension;
}
void
builder_context_set_build_extension (BuilderContext *self,
gboolean build_extension)
{
self->build_extension = !!build_extension;
}
gboolean
builder_context_get_separate_locales (BuilderContext *self)
{

View File

@ -70,6 +70,9 @@ void builder_context_set_options (BuilderContext *self,
gboolean builder_context_get_build_runtime (BuilderContext *self);
void builder_context_set_build_runtime (BuilderContext *self,
gboolean build_runtime);
gboolean builder_context_get_build_extension (BuilderContext *self);
void builder_context_set_build_extension (BuilderContext *self,
gboolean build_extension);
gboolean builder_context_get_separate_locales (BuilderContext *self);
void builder_context_set_separate_locales (BuilderContext *self,
gboolean separate_locales);

View File

@ -482,7 +482,7 @@ main (int argc,
g_print ("Exporting %s to repo\n", builder_manifest_get_id (manifest));
if (!do_export (build_context, &error,
builder_context_get_build_runtime (build_context),
FALSE,
"--exclude=/lib/debug/*",
"--include=/lib/debug/app",
builder_context_get_separate_locales (build_context) ? "--exclude=/share/runtime/locale/*/*" : skip_arg,

View File

@ -42,6 +42,7 @@ struct BuilderManifest
char *id;
char *id_platform;
char *branch;
char *type;
char *runtime;
char *runtime_commit;
char *runtime_version;
@ -67,6 +68,7 @@ struct BuilderManifest
char *desktop_file_name_prefix;
char *desktop_file_name_suffix;
gboolean build_runtime;
gboolean build_extension;
gboolean writable_sdk;
gboolean appstream_compose;
char **sdk_extensions;
@ -112,6 +114,7 @@ enum {
PROP_CLEANUP_COMMANDS,
PROP_CLEANUP_PLATFORM,
PROP_BUILD_RUNTIME,
PROP_BUILD_EXTENSION,
PROP_SEPARATE_LOCALES,
PROP_WRITABLE_SDK,
PROP_APPSTREAM_COMPOSE,
@ -318,6 +321,10 @@ builder_manifest_get_property (GObject *object,
g_value_set_boolean (value, self->build_runtime);
break;
case PROP_BUILD_EXTENSION:
g_value_set_boolean (value, self->build_extension);
break;
case PROP_SEPARATE_LOCALES:
g_value_set_boolean (value, self->separate_locales);
break;
@ -508,6 +515,10 @@ builder_manifest_set_property (GObject *object,
self->build_runtime = g_value_get_boolean (value);
break;
case PROP_BUILD_EXTENSION:
self->build_extension = g_value_get_boolean (value);
break;
case PROP_SEPARATE_LOCALES:
self->separate_locales = g_value_get_boolean (value);
break;
@ -742,6 +753,13 @@ builder_manifest_class_init (BuilderManifestClass *klass)
"",
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_BUILD_EXTENSION,
g_param_spec_boolean ("build-extension",
"",
"",
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_SEPARATE_LOCALES,
g_param_spec_boolean ("separate-locales",
@ -1156,7 +1174,10 @@ builder_manifest_init_app_dir (BuilderManifest *self,
g_ptr_array_add (args, g_strdup ("build-init"));
if (self->writable_sdk || self->build_runtime)
{
g_ptr_array_add (args, g_strdup ("--type=runtime"));
if (self->build_runtime)
g_ptr_array_add (args, g_strdup ("--type=runtime"));
else
g_ptr_array_add (args, g_strdup ("--writable-sdk"));
for (i = 0; self->sdk_extensions != NULL && self->sdk_extensions[i] != NULL; i++)
{
@ -1164,6 +1185,10 @@ builder_manifest_init_app_dir (BuilderManifest *self,
g_ptr_array_add (args, g_strdup_printf ("--sdk-extension=%s", ext));
}
}
if (self->build_extension)
{
g_ptr_array_add (args, g_strdup ("--type=extension"));
}
if (self->tags)
{
for (i = 0; self->tags[i] != NULL; i++)
@ -1236,6 +1261,7 @@ builder_manifest_checksum (BuilderManifest *self,
builder_cache_checksum_boolean (cache, self->writable_sdk);
builder_cache_checksum_strv (cache, self->sdk_extensions);
builder_cache_checksum_boolean (cache, self->build_runtime);
builder_cache_checksum_boolean (cache, self->build_extension);
builder_cache_checksum_boolean (cache, self->separate_locales);
builder_cache_checksum_str (cache, self->base);
builder_cache_checksum_str (cache, self->base_version);
@ -1363,7 +1389,14 @@ builder_manifest_build (BuilderManifest *self,
builder_context_set_options (context, self->build_options);
builder_context_set_global_cleanup (context, (const char **) self->cleanup);
builder_context_set_global_cleanup_platform (context, (const char **) self->cleanup_platform);
if (self->build_runtime && self->build_extension)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Can't build boh a runtime and an extension");
return FALSE;
}
builder_context_set_build_runtime (context, self->build_runtime);
builder_context_set_build_extension (context, self->build_extension);
builder_context_set_separate_locales (context, self->separate_locales);
g_print ("Starting build of %s\n", self->id ? self->id : "app");

View File

@ -899,7 +899,9 @@ builder_module_handle_debuginfo (BuilderModule *self,
}
}
}
else if (!builder_options_get_no_debuginfo (self->build_options, context))
else if (!builder_options_get_no_debuginfo (self->build_options, context) &&
/* No support for debuginfo for extensions atm */
!builder_context_get_build_extension (context))
{
g_autofree char *rel_path_dir = g_path_get_dirname (rel_path);
g_autofree char *filename = g_path_get_basename (rel_path);