@@ -18,11 +18,9 @@ fn sdkRoot() *const [sdkRootIntern().len]u8 {
18
18
19
19
// linux-x86_64
20
20
pub fn toolchainHostTag () []const u8 {
21
- comptime {
22
- const os = builtin .os .tag ;
23
- const arch = builtin .cpu .arch ;
24
- return @tagName (os ) ++ "-" ++ @tagName (arch );
25
- }
21
+ const os = builtin .os .tag ;
22
+ const arch = builtin .cpu .arch ;
23
+ return (comptime if (std .mem .eql (u8 , @tagName (os ), "macos" )) "darwin" else @tagName (os )) ++ "-" ++ @tagName (arch );
26
24
}
27
25
28
26
/// This file encodes a instance of an Android SDK interface.
@@ -92,12 +90,12 @@ pub fn init(b: *Builder, user_config: ?UserConfig, toolchains: ToolchainVersions
92
90
.name = "zip_add" ,
93
91
.root_source_file = .{ .path = sdkRoot () ++ "/tools/zip_add.zig" },
94
92
});
95
- zip_add .addCSourceFile (sdkRoot () ++ "/vendor/kuba-zip/zip.c" , &[_ ][]const u8 {
93
+ zip_add .addCSourceFile (.{ . file = .{ . path = sdkRoot () ++ "/vendor/kuba-zip/zip.c" }, . flags = &[_ ][]const u8 {
96
94
"-std=c99" ,
97
95
"-fno-sanitize=undefined" ,
98
96
"-D_POSIX_C_SOURCE=200112L" ,
99
- });
100
- zip_add .addIncludePath (sdkRoot () ++ "/vendor/kuba-zip" );
97
+ } } );
98
+ zip_add .addIncludePath (.{ . path = sdkRoot () ++ "/vendor/kuba-zip" } );
101
99
zip_add .linkLibC ();
102
100
103
101
break :blk HostTools {
@@ -503,10 +501,11 @@ pub fn createApp(
503
501
}
504
502
resource_dir_step .add (Resource {
505
503
.path = "values/strings.xml" ,
506
- .content = write_xml_step .getFileSource ("strings.xml" ).? ,
504
+ // .content = write_xml_step.getFileSource("strings.xml").?,
505
+ .content = write_xml_step .addCopyFile (.{ .path = "strings.xml" }, "" ),
507
506
});
508
507
509
- const sdk_version_int = @enumToInt (app_config .target_version );
508
+ const sdk_version_int = @intFromEnum (app_config .target_version );
510
509
511
510
if (sdk_version_int < 16 ) @panic ("Minimum supported sdk version is 16." );
512
511
@@ -549,7 +548,8 @@ pub fn createApp(
549
548
const unaligned_apk_file = make_unsigned_apk .addOutputFileArg (unaligned_apk_name );
550
549
551
550
make_unsigned_apk .addArg ("-M" ); // specify full path to AndroidManifest.xml to include in zip
552
- make_unsigned_apk .addFileSourceArg (manifest_step .getFileSource ("AndroidManifest.xml" ).? );
551
+ // make_unsigned_apk.addFileSourceArg(manifest_step.getFileSource("AndroidManifest.xml").?);
552
+ make_unsigned_apk .addFileSourceArg (manifest_step .addCopyFile (.{ .path = "AndroidManifest.xml" }, "" ));
553
553
554
554
make_unsigned_apk .addArg ("-S" ); // directory in which to find resources. Multiple directories will be scanned and the first match found (left to right) will take precedence
555
555
make_unsigned_apk .addDirectorySourceArg (resource_dir_step .getOutputDirectory ());
@@ -848,7 +848,7 @@ pub fn compileAppLibrary(
848
848
ndk_root ,
849
849
toolchainHostTag (),
850
850
config .lib_dir ,
851
- @enumToInt (app_config .target_version ),
851
+ @intFromEnum (app_config .target_version ),
852
852
});
853
853
854
854
const include_dir = std .fs .path .resolve (sdk .b .allocator , &[_ ][]const u8 {
@@ -887,7 +887,7 @@ pub fn compileAppLibrary(
887
887
888
888
// exe.addIncludePath(include_dir);
889
889
890
- exe .addLibraryPath (lib_dir );
890
+ exe .addLibraryPath (.{ . path = lib_dir } );
891
891
892
892
// exe.addIncludePath(include_dir);
893
893
// exe.addIncludePath(system_include_dir);
@@ -904,7 +904,7 @@ pub fn compileAppLibrary(
904
904
}
905
905
906
906
fn createLibCFile (sdk : * const Sdk , version : AndroidVersion , folder_name : []const u8 , include_dir : []const u8 , sys_include_dir : []const u8 , crt_dir : []const u8 ) ! std.build.FileSource {
907
- const fname = sdk .b .fmt ("android-{d}-{s}.conf" , .{ @enumToInt (version ), folder_name });
907
+ const fname = sdk .b .fmt ("android-{d}-{s}.conf" , .{ @intFromEnum (version ), folder_name });
908
908
909
909
var contents = std .ArrayList (u8 ).init (sdk .b .allocator );
910
910
errdefer contents .deinit ();
@@ -926,7 +926,8 @@ fn createLibCFile(sdk: *const Sdk, version: AndroidVersion, folder_name: []const
926
926
try writer .writeAll ("gcc_dir=\n " );
927
927
928
928
const step = sdk .b .addWriteFile (fname , contents .items );
929
- return step .getFileSource (fname ) orelse unreachable ;
929
+ // return step.getFileSource(fname) orelse unreachable;
930
+ return step .addCopyFile (.{ .path = fname }, "" );
930
931
}
931
932
932
933
pub fn compressApk (sdk : Sdk , input_apk_file : []const u8 , output_apk_file : []const u8 ) * Step {
@@ -1151,22 +1152,22 @@ const BuildOptionStep = struct {
1151
1152
}
1152
1153
return ;
1153
1154
},
1154
- std .builtin .Version = > {
1155
- out .print (
1156
- \\pub const {}: @import("std").builtin.Version = .{{
1157
- \\ .major = {d},
1158
- \\ .minor = {d},
1159
- \\ .patch = {d},
1160
- \\}};
1161
- \\
1162
- , .{
1163
- std .zig .fmtId (name ),
1164
-
1165
- value .major ,
1166
- value .minor ,
1167
- value .patch ,
1168
- }) catch unreachable ;
1169
- },
1155
+ // std.builtin.Version => {
1156
+ // out.print(
1157
+ // \\pub const {}: @import("std").builtin.Version = .{{
1158
+ // \\ .major = {d},
1159
+ // \\ .minor = {d},
1160
+ // \\ .patch = {d},
1161
+ // \\}};
1162
+ // \\
1163
+ // , .{
1164
+ // std.zig.fmtId(name),
1165
+
1166
+ // value.major,
1167
+ // value.minor,
1168
+ // value.patch,
1169
+ // }) catch unreachable;
1170
+ // },
1170
1171
std .SemanticVersion = > {
1171
1172
out .print (
1172
1173
\\pub const {}: @import("std").SemanticVersion = .{{
0 commit comments