Commit Graph

1038 Commits

Author SHA1 Message Date
Pritesh Nandgaonkar
c28ef62f07 Import and export Logs
Summary: This diff adds import and export support for the logs plugin

Reviewed By: danielbuechele

Differential Revision: D13958713

fbshipit-source-id: a072de025f0b959302175ef0ccaf763ca41377e9
2019-02-12 02:47:55 -08:00
Pritesh Nandgaonkar
e5151b9994 Add salt to the exported device serial id
Summary:
This diff solves the following bug.

When the user imports the exported flipper data for the device which is currently running, there was a bug. A duplicate device with the same serial got created after importing the file. Due to the same `device_id`, the plugins of the exported device got imported in the already running device(which has the same device id).

To solve this problem, I have prefixed the exported `device_id` with a random string, so that the exported device is unique across the device list in the Flipper app.

Look at the vide to understand the bug

Also updated the test case accordingly

Reviewed By: danielbuechele

Differential Revision: D13973180

fbshipit-source-id: df6ee00987e81923914855cea4d76e2bd7167358
2019-02-12 02:47:55 -08:00
John Knox
2335cfb312 Fix formatting in PortForwarding readme
Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/369

Differential Revision: D14031906

Pulled By: passy

fbshipit-source-id: 6da0ab7da30f7505b5265033f732a00cf9f397a4
2019-02-11 15:21:25 -08:00
John Knox
fe0eeafd98 Fix issue with responses from de-inited plugins
Summary:
Now that flipper is using rsocket requestResponse, the SDK is responding with an error when the connection for this plugin has been torn down.

To avoid flipper interpreting these as bad, keep track of which plugins are inited, and only worry about responses from these.

Reviewed By: danielbuechele

Differential Revision: D13973745

fbshipit-source-id: d4e6916f89b3b562e5dcf23c4fe5b5cb384a6ec4
2019-02-11 14:06:56 -08:00
John Knox
ce5f739d81 Add sdkVersion to ping events
Summary: So we can see usage of old sdks.

Reviewed By: passy

Differential Revision: D14022623

fbshipit-source-id: 22f0681cbf4374e2cf3256e1049d154789e1959e
2019-02-11 14:06:56 -08:00
John Knox
92271d1454 Use rsocket requestResponse in desktop app
Summary:
Changes the desktop app to use requestResponse for communicating with the sdk, when the sdk is on a version that can handle it.
If it's an old sdk version, just use fire and forget. We can delete this code after a while, but keeping it for now to smooth things over during migration.

This should be fully backwards compatible both ways.

Reviewed By: passy

Differential Revision: D13971354

fbshipit-source-id: 60e18dda5c253c81ab7e62ca1aae4f4bc423f7e2
2019-02-11 14:06:56 -08:00
John Knox
0413bbd458 Add sdk_version param when connecting to flipper
Summary:
Every time an app connects to flipper, it will include its version.

With this information, the desktop app will be able to know how to communicate with it (or even whether it still can - and show an error message if not).

Reviewed By: passy

Differential Revision: D14008785

fbshipit-source-id: ac4dfd52da4bc6a2b90ec09a8e619086b7cd4a59
2019-02-11 14:06:56 -08:00
John Knox
5da8f35ee3 Don't use private access in FlipperRSocketResponder
Summary:
Changing FlipperRSocketResponder to only use public parts of FlipperConnectionManagerImpl.

This means we can test it by injecting a FCM mock, and it can use its public interface.

Reviewed By: passy

Differential Revision: D14000078

fbshipit-source-id: c0431a888b0ca041807631c81b99fb8b947274d6
2019-02-11 14:06:56 -08:00
John Knox
c48c1a728a Extract Responder class out of FlipperConnectionManagerImpl
Summary:
For one thing, this file is too big so it's good to split it up.

Also, having this responder defined in the .cpp file makes it hard to test. Extracting it for testability.

Reviewed By: passy

Differential Revision: D14000079

