Skip to content

Commit 50307e9

Browse files
tidy up source so that structs are using top-level namespace (#22)
1 parent 4508072 commit 50307e9

File tree

7 files changed

+1061
-1067
lines changed

7 files changed

+1061
-1067
lines changed

build.zig

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
const std = @import("std");
22
const androidbuild = @import("src/androidbuild/androidbuild.zig");
3-
const apk = @import("src/androidbuild/apk.zig");
4-
const tools = @import("src/androidbuild/tools.zig");
3+
const Apk = @import("src/androidbuild/apk.zig");
54

65
// Expose Android build functionality for use in your build.zig
76

8-
pub const ToolsOptions = tools.ToolsOptions;
9-
pub const Tools = tools.Tools;
10-
pub const APK = apk.APK;
11-
pub const APILevel = androidbuild.APILevel;
12-
pub const CreateKey = tools.CreateKey;
7+
pub const Tools = @import("src/androidbuild/tools.zig");
8+
pub const APK = Apk; // TODO(jae): 2025-03-13: Consider deprecating and using 'Apk' to be conventional to Zig
9+
pub const APILevel = androidbuild.APILevel; // TODO(jae): 2025-03-13: Consider deprecating and using 'ApiLevel' to be conventional to Zig
1310
pub const standardTargets = androidbuild.standardTargets;
1411

12+
// Deprecated exposes fields
13+
14+
/// Deprecated: Use Tools.Options instead.
15+
pub const ToolsOptions = Tools.Options;
16+
/// Deprecated: Use Tools.CreateKey instead.
17+
pub const CreateKey = Tools.CreateKey;
18+
1519
/// NOTE: As well as providing the "android" module this declaration is required so this can be imported by other build.zig files
1620
pub fn build(b: *std.Build) void {
1721
const target = b.standardTargetOptions(.{});
@@ -24,7 +28,7 @@ pub fn build(b: *std.Build) void {
2428
});
2529

2630
// Create stub of builtin options.
27-
// This is discovered and then replace in src/androidbuild/apk.zig
31+
// This is discovered and then replaced by "Apk" in the build process
2832
const android_builtin_options = std.Build.addOptions(b);
2933
android_builtin_options.addOption([:0]const u8, "package_name", "");
3034
module.addImport("android_builtin", android_builtin_options.createModule());

src/androidbuild/WindowsSdk.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// NOTE(jae): 2024-09-15
2-
// Copy paste of lib/std/zig/WindowsSdk.zig but cutdown to only use Registry functions
3-
1+
//! NOTE(jae): 2024-09-15
2+
//! Copy paste of lib/std/zig/WindowsSdk.zig but cutdown to only use Registry functions
43
const WindowsSdk = @This();
54
const std = @import("std");
65
const builtin = @import("builtin");

src/androidbuild/androidbuild.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const Target = std.Target;
55
const ResolvedTarget = std.Build.ResolvedTarget;
66
const LazyPath = std.Build.LazyPath;
77

8+
const log = std.log.scoped(.@"zig-android-sdk");
9+
810
/// API Level is an enum the maps the Android OS version to the API level
911
///
1012
/// https://en.wikipedia.org/wiki/Android_version_history
@@ -35,6 +37,8 @@ pub const APILevel = enum(u32) {
3537
android14 = 34,
3638
/// Vanilla Ice Cream
3739
android15 = 35,
40+
/// Baklava
41+
android16 = 36,
3842
// allow custom overrides (incase this library is not up to date with the latest android version)
3943
_,
4044
};
@@ -97,8 +101,6 @@ pub fn runNameContext(comptime name: []const u8) []const u8 {
97101
return "zig-android-sdk " ++ name;
98102
}
99103

100-
const log = std.log.scoped(.@"zig-android-sdk");
101-
102104
pub fn printErrorsAndExit(message: []const u8, errors: []const []const u8) noreturn {
103105
nosuspend {
104106
log.err("{s}", .{message});

0 commit comments

Comments
 (0)