push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
{
runCommandLocal,
lib,
git,
clang-tools,
makeHardcodeGsettingsPatch,
}:
let
mkTest =
{
name,
expected,
src,
patches ? [ ],
args,
}:
let
patch = makeHardcodeGsettingsPatch (
args
// {
inherit src patches;
}
);
in
runCommandLocal "makeHardcodeGsettingsPatch-tests-${name}"
{
nativeBuildInputs = [
git
clang-tools
];
}
''
cp -r --no-preserve=all "${src}" src
cp -r --no-preserve=all "${expected}" src-expected
pushd src
for patch in ${lib.escapeShellArgs (map (p: "${p}") patches)}; do
patch < "$patch"
done
patch < "${patch}"
popd
find src -name '*.c' -print0 | while read -d $'\0' sourceFile; do
sourceFile=''${sourceFile#src/}
clang-format -style='{BasedOnStyle: InheritParentConfig, ColumnLimit: 240}' -i "src/$sourceFile" "src-expected/$sourceFile"
git diff --no-index "src/$sourceFile" "src-expected/$sourceFile" | cat
done
touch "$out"
'';
in
{
basic = mkTest {
name = "basic";
src = ./fixtures/example-project;
args = {
schemaIdToVariableMapping = {
"org.gnome.evolution-data-server.addressbook" = "EDS";
"org.gnome.evolution.calendar" = "EVO";
"org.gnome.seahorse.nautilus.window" = "SEANAUT";
};
};
expected = ./fixtures/example-project-patched;
};
patches = mkTest {
name = "patches";
src = ./fixtures/example-project-wrapped-settings-constructor;
patches = [
# Avoid using wrapper function, which the generator cannot handle.
./fixtures/example-project-wrapped-settings-constructor-resolve.patch
];
args = {
schemaIdToVariableMapping = {
"org.gnome.evolution-data-server.addressbook" = "EDS";
};
};
expected = ./fixtures/example-project-wrapped-settings-constructor-patched;
};
existsFn = mkTest {
name = "exists-fn";
src = ./fixtures/example-project;
args = {
schemaIdToVariableMapping = {
"org.gnome.evolution-data-server.addressbook" = "EDS";
"org.gnome.evolution.calendar" = "EVO";
"org.gnome.seahorse.nautilus.window" = "SEANAUT";
};
schemaExistsFunction = "e_ews_common_utils_gsettings_schema_exists";
};
expected = ./fixtures/example-project-patched-with-exists-fn;
};
}

View File

@@ -0,0 +1,129 @@
#include <gio/gio.h>
#include <glib-object.h>
void schema_id_literal() {
GSettings *settings;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EDS@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution-data-server.addressbook", FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
g_object_unref(settings);
}
#define SELF_UID_PATH_ID "org.gnome.evolution-data-server.addressbook"
int schema_id_from_constant() {
GSettings *settings;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EDS@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, SELF_UID_PATH_ID, FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
g_object_unref(settings);
}
void schema_id_autoptr() {
g_autoptr(GSettings) settings = NULL;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EVO@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution.calendar", FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
}
void schema_id_with_backend() {
GSettings *settings;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EDS@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution-data-server.addressbook", FALSE);
settings = g_settings_new_full(schema, g_settings_backend_get_default(), NULL);
}
g_object_unref(settings);
}
void schema_id_with_backend_and_path() {
GSettings *settings;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@SEANAUT@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.seahorse.nautilus.window", FALSE);
settings = g_settings_new_full(schema, g_settings_backend_get_default(), "/org/gnome/seahorse/nautilus/windows/123/");
}
g_object_unref(settings);
}
void schema_id_with_path() {
GSettings *settings;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@SEANAUT@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.seahorse.nautilus.window", FALSE);
settings = g_settings_new_full(schema, NULL, "/org/gnome/seahorse/nautilus/windows/123/");
}
g_object_unref(settings);
}
void exists_fn_guard() {
if (!TRUE) {
return;
}
g_autoptr(GSettings) settings = NULL;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EVO@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution.calendar", FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
}
void exists_fn_nested() {
if (TRUE) {
g_autoptr(GSettings) settings = NULL;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EVO@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution.calendar", FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
}
}
void exists_fn_unknown() {
if (TRUE) {
g_autoptr(GSettings) settings = NULL;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EVO@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution.calendar", FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
}
}
int main() {
schema_id_literal();
schema_id_from_constant();
schema_id_autoptr();
schema_id_with_backend();
schema_id_with_backend_and_path();
schema_id_with_path();
exists_fn_guard();
exists_fn_nested();
exists_fn_unknown();
return 0;
}

View File

