Skip to content
Merged
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
20 changes: 12 additions & 8 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
const std = @import("std");
const androidbuild = @import("src/androidbuild/androidbuild.zig");
const apk = @import("src/androidbuild/apk.zig");
const tools = @import("src/androidbuild/tools.zig");
const Apk = @import("src/androidbuild/apk.zig");

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

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

// Deprecated exposes fields

/// Deprecated: Use Tools.Options instead.
pub const ToolsOptions = Tools.Options;
/// Deprecated: Use Tools.CreateKey instead.
pub const CreateKey = Tools.CreateKey;

/// NOTE: As well as providing the "android" module this declaration is required so this can be imported by other build.zig files
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
Expand All @@ -24,7 +28,7 @@ pub fn build(b: *std.Build) void {
});

// Create stub of builtin options.
// This is discovered and then replace in src/androidbuild/apk.zig
// This is discovered and then replaced by "Apk" in the build process
const android_builtin_options = std.Build.addOptions(b);
android_builtin_options.addOption([:0]const u8, "package_name", "");
module.addImport("android_builtin", android_builtin_options.createModule());
Expand Down
5 changes: 2 additions & 3 deletions src/androidbuild/WindowsSdk.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// NOTE(jae): 2024-09-15
// Copy paste of lib/std/zig/WindowsSdk.zig but cutdown to only use Registry functions

//! NOTE(jae): 2024-09-15
//! Copy paste of lib/std/zig/WindowsSdk.zig but cutdown to only use Registry functions
const WindowsSdk = @This();
const std = @import("std");
const builtin = @import("builtin");
Expand Down
6 changes: 4 additions & 2 deletions src/androidbuild/androidbuild.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const Target = std.Target;
const ResolvedTarget = std.Build.ResolvedTarget;
const LazyPath = std.Build.LazyPath;

const log = std.log.scoped(.@"zig-android-sdk");

/// API Level is an enum the maps the Android OS version to the API level
///
/// https://en.wikipedia.org/wiki/Android_version_history
Expand Down Expand Up @@ -35,6 +37,8 @@ pub const APILevel = enum(u32) {
android14 = 34,
/// Vanilla Ice Cream
android15 = 35,
/// Baklava
android16 = 36,
// allow custom overrides (incase this library is not up to date with the latest android version)
_,
};
Expand Down Expand Up @@ -97,8 +101,6 @@ pub fn runNameContext(comptime name: []const u8) []const u8 {
return "zig-android-sdk " ++ name;
}

const log = std.log.scoped(.@"zig-android-sdk");

pub fn printErrorsAndExit(message: []const u8, errors: []const []const u8) noreturn {
nosuspend {
log.err("{s}", .{message});
Expand Down
Loading
Loading