-
-
Notifications
You must be signed in to change notification settings - Fork 298
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
Multiple build runners #1411
Merged
Merged
Multiple build runners #1411
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
leecannon
force-pushed
the
multiple_build_runners
branch
4 times, most recently
from
August 17, 2023 22:12
0c3598f
to
f75b8ff
Compare
leecannon
force-pushed
the
multiple_build_runners
branch
2 times, most recently
from
August 17, 2023 22:17
5db0a91
to
4f2017d
Compare
Techatrix
requested changes
Aug 19, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want, you can apply this patch to simplify the logic in BuildRunnerVersion.zig
I guess you did this because you didn't want to have the patch version in the enum but adding it in makes it so much simpler.
diff --git a/src/build_runner/0.10.zig b/src/build_runner/0.10.0.zig
similarity index 100%
rename from src/build_runner/0.10.zig
rename to src/build_runner/0.10.0.zig
diff --git a/src/build_runner/0.11.zig b/src/build_runner/0.11.0.zig
similarity index 100%
rename from src/build_runner/0.11.zig
rename to src/build_runner/0.11.0.zig
diff --git a/src/build_runner/BuildRunnerVersion.zig b/src/build_runner/BuildRunnerVersion.zig
index 7a2028a..24ef916 100644
--- a/src/build_runner/BuildRunnerVersion.zig
+++ b/src/build_runner/BuildRunnerVersion.zig
@@ -5,8 +5,8 @@ const build_options = @import("build_options");
// There should be no need to have a build runner for minor patches (e.g. 0.10.1)
pub const BuildRunnerVersion = enum {
master,
- @"0.11",
- @"0.10",
+ @"0.11.0",
+ @"0.10.0",
pub fn selectBuildRunnerVersion(runtime_zig_version: std.SemanticVersion) BuildRunnerVersion {
const runtime_zig_version_simple = std.SemanticVersion{
@@ -23,44 +23,18 @@ pub const BuildRunnerVersion = enum {
return switch (runtime_zig_version_simple.order(zls_version_simple)) {
.eq, .gt => .master,
.lt => blk: {
- const build_runners = BuildRunnerVersion.non_master_build_runners;
-
- for (build_runners) |build_runner| {
- switch (runtime_zig_version.order(build_runner.version)) {
- .eq, .gt => break :blk build_runner.tag,
+ const available_versions = std.meta.tags(BuildRunnerVersion);
+ for (available_versions[1..]) |build_runner_version| {
+ const version = std.SemanticVersion.parse(@tagName(build_runner_version)) catch unreachable;
+ switch (runtime_zig_version.order(version)) {
+ .eq, .gt => break :blk build_runner_version,
.lt => {},
}
}
// failed to find compatible build runner, falling back to oldest supported version
- break :blk BuildRunnerVersion.oldest_version;
+ break :blk available_versions[available_versions.len - 1];
},
};
}
-
- const oldest_version = blk: {
- const tags = std.meta.tags(BuildRunnerVersion);
- break :blk tags[tags.len - 1];
- };
-
- const NonMasterBuildRunner = struct { tag: BuildRunnerVersion, version: std.SemanticVersion };
-
- const non_master_build_runners = blk: {
- const tags = std.meta.tags(BuildRunnerVersion);
-
- var build_runners: [tags.len - 1]NonMasterBuildRunner = .{};
-
- var i: usize = 0;
-
- for (tags) |tag| {
- if (tag == .master) continue;
- build_runners[i] = .{
- .tag = tag,
- .version = std.SemanticVersion.parse(@tagName(tag) ++ ".0") catch unreachable,
- };
- i += 1;
- }
-
- break :blk build_runners;
- };
};
leecannon
force-pushed
the
multiple_build_runners
branch
from
August 19, 2023 21:23
4f2017d
to
8528903
Compare
leecannon
force-pushed
the
multiple_build_runners
branch
from
August 19, 2023 21:25
8528903
to
3b89d3b
Compare
Techatrix
approved these changes
Aug 19, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR uses a different build runner based on the runtime zig version.
This is not exactly aligned with the decision in #1020 but the maintenance burden to do this is not large:
build_runner/master.zig
for that release and update thebuild_runner/BuildRunnerVersion.zig
enum.build_runner/BuildConfig.zig
) then the older build runners will need to be updated to match the json format.Fixes #1396