Summary: This should in theory never happen since the state of the recording is also managed within the UI. However, it's better to ensure that if `startRecording` is called twice, without calling `stopRecording` first it will error rather than leak a recording (the first process will still run but the object representing it is oprhaned)
Reviewed By: passy
Differential Revision: D33913298
fbshipit-source-id: f8fa6b0e4fdbdf4282633fa29a736d3e7dedf3bb
Summary:
The state of the destination and the process are coupled together. As a result it makes sense to move these to an object type.
This prevents destination and process being independently settable. No change in behaviour, just a removal of invariants that need to be checked
Reviewed By: passy
Differential Revision: D33913213
fbshipit-source-id: ed18650cac4f72d40e82d20254674f7fa12cbb48
Summary: This is public but never read, no need for it to exist
Reviewed By: passy
Differential Revision: D33893097
fbshipit-source-id: aa423464f9cc0c35768a549fd5cb481784d8bcd6
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
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
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
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
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
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
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
Summary:
We pass the `idbPath` to only the log listener function, when in reality it should be used by all of these functions that call out to idb.
This could result in some bizzare inconsistencies where some idb functions to fail as they are not using the supplied path
Reviewed By: passy
Differential Revision: D33818298
fbshipit-source-id: f0fb7f26579c646a0d5265364d539dfded711c2e
Summary: This allows us to change the way that the command is itself exec'd (for instance to change the idb exec'ing in D33818298)
Reviewed By: passy
Differential Revision: D33818822
fbshipit-source-id: c90b7e58c7476f5db08da0e74e9791230ff97f6f
Summary: Similar to D33818267, but for simctl. Brings logical ordering of methods as well as consistency
Reviewed By: passy
Differential Revision: D33818687
fbshipit-source-id: 3fbcea128d06c900b49b83ad583ec8a7a07cae2c
Summary:
This isn't that important right now, but will help as the `IOSBridge` is expanded in the future. There's also an argument for logical ordering of functions within a container (a class!), but that's not the real motivation here.
The existence of `bind` shows that this free function is effectively closing over this argument anyway.
Reviewed By: passy, lblasa
Differential Revision: D33818267
fbshipit-source-id: e7b83f013121cedbd31cb28746b69c1fa76a0803
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
Summary:
Changelog: Allow only a single crash watcher and a single log listener per device. Start log listener and crash watcher for every device upon connection. Remove commands to start/stop them externally.
Monitored CPU load for a physical Android device with the log listener on and off. Did not notice any real difference.
Resolved crashing adbkit-logcat by forcing the usage of 2.0.1. A proper fix would be to unify babel transforms for browser flipper and electron flipper, but we might re-think how we distribute flipper in the next half, so a simple hot fix might be a better use of time and resources.
Reviewed By: mweststrate
Differential Revision: D33132506
fbshipit-source-id: 39d422682a10a64830ac516e30f43f32f416819d
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
Summary:
Forbid imports from nested directories of flipper-common, flipper-plugin, flipper-ui-core
In the stack of D32926830 I occasionally imported from flipper-plugin/src/... which is not allowed. This should fix any auto-import related issues once and for all.
Reviewed By: timur-valiev
Differential Revision: D32987054
fbshipit-source-id: f19f6278219961ad283cacfec094a6c703ca93f8
Summary:
Changelog: Disable idb stdout buffering for logs. Show logs on iOS devices without buffering.
Currently, idb buffers log output if it's redirected to a non-TTY. It is the default behavior for Python (read more about it [here](https://eklitzke.org/stdout-buffering)).
It leads to users seeing logs only in large chunks because the size of the buffer is substantial.
Setting PYTHONUNBUFFERED to a non-empty string disables Python output buffering.
Reviewed By: lblasa
Differential Revision: D32984711
fbshipit-source-id: 3e0a889b6b60b6d266f4a0c1894db937868c7433
Summary: Moved all types related to plugin descriptions from plugin-lib (which handles downloads and such) to flipper-common. The goal of that is to remove all plugin-lib usage from ui-core to server-core, so that the UI itself doesn't do any file operations anymore related to plugins. That will be done in next diffs, this just moves types but no code.
Reviewed By: nikoant, aigoncharov
Differential Revision: D32665064
fbshipit-source-id: 86d908e7264569b0229b09290a891171876c8e00
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
Summary: This diff makes sure flipper-ui-core no longer depends on flipper-server-core. Currently server config is still transferred from UI to server, which doesn't really make sense in future scenarios where server might start before client, but will address that separately
Reviewed By: timur-valiev, aigoncharov
Differential Revision: D32462835
fbshipit-source-id: 498a944256ba1aabbf963b896953e64d11e27214
Summary:
Workaround for idb weirdness
Originally started at D27590885
Re-appared at https://github.com/facebook/flipper/issues/3009
Reviewed By: mweststrate
Differential Revision: D32106952
fbshipit-source-id: 63d4fa64503c5c2ba80dae113850c937450ab0fb
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
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
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