Skip to content

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented Jan 23, 2019

This will only be supported on iOS.

It would be entirely possible to implement this on Android and potentially Fuchsia as well.

Needs flutter/packages#7 to land (and then update the pubspec.yaml to point to that properly on pub).

@dnfield
Copy link
Contributor Author

dnfield commented Jan 23, 2019

To test locally:

  • Run an iOS app on simulator or physical device
  • Type flutter attach without specifying the --debug-port from the folder for that application

@dnfield dnfield added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. labels Jan 23, 2019
meta: 1.1.6
multicast_dns:
git:
url: https://github.com/dnfield/flutter_packages
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this will change to flutter/packages or something once you migrate it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can just come from pub. Or we could pull it from flutter/packages - I'm just doing it this way so it can run through the CI tests for now.

@dnfield
Copy link
Contributor Author

dnfield commented Jan 23, 2019

I'll look at adding a devicelab test for this.

I could also try to mock out a socket responding with some mDNS packets, but an integration test for this would probably be more valuable.

@dnfield dnfield requested a review from DanTup January 24, 2019 18:41
@dnfield
Copy link
Contributor Author

dnfield commented Jan 24, 2019

Currently, this will break IDEs in some cases becuase it will ask for user input. Need to figure that out.

/cc @DanTup @devoncarew

@dnfield
Copy link
Contributor Author

dnfield commented Jan 24, 2019

I'm going to roll back the user interactivity in this and we can track that as a follow up. It makes this patch much more complicated and risky and isn't really necessary.

'debug-port',
help: 'Device port where the observatory is listening.',
)..addOption('pid-file',
)..addOption(
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we also infer this from the device + applicationBundle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A device could have multiple applications running on it. I'm not familiar with how that's implemented though...

Copy link
Contributor

Choose a reason for hiding this comment

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

What I mean is, we already have the concept of an ApplicationPackage which contains enough information (when combined with the proper Device subclass) to start the app. Presumably we could use this information gathered from the user's pubspec/project files (if present) to figure out the app id.

This doesn't necessarily help for google3, but maybe we can feed some more information through from blaze and the device information to skip it as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Attach doesn't start an app though, it looks for started apps.

Copy link
Contributor

Choose a reason for hiding this comment

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

but you know the device you are connecting to at this point, and you might be in the root of a directory which can infer the application package structure. That doesn't mean we can't allow a user to specify the id manually, but I don't understand why we couldn't infer which observatory to attach.

@dnfield dnfield changed the title [WIP] use mDNS to discover the device port Use mDNS to discover the device port Jan 24, 2019
@dnfield dnfield mentioned this pull request Jan 24, 2019
@dnfield dnfield merged commit f9e6242 into flutter:master Jan 25, 2019
@dnfield dnfield deleted the ios_attach branch January 25, 2019 20:12
@dnfield dnfield restored the ios_attach branch January 28, 2019 18:31
dnfield added a commit that referenced this pull request Jan 28, 2019
* Revert f9e6242

* fix pubspec

* finish pubspec upgrade
kangwang1988 pushed a commit to XianyuTech/flutter that referenced this pull request Feb 12, 2019
* Discover port over mDNS

* opt in, only for iOS for now
kangwang1988 pushed a commit to XianyuTech/flutter that referenced this pull request Feb 12, 2019
* Revert f9e6242

* fix pubspec

* finish pubspec upgrade
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 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.

4 participants