From 7bc44f09032d5873f8328e86fab18509b06ccfaa Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 26 Jun 2017 12:19:17 +0200 Subject: [PATCH] builder: Allow building modules with no sources if buildsystem=simple This makes a lot of sense to have for simple things like just directly modifying the /app root. --- builder/builder-manifest.c | 5 +---- builder/builder-module.c | 13 +++++++++++++ builder/builder-module.h | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/builder/builder-manifest.c b/builder/builder-manifest.c index d6d4b780..3d9a3211 100644 --- a/builder/builder-manifest.c +++ b/builder/builder-manifest.c @@ -1530,9 +1530,6 @@ builder_manifest_build_shell (BuilderManifest *self, if (found == NULL) return flatpak_fail (error, "Can't find module %s", modulename); - if (!builder_module_get_sources (found)) - return flatpak_fail (error, "No sources for module %s", modulename); - if (!builder_module_build (found, NULL, context, TRUE, error)) return FALSE; @@ -1566,7 +1563,7 @@ builder_manifest_build (BuilderManifest *self, return TRUE; } - if (!builder_module_get_sources (m)) + if (!builder_module_should_build (m)) { g_print ("Skipping module %s (no sources)\n", name); continue; diff --git a/builder/builder-module.c b/builder/builder-module.c index 733ae39c..62b385f3 100644 --- a/builder/builder-module.c +++ b/builder/builder-module.c @@ -826,6 +826,19 @@ builder_module_is_enabled (BuilderModule *self, return TRUE; } +gboolean +builder_module_should_build (BuilderModule *self) +{ + if (self->sources != NULL) + return TRUE; + + /* We allow building simple types even without sources, that is often useful */ + if (!g_strcmp0 (self->buildsystem, "simple")) + return TRUE; + + return FALSE; +} + gboolean builder_module_get_disabled (BuilderModule *self) { diff --git a/builder/builder-module.h b/builder/builder-module.h index c13c3c64..22933e8a 100644 --- a/builder/builder-module.h +++ b/builder/builder-module.h @@ -43,6 +43,7 @@ const char * builder_module_get_name (BuilderModule *self); gboolean builder_module_is_enabled (BuilderModule *self, BuilderContext *context); gboolean builder_module_get_disabled (BuilderModule *self); +gboolean builder_module_should_build (BuilderModule *self); GList * builder_module_get_sources (BuilderModule *self); GList * builder_module_get_modules (BuilderModule *self); void builder_module_set_json_path (BuilderModule *self,