| ... | ... | @@ -1808,6 +1808,29 @@ pub const LibExeObjStep = struct { |
| 1808 | 1808 | } |
| 1809 | 1809 | return; |
| 1810 | 1810 | }, |
| 1811 | std.SemanticVersion => { |
| 1812 | out.print( |
| 1813 | \\pub const {z}: @import("std").SemanticVersion = .{{ |
| 1814 | \\ .major = {d}, |
| 1815 | \\ .minor = {d}, |
| 1816 | \\ .patch = {d}, |
| 1817 | \\ |
| 1818 | , .{ |
| 1819 | name, |
| 1820 | |
| 1821 | value.major, |
| 1822 | value.minor, |
| 1823 | value.patch, |
| 1824 | }) catch unreachable; |
| 1825 | if (value.pre) |some| { |
| 1826 | out.print(" .pre = \"{Z}\",\n", .{some}) catch unreachable; |
| 1827 | } |
| 1828 | if (value.build) |some| { |
| 1829 | out.print(" .build = \"{Z}\",\n", .{some}) catch unreachable; |
| 1830 | } |
| 1831 | out.writeAll("};\n") catch unreachable; |
| 1832 | return; |
| 1833 | }, |
| 1811 | 1834 | else => {}, |
| 1812 | 1835 | } |
| 1813 | 1836 | switch (@typeInfo(T)) { |
| ... | ... | @@ -2774,12 +2797,20 @@ test "LibExeObjStep.addBuildOption" { |
| 2774 | 2797 | exe.addBuildOption(?usize, "option2", null); |
| 2775 | 2798 | exe.addBuildOption([]const u8, "string", "zigisthebest"); |
| 2776 | 2799 | exe.addBuildOption(?[]const u8, "optional_string", null); |
| 2800 | exe.addBuildOption(std.SemanticVersion, "semantic_version", try std.SemanticVersion.parse("0.1.2-foo+bar")); |
| 2777 | 2801 | |
| 2778 | 2802 | std.testing.expectEqualStrings( |
| 2779 | 2803 | \\pub const option1: usize = 1; |
| 2780 | 2804 | \\pub const option2: ?usize = null; |
| 2781 | 2805 | \\pub const string: []const u8 = "zigisthebest"; |
| 2782 | 2806 | \\pub const optional_string: ?[]const u8 = null; |
| 2807 | \\pub const semantic_version: @import("std").SemanticVersion = .{ |
| 2808 | \\ .major = 0, |
| 2809 | \\ .minor = 1, |
| 2810 | \\ .patch = 2, |
| 2811 | \\ .pre = "foo", |
| 2812 | \\ .build = "bar", |
| 2813 | \\}; |
| 2783 | 2814 | \\ |
| 2784 | 2815 | , exe.build_options_contents.items); |
| 2785 | 2816 | } |