Commit Graph

35 Commits

Author SHA1 Message Date
Lorenzo Blasa
03c0874f30 Query devices should be async
Summary: ^

Reviewed By: aigoncharov

Differential Revision: D48781102

fbshipit-source-id: c987be90c7bca7dbab40a89b389ee86ef2230393
2023-08-30 04:24:05 -07:00
Lorenzo Blasa
f301de64f3 iOSDeviceManager queryDevicesForever converted to async
Summary: ^

Reviewed By: lawrencelomax

Differential Revision: D47912037

fbshipit-source-id: ac7a9650c82219a21577e6bca7e08d075ae5da15
2023-07-31 03:55:58 -07:00
Lorenzo Blasa
e9bae419a7 iOSDeviceManager getSimulators converted to async
Summary: ^

Reviewed By: lawrencelomax

Differential Revision: D47911997

fbshipit-source-id: df2cab1986d5ddc7f2bc4e857c76cd178f6a7ccb
2023-07-31 03:55:58 -07:00
Lorenzo Blasa
1f63a25027 idb kill
Summary: Introduce a new command to allow killing idb

Reviewed By: lawrencelomax

Differential Revision: D47911709

fbshipit-source-id: 970f1147a177bbcca0bdfa9e9ba970cdc8a914a3
2023-07-31 03:55:58 -07:00
Lorenzo Blasa
fc38355eee Centralise logging
Summary:
Centralise connectivity logging into a single place. By having all logs go through a single interface, then it becomes trivial to manipulate them as needed.

In this change, this is not done.

In subsequent diffs, logs will be dispatched via an event and will be visualised in the Connectivity Hub.

Reviewed By: passy

Differential Revision: D47185054

fbshipit-source-id: fb5eab98895be0c8f61fb9a77d3e66d6a8dbcb27
2023-07-10 04:14:14 -07:00
Lorenzo Blasa
7dc978c3d3 Remove processDevices logs
Summary: These are no longer that useful and can be quite verbose, remove.

Reviewed By: antonk52

Differential Revision: D46516093

fbshipit-source-id: e6c3a546d379ca20ff8757fdc3feaa11bf0788a0
2023-06-07 06:59:31 -07:00
Lorenzo Blasa
828d56f617 Kill PortForwardingApp on exit
Summary:
I noticed we were not killing the PortForwardingApp on exit.

This is not ideal.

So, use an exit hook to kill the app.

Reviewed By: passy

Differential Revision: D46392855

fbshipit-source-id: e2b75f76c9dfab0ff46df3ad2c94a1a523154b2a
2023-06-02 07:55:56 -07:00
Pascal Hartig
cfcad76e74 Demote Xcode select error to warning
Summary: This is firing regularly when people have a broken local setup.

Reviewed By: lawrencelomax

Differential Revision: D43834469

fbshipit-source-id: 1fbc2cf52f93046984e9846f8aed931106542b03
2023-03-06 04:54:36 -08:00
Andrey Goncharov
b5a750935d Populate the initial list of connected devices on startup
Summary:
When we start using Flipper from the CLI for automation, we want to have the list of currently connected devices as soon as flipper server is alive.
Otherwise, we would have to poll flipper server waiting for some magical moment in the future when devices connect.
This way, we can be certain that if flipper server started, but we do not see a device, it is not connected at all.

Reviewed By: mweststrate

Differential Revision: D40184106

fbshipit-source-id: ce4c2b897a2df0081e3a0b6a8c26640599e0f9e8
2022-10-13 03:20:51 -07:00
Andrey Goncharov
69812d543e Do not disconnect dummy devices
Summary: Do not remove dummy devices as they are created during WWW cert exchange and are not picked up by IDB

Reviewed By: lblasa

Differential Revision: D39430458

fbshipit-source-id: 249efda23f324522ae2ae3a0ee4f198ab701d22d
2022-09-12 07:37:21 -07:00
Lorenzo Blasa
dbe818c6e1 Port-forward websocket ports
Summary:
^
Changelog: Port-forward websocket ports

