Skip to content

Commit f80aab4

Browse files
committed
more work
1 parent 9e8020e commit f80aab4

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

build.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ const androidbuild = @import("src/androidbuild/androidbuild.zig");
66
// TODO: rename tools.zig to Sdk.zig
77
pub const Sdk = @import("src/androidbuild/tools.zig");
88
pub const Apk = @import("src/androidbuild/apk.zig");
9-
pub const APILevel = androidbuild.APILevel; // TODO(jae): 2025-03-13: Consider deprecating and using 'ApiLevel' to be conventional to Zig
9+
pub const ApiLevel = androidbuild.ApiLevel;
1010
pub const standardTargets = androidbuild.standardTargets;
1111

12-
// Deprecated exposes fields
12+
// Deprecated exposed fields
1313

14+
/// Deprecated: Use ApiLevel
15+
pub const APILevel = @compileError("use android.ApiLevel instead of android.APILevel");
1416
/// Deprecated: Use Sdk instead
1517
pub const Tools = @compileError("Use android.Sdk instead of android.Tools");
1618
/// Deprecated: Use Apk.Options instead.

src/androidbuild/androidbuild.zig

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ const LazyPath = std.Build.LazyPath;
77

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

10-
/// Deprecated: Use ApiLevel
11-
pub const APILevel = ApiLevel;
12-
1310
/// API Level is an enum the maps the Android OS version to the API level
1411
///
1512
/// https://en.wikipedia.org/wiki/Android_version_history
@@ -47,11 +44,6 @@ pub const ApiLevel = enum(u32) {
4744
_,
4845
};
4946

50-
pub const KeyStore = struct {
51-
file: LazyPath,
52-
password: []const u8,
53-
};
54-
5547
pub fn getAndroidTriple(target: ResolvedTarget) error{InvalidAndroidTarget}![]const u8 {
5648
if (!target.result.abi.isAndroid()) return error.InvalidAndroidTarget;
5749
return switch (target.result.cpu.arch) {

src/androidbuild/apk.zig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const Ndk = @import("Ndk.zig");
77
const BuildTools = @import("BuildTools.zig");
88
const D8Glob = @import("d8glob.zig");
99

10+
const KeyStore = Tools.KeyStore;
1011
const ApiLevel = androidbuild.ApiLevel;
11-
const KeyStore = androidbuild.KeyStore;
1212
const getAndroidTriple = androidbuild.getAndroidTriple;
1313
const runNameContext = androidbuild.runNameContext;
1414
const printErrorsAndExit = androidbuild.printErrorsAndExit;
@@ -150,7 +150,7 @@ pub fn addJavaSourceFiles(apk: *Apk, options: AddJavaSourceFilesOptions) void {
150150
/// This is required run on an Android device.
151151
///
152152
/// If you want to just use a temporary key for local development, do something like this:
153-
/// - apk.setKeyStore(android_tools.createKeyStore(android.CreateKey.example()));
153+
/// - apk.setKeyStore(android_sdk.createKeyStore(.example);
154154
pub fn setKeyStore(apk: *Apk, key_store: KeyStore) void {
155155
apk.key_store = key_store;
156156
}
@@ -205,10 +205,7 @@ pub fn addInstallApk(apk: *Apk) *Step.InstallFile {
205205
fn doInstallApk(apk: *Apk) std.mem.Allocator.Error!*Step.InstallFile {
206206
const b = apk.b;
207207

208-
const key_store: KeyStore = apk.key_store orelse .{
209-
.file = .{ .cwd_relative = "" },
210-
.password = "",
211-
};
208+
const key_store: KeyStore = apk.key_store orelse .empty;
212209

213210
// validate
214211
{

src/androidbuild/tools.zig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const RegistryWtf8 = @import("WindowsSdk.zig").RegistryWtf8;
77
const windows = std.os.windows;
88

99
const ApiLevel = androidbuild.ApiLevel;
10-
const KeyStore = androidbuild.KeyStore;
1110
const getAndroidTriple = androidbuild.getAndroidTriple;
1211
const runNameContext = androidbuild.runNameContext;
1312
const printErrorsAndExit = androidbuild.printErrorsAndExit;
@@ -460,6 +459,16 @@ fn getAndroidSDKPath(allocator: std.mem.Allocator) error{OutOfMemory}![]const u8
460459
return &[0]u8{};
461460
}
462461

462+
pub const KeyStore = struct {
463+
file: LazyPath,
464+
password: []const u8,
465+
466+
pub const empty: KeyStore = .{
467+
.file = .{ .cwd_relative = "" },
468+
.password = "",
469+
};
470+
};
471+
463472
/// Searches your PATH environment variable directories for adb, jarsigner, etc
464473
const PathSearch = struct {
465474
allocator: std.mem.Allocator,

0 commit comments

Comments
 (0)