fbshipit-source-id: 8da4e0e325f48c0ada8efc7cd6fffcb3440c6e26
2019-02-11 14:06:56 -08:00
John Knox
4a3de26a88 Add requestResponse handler for incoming calls
Summary:
Flipper exposes a call() api to plugins which lets them call their sdk component, and it returns a promise with the response.
Currently this is done by sending a fireAndForget request, noting the id of the request, and then receiving fireAndForget requests and matching up the ids to give the result back to the right plugin promise.

Instead, it will be simpler to use rsocket requestResponse, instead of fireAndForget, which is for this exact use case. This diff adds a requestResponse handler to the SDK, so that it can deal with such requests and respond accordingly, while preserving the current functionality if it receives a fireAndForget.

So this part is backwards compatible and should be safe to land in isolation.

A later diff will change the desktop app to use requestResponse, which may not be backwards compatible, so that will have to be deployed more carefully.

Reviewed By: passy

Differential Revision: D13974049

fbshipit-source-id: b371d94a86b1f186375161ed8f2242a462ce418f
2019-02-11 14:06:55 -08:00
Mitch Ware
8f6138a41c Explicitly specify serial filename to openssl (#227)
Summary:
Manually add `serial.srl` as the `CAserial` param to `openssl`. This
fixes a permissions issue when generating certificates, which fixes some
of the issues explained in #101.
Pull Request resolved: https://github.com/facebook/flipper/pull/227

Reviewed By: passy

Differential Revision: D9316089

Pulled By: jknoxville

fbshipit-source-id: dd15e2f2f318d3a1217c6b4ffd0bb7e25b56d560
2019-02-11 04:58:46 -08:00
Daniel Büchele
c98047bbcf support DEVICE_SET_PATH env var
Summary: support for DEVICE_SET_PATH as used by 1W

Reviewed By: passy

Differential Revision: D14007285

fbshipit-source-id: 79f40355020c67efcb439f470af2fc35ec7fea7e
2019-02-11 02:57:19 -08:00
Daniel Büchele
6431d374c2 get adb config from env vars
Summary:
REact adb config from env vars:
- `ADB_SERVER_SOCKET`
- `ANDROID_ADB_SERVER_PORT`

Reviewed By: lawrencelomax

Differential Revision: D14002603

fbshipit-source-id: e30fa4354ab15048d4350654979fd0b6f394cd89
2019-02-11 02:51:25 -08:00
Patrick Shyu
3c35d6d4cf rename FBMacros.h to FBDefines.h (unrevert)
Summary:
Another smaller diff was responsible for breaking the build... D14019510 would have been the fix, which is integrated into this diff anyway.

 ---
Renaming FBMacros.h to FBDefines.h for more standard naming (similar to say UIKit/UIKit.h or Foundation/Foundation.h).

```
Tools/fastmod/fastmod --accept-all '\bFBMacros.h' FBDefines.h ../xplat
```

drop-conflicts
bypass-lint
allow-large-files

Reviewed By: dinhviethoa

Differential Revision: D14019529

fbshipit-source-id: 940490a5ec72ccdeb819598f488dc22eae454a26
2019-02-10 09:36:40 -08:00
Hoa Dinh
5cc1bb74c3 Revert D14011897: rename FBMacros.h to FBDefines.h
Differential Revision:
D14011897

Original commit changeset: f1dd7e686eef

fbshipit-source-id: ccf548ec2f82c7a1e6c2a0df5d6fd8f9dc9e1538
2019-02-09 23:23:24 -08:00
Patrick Shyu
159061c284 rename FBMacros.h to FBDefines.h
Summary:
Renaming FBMacros.h to FBDefines.h for more standard naming (similar to say UIKit/UIKit.h or Foundation/Foundation.h).

```
Tools/fastmod/fastmod --accept-all '\bFBMacros.h' FBDefines.h ../xplat
```

drop-conflicts
bypass-lint
allow-large-files

Reviewed By: adamjernst

Differential Revision: D14011897

fbshipit-source-id: f1dd7e686eef2cdb109e85c2db4a0f2ac3d0ba42
2019-02-09 16:51:50 -08:00
Pascal Hartig
351ac37fab Log to infinity_analytics_dev scribe cat in non-prod
Reviewed By: danielbuechele

Differential Revision: D13956251

fbshipit-source-id: a741ffc7f39b3a09eeb29b8b96c3a7183f630f84
2019-02-08 11:22:55 -08:00
Daniel Büchele
cb6c7bb137 yargs add .argv to fix CLI
Summary:
CLI was not working:
- setup now needs an object with arguments passed
- the `argv` property is needed by `yargs` to work in node: http://yargs.js.org/docs/#api-argv

Reviewed By: passy

Differential Revision: D13991958

fbshipit-source-id: a9432b27f3d4d24c1e43014b8fb87dca806a6e8a
2019-02-08 09:14:45 -08:00
Pritesh Nandgaonkar
697962359c Fixed the build issue for oss
Summary:
Our OSS build was failing with the latest version of cocoapods(1.6.0). The reason was that the `post_install` script of adding a `SWIFT_VERSION` was not getting applied while building the project. So I added a `swift_version` in the YogaKit pod itself. So with this change we no longer need the `post_install` script to add `SWIFT_VERSION`.

I have also released a new version of YogaKit(1.10.0) on the CocoaPods. Usually the swift pods should specify the swift_version which is being used to develop it.Due to unknown reason, it was never mentioned in the podspec.

Reviewed By: jknoxville

Differential Revision: D13990363

fbshipit-source-id: 3c2f814765c03683fbedd17b3607ff0e6cdef566
2019-02-07 12:52:21 -08:00
Pascal Hartig
3478968d3f Add sectionsDebug dependency
Summary: Required to build new Sections plugin.

Reviewed By: mihaelao

Differential Revision: D13986716

fbshipit-source-id: 7ce07192c3e5258eb1eff9528d95ce40145e9b5c
2019-02-07 09:39:20 -08:00
Daniel Büchele
0ad13a0606 use ANDROID_ADB_SERVER_PORT in adbkit
Summary: Using `ANDROID_ADB_SERVER_PORT` env var to create adbkit instance.

Reviewed By: jknoxville

Differential Revision: D13987361

fbshipit-source-id: 2283b52466f8ad536aa3a8320a4ee8f4ce97321a
2019-02-07 06:36:49 -08:00
John Knox
8a5b5a0cba Allow underscore characters in app name (#368)
Summary:
This whitelist exists to prevent unauthorized code execution. But there's no need to exclude _, which is a valid character in android app names.
Pull Request resolved: https://github.com/facebook/flipper/pull/368

Reviewed By: passy

Differential Revision: D13987022

Pulled By: jknoxville

fbshipit-source-id: 920c5906513af9ba00ae6626b4790dfd021fe4a0
2019-02-07 05:56:37 -08:00
Pascal Hartig
08e74e617b Polyfill fetch() for tests
Summary: Per title. Required as Scribe is now being used for device tests.

Reviewed By: jknoxville, danielbuechele

Differential Revision: D13971892

fbshipit-source-id: 2df36d44d4e45a579cc9cca0d4cad9105ba8a383
2019-02-06 16:33:24 -08:00
Pascal Hartig
719dd65340 Warn when console.error is used in tests
Summary:
It's a bit hacky but apparently the recommended solution:
https://stackoverflow.com/questions/28615293/is-there-a-jest-config-that-will-fail-tests-on-console-warn

This will bail when a call to `console.error` is used in a test.
If you *need to* use console.error in a test, then mock it.

This will likely not pass yet, but let's fix all failures and then land it.

Reviewed By: danielbuechele

Differential Revision: D13898383

fbshipit-source-id: 0ca222a07433a9a311dc6bdf0d264342a59208be
2019-02-06 08:51:47 -08:00
Daniel Büchele
765874f4be no bundled plugins while developing
Summary: While running in dev mode, there are no bundled plugins. This was causing an error messages being logged. Now we early return an empty array to prevent the error.

Reviewed By: passy

Differential Revision: D13971930

fbshipit-source-id: 4110a3ea5d6d2e60b3de17a43d497a3727b8e441
2019-02-06 08:10:43 -08:00
Pascal Hartig
14ae2fea2c Move configuration to module
Summary:
Moves the JSON config access to one module instead of
ad-hoc de-serialising the object all over the place.
This also adds a type for it so we hopefully won't typo things that easily.

Reviewed By: danielbuechele

Differential Revision: D13956612

fbshipit-source-id: 48098deafedf18cc86c8802a3c40fba9394b8262
2019-02-06 03:18:52 -08:00
Daniel Büchele
e78bd57514 build headless
Summary:
- create a zip-file when building the headless version of Flipper
- restore pkg cache in Sandcastle from pantri
- run build script in sandcastle.

Changes need to go together with D13942919

Reviewed By: passy

Differential Revision: D13942701

fbshipit-source-id: caac7d6cda99fec2a6836c652957ff609a0bf8bb
2019-02-05 11:35:52 -08:00
Pritesh Nandgaonkar
dc9160d05c Use Archived device for test, as IOSDevice registers for log listeners and spits errors in tests
Summary:
Instead of using IOSDevice, used ArchivedDevice, as it doesn't instantiate the loglistener which printed erros in the console when one ran the tests.

Look at the attached task.

Reviewed By: passy

Differential Revision: D13941803

fbshipit-source-id: 3e504a02522719985afaad25caf4d2a576bfc338
2019-02-05 09:36:35 -08:00
Pritesh Nandgaonkar
d70e512889 Show save as dialog for export data
Summary: This diff adds support to specify custom location to save the flipper data to be exported

Reviewed By: passy

Differential Revision: D13916944

fbshipit-source-id: cfe816d07eb505d99c00f7798f3a97a2093ab265
2019-02-05 09:36:35 -08:00
Pritesh Nandgaonkar
9bc54597cf Import from exported file
Summary:
This diff adds the feature to import the exported flipper data. It has the following features

- Dialog to select the file
- Merges the data with an existing store.

Reviewed By: danielbuechele

Differential Revision: D13901944

fbshipit-source-id: 1b9755735419732a34254bdc39d911bcb51ad8fe
2019-02-05 09:36:35 -08:00
Pascal Hartig
259ae35284 Fix ESLint issues
Summary: Accepted the Phabricator suggestions but looks like they weren't actually applied ...

Reviewed By: danielbuechele

Differential Revision: D13958095

fbshipit-source-id: 58f3a374fc76a6e3ebccb87732af0abd0ccd52f8
2019-02-05 09:29:16 -08:00
Pascal Hartig
493e30bcd8 Switch to Litho snapshots
Summary: In preparation for the Sections plugin.

Reviewed By: mihaelao

Differential Revision: D13956804

fbshipit-source-id: a1c34d4a52d443f750f749e3637ac24fd25949ff
2019-02-05 07:34:49 -08:00
Pascal Hartig
74a726aaf9 Use yargs for non-headless Flipper args parsing
Summary:
This seems like a better approach than ad-hoc lookup in
`electron.remove.argv`. Left a note to a task to provide
a better interface to this.

I also need this in order to ensure we're starting
Flipper through the launcher which needs to happen
before we start the Electron runtime.

Reviewed By: jknoxville

Differential Revision: D13881355

fbshipit-source-id: 69c70d71035a47084f789ddb4dc969b45ba4648b
2019-02-05 04:49:38 -08:00
Daniel Büchele
3b75fb092b output data on stdout
Summary: listening on `SIGINT` events and putting the serialized store to stdout.

Reviewed By: passy

Differential Revision: D13878051

fbshipit-source-id: 19c1d857a299ed9a474605169c54e5359e0515bd
2019-02-04 07:29:13 -08:00
Daniel Büchele
45d1a7b35c add command line options
Summary: Adding options for the CLI

Reviewed By: passy

Differential Revision: D13864405

fbshipit-source-id: 1900c32833c7d18a4806f2a839215b5b536cb44f
2019-02-04 07:29:13 -08:00
Daniel Büchele
db9bc985eb redirecting console to stderr
Summary:
Wrapping console to send all console.logs to stderr, as we are planning to use stdout for the actual data.
By default only console.error messages are logged. I will add a `-v` argument to show all.

Also, displaying some ASCII-art and the version number when starting flipper CLI.

Reviewed By: passy

Differential Revision: D13843675

fbshipit-source-id: acaa70d16f12965a8426abca506049dbafb7962c
2019-02-04 07:29:13 -08:00
Daniel Büchele
22f9401e05 move version number to build-utils
Summary:
* The generation of the version number is moved to build-utils so it can be used from the headless build process as well.
* The prelude script for the headless version exposes the version number on `global.__VERSION__`
* While at this file, moving some functions in the build process to use the Sync version. Doesn't matter for the build process anyways and the syntax is much nicer.

Reviewed By: passy

Differential Revision: D13843678

fbshipit-source-id: 7df8364044ab6ebc83a4060aab2e3a42ae48a934
2019-02-04 07:29:13 -08:00
Daniel Büchele
5b68c59b5c package bundle
Summary:
For the electron build, plugins are bundled with the app and loaded from there at launch. The headless version can't require from its binary, so plugins need to be required from another path.

This diff makes the path where bundled plugins are loaded from adjustable via an environment variable: `BUNDLED_PLUGIN_PATH`. If it's set, the plugins are loaded from this path, otherwise we default to the old behaviour of including them from `./defaultPlugins`.

For the headless version we expect the plugins to be in a folder called `plugins` next to the executable. This should later be configurable via an argument passed to the CLI.

Reviewed By: passy

Differential Revision: D13843676

fbshipit-source-id: 04237ae6631b4f2ba56887fe992a56f860724edc
2019-02-04 07:29:13 -08:00
Daniel Büchele
d512c97cab package bundle
Summary:
Building binaries for the headless version of Flipper. These binaries include node, so they can be run independent on any system.

allow-large-files

Reviewed By: passy

Differential Revision: D13843677

fbshipit-source-id: c053177328ddfcba11f9a293951ebe4db4d84034
2019-02-04 07:29:13 -08:00
Pascal Hartig
64c8163a01 Fix screen recording bug on Pixel devices
Summary:
Pixels don't seem to allow modifying the modification time
of files on the "sdcard". You can repro this by getting a Pixel
device and running

```
$ adb shell touch /sdcard/boop
$ adb shell touch /sdcard/boop
touch: '/sdcard/boop': Invalid argument
```

Access time seems to work, strangely enough, but I'd rather
not play games and just create an empty file instead with echo.

Reviewed By: danielbuechele

Differential Revision: D13941381

fbshipit-source-id: 1321482a07a6698aa5eaf71e5a022c8e7dfe0b18
2019-02-04 07:22:38 -08:00
Mihaela Ogrezeanu
3d03f44f1b Map highlight overlay drawable to view
Summary:
For the Sections plugin I need to be able to highlight multiple views at the same time (without highlighting their parent view). This enables us to do that. Let me know if you have any concerns
Depends on D13803412

Reviewed By: astreet

Differential Revision: D13900729

fbshipit-source-id: cdea9c21ceb11563793410b2bb8f7f2c3a44cefb
2019-02-04 06:11:58 -08:00
Pascal Hartig
dc412ce0bc Replace ad-hoc home dir expansion with package
Summary:
Instead of replacing the tilde with home-dirs on an incomplete, ad-hoc
basis, let's use a package for this. It also supports `~USER` resolution
which someone might reasonbly expect to work if `~/DIR` is working.

Reviewed By: jknoxville

Differential Revision: D13940956

fbshipit-source-id: 5bfa9b8b2540fed8c05c856ff736e48e925f985d
2019-02-04 04:42:18 -08:00
Pascal Hartig
ce80e03e8f Add expand-tilde package
Summary:
Just splitting the diff adding the dep from using it
because this is always quite noisy.

Reviewed By: jknoxville

Differential Revision: D13940957

fbshipit-source-id: b31a953a7ebdce9a6611c47ee007c051cdcac147
2019-02-04 04:42:18 -08:00
Pritesh Nandgaonkar
4288a7cfd5 send flipper cpp errors only in non-prod builds
Summary: This diff makes sure that flipper error notifications are triggered only on the non-prod builds. Ideally we should have a preference in the flipper app itself, this we can work out later. As this diff solves the issue posted in the [group](https://fb.workplace.com/groups/230455004101832/permalink/561100837703912/).

Reviewed By: passy

Differential Revision: D13923819

fbshipit-source-id: 6598f00ab3a7b0c4a3b783120e62a1796fe4e5d2
2019-02-01 11:06:46 -08:00
Pascal Hartig
09a93cd9e6 Upgrading flow and fixing lint errors
Summary:
Upgrading to flow 0.91, fixing a bunch of `$FloxFixMe`s that were introduced by upgrading to 0.86.
Also fixing some linting issues.

Reviewed By: priteshrnandgaonkar

Differential Revision: D13900794

fbshipit-source-id: 5d0a1b62371f3b5d34b909bae0876583acb6f977
2019-02-01 06:51:01 -08:00
Daniel Büchele
88cc299811 don't trim messages
Summary: Don't trim messages to allow indentation using spaces. (e.g. for dispalying hierarchical data)

Reviewed By: jknoxville

Differential Revision: D13895630

fbshipit-source-id: 2c0e075bdecb6ab850a8ed7ed52c8423fa9343f2
2019-01-31 05:47:35 -08:00
Pritesh Nandgaonkar
5aff7cf0f1 Flipper Bump: v0.15.1-SNAPSHOT
Summary: As per the title

Reviewed By: passy

Differential Revision: D13880664

fbshipit-source-id: 37a130301db6bdd8e4ad6b5f7f1b6419678e35b6
2019-01-31 04:03:48 -08:00
Pritesh Nandgaonkar
ca797999eb Flipper Release: v0.15.0
Summary:
- Added build-headless yarn target for producing a headless binary
- Crash Reporter plugin added. Details [here](https://fbflipper.com/docs/crash-reporter-plugin.html).
- Bug fixes and dependency updates

- Desktop notifications for all kinds of crashes with their callstack
- Desktop notifications when an exception occurs within [Litho's error boundaries](https://fblitho.com/docs/error-boundaries)
- Ability to deeplink to the crash entry in the Logs plugin for Android. This feature is not available in iOS as the callstack doesn't get logged through Flipper's Logs plugin
- Ability to copy the stacktrace by right-clicking it
- Ability to see the list of crashes in the Notifications hub

Reviewed By: passy

Differential Revision: D13880665

fbshipit-source-id: 92a3455bb826b6fb22858e2c4c88c0b9ace91a5f
2019-01-31 04:03:48 -08:00
Pritesh Nandgaonkar
0e8b1a7d1a Expose crash reporter plugin to open source
Summary: Exposes crash reporter plugin and export data functionality to open source

Reviewed By: passy

Differential Revision: D13879149

fbshipit-source-id: ee10097cc9ff1af11e0350f50c855d7766076cd1
2019-01-31 04:03:48 -08:00
Lawrence Lomax
5b2f100943 Use shell - su chaining for 1-command of flipper.port
Summary: Makes the command easier as this is a one-liner

Reviewed By: passy

Differential Revision: D13878049

fbshipit-source-id: 99477939e51524234ae06c42687ae3a2db31211e
2019-01-31 03:49:53 -08:00