created giga scripts that run the generator for all available sdl3 apis

This commit is contained in:
peterino2 2026-01-26 01:34:58 -08:00
parent 41b11099be
commit e7b3bd98f8
39 changed files with 874 additions and 11 deletions

View File

@ -26,6 +26,40 @@ The codebase consists of several modules:
## Developing ## Developing
### Build System Patterns
**Custom Build Steps:**
The project uses custom Zig build steps for operations that need to happen during the build process:
```zig
const MakeDirStep = struct {
step: std.Build.Step,
dir_path: []const u8,
pub fn create(b: *std.Build, dir_path: []const u8) *std.Build.Step {
const self = b.allocator.create(MakeDirStep) catch @panic("OOM");
self.* = .{
.step = std.Build.Step.init(.{
.id = .custom,
.name = b.fmt("mkdir {s}", .{dir_path}),
.owner = b,
.makeFn = make,
}),
.dir_path = dir_path,
};
return &self.step;
}
fn make(step: *std.Build.Step, options: std.Build.Step.MakeOptions) !void {
_ = options;
const self: *MakeDirStep = @fieldParentPtr("step", step);
try std.fs.cwd().makePath(self.dir_path);
}
};
```
This pattern allows cross-platform directory creation and other filesystem operations during build without relying on shell commands.
### Error Handling ### Error Handling
**CRITICAL:** Whenever actual errors are encountered (parsing failures, invalid declarations, missing types, etc.), you MUST call `io.emitError` to report them properly. Do NOT use `std.debug.print` for actual errors. **CRITICAL:** Whenever actual errors are encountered (parsing failures, invalid declarations, missing types, etc.), you MUST call `io.emitError` to report them properly. Do NOT use `std.debug.print` for actual errors.

64
api/messagebox.zig Normal file
View File

@ -0,0 +1,64 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const Window = opaque {};
pub const MessageBoxFlags = packed struct(u32) {
messageboxError: bool = false, // error dialog
messageboxWarning: bool = false, // warning dialog
messageboxInformation: bool = false, // informational dialog
messageboxButtonsLeftToRight: bool = false, // buttons placed left to right
messageboxButtonsRightToLeft: bool = false, // buttons placed right to left
pad0: u26 = 0,
rsvd: bool = false,
};
pub const MessageBoxButtonFlags = packed struct(u32) {
messageboxButtonReturnkeyDefault: bool = false, // Marks the default button when return is hit
messageboxButtonEscapekeyDefault: bool = false, // Marks the default button when escape is hit
pad0: u29 = 0,
rsvd: bool = false,
};
pub const MessageBoxButtonData = extern struct {
flags: MessageBoxButtonFlags,
buttonID: c_int, // User defined button id (value returned via SDL_ShowMessageBox)
text: [*c]const u8, // The UTF-8 button text
};
pub const MessageBoxColor = extern struct {
r: u8,
g: u8,
b: u8,
};
pub const MessageBoxColorType = enum(c_int) {
messageboxColorBackground,
messageboxColorText,
messageboxColorButtonBorder,
messageboxColorButtonBackground,
messageboxColorButtonSelected,
messageboxColorCount, //Size of the colors array of SDL_MessageBoxColorScheme.
};
pub const MessageBoxColorScheme = extern struct {
colors: [c.SDL_MESSAGEBOX_COLOR_COUNT]MessageBoxColor,
};
pub const MessageBoxData = extern struct {
flags: MessageBoxFlags,
window: ?*Window, // Parent window, can be NULL
title: [*c]const u8, // UTF-8 title
message: [*c]const u8, // UTF-8 message text
numbuttons: c_int,
buttons: *const MessageBoxButtonData,
colorScheme: *const MessageBoxColorScheme, // SDL_MessageBoxColorScheme, can be NULL to use system settings
};
pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool {
return c.SDL_ShowMessageBox(@ptrCast(messageboxdata), @ptrCast(buttonid));
}
pub inline fn showSimpleMessageBox(flags: MessageBoxFlags, title: [*c]const u8, message: [*c]const u8, window: ?*Window) bool {
return c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window);
}

View File

