| ... | @@ -11,14 +11,14 @@ const Configuration = std.Build.Configuration; | ... | @@ -11,14 +11,14 @@ const Configuration = std.Build.Configuration; |
| 11 | | 11 | |
| 12 | step: Step, | 12 | step: Step, |
| 13 | generated_file: Configuration.GeneratedFileIndex, | 13 | generated_file: Configuration.GeneratedFileIndex, |
| 14 | contents: std.ArrayList(u8), | 14 | contents: std.ArrayList(u8) = .empty, |
| 15 | args: std.ArrayList(Arg), | 15 | args: std.ArrayList(Arg) = .empty, |
| 16 | encountered_types: std.StringHashMapUnmanaged(void), | 16 | encountered_types: std.StringHashMapUnmanaged(void), |
| 17 | | 17 | |
| 18 | pub const base_tag: Step.Tag = .options; | 18 | pub const base_tag: Step.Tag = .options; |
| 19 | | 19 | |
| 20 | pub const Arg = struct { | 20 | pub const Arg = struct { |
| 21 | name: []const u8, | 21 | name: Configuration.String, |
| 22 | path: LazyPath, | 22 | path: LazyPath, |
| 23 | }; | 23 | }; |
| 24 | | 24 | |
| ... | @@ -34,8 +34,6 @@ pub fn create(owner: *std.Build) *Options { | ... | @@ -34,8 +34,6 @@ pub fn create(owner: *std.Build) *Options { |
| 34 | .owner = owner, | 34 | .owner = owner, |
| 35 | }), | 35 | }), |
| 36 | .generated_file = graph.addGeneratedFile(&options.step), | 36 | .generated_file = graph.addGeneratedFile(&options.step), |
| 37 | .contents = .empty, | | |
| 38 | .args = .empty, | | |
| 39 | .encountered_types = .empty, | 37 | .encountered_types = .empty, |
| 40 | }; | 38 | }; |
| 41 | | 39 | |
| ... | @@ -416,16 +414,14 @@ fn printStructValue( | ... | @@ -416,16 +414,14 @@ fn printStructValue( |
| 416 | } | 414 | } |
| 417 | } | 415 | } |
| 418 | | 416 | |
| 419 | /// The value is the path in the cache dir. | 417 | /// The added option has type `[]const u8` and value of the provided path. |
| 420 | /// Adds a dependency automatically. | 418 | pub fn addOptionPath(options: *Options, name: []const u8, path: LazyPath) void { |
| 421 | pub fn addOptionPath( | 419 | const graph = options.step.owner.graph; |
| 422 | options: *Options, | 420 | const arena = graph.arena; |
| 423 | name: []const u8, | 421 | const wc = &graph.wip_configuration; |
| 424 | path: LazyPath, | 422 | |
| 425 | ) void { | | |
| 426 | const arena = options.step.owner.allocator; | | |
| 427 | options.args.append(arena, .{ | 423 | options.args.append(arena, .{ |
| 428 | .name = options.step.owner.dupe(name), | 424 | .name = try wc.addString(name), |
| 429 | .path = path.dupe(options.step.owner), | 425 | .path = path.dupe(options.step.owner), |
| 430 | }) catch @panic("OOM"); | 426 | }) catch @panic("OOM"); |
| 431 | path.addStepDependencies(&options.step); | 427 | path.addStepDependencies(&options.step); |