Reviewed By: passy

Differential Revision: D34210187

fbshipit-source-id: 8ec84a9ce89d9982519111417538b7bfa0964cfc
2022-02-14 04:37:21 -08:00
Lawrence Lomax
9973014116 Fix error message when there's no xcode-select'ed Xcode
Summary:
This error messaging is confusing for device only users. These users may only be running against a device **without xcode installed**, which is supported.

However, we also need to handle the case where a user has a sim running and they haven't xcode-select'd as this will mean that the sim is working fine, but the user has no way of knowing why Flipper is not working.

Reviewed By: passy

Differential Revision: D34140277

fbshipit-source-id: f9b035b6c7918424d6131d1dfcdba10acf438fa8
2022-02-11 00:33:48 -08:00
Lawrence Lomax
2a9983b1ef Use Promise.all for checking xcode-select and apps in parallel
Summary: These can be batched together rather nicely

Reviewed By: lblasa

Differential Revision: D34139753

fbshipit-source-id: 7388630dcae34d40308d54f18a37215cf18e5904
2022-02-10 07:59:24 -08:00
Lawrence Lomax
84fac685ac Actually use unit tested function in wrapped xcode check
Summary: Accidentally tested a function that should have been called from the internals. This makes the internal function use the check.

Reviewed By: lblasa

Differential Revision: D34139589

