-
Notifications
You must be signed in to change notification settings - Fork 16
AF-2971 Dart 2 compatibility #137
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
Changes from all commits
1422f6e
8558d98
77e83a6
a48e41c
966f93b
502dc3f
df75053
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
language: dart | ||
dart: | ||
- 1.24.3 | ||
- stable | ||
sudo: required | ||
addons: | ||
chrome: stable | ||
cache: | ||
directories: | ||
- $HOME/.pub-cache | ||
script: | ||
- pub get --packages-dir | ||
- pub run dart_dev format --check | ||
- pub get | ||
- pub run dart_dev dart2-only -- format --check | ||
- pub run dart_dev analyze | ||
- pub run dart_dev test | ||
- pub run dart_dev coverage --no-html | ||
- bash <(curl -s https://codecov.io/bash) -f coverage/coverage.lcov | ||
- pub run dart_dev dart1-only -- coverage --no-html && bash <(curl -s https://codecov.io/bash) -f coverage/coverage.lcov | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,6 @@ | ||
FROM google/dart:1.24.3 as build | ||
|
||
RUN apt-get update -qq | ||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
wget \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# install chrome | ||
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ | ||
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list && \ | ||
apt-get -qq update && apt-get install -y google-chrome-stable && \ | ||
mv /usr/bin/google-chrome-stable /usr/bin/google-chrome && \ | ||
sed -i --follow-symlinks -e 's/\"\$HERE\/chrome\"/\"\$HERE\/chrome\" --no-sandbox/g' /usr/bin/google-chrome && \ | ||
google-chrome --version | ||
|
||
|
||
WORKDIR /build | ||
|
||
# setup ssh | ||
ARG GIT_SSH_KEY | ||
ARG KNOWN_HOSTS_CONTENT | ||
RUN mkdir /root/.ssh/ && \ | ||
echo "$KNOWN_HOSTS_CONTENT" > "/root/.ssh/known_hosts" && \ | ||
chmod 700 /root/.ssh/ && \ | ||
umask 0077 && echo "$GIT_SSH_KEY" >/root/.ssh/id_rsa && \ | ||
eval "$(ssh-agent -s)" && ssh-add /root/.ssh/id_rsa | ||
|
||
# grab source | ||
COPY . /build/ | ||
|
||
# deps / test / sanity check / build | ||
ENV DART_FLAGS="--checked" | ||
ARG BUILD_ID | ||
ARG GIT_COMMIT | ||
ARG GIT_TAG | ||
ARG GIT_BRANCH | ||
ARG GIT_MERGE_HEAD | ||
ARG GIT_MERGE_BRANCH | ||
RUN pub get --packages-dir && \ | ||
pub run dart_dev test --pub-serve --web-compiler=dartdevc -p chrome -p vm | ||
WORKDIR /build/ | ||
ADD pubspec.* /build/ | ||
RUN pub get | ||
ARG BUILD_ARTIFACTS_BUILD=/build/pubspec.lock | ||
FROM scratch |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,8 +32,7 @@ class SampleSpan implements Span { | |
this.references, | ||
DateTime startTime, | ||
Map<String, dynamic> tags, | ||
}) | ||
: this.startTime = startTime ?? new DateTime.now(), | ||
}) : this.startTime = startTime ?? new DateTime.now(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dart 2 formatter change |
||
this.tags = tags ?? {} { | ||
if (childOf != null) { | ||
references.add(new Reference.childOf(childOf)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -594,7 +594,7 @@ abstract class LifecycleModule extends SimpleModule with Disposable { | |
]); | ||
} | ||
|
||
Future pendingTransition; | ||
Future<Null> pendingTransition; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed to match the type signature of _suspend There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is internal and not a public api change |
||
if (_transition != null && !_transition.isCompleted) { | ||
pendingTransition = _transition.future.then((_) { | ||
_activeSpan = _startTransitionSpan('suspend'); | ||
|
@@ -661,7 +661,7 @@ abstract class LifecycleModule extends SimpleModule with Disposable { | |
allowedStates: [LifecycleState.suspended, LifecycleState.suspending]); | ||
} | ||
|
||
Future pendingTransition; | ||
Future<Null> pendingTransition; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed to match the type signature of _resume There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also internal only. no public api change. |
||
if (_transition != null && !_transition.isCompleted) { | ||
pendingTransition = _transition.future.then((_) { | ||
_activeSpan = _startTransitionSpan('resume'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,9 @@ authors: | |
- Trent Grover <[email protected]> | ||
homepage: https://github.com/Workiva/w_module | ||
|
||
environment: | ||
sdk: '>=1.24.3 <3.0.0' | ||
|
||
dependencies: | ||
logging: ^0.11.0 | ||
meta: ^1.0.0 | ||
|
@@ -18,18 +21,16 @@ dependencies: | |
w_common: ^1.9.0 | ||
|
||
dev_dependencies: | ||
browser: ^0.10.0+2 | ||
coverage: ^0.7.3 | ||
dart_dev: ^1.8.0 | ||
dart_style: ^1.0.7 | ||
dartdoc: ">=0.13.0 <0.16.0" | ||
mockito: ^1.0.1 | ||
react: ^3.0.0 | ||
test: ^0.12.0 | ||
w_flux: '>=1.0.0 <3.0.0' | ||
|
||
environment: | ||
sdk: '>=1.9.0 <2.0.0' | ||
build_runner: ">=0.6.0 <1.0.0" | ||
build_test: ">=0.9.0 <1.0.0" | ||
build_web_compilers: ">=0.2.0 <1.0.0" | ||
coverage: ">=0.10.0 <0.13.0" | ||
dart_dev: ^2.0.0 | ||
dart_style: ^1.0.9 | ||
mockito: ">=2.2.2 <4.0.0" | ||
react: ^4.4.2 | ||
test: ">=0.12.30 <2.0.0" | ||
w_flux: ">=1.0.0 <3.0.0" | ||
|
||
transformers: | ||
- test/pub_serve: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,6 +149,7 @@ class TestLifecycleModule extends LifecycleModule { | |
@override | ||
@protected | ||
Future<Null> onWillUnloadChildModule(LifecycleModule module) async { | ||
await new Future.value(null); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This spot is a little more concerning because this may mean that it's possible for other consumers that are overriding one of these lifecycle methods may get a change in how lifecycle events are ordered due to sync-async. I think we can go ahead with this PR as is, but be aware that there may be a recommended migration step of putting a line like this in each overriden module lifecycle method. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without this await here .. the order that events are added to the tracking list of events is different than what the tests expect the order to be. This looks like:
|
||
if (onWillUnloadChildModuleError != null) { | ||
throw onWillUnloadChildModuleError; | ||
} | ||
|
@@ -280,6 +281,8 @@ void expectInLifecycleState(LifecycleModule module, LifecycleState state) { | |
} | ||
|
||
Future<Null> gotoState(LifecycleModule module, LifecycleState state) async { | ||
// wait for next event loop. fixes sync-async in Dart 2 | ||
await new Future.value(null); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Workiva/app-frameworks want to take a look at these closely to determine if we're going to have a sync-async problem with lifecycle module or if it's just the tests and mocks? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, goto state is only used internally in tests, so I'm not too concerned about this one. |
||
if (state == LifecycleState.instantiated) { | ||
return; | ||
} | ||
|
@@ -288,7 +291,7 @@ Future<Null> gotoState(LifecycleModule module, LifecycleState state) async { | |
if (state == LifecycleState.loading) { | ||
return; | ||
} | ||
await future; | ||
await future; // Dart 2 would have run synchronously up until this await | ||
if (state == LifecycleState.loaded) { | ||
return; | ||
} | ||
|
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.
Just let Travis CI run all the tests.