Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sdk-version #481

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions data/flatpak-manifest.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,10 @@
"description": "The name of the development runtime that the application builds with.",
"type": "string"
},
"sdk-version": {
"description": "The version of the development runtime that the application builds with, defaults to the runtime version.",
"type": "string"
},
"var": {
"description": "Initialize the (otherwise empty) writable /var in the build with a copy of this runtime.",
"type": "string"
Expand Down
4 changes: 4 additions & 0 deletions doc/flatpak-manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@
<term><option>sdk</option> (string)</term>
<listitem><para>The name of the development runtime that the application builds with.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>sdk-version</option> (string)</term>
<listitem><para>The version of the development runtime that the application builds with, defaults to the runtime version.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>var</option> (string)</term>
<listitem><para>Initialize the (otherwise empty) writable /var in the build with a copy of this runtime.</para></listitem>
Expand Down
36 changes: 32 additions & 4 deletions src/builder-manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct BuilderManifest
char *runtime_version;
char *sdk;
char *sdk_commit;
char *sdk_version;
char *var;
char *base;
char *base_commit;
Expand Down Expand Up @@ -132,6 +133,7 @@ enum {
PROP_RUNTIME_COMMIT,
PROP_SDK,
PROP_SDK_COMMIT,
PROP_SDK_VERSION,
PROP_BASE,
PROP_BASE_VERSION,
PROP_BASE_COMMIT,
Expand Down Expand Up @@ -189,6 +191,7 @@ builder_manifest_finalize (GObject *object)
g_free (self->runtime_version);
g_free (self->sdk);
g_free (self->sdk_commit);
g_free (self->sdk_version);
g_free (self->base);
g_free (self->base_commit);
g_free (self->base_version);
Expand Down Expand Up @@ -326,6 +329,10 @@ builder_manifest_get_property (GObject *object,
g_value_set_string (value, self->sdk_commit);
break;

case PROP_SDK_VERSION:
g_value_set_string (value, self->sdk_version);
break;

case PROP_BASE:
g_value_set_string (value, self->base);
break;
Expand Down Expand Up @@ -548,6 +555,11 @@ builder_manifest_set_property (GObject *object,
self->sdk_commit = g_value_dup_string (value);
break;

case PROP_SDK_VERSION:
g_free (self->sdk_version);
self->sdk_version = g_value_dup_string (value);
break;

case PROP_BASE:
g_free (self->base);
self->base = g_value_dup_string (value);
Expand Down Expand Up @@ -833,6 +845,15 @@ builder_manifest_class_init (BuilderManifestClass *klass)
"",
NULL,
G_PARAM_READWRITE));

g_object_class_install_property (object_class,
PROP_SDK_VERSION,
g_param_spec_string ("sdk-version",
"",
"",
NULL,
G_PARAM_READWRITE));

g_object_class_install_property (object_class,
PROP_BASE,
g_param_spec_string ("base",
Expand Down Expand Up @@ -1436,6 +1457,12 @@ builder_manifest_get_runtime_version (BuilderManifest *self)
return self->runtime_version ? self->runtime_version : "master";
}

static const char *
builder_manifest_get_sdk_version (BuilderManifest *self)
{
return self->sdk_version ? self->sdk_version : builder_manifest_get_runtime_version(self);
}

const char *
builder_manifest_get_branch (BuilderManifest *self,
BuilderContext *context)
Expand Down Expand Up @@ -1661,13 +1688,13 @@ builder_manifest_start (BuilderManifest *self,
arch_option = g_strdup_printf ("--arch=%s", builder_context_get_arch (context));

self->sdk_commit = flatpak (NULL, "info", arch_option, "--show-commit", self->sdk,
builder_manifest_get_runtime_version (self), NULL);
builder_manifest_get_sdk_version (self), NULL);
if (!download_only && !allow_missing_runtimes && self->sdk_commit == NULL)
return flatpak_fail (error, "Unable to find sdk %s version %s",
self->sdk,
builder_manifest_get_runtime_version (self));
builder_manifest_get_sdk_version (self));

sdk_path = flatpak_info_show_path (self->sdk, builder_manifest_get_runtime_version (self), context);
sdk_path = flatpak_info_show_path (self->sdk, builder_manifest_get_sdk_version (self), context);
if (sdk_path != NULL &&
!builder_context_load_sdk_config (context, sdk_path, error))
return FALSE;
Expand Down Expand Up @@ -1825,6 +1852,7 @@ builder_manifest_checksum (BuilderManifest *self,
builder_cache_checksum_str (cache, self->runtime);
builder_cache_checksum_str (cache, builder_manifest_get_runtime_version (self));
builder_cache_checksum_str (cache, self->sdk);
builder_cache_checksum_str (cache, builder_manifest_get_sdk_version (self));
/* Always rebuild on sdk change if we're actually including the sdk in the cache */
if (self->writable_sdk || self->build_runtime ||
builder_context_get_rebuild_on_sdk_change (context))
Expand Down Expand Up @@ -4014,7 +4042,7 @@ builder_manifest_install_deps (BuilderManifest *self,
else
{
sdk = self->sdk;
sdk_branch = builder_manifest_get_runtime_version (self);
sdk_branch = builder_manifest_get_sdk_version (self);
}

/* Sdk */
Expand Down