Skip to content
Snippets Groups Projects
Commit b6a00125 authored by rnystrom@google.com's avatar rnystrom@google.com Committed by Natalie Weizenbaum
Browse files

Parse the repo's version file when running from the repo.

R=nweiz@google.com

Review URL: https://codereview.chromium.org//572053002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@40381 260f80e4-7a28-3924-810f-c04153c831b5
parent 53ee254d
No related branches found
No related tags found
No related merge requests found
......@@ -39,8 +39,36 @@ Version _getVersion() {
var sdkVersion = Platform.environment["_PUB_TEST_SDK_VERSION"];
if (sdkVersion != null) return new Version.parse(sdkVersion);
// Read the "version" file.
var revisionPath = path.join(_rootDirectory, "version");
var version = readTextFile(revisionPath).trim();
if (runningFromSdk) {
// Read the "version" file.
var version = readTextFile(path.join(_rootDirectory, "version")).trim();
return new Version.parse(version);
}
// When running from the repo, read the canonical VERSION file in tools/.
// This makes it possible to run pub without having built the SDK first.
var contents = readTextFile(path.join(repoRoot, "tools/VERSION"));
parseField(name) {
var pattern = new RegExp("^$name ([a-z0-9]+)", multiLine: true);
var match = pattern.firstMatch(contents);
return match[1];
}
var channel = parseField("CHANNEL");
var major = parseField("MAJOR");
var minor = parseField("MINOR");
var patch = parseField("PATCH");
var prerelease = parseField("PRERELEASE");
var prereleasePatch = parseField("PRERELEASE_PATCH");
var version = "$major.$minor.$patch";
if (channel == "be") {
// TODO(rnystrom): tools/utils.py includes the svn commit here. Should we?
version += "-edge";
} else if (channel == "dev") {
version += "-dev.$prerelease.$prereleasePatch";
}
return new Version.parse(version);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment