| ... | @@ -250,7 +250,7 @@ pub fn create( | ... | @@ -250,7 +250,7 @@ pub fn create( |
| 250 | build_root: Cache.Directory, | 250 | build_root: Cache.Directory, |
| 251 | cache_root: Cache.Directory, | 251 | cache_root: Cache.Directory, |
| 252 | available_deps: AvailableDeps, | 252 | available_deps: AvailableDeps, |
| 253 | ) !*Build { | 253 | ) error{OutOfMemory}!*Build { |
| 254 | const arena = graph.arena; | 254 | const arena = graph.arena; |
| 255 | | 255 | |
| 256 | const b = try arena.create(Build); | 256 | const b = try arena.create(Build); |
| ... | @@ -318,7 +318,7 @@ fn createChild( | ... | @@ -318,7 +318,7 @@ fn createChild( |
| 318 | pkg_hash: []const u8, | 318 | pkg_hash: []const u8, |
| 319 | pkg_deps: AvailableDeps, | 319 | pkg_deps: AvailableDeps, |
| 320 | user_input_options: UserInputOptionsMap, | 320 | user_input_options: UserInputOptionsMap, |
| 321 | ) !*Build { | 321 | ) error{OutOfMemory}!*Build { |
| 322 | const child = try createChildOnly(parent, dep_name, build_root, pkg_hash, pkg_deps, user_input_options); | 322 | const child = try createChildOnly(parent, dep_name, build_root, pkg_hash, pkg_deps, user_input_options); |
| 323 | try determineAndApplyInstallPrefix(child); | 323 | try determineAndApplyInstallPrefix(child); |
| 324 | return child; | 324 | return child; |
| ... | @@ -331,7 +331,7 @@ fn createChildOnly( | ... | @@ -331,7 +331,7 @@ fn createChildOnly( |
| 331 | pkg_hash: []const u8, | 331 | pkg_hash: []const u8, |
| 332 | pkg_deps: AvailableDeps, | 332 | pkg_deps: AvailableDeps, |
| 333 | user_input_options: UserInputOptionsMap, | 333 | user_input_options: UserInputOptionsMap, |
| 334 | ) !*Build { | 334 | ) error{OutOfMemory}!*Build { |
| 335 | const allocator = parent.allocator; | 335 | const allocator = parent.allocator; |
| 336 | const child = try allocator.create(Build); | 336 | const child = try allocator.create(Build); |
| 337 | child.* = .{ | 337 | child.* = .{ |
| ... | @@ -623,7 +623,7 @@ fn hashUserInputOptionsMap(allocator: Allocator, user_input_options: UserInputOp | ... | @@ -623,7 +623,7 @@ fn hashUserInputOptionsMap(allocator: Allocator, user_input_options: UserInputOp |
| 623 | user_option.hash(hasher); | 623 | user_option.hash(hasher); |
| 624 | } | 624 | } |
| 625 | | 625 | |
| 626 | fn determineAndApplyInstallPrefix(b: *Build) !void { | 626 | fn determineAndApplyInstallPrefix(b: *Build) error{OutOfMemory}!void { |
| 627 | // Create an installation directory local to this package. This will be used when | 627 | // Create an installation directory local to this package. This will be used when |
| 628 | // dependant packages require a standard prefix, such as include directories for C headers. | 628 | // dependant packages require a standard prefix, such as include directories for C headers. |
| 629 | var hash = b.graph.cache.hash; | 629 | var hash = b.graph.cache.hash; |
| ... | @@ -1684,7 +1684,7 @@ pub fn standardTargetOptionsQueryOnly(b: *Build, args: StandardTargetOptionsArgs | ... | @@ -1684,7 +1684,7 @@ pub fn standardTargetOptionsQueryOnly(b: *Build, args: StandardTargetOptionsArgs |
| 1684 | return args.default_target; | 1684 | return args.default_target; |
| 1685 | } | 1685 | } |
| 1686 | | 1686 | |
| 1687 | pub fn addUserInputOption(b: *Build, name_raw: []const u8, value_raw: []const u8) !bool { | 1687 | pub fn addUserInputOption(b: *Build, name_raw: []const u8, value_raw: []const u8) error{OutOfMemory}!bool { |
| 1688 | const name = b.dupe(name_raw); | 1688 | const name = b.dupe(name_raw); |
| 1689 | const value = b.dupe(value_raw); | 1689 | const value = b.dupe(value_raw); |
| 1690 | const gop = try b.user_input_options.getOrPut(name); | 1690 | const gop = try b.user_input_options.getOrPut(name); |
| ... | @@ -1736,7 +1736,7 @@ pub fn addUserInputOption(b: *Build, name_raw: []const u8, value_raw: []const u8 | ... | @@ -1736,7 +1736,7 @@ pub fn addUserInputOption(b: *Build, name_raw: []const u8, value_raw: []const u8 |
| 1736 | return false; | 1736 | return false; |
| 1737 | } | 1737 | } |
| 1738 | | 1738 | |
| 1739 | pub fn addUserInputFlag(b: *Build, name_raw: []const u8) !bool { | 1739 | pub fn addUserInputFlag(b: *Build, name_raw: []const u8) error{OutOfMemory}!bool { |
| 1740 | const name = b.dupe(name_raw); | 1740 | const name = b.dupe(name_raw); |
| 1741 | const gop = try b.user_input_options.getOrPut(name); | 1741 | const gop = try b.user_input_options.getOrPut(name); |
| 1742 | if (!gop.found_existing) { | 1742 | if (!gop.found_existing) { |
| ... | @@ -1808,7 +1808,7 @@ pub fn validateUserInputDidItFail(b: *Build) bool { | ... | @@ -1808,7 +1808,7 @@ pub fn validateUserInputDidItFail(b: *Build) bool { |
| 1808 | return b.invalid_user_input; | 1808 | return b.invalid_user_input; |
| 1809 | } | 1809 | } |
| 1810 | | 1810 | |
| 1811 | fn allocPrintCmd(ally: Allocator, opt_cwd: ?[]const u8, argv: []const []const u8) ![]u8 { | 1811 | fn allocPrintCmd(ally: Allocator, opt_cwd: ?[]const u8, argv: []const []const u8) error{OutOfMemory}![]u8 { |
| 1812 | var buf = ArrayList(u8).init(ally); | 1812 | var buf = ArrayList(u8).init(ally); |
| 1813 | if (opt_cwd) |cwd| try buf.writer().print("cd {s} && ", .{cwd}); | 1813 | if (opt_cwd) |cwd| try buf.writer().print("cd {s} && ", .{cwd}); |
| 1814 | for (argv) |arg| { | 1814 | for (argv) |arg| { |
| ... | @@ -1903,7 +1903,7 @@ pub fn addCheckFile( | ... | @@ -1903,7 +1903,7 @@ pub fn addCheckFile( |
| 1903 | return Step.CheckFile.create(b, file_source, options); | 1903 | return Step.CheckFile.create(b, file_source, options); |
| 1904 | } | 1904 | } |
| 1905 | | 1905 | |
| 1906 | pub fn truncateFile(b: *Build, dest_path: []const u8) !void { | 1906 | pub fn truncateFile(b: *Build, dest_path: []const u8) (fs.Dir.MakeError || fs.Dir.StatFileError)!void { |
| 1907 | if (b.verbose) { | 1907 | if (b.verbose) { |
| 1908 | log.info("truncate {s}", .{dest_path}); | 1908 | log.info("truncate {s}", .{dest_path}); |
| 1909 | } | 1909 | } |
| ... | @@ -1990,7 +1990,7 @@ fn tryFindProgram(b: *Build, full_path: []const u8) ?[]const u8 { | ... | @@ -1990,7 +1990,7 @@ fn tryFindProgram(b: *Build, full_path: []const u8) ?[]const u8 { |
| 1990 | return null; | 1990 | return null; |
| 1991 | } | 1991 | } |
| 1992 | | 1992 | |
| 1993 | pub fn findProgram(b: *Build, names: []const []const u8, paths: []const []const u8) ![]const u8 { | 1993 | pub fn findProgram(b: *Build, names: []const []const u8, paths: []const []const u8) error{FileNotFound}![]const u8 { |
| 1994 | // TODO report error for ambiguous situations | 1994 | // TODO report error for ambiguous situations |
| 1995 | for (b.search_prefixes.items) |search_prefix| { | 1995 | for (b.search_prefixes.items) |search_prefix| { |
| 1996 | for (names) |name| { | 1996 | for (names) |name| { |