Skip to content

Commit 80b43c0

Browse files
committed
rustbuild: Add version info to channel.rs
Now that the makefiles are gone this is the new source of truth for all versioning of releases!
1 parent 59e0312 commit 80b43c0

File tree

1 file changed

+15
-25
lines changed

1 file changed

+15
-25
lines changed

src/bootstrap/channel.rs

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,55 +15,45 @@
1515
//! `package_vers`, and otherwise indicating to the compiler what it should
1616
//! print out as part of its version information.
1717
18-
use std::fs::File;
19-
use std::io::prelude::*;
2018
use std::process::Command;
2119

2220
use build_helper::output;
2321

2422
use Build;
2523

26-
pub fn collect(build: &mut Build) {
27-
// Currently the canonical source for the release number (e.g. 1.10.0) and
28-
// the prerelease version (e.g. `.1`) is in `mk/main.mk`. We "parse" that
29-
// here to learn about those numbers.
30-
let mut main_mk = String::new();
31-
t!(t!(File::open(build.src.join("mk/main.mk"))).read_to_string(&mut main_mk));
32-
let mut release_num = "";
33-
let mut prerelease_version = "";
34-
for line in main_mk.lines() {
35-
if line.starts_with("CFG_RELEASE_NUM") {
36-
release_num = line.split('=').skip(1).next().unwrap().trim();
37-
}
38-
if line.starts_with("CFG_PRERELEASE_VERSION") {
39-
prerelease_version = line.split('=').skip(1).next().unwrap().trim();
40-
}
41-
}
24+
// The version number
25+
const CFG_RELEASE_NUM: &'static str = "1.17.0";
26+
27+
// An optional number to put after the label, e.g. '.2' -> '-beta.2'
28+
// Be sure to make this starts with a dot to conform to semver pre-release
29+
// versions (section 9)
30+
const CFG_PRERELEASE_VERSION: &'static str = ".1";
4231

43-
build.release_num = release_num.to_string();
44-
build.prerelease_version = release_num.to_string();
32+
pub fn collect(build: &mut Build) {
33+
build.release_num = CFG_RELEASE_NUM.to_string();
34+
build.prerelease_version = CFG_RELEASE_NUM.to_string();
4535

4636
// Depending on the channel, passed in `./configure --release-channel`,
4737
// determine various properties of the build.
4838
match &build.config.channel[..] {
4939
"stable" => {
50-
build.release = release_num.to_string();
40+
build.release = CFG_RELEASE_NUM.to_string();
5141
build.package_vers = build.release.clone();
5242
build.unstable_features = false;
5343
}
5444
"beta" => {
55-
build.release = format!("{}-beta{}", release_num,
56-
prerelease_version);
45+
build.release = format!("{}-beta{}", CFG_RELEASE_NUM,
46+
CFG_PRERELEASE_VERSION);
5747
build.package_vers = "beta".to_string();
5848
build.unstable_features = false;
5949
}
6050
"nightly" => {
61-
build.release = format!("{}-nightly", release_num);
51+
build.release = format!("{}-nightly", CFG_RELEASE_NUM);
6252
build.package_vers = "nightly".to_string();
6353
build.unstable_features = true;
6454
}
6555
_ => {
66-
build.release = format!("{}-dev", release_num);
56+
build.release = format!("{}-dev", CFG_RELEASE_NUM);
6757
build.package_vers = build.release.clone();
6858
build.unstable_features = true;
6959
}

0 commit comments

Comments
 (0)