-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use shared stage0 parser from
build_helper
Signed-off-by: onur-ozkan <[email protected]>
- Loading branch information
1 parent
f2d50b6
commit b46c3f2
Showing
7 changed files
with
120 additions
and
141 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ pub mod ci; | |
pub mod git; | ||
pub mod metrics; | ||
pub mod util; | ||
pub mod stage0_parser; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
use std::collections::BTreeMap; | ||
|
||
#[derive(Default, Clone)] | ||
pub struct Stage0 { | ||
pub compiler: VersionMetadata, | ||
pub rustfmt: Option<VersionMetadata>, | ||
pub config: Stage0Config, | ||
pub checksums_sha256: BTreeMap<String, String>, | ||
} | ||
|
||
#[derive(Default, Clone)] | ||
pub struct VersionMetadata { | ||
pub date: String, | ||
pub version: String, | ||
} | ||
|
||
#[derive(Default, Clone)] | ||
pub struct Stage0Config { | ||
pub dist_server: String, | ||
pub artifacts_server: String, | ||
pub artifacts_with_llvm_assertions_server: String, | ||
pub git_merge_commit_email: String, | ||
pub git_repository: String, | ||
pub nightly_branch: String, | ||
} | ||
|
||
pub fn parse_stage0_file() -> Stage0 { | ||
let stage0_content = include_str!("../../../stage0"); | ||
|
||
let mut stage0 = Stage0::default(); | ||
for line in stage0_content.lines() { | ||
let line = line.trim(); | ||
|
||
if line.is_empty() { | ||
continue; | ||
} | ||
|
||
// Ignore comments | ||
if line.starts_with('#') { | ||
continue; | ||
} | ||
|
||
let (key, value) = line.split_once('=').unwrap(); | ||
|
||
match key { | ||
"dist_server" => stage0.config.dist_server = value.to_owned(), | ||
"artifacts_server" => stage0.config.artifacts_server = value.to_owned(), | ||
"artifacts_with_llvm_assertions_server" => { | ||
stage0.config.artifacts_with_llvm_assertions_server = value.to_owned() | ||
} | ||
"git_merge_commit_email" => stage0.config.git_merge_commit_email = value.to_owned(), | ||
"git_repository" => stage0.config.git_repository = value.to_owned(), | ||
"nightly_branch" => stage0.config.nightly_branch = value.to_owned(), | ||
|
||
"compiler_date" => stage0.compiler.date = value.to_owned(), | ||
"compiler_version" => stage0.compiler.version = value.to_owned(), | ||
|
||
"rustfmt_date" => { | ||
stage0.rustfmt.get_or_insert(VersionMetadata::default()).date = value.to_owned(); | ||
} | ||
"rustfmt_version" => { | ||
stage0.rustfmt.get_or_insert(VersionMetadata::default()).version = value.to_owned(); | ||
} | ||
|
||
dist if dist.starts_with("dist") => { | ||
stage0.checksums_sha256.insert(key.to_owned(), value.to_owned()); | ||
} | ||
|
||
unsupported => { | ||
println!("'{unsupported}' field is not supported."); | ||
} | ||
} | ||
} | ||
|
||
stage0 | ||
} |
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
Oops, something went wrong.