fbshipit-source-id: fac13f7b54ffb0b6f501fb9237f55766706e975a
2022-02-10 07:59:24 -08:00
Liam Jones
8696349593 Fix Xcode version check (#3428)
Summary:
Fixes https://github.com/facebook/flipper/issues/3396 - the Xcode version mismatch check has been broken since 0.132.0.

## Changelog

Fixed Xcode version mismatch check

Pull Request resolved: https://github.com/facebook/flipper/pull/3428

Test Plan: No existing test, manually tested locally on macOS 11.6.3 via `yarn start` when launching the Simulator directly or via `yarn react-native run-ios` in an RN project

Reviewed By: lblasa, mweststrate

Differential Revision: D34139471

Pulled By: lawrencelomax

fbshipit-source-id: 97920de5c463b366ef7ecaef0441ee37debe5d46
2022-02-10 01:48:11 -08:00
Andrey Goncharov
c7492a83c7 Remove global access to adb client and idb config
Summary: Idb and adb sholuld not really be accessed out side of Adnroid and iOS device managers

Reviewed By: lawrencelomax

Differential Revision: D33915162

fbshipit-source-id: 0d1bb028b9a53254cf5b0ce6289ae76339c5a254
2022-02-02 03:07:00 -08:00
Andrey Goncharov
51ef1810b2 Defer initialization of Android and iOS device managers
Summary: Remove hidden async initialization of adb and idb. Make it explicit. Remove nullable fields in Android and iOS device managers.

Reviewed By: lawrencelomax

Differential Revision: D33915177

fbshipit-source-id: 882f79310410e0dfde6169abf343ab808644e4a2
2022-02-02 03:07:00 -08:00
Andrey Goncharov
fd13399cb9 Extract WWW certificate provider
Summary: Extract WWW certificate provider from the iOS certificate provider. Hide its implementation from OSS since it is not relevant for OSS folks.

Reviewed By: mweststrate

Differential Revision: D33895378

fbshipit-source-id: 376afda3b5fa3857c0eb280b92555314eb1a0d1f
2022-02-02 03:07:00 -08:00
Andrey Goncharov
29f6d0e711 Add device-specific Certificate Providers
Reviewed By: mweststrate

Differential Revision: D33821880

fbshipit-source-id: c75c71db4d7dc680f75cf41ba2d5dad009a5fd03
2022-02-02 03:07:00 -08:00
Lawrence Lomax
a9b9a1bff4 Remove redundant xcodeCommandLineToolsDetected
Summary: This is public but never read, no need for it to exist

Reviewed By: passy

Differential Revision: D33893097

fbshipit-source-id: aa423464f9cc0c35768a549fd5cb481784d8bcd6
2022-02-01 00:44:34 -08:00
Lawrence Lomax
9cbdc3038f Remove mising iOS Bridge invariant in iOSDeviceManager
Summary:
There's no need for us to have a property that can be undefined, since we can use the magic of *passing arguments* to achieve the same end result.

The unit test a bit more precarious, but it's left here for posterity or until we decide to kill it otherwise.

Reviewed By: passy

Differential Revision: D33892407

fbshipit-source-id: 3b499511189862e2265d8d6d29f849a7b813050e
2022-02-01 00:44:34 -08:00
Lawrence Lomax
757b82757e Use polymorphic IOSBridge to perform iOS target listing
Summary:
Bulding on the work from prior diffs we can use the created bridge directly. No need to have if statements calling out to sub-functions, just use the base type itself which will use the appropriate implementation.

There's no behavioural change here. Either idb was queried for sims/devices or simctl was queried for just sims, they were always mutually exclusive.

Reviewed By: passy

Differential Revision: D33842604

fbshipit-source-id: 0bf63ffc34368c70df31c105ea0ba5df941e72cc
2022-02-01 00:44:34 -08:00
Lawrence Lomax
b0046c8ddb Check for xcode mismatch once and only once
Summary:
We perform this *repeatedly* (every 2s!!!). Which is clearly excessive.

Let's perform this check once to avoid noise and a waste of system resources

Reviewed By: passy

Differential Revision: D33844194

fbshipit-source-id: 226dc9d67bb83b167afa8e28ade8e1911470ef8a
2022-02-01 00:44:34 -08:00
Lawrence Lomax
e16662a28f Improve xcode version mismatch messaging
Summary:
This runs in a very hot loop (which I will change shortly)

However, there's also some simplification that we can do here:
- Only look for `Simulator.app` processes instead of all the processes. This limits the amount of string comparison to do. If there's a `Simulator.app` running, then we know a sim is running for that Xcode.
- Use piping to extract the launch path of the process, instead of then regex'ing this out.
- Use a simpler substring match to determine if paths have a different start.

Reviewed By: passy

Differential Revision: D33891296

fbshipit-source-id: e37d5f260fc6c6113be9c5268b7c8cffb4057b9a
2022-02-01 00:44:34 -08:00
Lawrence Lomax
ccae37aa71 Extract idb device querying to IOSBridge
Summary:
Again this is just a code move for now.

However, we now have a common method between simctl and idb cases. This means that the next diff can call an `IOSBridge` with polymorpism taking over. This is still delegated out, but there's an argument to be made to move `iosUtil` functionality back so that this all lives in the same place.

Reviewed By: passy

Differential Revision: D33843093

fbshipit-source-id: 5cd884140817df851cccf63e5780582b16d4231c
2022-01-31 07:29:34 -08:00
Lawrence Lomax
aeb0b5f317 Extract getSimulators to IOSBridge
Summary:
Extracts `getSimulator` interrnals to `SimctlBridge`. This allows this functionality to be used independently of things like the the flipper server.

For now this just moves the functionality, but future diffs will build on top of this.

Reviewed By: passy

Differential Revision: D33842986

fbshipit-source-id: bae26a9bd5c21c9813f8a2b10c3b3e3efc1c5929
2022-01-31 07:29:34 -08:00
Lawrence Lomax
959a2a77d7 Extract launchSimulator to IOSBridge
Summary:
This is related to `simctl` functionality, so can be extracted there.

This will aid in future changes whereby we can hide `getDeviceSetPath` in the IOSBridge module

Reviewed By: passy

Differential Revision: D33842987

fbshipit-source-id: de292ce5afba3e7d79d8ba27c2b8852909d7e6f3
2022-01-31 07:29:34 -08:00
Anton Kastritskiy
1aff8466b1 let linter handle type naming conventions
Summary: {gif:kosnw403}

Reviewed By: passy

Differential Revision: D33846715

fbshipit-source-id: 5de4bb0cf88f24f5a26acedb82a0816417fb0787
2022-01-31 02:49:09 -08:00
Andrey Goncharov
da618fd3f3 Decouple CertificateProvider and adb/idb client intialization
Summary:
Previously CertificateProvider initialized ADB and provided config to IDB. As result, AndroidDeviceManager and iOSDeviceManager indirectly depended on CertificateProvider.

With this diff we:
1. Make idbConfig resemble adbClient.
2. Make AndroidDeviceManager and iOSDeviceManager initialize their own clients
3. Fix server crash when one of the clients couldn't be initialized. The reason for the crash is CertificateProvider.prototype.init which is no longer needed.

Reviewed By: passy

Differential Revision: D33711652

fbshipit-source-id: 055b5625ed993827b65396f4af5157808479242b
2022-01-26 04:23:05 -08:00
Andres Suarez
79023ee190 Update copyright headers from Facebook to Meta
Reviewed By: bhamodi

Differential Revision: D33331422

fbshipit-source-id: 016e8dcc0c0c7f1fc353a348b54fda0d5e2ddc01
2021-12-27 14:31:45 -08:00
Michel Weststrate
dcfeb4a4d5 Clean up packages and types
Summary:
This diff removes most deps from the root package.json, which now only contains electron and shared build / test infra structure: lint, prettier, jest, typescript.

This makes it possible to control much better which packages are used where, as all sub packages now have their deps explicitly in their package.json instead of incidentally shared. This allows for example to disable DOM types for all packages by default (flipper-plugin, ui(-core) and app still request it), and in the next diff I hope to add to this that nodeJS types are no longer shared either, so that UI oriented packages will generate compile errors when using Node built-ins

This diff removes most deps that were currently unused, and dedupes a bunch of other ones, so the build should probably be a bit smaller now as well:

{F686704253}

{F686704295}

Reviewed By: antonk52

Differential Revision: D33062859

fbshipit-source-id: 5afaa4f2103d055188382a3370c1fffa295a298a
2021-12-16 14:54:59 -08:00
Michel Weststrate
bca169df73 Move settings, launcherSettings, GKs to app / flipper-server-core
Summary:
This diff moves a lot of stuff from the client to the server. This diff is fairly large, as a lot of concept closely relate, although some things have split off to the earlier diffs in the stack, or are still to follow (like making intern requests).

This diff primarily moves reading and storing settings and GKs from client to server (both flipper and launcher settings). This means that settings are no longer persisted by Redux (which only exists on client). Most other changes are fallout from that. For now settings are just one big object, although we might need to separate settings that are only make sense in an Electron context. For example launcher settings.

Reviewed By: passy, aigoncharov

Differential Revision: D32498649

fbshipit-source-id: d842faf7a7f03774b621c7656e53a9127afc6192
2021-12-08 04:30:54 -08:00
Andrey Goncharov
bffd58b3a6 Fix idb device duplicates
Summary:
idb sometimes returns duplicates when we query targets. It leads us to removing valid devices and reconnecting to them again. Eventually, it starves the idb thread pool.
This diff removes the duplicates from the idb output.

Reviewed By: jknoxville

Differential Revision: D32099320

fbshipit-source-id: 7d8b756360f82557000ea5aa037a249b33be9961
2021-11-03 08:11:01 -07:00
Michel Weststrate
6589eb86c5 Improve port forwarding logging
Summary: Port forwarding tool was logging the child process object. Made the logging cleaner and more useful.

Reviewed By: nikoant

Differential Revision: D31608867

fbshipit-source-id: 1c2ae7c926ed4e1b44d51db5415874600acde7ae
2021-10-14 03:17:47 -07:00
Michel Weststrate
d88b28330a Move app/server to flipper-server-core
Summary: moved `app/src/server` to `flipper-server-core/src` and fixed any fallout from that (aka integration points I missed on the preparing diffs).

Reviewed By: passy

Differential Revision: D31541378

fbshipit-source-id: 8a7e0169ebefa515781f6e5e0f7b926415d4b7e9
2021-10-12 16:00:52 -07:00