| ... | ... | @@ -1805,6 +1805,29 @@ pub const LibExeObjStep = struct { |
| 1805 | 1805 | } |
| 1806 | 1806 | return; |
| 1807 | 1807 | }, |
| 1808 | std.SemanticVersion => { |
| 1809 | out.print( |
| 1810 | \\pub const {z}: @import("std").SemanticVersion = .{{ |
| 1811 | \\ .major = {d}, |
| 1812 | \\ .minor = {d}, |
| 1813 | \\ .patch = {d}, |
| 1814 | \\ |
| 1815 | , .{ |
| 1816 | name, |
| 1817 | |
| 1818 | value.major, |
| 1819 | value.minor, |
| 1820 | value.patch, |
| 1821 | }) catch unreachable; |
| 1822 | if (value.pre) |some| { |
| 1823 | out.print(" .pre = \"{Z}\",\n", .{some}) catch unreachable; |
| 1824 | } |
| 1825 | if (value.build) |some| { |
| 1826 | out.print(" .build = \"{Z}\",\n", .{some}) catch unreachable; |
| 1827 | } |
| 1828 | out.writeAll("};\n") catch unreachable; |
| 1829 | return; |
| 1830 | }, |
| 1808 | 1831 | else => {}, |
| 1809 | 1832 | } |
| 1810 | 1833 | switch (@typeInfo(T)) { |
| ... | ... | @@ -2763,12 +2786,20 @@ test "LibExeObjStep.addBuildOption" { |
| 2763 | 2786 | exe.addBuildOption(?usize, "option2", null); |
| 2764 | 2787 | exe.addBuildOption([]const u8, "string", "zigisthebest"); |
| 2765 | 2788 | exe.addBuildOption(?[]const u8, "optional_string", null); |
| 2789 | exe.addBuildOption(std.SemanticVersion, "semantic_version", try std.SemanticVersion.parse("0.1.2-foo+bar")); |
| 2766 | 2790 | |
| 2767 | 2791 | std.testing.expectEqualStrings( |
| 2768 | 2792 | \\pub const option1: usize = 1; |
| 2769 | 2793 | \\pub const option2: ?usize = null; |
| 2770 | 2794 | \\pub const string: []const u8 = "zigisthebest"; |
| 2771 | 2795 | \\pub const optional_string: ?[]const u8 = null; |
| 2796 | \\pub const semantic_version: @import("std").SemanticVersion = .{ |
| 2797 | \\ .major = 0, |
| 2798 | \\ .minor = 1, |
| 2799 | \\ .patch = 2, |
| 2800 | \\ .pre = "foo", |
| 2801 | \\ .build = "bar", |
| 2802 | \\}; |
| 2772 | 2803 | \\ |
| 2773 | 2804 | , exe.build_options_contents.items); |
| 2774 | 2805 | } |