Disable SDK constraint checking on bleeding edge.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21773 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
rnystrom@google.com 2013-04-19 21:13:08 +00:00
parent b24dbd7941
commit 76cc853f06
4 changed files with 34 additions and 2 deletions

View file

@ -37,6 +37,12 @@ String get rootDirectory {
/// Gets the SDK's revision number formatted to be a semantic version.
Version version = _getVersion();
/// Is `true` if the current SDK is an unreleased bleeding edge version.
bool get isBleedingEdge {
// The live build is locked to the magical old number "0.1.2+<stuff>".
return version.major == 0 && version.minor == 1 && version.patch == 2;
}
/// Determine the SDK's version number.
Version _getVersion() {
var revisionPath = path.join(rootDirectory, "version");

View file

@ -588,6 +588,12 @@ class Traverser {
/// Ensures that if [pubspec] has an SDK constraint, then it is compatible
/// with the current SDK. Throws a [SolverFailure] if not.
void _validateSdkConstraint(Pubspec pubspec) {
// If the user is running a continouous build of the SDK, just disable SDK
// constraint checking entirely. The actual version number you get is
// impossibly old and not correct. We'll just assume users on continuous
// know what they're doing.
if (sdk.isBleedingEdge) return;
if (pubspec.environment.sdkVersion.allows(sdk.version)) return;
throw new CouldNotSolveException(

View file

@ -154,7 +154,7 @@ class _StackFrame {
if (match == null) {
match = coreRegExp.firstMatch(text);
if (match == null) {
throw FormatException("Couldn't parse stack trace line '$text'.");
throw new FormatException("Couldn't parse stack trace line '$text'.");
}
isCore = true;
}

View file

@ -611,11 +611,19 @@ sdkConstraint() {
'foo': '2.0.0',
'bar': '2.0.0'
}, maxTries: 3);
testResolve('ignores SDK constraints on bleeding edge', {
'myapp 0.0.0': {'sdk': badVersion }
}, result: {
'myapp from root': '0.0.0'
}, useBleedingEdgeSdkVersion: true);
}
testResolve(description, packages,
{lockfile, result, FailMatcherBuilder error, int maxTries}) {
{lockfile, result, FailMatcherBuilder error, int maxTries,
bool useBleedingEdgeSdkVersion}) {
if (maxTries == null) maxTries = 1;
if (useBleedingEdgeSdkVersion == null) useBleedingEdgeSdkVersion = false;
test(description, () {
var cache = new SystemCache('.');
@ -666,6 +674,12 @@ testResolve(description, packages,
});
}
// Make a version number like the continuous build's version.
var previousVersion = sdk.version;
if (useBleedingEdgeSdkVersion) {
sdk.version = new Version(0, 1, 2, build: '0_r12345_juser');
}
// Resolve the versions.
var future = resolveVersions(cache.sources, root,
lockFile: realLockFile);
@ -677,6 +691,12 @@ testResolve(description, packages,
matcher = error(maxTries);
}
future = future.whenComplete(() {
if (useBleedingEdgeSdkVersion) {
sdk.version = previousVersion;
}
});
expect(future, completion(matcher));
});
}