Skip to content

Conversation

@christopherfujino
Copy link
Contributor

@christopherfujino christopherfujino commented Sep 13, 2019

Description

Fixes the flutter tool not attaching to app observatory services on ios13 by implementing mDNS for flutter run (previously the tool would discover the observatory URI via reading the logs). If mDNS fails, the tool will fallback to the old method.

Related Issues

Fixes #40448

Tests

I added the following tests:

Testing both mDNS discovery, and the fallback log scanning.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read [Handling breaking changes]). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@fluttergithubbot
Copy link
Contributor

It looks like this pull request may not have tests. Please make sure to add tests before merging. While there are exceptions to this rule, if this patch modifies code it is probably not an exception.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@fluttergithubbot fluttergithubbot added the tool Affects the "flutter" command-line tool. See also t: labels. label Sep 13, 2019
@codecov
Copy link

codecov bot commented Sep 17, 2019

Codecov Report

Merging #40447 into master will decrease coverage by 0.76%.
The diff coverage is 70.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #40447      +/-   ##
==========================================
- Coverage   59.46%    58.7%   -0.77%     
==========================================
  Files         192      194       +2     
  Lines       18697    18735      +38     
==========================================
- Hits        11119    10998     -121     
- Misses       7578     7737     +159
Flag Coverage Δ
#flutter_tool 58.7% <70.73%> (-0.77%) ⬇️
Impacted Files Coverage Δ
packages/flutter_tools/lib/src/context_runner.dart 70.9% <0%> (-1.32%) ⬇️
...ackages/flutter_tools/lib/src/commands/attach.dart 73.68% <62.5%> (-0.79%) ⬇️
packages/flutter_tools/lib/src/mdns_discovery.dart 69.84% <69.84%> (ø)
packages/flutter_tools/lib/src/ios/devices.dart 63.24% <90%> (+0.63%) ⬆️
packages/flutter_tools/lib/src/bundle.dart 31.81% <0%> (-43.94%) ⬇️
...kages/flutter_tools/lib/src/commands/precache.dart 50% <0%> (-41.67%) ⬇️
...s/flutter_tools/lib/src/tester/flutter_tester.dart 32.98% <0%> (-38.15%) ⬇️
...flutter_tools/lib/src/android/android_builder.dart 12.5% <0%> (-34.38%) ⬇️
packages/flutter_tools/lib/src/web/web_device.dart 20.51% <0%> (-25.65%) ⬇️
...ackages/flutter_tools/lib/src/commands/config.dart 72% <0%> (-14.67%) ⬇️
... and 86 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9dd8c3a...9333fab. Read the comment docs.

@christopherfujino christopherfujino marked this pull request as ready for review September 17, 2019 22:12
@dnfield dnfield added the platform-ios iOS applications specifically label Sep 17, 2019
Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm w/ nits, but also wait for dnfield's review.

package.id,
this,
ipv6,
debuggingOptions.observatoryPort
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: missing comma

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added comma

/// The [MDnsClient] used to do a lookup.
final MDnsClient client;

static const String dartObservatoryName = '_dartobservatory._tcp.local';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be public? Could it be @visibleForTesting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added @visibleForTesting

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, would defer to @zanderso for final approval - in particular, do we want any analytics going on in here? How often mDNS fails, how long it takes?

Also, can you update the pull request message template? :)

}

// Fallback to manual protocol discovery
printTrace('mDNS lookup failed, attempting fallback protocol discovery.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Maybe just clarify that this is going to try to scan logs in the message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still lgtm

@christopherfujino christopherfujino merged commit 0b24a5a into flutter:master Sep 18, 2019
@christopherfujino christopherfujino deleted the implement-mdns-for-run branch September 18, 2019 18:01
@tvolkert tvolkert mentioned this pull request Sep 24, 2019
tvolkert added a commit that referenced this pull request Sep 25, 2019
Bump version of just package:multicast_dns (#41207)
Implement mdns for flutter run (#40447)
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Sep 30, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flutter run doesn't attach to observatory service on ios13

5 participants