Skip to content

Commit f18f220

Browse files
add current stable build to CI and fix 0.16.0-dev.224+f63cd9194 nightly build (#50)
- resolve `try file.readToEndAlloc(b.allocator, 8192)` being removed in 0.16.x-dev - resolve issue where `std.io` doesn't work in 0.16.x-dev - update CI config to cover 0.15.1 and 0.14.0 (for now)
1 parent b40e0f1 commit f18f220

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ jobs:
4141
# Stable Zig Builds
4242
#
4343

44-
- name: Setup Zig Stable (0.14.0)
44+
- name: Setup Zig Stable (0.15.1)
4545
# note(jae): 2024-09-15
4646
# Uses download mirror first as preferred by Zig Foundation
4747
# see: https://ziglang.org/news/migrate-to-self-hosting/
4848
uses: mlugg/setup-zig@v2
4949
with:
50-
version: "0.14.0"
50+
version: "0.15.1"
5151

5252
- name: Build Minimal Example (Zig Stable)
5353
run: zig build -Dandroid=true --verbose
@@ -94,6 +94,23 @@ jobs:
9494
# adb shell monkey --kill-process-after-error --monitor-native-crashes --pct-touch 100 -p com.zig.sdl2 --throttle 1000 -v 2
9595
# working-directory: examples/sdl2
9696

97+
#
98+
# Previous Stable Zig Build
99+
#
100+
101+
- name: Setup Zig Previous Stable (0.14.0)
102+
uses: mlugg/setup-zig@v2
103+
with:
104+
version: "0.14.0"
105+
106+
- name: Build Minimal Example (Zig Previous Stable)
107+
run: zig build -Dandroid=true --verbose
108+
working-directory: examples/minimal
109+
110+
- name: Build SDL2 Example (Zig Previous Stable)
111+
run: zig build -Dandroid=true --verbose
112+
working-directory: examples/sdl2
113+
97114
#
98115
# Nightly Zig Builds
99116
#

src/android/android.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ const AndroidLog = struct {
176176
};
177177
}
178178

179-
fn log_each_newline(logger: *AndroidLog, buffer: []const u8) std.io.Writer.Error!usize {
179+
fn log_each_newline(logger: *AndroidLog, buffer: []const u8) std.Io.Writer.Error!usize {
180180
var written: usize = 0;
181181
var bytes_to_log = buffer;
182182
while (std.mem.indexOfScalar(u8, bytes_to_log, '\n')) |newline_pos| {
@@ -191,7 +191,7 @@ const AndroidLog = struct {
191191
return written;
192192
}
193193

194-
fn drain(w: *std.Io.Writer, data: []const []const u8, splat: usize) std.io.Writer.Error!usize {
194+
fn drain(w: *std.Io.Writer, data: []const []const u8, splat: usize) std.Io.Writer.Error!usize {
195195
const logger: *AndroidLog = @alignCast(@fieldParentPtr("writer", w));
196196
var written: usize = 0;
197197

src/androidbuild/builtin_options_update.zig

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ fn make(step: *Step, _: Build.Step.MakeOptions) !void {
4343

4444
const package_name_path = builtin_options_update.package_name_stdout.getPath3(b, step);
4545

46-
// NOTE(jae): 2025-07-23
47-
// As of Zig 0.15.0-dev.1092+d772c0627, package_name_path.openFile("") is not possible as it assumes you're appending *something*
48-
const file = try package_name_path.root_dir.handle.openFile(package_name_path.sub_path, .{});
49-
5046
// Read package name from stdout and strip line feed / carriage return
5147
// ie. "com.zig.sdl2\n\r"
52-
const package_name_filedata = try file.readToEndAlloc(b.allocator, 8192);
48+
const package_name_backing_buf = try b.allocator.alloc(u8, 8192);
49+
defer b.allocator.free(package_name_backing_buf);
50+
const package_name_filedata = try package_name_path.root_dir.handle.readFile(package_name_path.sub_path, package_name_backing_buf);
5351
const package_name_stripped = std.mem.trimRight(u8, package_name_filedata, " \r\n");
5452
const package_name: [:0]const u8 = try b.allocator.dupeZ(u8, package_name_stripped);
5553

0 commit comments

Comments
 (0)