@@ -0,0 +1,129 @@
#include <gio/gio.h>
#include <glib-object.h>
void schema_id_literal() {
GSettings *settings;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EDS@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution-data-server.addressbook", FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
g_object_unref(settings);
}
#define SELF_UID_PATH_ID "org.gnome.evolution-data-server.addressbook"
int schema_id_from_constant() {
GSettings *settings;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EDS@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, SELF_UID_PATH_ID, FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
g_object_unref(settings);
}
void schema_id_autoptr() {
g_autoptr(GSettings) settings = NULL;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EVO@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution.calendar", FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
}
void schema_id_with_backend() {
GSettings *settings;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EDS@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution-data-server.addressbook", FALSE);
settings = g_settings_new_full(schema, g_settings_backend_get_default(), NULL);
}
g_object_unref(settings);
}
void schema_id_with_backend_and_path() {
GSettings *settings;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@SEANAUT@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.seahorse.nautilus.window", FALSE);
settings = g_settings_new_full(schema, g_settings_backend_get_default(), "/org/gnome/seahorse/nautilus/windows/123/");
}
g_object_unref(settings);
}
void schema_id_with_path() {
GSettings *settings;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@SEANAUT@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.seahorse.nautilus.window", FALSE);
settings = g_settings_new_full(schema, NULL, "/org/gnome/seahorse/nautilus/windows/123/");
}
g_object_unref(settings);
}
void exists_fn_guard() {
if (!e_ews_common_utils_gsettings_schema_exists("org.gnome.evolution.calendar")) {
return;
}
g_autoptr(GSettings) settings = NULL;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EVO@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution.calendar", FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
}
void exists_fn_nested() {
if (e_ews_common_utils_gsettings_schema_exists("org.gnome.evolution.calendar")) {
g_autoptr(GSettings) settings = NULL;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EVO@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution.calendar", FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
}
}
void exists_fn_unknown() {
if (e_ews_common_utils_gsettings_schema_exists("org.gnome.foo")) {
g_autoptr(GSettings) settings = NULL;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EVO@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution.calendar", FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
}
}
int main() {
schema_id_literal();
schema_id_from_constant();
schema_id_autoptr();
schema_id_with_backend();
schema_id_with_backend_and_path();
schema_id_with_path();
exists_fn_guard();
exists_fn_nested();
exists_fn_unknown();
return 0;
}

View File

@@ -0,0 +1,15 @@
#include <gio/gio.h>
#include <glib-object.h>
int main() {
g_autoptr(GSettings) settings;
{
g_autoptr(GSettingsSchemaSource) schema_source;
g_autoptr(GSettingsSchema) schema;
schema_source = g_settings_schema_source_new_from_directory("@EDS@", g_settings_schema_source_get_default(), TRUE, NULL);
schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution-data-server.addressbook", FALSE);
settings = g_settings_new_full(schema, NULL, NULL);
}
return 0;
}

View File

@@ -0,0 +1,17 @@
--- a/main.c
+++ b/main.c
@@ -1,13 +1,9 @@
#include <gio/gio.h>
#include <glib-object.h>
-void my_settings_new(const char *schema_id) {
- return g_settings_new(schema_id);
-}
-
int main() {
g_autoptr (GSettings) settings;
- settings = my_settings_new("org.gnome.evolution-data-server.addressbook");
+ settings = g_settings_new("org.gnome.evolution-data-server.addressbook");
return 0;
}

View File

@@ -0,0 +1,13 @@
#include <gio/gio.h>
#include <glib-object.h>
void my_settings_new(const char *schema_id) {
return g_settings_new(schema_id);
}
int main() {
g_autoptr (GSettings) settings;
settings = my_settings_new("org.gnome.evolution-data-server.addressbook");
return 0;
}

View File

@@ -0,0 +1,75 @@
#include <gio/gio.h>
#include <glib-object.h>
void schema_id_literal() {
GSettings *settings;
settings = g_settings_new("org.gnome.evolution-data-server.addressbook");
g_object_unref(settings);
}
#define SELF_UID_PATH_ID "org.gnome.evolution-data-server.addressbook"
int schema_id_from_constant() {
GSettings *settings;
settings = g_settings_new(SELF_UID_PATH_ID);
g_object_unref(settings);
}
void schema_id_autoptr() {
g_autoptr(GSettings) settings = NULL;
settings = g_settings_new("org.gnome.evolution.calendar");
}
void schema_id_with_backend() {
GSettings *settings;
settings = g_settings_new_with_backend("org.gnome.evolution-data-server.addressbook", g_settings_backend_get_default());
g_object_unref(settings);
}
void schema_id_with_backend_and_path() {
GSettings *settings;
settings = g_settings_new_with_backend_and_path("org.gnome.seahorse.nautilus.window", g_settings_backend_get_default(), "/org/gnome/seahorse/nautilus/windows/123/");
g_object_unref(settings);
}
void schema_id_with_path() {
GSettings *settings;
settings = g_settings_new_with_path("org.gnome.seahorse.nautilus.window", "/org/gnome/seahorse/nautilus/windows/123/");
g_object_unref(settings);
}
void exists_fn_guard() {
if (!e_ews_common_utils_gsettings_schema_exists("org.gnome.evolution.calendar")) {
return;
}
g_autoptr(GSettings) settings = NULL;
settings = g_settings_new("org.gnome.evolution.calendar");
}
void exists_fn_nested() {
if (e_ews_common_utils_gsettings_schema_exists("org.gnome.evolution.calendar")) {
g_autoptr(GSettings) settings = NULL;
settings = g_settings_new("org.gnome.evolution.calendar");
}
}
void exists_fn_unknown() {
if (e_ews_common_utils_gsettings_schema_exists("org.gnome.foo")) {
g_autoptr(GSettings) settings = NULL;
settings = g_settings_new("org.gnome.evolution.calendar");
}
}
int main() {
schema_id_literal();
schema_id_from_constant();
schema_id_autoptr();
schema_id_with_backend();
schema_id_with_backend_and_path();
schema_id_with_path();
exists_fn_guard();
exists_fn_nested();
exists_fn_unknown();
return 0;
}