-
Notifications
You must be signed in to change notification settings - Fork 233
Add default upper bound Dart SDK constraint override from 2.0.0 -> 2.0.0-dev.infinity #1704
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
Conversation
lib/src/pubspec.dart
Outdated
return true; | ||
break; | ||
case "quiet": | ||
warnAboutPreReleaseTwoDotZeroSdkOverrides = false; |
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.
PM nit...
This makes me sad. I hate mutable top-level things.
Could their be a private field w/ an enum type and then two public bool properties that just key off it?
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.
done (didn't use an enum though)
test/version_solver_test.dart
Outdated
// Log output should mention the PUB_ALLOW_RELEASE_SDK environment | ||
// variable and mention the foo and bar packages specifically. | ||
output: allOf(contains('PUB_ALLOW_PRERELEASE_SDK'), | ||
anyOf(contains('foo, bar'), contains('bar, foo'))), |
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.
Or you could just sort it? Might make it easier to parse for the user, too...
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.
Or just:
allOf(contains('PUB_ALLOW_PRERELEASE_SDK'), contains('foo'), contains('bar'))
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.
went ahead and sorted it since this is actually a long list in many cases so its a bit easier to parse
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.
I mostly reviewed for pub style and idioms. I'll let Kevin do the deep thinking around the actual semantics. :)
lib/src/entrypoint.dart
Outdated
.join(', '); | ||
if (overriddenPackages.isNotEmpty) { | ||
log.message(log.yellow( | ||
'Overriding Dart SDK constraint from <2.0.0 to <2.0.0-dev.infinity' |
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.
"SDK"
You did it! 🎉
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.
:D
lib/src/pubspec.dart
Outdated
final VersionRange _defaultUpperBoundSdkConstraint = | ||
new VersionConstraint.parse("<2.0.0"); | ||
|
||
/// The upper bound contraint that matches the dev sdk. |
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.
"sdk", here and elsewhere.
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.
done
lib/src/pubspec.dart
Outdated
}(); | ||
|
||
/// Whether or not to warn about pre-release sdk overrides. | ||
bool warnAboutPreReleaseTwoDotZeroSdkOverrides = true; |
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.
This returns the wrong value if it's read before allowPreReleaseTwoDotZeroSdk
is. Like @kevmoo suggests, you probably want a single lazy-initialized backing field and then two bool getters.
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.
done
test/version_solver_test.dart
Outdated
// Log output should mention the PUB_ALLOW_RELEASE_SDK environment | ||
// variable and mention the foo and bar packages specifically. | ||
output: allOf(contains('PUB_ALLOW_PRERELEASE_SDK'), | ||
anyOf(contains('foo, bar'), contains('bar, foo'))), |
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.
Or just:
allOf(contains('PUB_ALLOW_PRERELEASE_SDK'), contains('foo'), contains('bar'))
test/version_solver_test.dart
Outdated
}); | ||
|
||
test( | ||
'pub doesn\'t log about pre-release sdk overrides if ' |
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.
Nit: I think it's a little cleaner to use a double-quoted string instead of escaping the apostrophe.
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.
done
Also introduces the PUB_ALLOW_PRERELEASE_SDK environment variable which can override this behavior. Valid values are
true
(default),false
, andquiet
(true but no log message about the override).Fixes #1692