| ... | ... | @@ -6,7 +6,7 @@ const mem = std.mem; |
| 6 | 6 | const debug = std.debug; |
| 7 | 7 | const panic = std.debug.panic; |
| 8 | 8 | const assert = debug.assert; |
| 9 | | const warn = std.debug.print; // TODO use the log system instead of this |
| 9 | const log = std.log; |
| 10 | 10 | const ArrayList = std.ArrayList; |
| 11 | 11 | const StringHashMap = std.StringHashMap; |
| 12 | 12 | const Allocator = mem.Allocator; |
| ... | ... | @@ -478,7 +478,7 @@ pub const Builder = struct { |
| 478 | 478 | for (self.installed_files.items) |installed_file| { |
| 479 | 479 | const full_path = self.getInstallPath(installed_file.dir, installed_file.path); |
| 480 | 480 | if (self.verbose) { |
| 481 | | warn("rm {s}\n", .{full_path}); |
| 481 | log.info("rm {s}", .{full_path}); |
| 482 | 482 | } |
| 483 | 483 | fs.cwd().deleteTree(full_path) catch {}; |
| 484 | 484 | } |
| ... | ... | @@ -488,7 +488,7 @@ pub const Builder = struct { |
| 488 | 488 | |
| 489 | 489 | fn makeOneStep(self: *Builder, s: *Step) anyerror!void { |
| 490 | 490 | if (s.loop_flag) { |
| 491 | | warn("Dependency loop detected:\n {s}\n", .{s.name}); |
| 491 | log.err("Dependency loop detected:\n {s}", .{s.name}); |
| 492 | 492 | return error.DependencyLoopDetected; |
| 493 | 493 | } |
| 494 | 494 | s.loop_flag = true; |
| ... | ... | @@ -496,7 +496,7 @@ pub const Builder = struct { |
| 496 | 496 | for (s.dependencies.items) |dep| { |
| 497 | 497 | self.makeOneStep(dep) catch |err| { |
| 498 | 498 | if (err == error.DependencyLoopDetected) { |
| 499 | | warn(" {s}\n", .{s.name}); |
| 499 | log.err(" {s}", .{s.name}); |
| 500 | 500 | } |
| 501 | 501 | return err; |
| 502 | 502 | }; |
| ... | ... | @@ -513,7 +513,7 @@ pub const Builder = struct { |
| 513 | 513 | return &top_level_step.step; |
| 514 | 514 | } |
| 515 | 515 | } |
| 516 | | warn("Cannot run step '{s}' because it does not exist\n", .{name}); |
| 516 | log.err("Cannot run step '{s}' because it does not exist", .{name}); |
| 517 | 517 | return error.InvalidStepName; |
| 518 | 518 | } |
| 519 | 519 | |
| ... | ... | @@ -553,32 +553,32 @@ pub const Builder = struct { |
| 553 | 553 | } else if (mem.eql(u8, s, "false")) { |
| 554 | 554 | return false; |
| 555 | 555 | } else { |
| 556 | | warn("Expected -D{s} to be a boolean, but received '{s}'\n\n", .{ name, s }); |
| 556 | log.err("Expected -D{s} to be a boolean, but received '{s}'\n", .{ name, s }); |
| 557 | 557 | self.markInvalidUserInput(); |
| 558 | 558 | return null; |
| 559 | 559 | } |
| 560 | 560 | }, |
| 561 | 561 | .list => { |
| 562 | | warn("Expected -D{s} to be a boolean, but received a list.\n\n", .{name}); |
| 562 | log.err("Expected -D{s} to be a boolean, but received a list.\n", .{name}); |
| 563 | 563 | self.markInvalidUserInput(); |
| 564 | 564 | return null; |
| 565 | 565 | }, |
| 566 | 566 | }, |
| 567 | 567 | .int => switch (option_ptr.value) { |
| 568 | 568 | .flag => { |
| 569 | | warn("Expected -D{s} to be an integer, but received a boolean.\n\n", .{name}); |
| 569 | log.err("Expected -D{s} to be an integer, but received a boolean.\n", .{name}); |
| 570 | 570 | self.markInvalidUserInput(); |
| 571 | 571 | return null; |
| 572 | 572 | }, |
| 573 | 573 | .scalar => |s| { |
| 574 | 574 | const n = std.fmt.parseInt(T, s, 10) catch |err| switch (err) { |
| 575 | 575 | error.Overflow => { |
| 576 | | warn("-D{s} value {s} cannot fit into type {s}.\n\n", .{ name, s, @typeName(T) }); |
| 576 | log.err("-D{s} value {s} cannot fit into type {s}.\n", .{ name, s, @typeName(T) }); |
| 577 | 577 | self.markInvalidUserInput(); |
| 578 | 578 | return null; |
| 579 | 579 | }, |
| 580 | 580 | else => { |
| 581 | | warn("Expected -D{s} to be an integer of type {s}.\n\n", .{ name, @typeName(T) }); |
| 581 | log.err("Expected -D{s} to be an integer of type {s}.\n", .{ name, @typeName(T) }); |
| 582 | 582 | self.markInvalidUserInput(); |
| 583 | 583 | return null; |
| 584 | 584 | }, |
| ... | ... | @@ -586,34 +586,34 @@ pub const Builder = struct { |
| 586 | 586 | return n; |
| 587 | 587 | }, |
| 588 | 588 | .list => { |
| 589 | | warn("Expected -D{s} to be an integer, but received a list.\n\n", .{name}); |
| 589 | log.err("Expected -D{s} to be an integer, but received a list.\n", .{name}); |
| 590 | 590 | self.markInvalidUserInput(); |
| 591 | 591 | return null; |
| 592 | 592 | }, |
| 593 | 593 | }, |
| 594 | 594 | .float => switch (option_ptr.value) { |
| 595 | 595 | .flag => { |
| 596 | | warn("Expected -D{s} to be a float, but received a boolean.\n\n", .{name}); |
| 596 | log.err("Expected -D{s} to be a float, but received a boolean.\n", .{name}); |
| 597 | 597 | self.markInvalidUserInput(); |
| 598 | 598 | return null; |
| 599 | 599 | }, |
| 600 | 600 | .scalar => |s| { |
| 601 | 601 | const n = std.fmt.parseFloat(T, s) catch { |
| 602 | | warn("Expected -D{s} to be a float of type {s}.\n\n", .{ name, @typeName(T) }); |
| 602 | log.err("Expected -D{s} to be a float of type {s}.\n", .{ name, @typeName(T) }); |
| 603 | 603 | self.markInvalidUserInput(); |
| 604 | 604 | return null; |
| 605 | 605 | }; |
| 606 | 606 | return n; |
| 607 | 607 | }, |
| 608 | 608 | .list => { |
| 609 | | warn("Expected -D{s} to be a float, but received a list.\n\n", .{name}); |
| 609 | log.err("Expected -D{s} to be a float, but received a list.\n", .{name}); |
| 610 | 610 | self.markInvalidUserInput(); |
| 611 | 611 | return null; |
| 612 | 612 | }, |
| 613 | 613 | }, |
| 614 | 614 | .@"enum" => switch (option_ptr.value) { |
| 615 | 615 | .flag => { |
| 616 | | warn("Expected -D{s} to be a string, but received a boolean.\n\n", .{name}); |
| 616 | log.err("Expected -D{s} to be a string, but received a boolean.\n", .{name}); |
| 617 | 617 | self.markInvalidUserInput(); |
| 618 | 618 | return null; |
| 619 | 619 | }, |
| ... | ... | @@ -621,25 +621,25 @@ pub const Builder = struct { |
| 621 | 621 | if (std.meta.stringToEnum(T, s)) |enum_lit| { |
| 622 | 622 | return enum_lit; |
| 623 | 623 | } else { |
| 624 | | warn("Expected -D{s} to be of type {s}.\n\n", .{ name, @typeName(T) }); |
| 624 | log.err("Expected -D{s} to be of type {s}.\n", .{ name, @typeName(T) }); |
| 625 | 625 | self.markInvalidUserInput(); |
| 626 | 626 | return null; |
| 627 | 627 | } |
| 628 | 628 | }, |
| 629 | 629 | .list => { |
| 630 | | warn("Expected -D{s} to be a string, but received a list.\n\n", .{name}); |
| 630 | log.err("Expected -D{s} to be a string, but received a list.\n", .{name}); |
| 631 | 631 | self.markInvalidUserInput(); |
| 632 | 632 | return null; |
| 633 | 633 | }, |
| 634 | 634 | }, |
| 635 | 635 | .string => switch (option_ptr.value) { |
| 636 | 636 | .flag => { |
| 637 | | warn("Expected -D{s} to be a string, but received a boolean.\n\n", .{name}); |
| 637 | log.err("Expected -D{s} to be a string, but received a boolean.\n", .{name}); |
| 638 | 638 | self.markInvalidUserInput(); |
| 639 | 639 | return null; |
| 640 | 640 | }, |
| 641 | 641 | .list => { |
| 642 | | warn("Expected -D{s} to be a string, but received a list.\n\n", .{name}); |
| 642 | log.err("Expected -D{s} to be a string, but received a list.\n", .{name}); |
| 643 | 643 | self.markInvalidUserInput(); |
| 644 | 644 | return null; |
| 645 | 645 | }, |
| ... | ... | @@ -647,7 +647,7 @@ pub const Builder = struct { |
| 647 | 647 | }, |
| 648 | 648 | .list => switch (option_ptr.value) { |
| 649 | 649 | .flag => { |
| 650 | | warn("Expected -D{s} to be a list, but received a boolean.\n\n", .{name}); |
| 650 | log.err("Expected -D{s} to be a list, but received a boolean.\n", .{name}); |
| 651 | 651 | self.markInvalidUserInput(); |
| 652 | 652 | return null; |
| 653 | 653 | }, |
| ... | ... | @@ -697,7 +697,7 @@ pub const Builder = struct { |
| 697 | 697 | else if (!release_fast and !release_safe and !release_small) |
| 698 | 698 | std.builtin.Mode.Debug |
| 699 | 699 | else x: { |
| 700 | | warn("Multiple release modes (of -Drelease-safe, -Drelease-fast and -Drelease-small)\n\n", .{}); |
| 700 | log.err("Multiple release modes (of -Drelease-safe, -Drelease-fast and -Drelease-small)\n", .{}); |
| 701 | 701 | self.markInvalidUserInput(); |
| 702 | 702 | break :x std.builtin.Mode.Debug; |
| 703 | 703 | }; |
| ... | ... | @@ -734,19 +734,18 @@ pub const Builder = struct { |
| 734 | 734 | .diagnostics = &diags, |
| 735 | 735 | }) catch |err| switch (err) { |
| 736 | 736 | error.UnknownCpuModel => { |
| 737 | | warn("Unknown CPU: '{s}'\nAvailable CPUs for architecture '{s}':\n", .{ |
| 737 | log.err("Unknown CPU: '{s}'\nAvailable CPUs for architecture '{s}':", .{ |
| 738 | 738 | diags.cpu_name.?, |
| 739 | 739 | @tagName(diags.arch.?), |
| 740 | 740 | }); |
| 741 | 741 | for (diags.arch.?.allCpuModels()) |cpu| { |
| 742 | | warn(" {s}\n", .{cpu.name}); |
| 742 | log.err(" {s}", .{cpu.name}); |
| 743 | 743 | } |
| 744 | | warn("\n", .{}); |
| 745 | 744 | self.markInvalidUserInput(); |
| 746 | 745 | return args.default_target; |
| 747 | 746 | }, |
| 748 | 747 | error.UnknownCpuFeature => { |
| 749 | | warn( |
| 748 | log.err( |
| 750 | 749 | \\Unknown CPU feature: '{s}' |
| 751 | 750 | \\Available CPU features for architecture '{s}': |
| 752 | 751 | \\ |
| ... | ... | @@ -755,27 +754,25 @@ pub const Builder = struct { |
| 755 | 754 | @tagName(diags.arch.?), |
| 756 | 755 | }); |
| 757 | 756 | for (diags.arch.?.allFeaturesList()) |feature| { |
| 758 | | warn(" {s}: {s}\n", .{ feature.name, feature.description }); |
| 757 | log.err(" {s}: {s}", .{ feature.name, feature.description }); |
| 759 | 758 | } |
| 760 | | warn("\n", .{}); |
| 761 | 759 | self.markInvalidUserInput(); |
| 762 | 760 | return args.default_target; |
| 763 | 761 | }, |
| 764 | 762 | error.UnknownOperatingSystem => { |
| 765 | | warn( |
| 763 | log.err( |
| 766 | 764 | \\Unknown OS: '{s}' |
| 767 | 765 | \\Available operating systems: |
| 768 | 766 | \\ |
| 769 | 767 | , .{diags.os_name}); |
| 770 | 768 | inline for (std.meta.fields(std.Target.Os.Tag)) |field| { |
| 771 | | warn(" {s}\n", .{field.name}); |
| 769 | log.err(" {s}", .{field.name}); |
| 772 | 770 | } |
| 773 | | warn("\n", .{}); |
| 774 | 771 | self.markInvalidUserInput(); |
| 775 | 772 | return args.default_target; |
| 776 | 773 | }, |
| 777 | 774 | else => |e| { |
| 778 | | warn("Unable to parse target '{s}': {s}\n\n", .{ triple, @errorName(e) }); |
| 775 | log.err("Unable to parse target '{s}': {s}\n", .{ triple, @errorName(e) }); |
| 779 | 776 | self.markInvalidUserInput(); |
| 780 | 777 | return args.default_target; |
| 781 | 778 | }, |
| ... | ... | @@ -805,22 +802,21 @@ pub const Builder = struct { |
| 805 | 802 | } |
| 806 | 803 | } |
| 807 | 804 | if (mismatch_triple) { |
| 808 | | warn("Chosen target '{s}' does not match one of the supported targets:\n", .{ |
| 805 | log.err("Chosen target '{s}' does not match one of the supported targets:", .{ |
| 809 | 806 | selected_canonicalized_triple, |
| 810 | 807 | }); |
| 811 | 808 | for (list) |t| { |
| 812 | 809 | const t_triple = t.zigTriple(self.allocator) catch unreachable; |
| 813 | | warn(" {s}\n", .{t_triple}); |
| 810 | log.err(" {s}", .{t_triple}); |
| 814 | 811 | } |
| 815 | | warn("\n", .{}); |
| 816 | 812 | } else { |
| 817 | 813 | assert(mismatch_cpu_features); |
| 818 | 814 | const whitelist_cpu = whitelist_item.getCpu(); |
| 819 | 815 | const selected_cpu = selected_target.getCpu(); |
| 820 | | warn("Chosen CPU model '{s}' does not match one of the supported targets:\n", .{ |
| 816 | log.err("Chosen CPU model '{s}' does not match one of the supported targets:", .{ |
| 821 | 817 | selected_cpu.model.name, |
| 822 | 818 | }); |
| 823 | | warn(" Supported feature Set: ", .{}); |
| 819 | log.err(" Supported feature Set: ", .{}); |
| 824 | 820 | const all_features = whitelist_cpu.arch.allFeaturesList(); |
| 825 | 821 | var populated_cpu_features = whitelist_cpu.model.features; |
| 826 | 822 | populated_cpu_features.populateDependencies(all_features); |
| ... | ... | @@ -828,20 +824,18 @@ pub const Builder = struct { |
| 828 | 824 | const i = @intCast(std.Target.Cpu.Feature.Set.Index, i_usize); |
| 829 | 825 | const in_cpu_set = populated_cpu_features.isEnabled(i); |
| 830 | 826 | if (in_cpu_set) { |
| 831 | | warn("{s} ", .{feature.name}); |
| 827 | log.err("{s} ", .{feature.name}); |
| 832 | 828 | } |
| 833 | 829 | } |
| 834 | | warn("\n", .{}); |
| 835 | | warn(" Remove: ", .{}); |
| 830 | log.err(" Remove: ", .{}); |
| 836 | 831 | for (all_features) |feature, i_usize| { |
| 837 | 832 | const i = @intCast(std.Target.Cpu.Feature.Set.Index, i_usize); |
| 838 | 833 | const in_cpu_set = populated_cpu_features.isEnabled(i); |
| 839 | 834 | const in_actual_set = selected_cpu.features.isEnabled(i); |
| 840 | 835 | if (in_actual_set and !in_cpu_set) { |
| 841 | | warn("{s} ", .{feature.name}); |
| 836 | log.err("{s} ", .{feature.name}); |
| 842 | 837 | } |
| 843 | 838 | } |
| 844 | | warn("\n", .{}); |
| 845 | 839 | } |
| 846 | 840 | self.markInvalidUserInput(); |
| 847 | 841 | return args.default_target; |
| ... | ... | @@ -886,7 +880,7 @@ pub const Builder = struct { |
| 886 | 880 | }) catch unreachable; |
| 887 | 881 | }, |
| 888 | 882 | .flag => { |
| 889 | | warn("Option '-D{s}={s}' conflicts with flag '-D{s}'.\n", .{ name, value, name }); |
| 883 | log.warn("Option '-D{s}={s}' conflicts with flag '-D{s}'.", .{ name, value, name }); |
| 890 | 884 | return true; |
| 891 | 885 | }, |
| 892 | 886 | } |
| ... | ... | @@ -908,11 +902,11 @@ pub const Builder = struct { |
| 908 | 902 | // option already exists |
| 909 | 903 | switch (gop.value_ptr.value) { |
| 910 | 904 | .scalar => |s| { |
| 911 | | warn("Flag '-D{s}' conflicts with option '-D{s}={s}'.\n", .{ name, name, s }); |
| 905 | log.err("Flag '-D{s}' conflicts with option '-D{s}={s}'.", .{ name, name, s }); |
| 912 | 906 | return true; |
| 913 | 907 | }, |
| 914 | 908 | .list => { |
| 915 | | warn("Flag '-D{s}' conflicts with multiple options of the same name.\n", .{name}); |
| 909 | log.err("Flag '-D{s}' conflicts with multiple options of the same name.", .{name}); |
| 916 | 910 | return true; |
| 917 | 911 | }, |
| 918 | 912 | .flag => {}, |
| ... | ... | @@ -943,7 +937,7 @@ pub const Builder = struct { |
| 943 | 937 | var it = self.user_input_options.iterator(); |
| 944 | 938 | while (it.next()) |entry| { |
| 945 | 939 | if (!entry.value_ptr.used) { |
| 946 | | warn("Invalid option: -D{s}\n\n", .{entry.key_ptr.*}); |
| 940 | log.err("Invalid option: -D{s}\n", .{entry.key_ptr.*}); |
| 947 | 941 | self.markInvalidUserInput(); |
| 948 | 942 | } |
| 949 | 943 | } |
| ... | ... | @@ -956,11 +950,11 @@ pub const Builder = struct { |
| 956 | 950 | } |
| 957 | 951 | |
| 958 | 952 | fn printCmd(cwd: ?[]const u8, argv: []const []const u8) void { |
| 959 | | if (cwd) |yes_cwd| warn("cd {s} && ", .{yes_cwd}); |
| 953 | if (cwd) |yes_cwd| std.debug.print("cd {s} && ", .{yes_cwd}); |
| 960 | 954 | for (argv) |arg| { |
| 961 | | warn("{s} ", .{arg}); |
| 955 | std.debug.print("{s} ", .{arg}); |
| 962 | 956 | } |
| 963 | | warn("\n", .{}); |
| 957 | std.debug.print("\n", .{}); |
| 964 | 958 | } |
| 965 | 959 | |
| 966 | 960 | pub fn spawnChildEnvMap(self: *Builder, cwd: ?[]const u8, env_map: *const EnvMap, argv: []const []const u8) !void { |
| ... | ... | @@ -976,20 +970,20 @@ pub const Builder = struct { |
| 976 | 970 | child.env_map = env_map; |
| 977 | 971 | |
| 978 | 972 | const term = child.spawnAndWait() catch |err| { |
| 979 | | warn("Unable to spawn {s}: {s}\n", .{ argv[0], @errorName(err) }); |
| 973 | log.err("Unable to spawn {s}: {s}", .{ argv[0], @errorName(err) }); |
| 980 | 974 | return err; |
| 981 | 975 | }; |
| 982 | 976 | |
| 983 | 977 | switch (term) { |
| 984 | 978 | .Exited => |code| { |
| 985 | 979 | if (code != 0) { |
| 986 | | warn("The following command exited with error code {}:\n", .{code}); |
| 980 | log.err("The following command exited with error code {}:", .{code}); |
| 987 | 981 | printCmd(cwd, argv); |
| 988 | 982 | return error.UncleanExit; |
| 989 | 983 | } |
| 990 | 984 | }, |
| 991 | 985 | else => { |
| 992 | | warn("The following command terminated unexpectedly:\n", .{}); |
| 986 | log.err("The following command terminated unexpectedly:", .{}); |
| 993 | 987 | printCmd(cwd, argv); |
| 994 | 988 | |
| 995 | 989 | return error.UncleanExit; |
| ... | ... | @@ -999,7 +993,7 @@ pub const Builder = struct { |
| 999 | 993 | |
| 1000 | 994 | pub fn makePath(self: *Builder, path: []const u8) !void { |
| 1001 | 995 | fs.cwd().makePath(self.pathFromRoot(path)) catch |err| { |
| 1002 | | warn("Unable to create path {s}: {s}\n", .{ path, @errorName(err) }); |
| 996 | log.err("Unable to create path {s}: {s}", .{ path, @errorName(err) }); |
| 1003 | 997 | return err; |
| 1004 | 998 | }; |
| 1005 | 999 | } |
| ... | ... | @@ -1087,19 +1081,19 @@ pub const Builder = struct { |
| 1087 | 1081 | |
| 1088 | 1082 | pub fn updateFile(self: *Builder, source_path: []const u8, dest_path: []const u8) !void { |
| 1089 | 1083 | if (self.verbose) { |
| 1090 | | warn("cp {s} {s} ", .{ source_path, dest_path }); |
| 1084 | log.info("cp {s} {s} ", .{ source_path, dest_path }); |
| 1091 | 1085 | } |
| 1092 | 1086 | const cwd = fs.cwd(); |
| 1093 | 1087 | const prev_status = try fs.Dir.updateFile(cwd, source_path, cwd, dest_path, .{}); |
| 1094 | 1088 | if (self.verbose) switch (prev_status) { |
| 1095 | | .stale => warn("# installed\n", .{}), |
| 1096 | | .fresh => warn("# up-to-date\n", .{}), |
| 1089 | .stale => log.info("# installed", .{}), |
| 1090 | .fresh => log.info("# up-to-date", .{}), |
| 1097 | 1091 | }; |
| 1098 | 1092 | } |
| 1099 | 1093 | |
| 1100 | 1094 | pub fn truncateFile(self: *Builder, dest_path: []const u8) !void { |
| 1101 | 1095 | if (self.verbose) { |
| 1102 | | warn("truncate {s}\n", .{dest_path}); |
| 1096 | log.info("truncate {s}", .{dest_path}); |
| 1103 | 1097 | } |
| 1104 | 1098 | const cwd = fs.cwd(); |
| 1105 | 1099 | var src_file = cwd.createFile(dest_path, .{}) catch |err| switch (err) { |
| ... | ... | @@ -1222,8 +1216,8 @@ pub const Builder = struct { |
| 1222 | 1216 | } |
| 1223 | 1217 | |
| 1224 | 1218 | if (!std.process.can_spawn) { |
| 1225 | | if (src_step) |s| warn("{s}...", .{s.name}); |
| 1226 | | warn("Unable to spawn the following command: cannot spawn child process\n", .{}); |
| 1219 | if (src_step) |s| log.err("{s}...", .{s.name}); |
| 1220 | log.err("Unable to spawn the following command: cannot spawn child process", .{}); |
| 1227 | 1221 | printCmd(null, argv); |
| 1228 | 1222 | std.os.abort(); |
| 1229 | 1223 | } |
| ... | ... | @@ -1231,31 +1225,31 @@ pub const Builder = struct { |
| 1231 | 1225 | var code: u8 = undefined; |
| 1232 | 1226 | return self.execAllowFail(argv, &code, .Inherit) catch |err| switch (err) { |
| 1233 | 1227 | error.ExecNotSupported => { |
| 1234 | | if (src_step) |s| warn("{s}...", .{s.name}); |
| 1235 | | warn("Unable to spawn the following command: cannot spawn child process\n", .{}); |
| 1228 | if (src_step) |s| log.err("{s}...", .{s.name}); |
| 1229 | log.err("Unable to spawn the following command: cannot spawn child process", .{}); |
| 1236 | 1230 | printCmd(null, argv); |
| 1237 | 1231 | std.os.abort(); |
| 1238 | 1232 | }, |
| 1239 | 1233 | error.FileNotFound => { |
| 1240 | | if (src_step) |s| warn("{s}...", .{s.name}); |
| 1241 | | warn("Unable to spawn the following command: file not found\n", .{}); |
| 1234 | if (src_step) |s| log.err("{s}...", .{s.name}); |
| 1235 | log.err("Unable to spawn the following command: file not found", .{}); |
| 1242 | 1236 | printCmd(null, argv); |
| 1243 | 1237 | std.os.exit(@truncate(u8, code)); |
| 1244 | 1238 | }, |
| 1245 | 1239 | error.ExitCodeFailure => { |
| 1246 | | if (src_step) |s| warn("{s}...", .{s.name}); |
| 1240 | if (src_step) |s| log.err("{s}...", .{s.name}); |
| 1247 | 1241 | if (self.prominent_compile_errors) { |
| 1248 | | warn("The step exited with error code {d}\n", .{code}); |
| 1242 | log.err("The step exited with error code {d}", .{code}); |
| 1249 | 1243 | } else { |
| 1250 | | warn("The following command exited with error code {d}:\n", .{code}); |
| 1244 | log.err("The following command exited with error code {d}:", .{code}); |
| 1251 | 1245 | printCmd(null, argv); |
| 1252 | 1246 | } |
| 1253 | 1247 | |
| 1254 | 1248 | std.os.exit(@truncate(u8, code)); |
| 1255 | 1249 | }, |
| 1256 | 1250 | error.ProcessTerminated => { |
| 1257 | | if (src_step) |s| warn("{s}...", .{s.name}); |
| 1258 | | warn("The following command terminated unexpectedly:\n", .{}); |
| 1251 | if (src_step) |s| log.err("{s}...", .{s.name}); |
| 1252 | log.err("The following command terminated unexpectedly:", .{}); |
| 1259 | 1253 | printCmd(null, argv); |
| 1260 | 1254 | std.os.exit(@truncate(u8, code)); |
| 1261 | 1255 | }, |
| ... | ... | @@ -2140,7 +2134,7 @@ pub const LibExeObjStep = struct { |
| 2140 | 2134 | } else if (mem.startsWith(u8, tok, "-D")) { |
| 2141 | 2135 | try zig_args.append(tok); |
| 2142 | 2136 | } else if (self.builder.verbose) { |
| 2143 | | warn("Ignoring pkg-config flag '{s}'\n", .{tok}); |
| 2137 | log.warn("Ignoring pkg-config flag '{s}'", .{tok}); |
| 2144 | 2138 | } |
| 2145 | 2139 | } |
| 2146 | 2140 | |
| ... | ... | @@ -2435,7 +2429,7 @@ pub const LibExeObjStep = struct { |
| 2435 | 2429 | const builder = self.builder; |
| 2436 | 2430 | |
| 2437 | 2431 | if (self.root_src == null and self.link_objects.items.len == 0) { |
| 2438 | | warn("{s}: linker needs 1 or more objects to link\n", .{self.step.name}); |
| 2432 | log.err("{s}: linker needs 1 or more objects to link", .{self.step.name}); |
| 2439 | 2433 | return error.NeedAnObject; |
| 2440 | 2434 | } |
| 2441 | 2435 | |
| ... | ... | @@ -2558,7 +2552,7 @@ pub const LibExeObjStep = struct { |
| 2558 | 2552 | if (system_lib.needed) break :prefix "-needed-l"; |
| 2559 | 2553 | if (system_lib.weak) { |
| 2560 | 2554 | if (self.target.isDarwin()) break :prefix "-weak-l"; |
| 2561 | | warn("Weak library import used for a non-darwin target, this will be converted to normally library import `-lname`\n", .{}); |
| 2555 | log.warn("Weak library import used for a non-darwin target, this will be converted to normally library import `-lname`", .{}); |
| 2562 | 2556 | } |
| 2563 | 2557 | break :prefix "-l"; |
| 2564 | 2558 | }; |
| ... | ... | @@ -3078,11 +3072,11 @@ pub const LibExeObjStep = struct { |
| 3078 | 3072 | } |
| 3079 | 3073 | } else { |
| 3080 | 3074 | if (self.framework_dirs.items.len > 0) { |
| 3081 | | warn("Framework directories have been added for a non-darwin target, this will have no affect on the build\n", .{}); |
| 3075 | log.info("Framework directories have been added for a non-darwin target, this will have no affect on the build", .{}); |
| 3082 | 3076 | } |
| 3083 | 3077 | |
| 3084 | 3078 | if (self.frameworks.count() > 0) { |
| 3085 | | warn("Frameworks have been added for a non-darwin target, this will have no affect on the build\n", .{}); |
| 3079 | log.info("Frameworks have been added for a non-darwin target, this will have no affect on the build", .{}); |
| 3086 | 3080 | } |
| 3087 | 3081 | } |
| 3088 | 3082 | |
| ... | ... | @@ -3530,7 +3524,7 @@ pub const LogStep = struct { |
| 3530 | 3524 | |
| 3531 | 3525 | fn make(step: *Step) anyerror!void { |
| 3532 | 3526 | const self = @fieldParentPtr(LogStep, "step", step); |
| 3533 | | warn("{s}", .{self.data}); |
| 3527 | log.info("{s}", .{self.data}); |
| 3534 | 3528 | } |
| 3535 | 3529 | }; |
| 3536 | 3530 | |
| ... | ... | @@ -3554,7 +3548,7 @@ pub const RemoveDirStep = struct { |
| 3554 | 3548 | |
| 3555 | 3549 | const full_path = self.builder.pathFromRoot(self.dir_path); |
| 3556 | 3550 | fs.cwd().deleteTree(full_path) catch |err| { |
| 3557 | | warn("Unable to remove {s}: {s}\n", .{ full_path, @errorName(err) }); |
| 3551 | log.err("Unable to remove {s}: {s}", .{ full_path, @errorName(err) }); |
| 3558 | 3552 | return err; |
| 3559 | 3553 | }; |
| 3560 | 3554 | } |
| ... | ... | @@ -3639,7 +3633,7 @@ fn doAtomicSymLinks(allocator: Allocator, output_path: []const u8, filename_majo |
| 3639 | 3633 | &[_][]const u8{ out_dir, filename_major_only }, |
| 3640 | 3634 | ) catch unreachable; |
| 3641 | 3635 | fs.atomicSymLink(allocator, out_basename, major_only_path) catch |err| { |
| 3642 | | warn("Unable to symlink {s} -> {s}\n", .{ major_only_path, out_basename }); |
| 3636 | log.err("Unable to symlink {s} -> {s}", .{ major_only_path, out_basename }); |
| 3643 | 3637 | return err; |
| 3644 | 3638 | }; |
| 3645 | 3639 | // sym link for libfoo.so to libfoo.so.1 |
| ... | ... | @@ -3648,7 +3642,7 @@ fn doAtomicSymLinks(allocator: Allocator, output_path: []const u8, filename_majo |
| 3648 | 3642 | &[_][]const u8{ out_dir, filename_name_only }, |
| 3649 | 3643 | ) catch unreachable; |
| 3650 | 3644 | fs.atomicSymLink(allocator, filename_major_only, name_only_path) catch |err| { |
| 3651 | | warn("Unable to symlink {s} -> {s}\n", .{ name_only_path, filename_major_only }); |
| 3645 | log.err("Unable to symlink {s} -> {s}", .{ name_only_path, filename_major_only }); |
| 3652 | 3646 | return err; |
| 3653 | 3647 | }; |
| 3654 | 3648 | } |