@ -37,6 +37,10 @@ fn addFetchSdlStep(b: *std.Build) *std.Build.Step {
const checkout_step = if (sdl_checkout) |ref| &b.addSystemCommand(&.{ "git", "-C", "sdl3", "checkout", ref }).step else end_step; const checkout_step = if (sdl_checkout) |ref| &b.addSystemCommand(&.{ "git", "-C", "sdl3", "checkout", ref }).step else end_step;
if (sdl_checkout != null) {
checkout_step.dependOn(end_step);
}
fetch_step.dependOn(checkout_step); fetch_step.dependOn(checkout_step);
return fetch_step; return fetch_step;
} }
@ -63,9 +67,9 @@ const ArchiveStep = struct {
const cwd = std.fs.cwd(); const cwd = std.fs.cwd();
const json_exists = if (cwd.access("json", .{})) true else |_| false; const json_exists = if (cwd.access("json", .{})) true else |_| false;
const v2_exists = if (cwd.access("v2", .{})) true else |_| false; const api_exists = if (cwd.access("api", .{})) true else |_| false;
if (!json_exists and !v2_exists) return; if (!json_exists and !api_exists) return;
const timestamp = std.time.timestamp(); const timestamp = std.time.timestamp();
var buf: [64]u8 = undefined; var buf: [64]u8 = undefined;
@ -79,16 +83,41 @@ const ArchiveStep = struct {
try cwd.rename("json", json_dest); try cwd.rename("json", json_dest);
} }
if (v2_exists) { if (api_exists) {
var v2_dest_buf: [128]u8 = undefined; var api_dest_buf: [128]u8 = undefined;
const v2_dest = try std.fmt.bufPrint(&v2_dest_buf, "{s}/v2", .{archive_path}); const api_dest = try std.fmt.bufPrint(&api_dest_buf, "{s}/api", .{archive_path});
try cwd.rename("v2", v2_dest); try cwd.rename("api", api_dest);
} }
} }
}; };
const MakeDirStep = struct {
step: std.Build.Step,
dir_path: []const u8,
pub fn create(b: *std.Build, dir_path: []const u8) *std.Build.Step {
const self = b.allocator.create(MakeDirStep) catch @panic("OOM");
self.* = .{
.step = std.Build.Step.init(.{
.id = .custom,
.name = b.fmt("mkdir {s}", .{dir_path}),
.owner = b,
.makeFn = make,
}),
.dir_path = dir_path,
};
return &self.step;
}
fn make(step: *std.Build.Step, options: std.Build.Step.MakeOptions) !void {
_ = options;
const self: *MakeDirStep = @fieldParentPtr("step", step);
try std.fs.cwd().makePath(self.dir_path);
}
};
pub fn generateApi(b: *std.Build, parser_exe: *std.Build.Step.Compile, fetch_sdl_step: *std.Build.Step) void { pub fn generateApi(b: *std.Build, parser_exe: *std.Build.Step.Compile, fetch_sdl_step: *std.Build.Step) void {
// Archive existing json/ and v2/ directories before regenerating // Archive existing json/ and api/ directories before regenerating
const archive_step = ArchiveStep.create(b); const archive_step = ArchiveStep.create(b);
fetch_sdl_step.dependOn(archive_step); fetch_sdl_step.dependOn(archive_step);
@ -99,6 +128,13 @@ pub fn generateApi(b: *std.Build, parser_exe: *std.Build.Step.Compile, fetch_sdl
_ = marker_file; _ = marker_file;
wf.step.dependOn(fetch_sdl_step); wf.step.dependOn(fetch_sdl_step);
const basedir = b.option([]const u8, "basedir", "Working directory for the parser to execute in");
// Create basedir if specified
const basedir_step = if (basedir) |dir| MakeDirStep.create(b, dir) else &wf.step;
if (basedir != null)
basedir_step.dependOn(&wf.step);
// All public SDL3 API headers (53 total) // All public SDL3 API headers (53 total)
// Skipped: assert, thread, hidapi, mutex, tray (not core APIs or problematic) // Skipped: assert, thread, hidapi, mutex, tray (not core APIs or problematic)
const headers_to_generate = [_]struct { header: []const u8, output: []const u8 }{ const headers_to_generate = [_]struct { header: []const u8, output: []const u8 }{
@ -165,17 +201,23 @@ pub fn generateApi(b: *std.Build, parser_exe: *std.Build.Step.Compile, fetch_sdl
for (headers_to_generate) |header_info| { for (headers_to_generate) |header_info| {
const regenerate = b.addRunArtifact(parser_exe); const regenerate = b.addRunArtifact(parser_exe);
regenerate.addFileArg(b.path(b.fmt("{s}/{s}", .{ header_path, header_info.header }))); regenerate.addFileArg(b.path(b.fmt("{s}/{s}", .{ header_path, header_info.header })));
regenerate.addArg(b.fmt("--output=v2/{s}.zig", .{header_info.output})); regenerate.addArg(b.fmt("--output=api/{s}.zig", .{header_info.output}));
regenerate.addArg(timestamp_arg); regenerate.addArg(timestamp_arg);
// regenerate.addArg(b.fmt("--output=v2/{s}.zig --mocks=mocks/{s}.c", .{ header_info.output, header_info.output })); if (basedir) |dir| {
regenerate.step.dependOn(&wf.step); regenerate.addArg(b.fmt("--basedir={s}", .{dir}));
}
// regenerate.addArg(b.fmt("--output=api/{s}.zig --mocks=mocks/{s}.c", .{ header_info.output, header_info.output }));
regenerate.step.dependOn(basedir_step);
regenerate_step.dependOn(&regenerate.step); regenerate_step.dependOn(&regenerate.step);
const regenerateJson = b.addRunArtifact(parser_exe); const regenerateJson = b.addRunArtifact(parser_exe);
regenerateJson.addFileArg(b.path(b.fmt("{s}/{s}", .{ header_path, header_info.header }))); regenerateJson.addFileArg(b.path(b.fmt("{s}/{s}", .{ header_path, header_info.header })));
regenerateJson.addArg(b.fmt("--generate-json=json/{s}.json", .{header_info.output})); regenerateJson.addArg(b.fmt("--generate-json=json/{s}.json", .{header_info.output}));
regenerateJson.addArg(timestamp_arg); regenerateJson.addArg(timestamp_arg);
regenerateJson.step.dependOn(&wf.step); if (basedir) |dir| {
regenerateJson.addArg(b.fmt("--basedir={s}", .{dir}));
}
regenerateJson.step.dependOn(basedir_step);
regenerate_step.dependOn(&regenerateJson.step); regenerate_step.dependOn(&regenerateJson.step);
} }
} }

182
scripts/castholm_tags.json Normal file
View File

@ -0,0 +1,182 @@
[
{
"name": "v0.4.0+3.4.0",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.4.0+3.4.0",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.4.0+3.4.0",
"commit": {
"sha": "ae5deb068787bd71d9aadbc054ff1af54f5d058c",
"url": "https://api.github.com/repos/castholm/SDL/commits/ae5deb068787bd71d9aadbc054ff1af54f5d058c"
},
"node_id": "REF_kwDONdlsr7ZyZWZzL3RhZ3MvdjAuNC4wKzMuNC4w"
},
{
"name": "v0.3.3+3.2.28",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.3.3+3.2.28",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.3.3+3.2.28",
"commit": {
"sha": "2cde21ea89c7b67d6e16f7f1e2faaa6f44618ecb",
"url": "https://api.github.com/repos/castholm/SDL/commits/2cde21ea89c7b67d6e16f7f1e2faaa6f44618ecb"
},
"node_id": "REF_kwDONdlsr7dyZWZzL3RhZ3MvdjAuMy4zKzMuMi4yOA"
},
{
"name": "v0.3.2+3.2.26",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.3.2+3.2.26",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.3.2+3.2.26",
"commit": {
"sha": "f103a1439670c35be756d4491b296a6e3ccffaed",
"url": "https://api.github.com/repos/castholm/SDL/commits/f103a1439670c35be756d4491b296a6e3ccffaed"
},
"node_id": "REF_kwDONdlsr7dyZWZzL3RhZ3MvdjAuMy4yKzMuMi4yNg"
},
{
"name": "v0.3.1+3.2.24",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.3.1+3.2.24",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.3.1+3.2.24",
"commit": {
"sha": "1d4b8dcc03bd216712b55318b4ad2402b5511490",
"url": "https://api.github.com/repos/castholm/SDL/commits/1d4b8dcc03bd216712b55318b4ad2402b5511490"
},
"node_id": "REF_kwDONdlsr7dyZWZzL3RhZ3MvdjAuMy4xKzMuMi4yNA"
},
{
"name": "v0.3.0+3.2.22",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.3.0+3.2.22",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.3.0+3.2.22",
"commit": {
"sha": "b1913e7c31ad72ecfd3ab04aeac387027754cfaf",
"url": "https://api.github.com/repos/castholm/SDL/commits/b1913e7c31ad72ecfd3ab04aeac387027754cfaf"
},
"node_id": "REF_kwDONdlsr7dyZWZzL3RhZ3MvdjAuMy4wKzMuMi4yMg"
},
{
"name": "v0.2.6+3.2.20",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.2.6+3.2.20",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.2.6+3.2.20",
"commit": {
"sha": "0f81c0affb2584b242b2fb5744e7dfebcfd904a5",
"url": "https://api.github.com/repos/castholm/SDL/commits/0f81c0affb2584b242b2fb5744e7dfebcfd904a5"
},
"node_id": "REF_kwDONdlsr7dyZWZzL3RhZ3MvdjAuMi42KzMuMi4yMA"
},
{
"name": "v0.2.5+3.2.18",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.2.5+3.2.18",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.2.5+3.2.18",
"commit": {
"sha": "5c55c894039a15a16bb7c89b2d6438e158e86ef1",
"url": "https://api.github.com/repos/castholm/SDL/commits/5c55c894039a15a16bb7c89b2d6438e158e86ef1"
},
"node_id": "REF_kwDONdlsr7dyZWZzL3RhZ3MvdjAuMi41KzMuMi4xOA"
},
{
"name": "v0.2.4+3.2.16",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.2.4+3.2.16",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.2.4+3.2.16",
"commit": {
"sha": "3ed62e53aecd9ffb28e44b9d35b7c09a8739e823",
"url": "https://api.github.com/repos/castholm/SDL/commits/3ed62e53aecd9ffb28e44b9d35b7c09a8739e823"
},
"node_id": "REF_kwDONdlsr7dyZWZzL3RhZ3MvdjAuMi40KzMuMi4xNg"
},
{
"name": "v0.2.3+3.2.14",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.2.3+3.2.14",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.2.3+3.2.14",
"commit": {
"sha": "1b48e5c58374f75a3ea81cbc662fa63f8f83531b",
"url": "https://api.github.com/repos/castholm/SDL/commits/1b48e5c58374f75a3ea81cbc662fa63f8f83531b"
},
"node_id": "REF_kwDONdlsr7dyZWZzL3RhZ3MvdjAuMi4zKzMuMi4xNA"
},
{
"name": "v0.2.2+3.2.12",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.2.2+3.2.12",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.2.2+3.2.12",
"commit": {
"sha": "fce122b6b1e963285b3359f95a1bfe876afc20a6",
"url": "https://api.github.com/repos/castholm/SDL/commits/fce122b6b1e963285b3359f95a1bfe876afc20a6"
},
"node_id": "REF_kwDONdlsr7dyZWZzL3RhZ3MvdjAuMi4yKzMuMi4xMg"
},
{
"name": "v0.2.1+3.2.10",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.2.1+3.2.10",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.2.1+3.2.10",
"commit": {
"sha": "f6bbe8ac5e7b901db69ba62f017596090c362d84",
"url": "https://api.github.com/repos/castholm/SDL/commits/f6bbe8ac5e7b901db69ba62f017596090c362d84"
},
"node_id": "REF_kwDONdlsr7dyZWZzL3RhZ3MvdjAuMi4xKzMuMi4xMA"
},
{
"name": "v0.2.0+3.2.8",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.2.0+3.2.8",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.2.0+3.2.8",
"commit": {
"sha": "dbb1b96360658f5845ff6fac380c4f13d7276dc2",
"url": "https://api.github.com/repos/castholm/SDL/commits/dbb1b96360658f5845ff6fac380c4f13d7276dc2"
},
"node_id": "REF_kwDONdlsr7ZyZWZzL3RhZ3MvdjAuMi4wKzMuMi44"
},
{
"name": "v0.1.5+SDL-3.2.4",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.1.5+SDL-3.2.4",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.1.5+SDL-3.2.4",
"commit": {
"sha": "2bb5f57ea8b8c43eabe514f7bbd3361365ba2ff3",
"url": "https://api.github.com/repos/castholm/SDL/commits/2bb5f57ea8b8c43eabe514f7bbd3361365ba2ff3"
},
"node_id": "REF_kwDONdlsr7pyZWZzL3RhZ3MvdjAuMS41K1NETC0zLjIuNA"
},
{
"name": "v0.1.4+SDL-3.2.2",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.1.4+SDL-3.2.2",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.1.4+SDL-3.2.2",
"commit": {
"sha": "60d237ed50e5f195ed792051385ac7dfc4e229e9",
"url": "https://api.github.com/repos/castholm/SDL/commits/60d237ed50e5f195ed792051385ac7dfc4e229e9"
},
"node_id": "REF_kwDONdlsr7pyZWZzL3RhZ3MvdjAuMS40K1NETC0zLjIuMg"
},
{
"name": "v0.1.3+SDL-3.2.0",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.1.3+SDL-3.2.0",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.1.3+SDL-3.2.0",
"commit": {
"sha": "bbc8dfb78c2a71f10b21548b58dfe5ac46cc3fef",
"url": "https://api.github.com/repos/castholm/SDL/commits/bbc8dfb78c2a71f10b21548b58dfe5ac46cc3fef"
},
"node_id": "REF_kwDONdlsr7pyZWZzL3RhZ3MvdjAuMS4zK1NETC0zLjIuMA"
},
{
"name": "v0.1.2+SDL-3.1.10",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.1.2+SDL-3.1.10",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.1.2+SDL-3.1.10",
"commit": {
"sha": "0f9b915d86e948d7fa09de1a5bb912a0d7d203f1",
"url": "https://api.github.com/repos/castholm/SDL/commits/0f9b915d86e948d7fa09de1a5bb912a0d7d203f1"
},
"node_id": "REF_kwDONdlsr7tyZWZzL3RhZ3MvdjAuMS4yK1NETC0zLjEuMTA"
},
{
"name": "v0.1.1+SDL-3.1.8",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.1.1+SDL-3.1.8",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.1.1+SDL-3.1.8",
"commit": {
"sha": "2ac69003123388d06e9d0fba19fce74e5e7e4cb8",
"url": "https://api.github.com/repos/castholm/SDL/commits/2ac69003123388d06e9d0fba19fce74e5e7e4cb8"
},
"node_id": "REF_kwDONdlsr7pyZWZzL3RhZ3MvdjAuMS4xK1NETC0zLjEuOA"
},
{
"name": "v0.1.0+SDL-3.1.6",
"zipball_url": "https://api.github.com/repos/castholm/SDL/zipball/refs/tags/v0.1.0+SDL-3.1.6",
"tarball_url": "https://api.github.com/repos/castholm/SDL/tarball/refs/tags/v0.1.0+SDL-3.1.6",
"commit": {
"sha": "ad29033021d98d915bc9396590f8a3535bf752ae",
"url": "https://api.github.com/repos/castholm/SDL/commits/ad29033021d98d915bc9396590f8a3535bf752ae"
},
"node_id": "REF_kwDONdlsr7pyZWZzL3RhZ3MvdjAuMS4wK1NETC0zLjEuNg"
}
]

302
scripts/official_tags.json Normal file
View File

@ -0,0 +1,302 @@
[
{
"name": "release-3.4.0",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.4.0",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.4.0",
"commit": {
"sha": "a962f40bbba175e9716557a25d5d7965f134a3d3",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/a962f40bbba175e9716557a25d5d7965f134a3d3"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuNC4w"
},
{
"name": "release-3.2.30",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.30",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.30",
"commit": {
"sha": "f5e5f6588921eed3d7d048ce43d9eb1ff0da0ffc",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/f5e5f6588921eed3d7d048ce43d9eb1ff0da0ffc"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4zMA=="
},
{
"name": "release-3.2.28",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.28",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.28",
"commit": {
"sha": "7f3ae3d57459e59943a4ecfefc8f6277ec6bf540",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/7f3ae3d57459e59943a4ecfefc8f6277ec6bf540"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4yOA=="
},
{
"name": "release-3.2.26",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.26",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.26",
"commit": {
"sha": "badbf8da4ee72b3ef599c721ffc9899e8d7c8d90",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/badbf8da4ee72b3ef599c721ffc9899e8d7c8d90"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4yNg=="
},
{
"name": "release-3.2.24",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.24",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.24",
"commit": {
"sha": "a8589a84226a6202831a3d49ff4edda4acab9acd",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/a8589a84226a6202831a3d49ff4edda4acab9acd"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4yNA=="
},
{
"name": "release-3.2.22",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.22",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.22",
"commit": {
"sha": "a96677bdf6b4acb84af4ec294e5f60a4e8cbbe03",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/a96677bdf6b4acb84af4ec294e5f60a4e8cbbe03"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4yMg=="
},
{
"name": "release-3.2.20",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.20",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.20",
"commit": {
"sha": "96292a5b464258a2b926e0a3d72f8b98c2a81aa6",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/96292a5b464258a2b926e0a3d72f8b98c2a81aa6"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4yMA=="
},
{
"name": "release-3.2.18",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.18",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.18",
"commit": {
"sha": "68bfcb6c5419f51104e74e72ea0f8d405a4615b0",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/68bfcb6c5419f51104e74e72ea0f8d405a4615b0"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4xOA=="
},
{
"name": "release-3.2.16",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.16",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.16",
"commit": {
"sha": "c9a6709bd21750f1ad9597be21abace78c6378c9",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/c9a6709bd21750f1ad9597be21abace78c6378c9"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4xNg=="
},
{
"name": "release-3.2.14",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.14",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.14",
"commit": {
"sha": "8d604353a53853fa56d1bdce0363535605ca868f",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/8d604353a53853fa56d1bdce0363535605ca868f"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4xNA=="
},
{
"name": "release-3.2.12",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.12",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.12",
"commit": {
"sha": "5ac37a8ffcf89da390404c1016833d56e2d67ae4",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/5ac37a8ffcf89da390404c1016833d56e2d67ae4"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4xMg=="
},
{
"name": "release-3.2.10",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.10",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.10",
"commit": {
"sha": "877399b2b2cf21e67554ed9046410f268ce1d1b2",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/877399b2b2cf21e67554ed9046410f268ce1d1b2"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4xMA=="
},
{
"name": "release-3.2.8",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.8",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.8",
"commit": {
"sha": "f6864924f76e1a0b4abaefc76ae2ed22b1a8916e",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/f6864924f76e1a0b4abaefc76ae2ed22b1a8916e"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi44"
},
{
"name": "release-3.2.6",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.6",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.6",
"commit": {
"sha": "65864190cc8393103fd218fd17e2dfdf92e0532d",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/65864190cc8393103fd218fd17e2dfdf92e0532d"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi42"
},
{
"name": "release-3.2.4",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.4",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.4",
"commit": {
"sha": "b5c3eab6b447111d3c7879bb547b80fb4abd9063",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/b5c3eab6b447111d3c7879bb547b80fb4abd9063"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi40"
},
{
"name": "release-3.2.2",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.2",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.2",
"commit": {
"sha": "2fa1e7258a1fd9e3a7a546218b5ed1564953ad39",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/2fa1e7258a1fd9e3a7a546218b5ed1564953ad39"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4y"
},
{
"name": "release-3.2.0",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-3.2.0",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-3.2.0",
"commit": {
"sha": "535d80badefc83c5c527ec5748f2a20d6a9310fe",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/535d80badefc83c5c527ec5748f2a20d6a9310fe"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTMuMi4w"
},
{
"name": "release-2.32.10",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.32.10",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.32.10",
"commit": {
"sha": "5d249570393f7a37e037abf22cd6012a4cc56a71",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/5d249570393f7a37e037abf22cd6012a4cc56a71"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzIuMTA="
},
{
"name": "release-2.32.8",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.32.8",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.32.8",
"commit": {
"sha": "98d1f3a45aae568ccd6ed5fec179330f47d4d356",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/98d1f3a45aae568ccd6ed5fec179330f47d4d356"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzIuOA=="
},
{
"name": "release-2.32.6",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.32.6",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.32.6",
"commit": {
"sha": "6510d6ccbf446e058ae8ed95233f59057312df02",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/6510d6ccbf446e058ae8ed95233f59057312df02"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzIuNg=="
},
{
"name": "release-2.32.4",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.32.4",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.32.4",
"commit": {
"sha": "2359383fc187386204c3bb22de89655a494cd128",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/2359383fc187386204c3bb22de89655a494cd128"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzIuNA=="
},
{
"name": "release-2.32.2",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.32.2",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.32.2",
"commit": {
"sha": "e11183ea6caa3ae4895f4bc54cad2bbb0e365417",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/e11183ea6caa3ae4895f4bc54cad2bbb0e365417"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzIuMg=="
},
{
"name": "release-2.32.0",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.32.0",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.32.0",
"commit": {
"sha": "7a44b1ab002cee6efa56d3b4c0e146b7fbaed80b",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/7a44b1ab002cee6efa56d3b4c0e146b7fbaed80b"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzIuMA=="
},
{
"name": "release-2.30.12",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.30.12",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.30.12",
"commit": {
"sha": "8236e01a9f758d15927624925c6043f84d8a261f",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/8236e01a9f758d15927624925c6043f84d8a261f"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzAuMTI="
},
{
"name": "release-2.30.11",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.30.11",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.30.11",
"commit": {
"sha": "fa24d868ac2f8fd558e4e914c9863411245db8fd",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/fa24d868ac2f8fd558e4e914c9863411245db8fd"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzAuMTE="
},
{
"name": "release-2.30.10",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.30.10",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.30.10",
"commit": {
"sha": "9c821dc21ccbd69b2bda421fdb35cb4ae2da8f5e",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/9c821dc21ccbd69b2bda421fdb35cb4ae2da8f5e"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzAuMTA="
},
{
"name": "release-2.30.9",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.30.9",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.30.9",
"commit": {
"sha": "c98c4fbff6d8f3016a3ce6685bf8f43433c3efcc",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/c98c4fbff6d8f3016a3ce6685bf8f43433c3efcc"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzAuOQ=="
},
{
"name": "release-2.30.8",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.30.8",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.30.8",
"commit": {
"sha": "79ec168f3c1e2fe27335cb8886439f7ef676fb49",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/79ec168f3c1e2fe27335cb8886439f7ef676fb49"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzAuOA=="
},
{
"name": "release-2.30.7",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.30.7",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.30.7",
"commit": {
"sha": "9519b9916cd29a14587af0507292f2bd31dd5752",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/9519b9916cd29a14587af0507292f2bd31dd5752"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzAuNw=="
},
{
"name": "release-2.30.6",
"zipball_url": "https://api.github.com/repos/libsdl-org/SDL/zipball/refs/tags/release-2.30.6",
"tarball_url": "https://api.github.com/repos/libsdl-org/SDL/tarball/refs/tags/release-2.30.6",
"commit": {
"sha": "ba2f78a0069118a6c583f1fbf1420144ffa35bad",
"url": "https://api.github.com/repos/libsdl-org/SDL/commits/ba2f78a0069118a6c583f1fbf1420144ffa35bad"
},
"node_id": "MDM6UmVmMzMwMDA4ODAxOnJlZnMvdGFncy9yZWxlYXNlLTIuMzAuNg=="
}
]

49
scripts/releases.json Normal file
View File

@ -0,0 +1,49 @@
{
"repos": {
"castholm": {
"url": "git@github.com:castholm/SDL.git",
"tags": [
"v0.4.0+3.4.0",
"v0.3.3+3.2.28",
"v0.3.2+3.2.26",
"v0.3.1+3.2.24",
"v0.3.0+3.2.22",
"v0.2.6+3.2.20",
"v0.2.5+3.2.18",
"v0.2.4+3.2.16",
"v0.2.3+3.2.14",
"v0.2.2+3.2.12",
"v0.2.1+3.2.10",
"v0.2.0+3.2.8",
"v0.1.5+SDL-3.2.4",
"v0.1.4+SDL-3.2.2",
"v0.1.3+SDL-3.2.0",
"v0.1.2+SDL-3.1.10",
"v0.1.1+SDL-3.1.8",
"v0.1.0+SDL-3.1.6"
]
},
"official": {
"url": "git@github.com:libsdl-org/SDL.git",
"tags": [
"release-3.4.0",
"release-3.2.30",
"release-3.2.28",
"release-3.2.26",
"release-3.2.24",
"release-3.2.22",
"release-3.2.20",
"release-3.2.18",
"release-3.2.16",
"release-3.2.14",
"release-3.2.12",
"release-3.2.10",
"release-3.2.8",
"release-3.2.6",
"release-3.2.4",
"release-3.2.2",
"release-3.2.0"
]
}
}
}

View File

@ -0,0 +1,190 @@
#!/usr/bin/env python3
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
# Store original directory
ORIG_DIR = os.getcwd()
# Repository URLs from build.zig
CASTHOLM_REPO = "castholm/SDL"
OFFICIAL_REPO = "libsdl-org/SDL"
def fetch_tags(owner_repo):
"""Fetch tags from GitHub API for a given owner/repo."""
url = f"https://api.github.com/repos/{owner_repo}/tags"
try:
result = subprocess.run(
["curl", "-s", url],
capture_output=True,
text=True,
check=True
)
tags_data = json.loads(result.stdout)
return [tag["name"] for tag in tags_data]
except Exception as e:
print(f"Error fetching tags for {owner_repo}: {e}", file=sys.stderr)
return []
def test_release(repo_name, tag, sdl_url_flag, clean=False):
"""Test a single release tag by running zig build generate."""
os.chdir(ORIG_DIR)
# Change to sdlparser-scrap root (parent of scripts/)
root_dir = Path(__file__).parent.parent
os.chdir(root_dir)
if clean and os.path.exists("sdl3"):
cmd = [
"zig", "build", "fetch-sdl",
sdl_url_flag,
"-Dclean"
]
try:
result = subprocess.run(
cmd,
capture_output=True,
text=True,
check=False
)
if result.returncode == 0:
print(f"fetched sdl repo from {sdl_url_flag}")
else:
print(f"✗ FAILED: {repo_name}/{tag}")
if result.stdout:
print("STDOUT:", result.stdout[-500:]) # Last 500 chars
if result.stderr:
print("STDERR:", result.stderr[-500:])
return result.returncode == 0
except Exception as e:
print(f"✗ ERROR: {repo_name}/{tag} - {e}")
return False
basedir = f"./all-releases/{repo_name}/{tag}"
basedir = basedir.replace("+", '-')
print(f"\n{'='*60}")
print(f"Testing {repo_name}/{tag}")
print(f"Base directory: {basedir}")
print(f"{'='*60}")
cmd = [
"zig", "build", "generate",
f"-Dref={tag}",
f"-Dbasedir={basedir}",
sdl_url_flag
]
try:
result = subprocess.run(
cmd,
capture_output=True,
text=True,
check=False
)
if result.returncode == 0:
print(f"✓ SUCCESS: {repo_name}/{tag}")
else:
print(f"✗ FAILED: {repo_name}/{tag}")
if result.stdout:
print("STDOUT:", result.stdout[-500:]) # Last 500 chars
if result.stderr:
print("STDERR:", result.stderr[-500:])
return result.returncode == 0
except Exception as e:
print(f"✗ ERROR: {repo_name}/{tag} - {e}")
return False
def test_all_releases(releases_data):
"""Test all releases from the releases.json data."""
results = {
"castholm": {"success": 0, "failed": 0},
"official": {"success": 0, "failed": 0}
}
# Test castholm releases
print("\n" + "="*60)
print("TESTING CASTHOLM RELEASES")
print("="*60)
first = True
for tag in releases_data["repos"]["castholm"]["tags"]:
success = test_release("castholm", tag, "-Dsdl-url=git@github.com:castholm/SDL.git", first)
first = False
if success:
results["castholm"]["success"] += 1
else:
results["castholm"]["failed"] += 1
# Test official releases
print("\n" + "="*60)
print("TESTING OFFICIAL RELEASES")
print("="*60)
first = True
for tag in releases_data["repos"]["official"]["tags"]:
success = test_release("official", tag, "-Dofficial", first)
first = False
if success:
results["official"]["success"] += 1
else:
results["official"]["failed"] += 1
# Print summary
print("\n" + "="*60)
print("SUMMARY")
print("="*60)
print(f"Castholm: {results['castholm']['success']} success, {results['castholm']['failed']} failed")
print(f"Official: {results['official']['success']} success, {results['official']['failed']} failed")
total_success = results['castholm']['success'] + results['official']['success']
total_failed = results['castholm']['failed'] + results['official']['failed']
print(f"Total: {total_success} success, {total_failed} failed")
def main():
os.chdir(ORIG_DIR)
# Fetch tags from both repositories
print("Fetching tags from GitHub...")
castholm_tags = fetch_tags(CASTHOLM_REPO)
official_tags = fetch_tags(OFFICIAL_REPO)
official_tags = [x for x in official_tags if not x.startswith("release-2") ]
# Build JSON structure
releases_data = {
"repos": {
"castholm": {
"url": f"git@github.com:{CASTHOLM_REPO}.git",
"tags": castholm_tags
},
"official": {
"url": f"git@github.com:{OFFICIAL_REPO}.git",
"tags": official_tags
}
}
}
# Write to releases.json
output_path = "releases.json"
with open(output_path, "w") as f:
json.dump(releases_data, f, indent=2)
print(f"> Wrote {len(castholm_tags)} castholm tags and {len(official_tags)} official tags to {output_path}")
# Ask if user wants to test all releases
response = input("\nTest all releases? (y/n): ").strip().lower()
if response == 'y':
test_all_releases(releases_data)
if __name__ == "__main__":
main()