Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

take away EmitOption.emit_to option and make it give a FileSource #14971

Closed
Tracked by #14647
andrewrk opened this issue Mar 17, 2023 · 1 comment
Closed
Tracked by #14647

take away EmitOption.emit_to option and make it give a FileSource #14971

andrewrk opened this issue Mar 17, 2023 · 1 comment
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@andrewrk
Copy link
Member

Extracted from #14647.

emit_analysis: EmitOption = .default,
emit_asm: EmitOption = .default,
emit_bin: EmitOption = .default,
emit_docs: EmitOption = .default,
emit_implib: EmitOption = .default,
emit_llvm_bc: EmitOption = .default,
emit_llvm_ir: EmitOption = .default,
// Lots of things depend on emit_h having a consistent path,
// so it is not an EmitOption for now.
emit_h: bool = false,

pub const EmitOption = union(enum) {
default: void,
no_emit: void,
emit: void,
emit_to: []const u8,
fn getArg(self: @This(), b: *std.Build, arg_name: []const u8) ?[]const u8 {
return switch (self) {
.no_emit => b.fmt("-fno-{s}", .{arg_name}),
.default => null,
.emit => b.fmt("-f{s}", .{arg_name}),
.emit_to => |path| b.fmt("-f{s}={s}", .{ arg_name, path }),
};
}
};

All of these, including emit_h, will no longer have the option to specify an output path, same as #14951. Instead, the two choices will be null, or providing a FileSource to interact with the rest of the build system. The zig compiler itself will only ever see -femit-foo or -fno-emit-foo. It will always put the artifact in the cache directory, and the build script must rely on other steps that interact with FileSource to do anything with the artifacts.

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. breaking Implementing this issue could cause existing code to no longer compile or have different behavior. zig build system std.Build, the build runner, `zig build` subcommand, package management labels Mar 17, 2023
@andrewrk andrewrk added this to the 0.11.0 milestone Mar 17, 2023
@RossComputerGuy
Copy link
Contributor

Is there anything blocking this? If not, I'm willing to implement this in the same PR I am working on for #15156.

@andrewrk andrewrk modified the milestones: 0.11.0, 0.12.0 Jul 24, 2023
ikskuh pushed a commit to ikskuh/zig that referenced this issue Jul 25, 2023
ikskuh pushed a commit to ikskuh/zig that referenced this issue Jul 25, 2023
ikskuh pushed a commit to ikskuh/zig that referenced this issue Jul 26, 2023
ikskuh pushed a commit to ikskuh/zig that referenced this issue Jul 26, 2023
@andrewrk andrewrk modified the milestones: 0.12.0, 0.11.0 Jul 31, 2023
QusaiHroub pushed a commit to QusaiHroub/zig that referenced this issue Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

No branches or pull requests

2 participants