forked from facebook/stetho
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Josh Guilfoyle
committed
Jan 29, 2015
0 parents
commit 63560a7
Showing
130 changed files
with
9,379 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.gradle | ||
/local.properties | ||
/.idea | ||
*.iml | ||
.DS_Store | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Contributing to Stetho | ||
We want to make contributing to this project as easy and transparent as | ||
possible. | ||
|
||
## Our Development Process | ||
We work directly in the github project and provide versioned releases | ||
appropriate for major milestones and minor bug fixes or improvements. GitHub | ||
is used directly for issues and pull requests and the developers actively | ||
respond to requests. | ||
|
||
## Pull Requests | ||
We actively welcome your pull requests. | ||
1. Fork the repo and create your branch from `master`. | ||
2. If you've added code that should be tested, add tests | ||
3. If you've changed APIs, update the documentation. | ||
4. Ensure the test suite passes. | ||
5. Make sure your code lints. | ||
6. If you haven't already, complete the Contributor License Agreement ("CLA"). | ||
|
||
## Contributor License Agreement ("CLA") | ||
In order to accept your pull request, we need you to submit a CLA. You only need | ||
to do this once to work on any of Facebook's open source projects. | ||
|
||
Complete your CLA here: <https://code.facebook.com/cla> | ||
|
||
## Issues | ||
We use GitHub issues to track public bugs. Please ensure your description is | ||
clear and has sufficient instructions to be able to reproduce the issue. | ||
|
||
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe | ||
disclosure of security bugs. In those cases, please go through the process | ||
outlined on that page and do not file a public issue. | ||
|
||
## Coding Style | ||
* 2 spaces for indentation rather than tabs | ||
* Line wrapping indents 4 spaces | ||
* 100 character line length | ||
* One parameter per line when line wrapping is required | ||
* Use the `m` member variable prefix for private fields | ||
* Opening braces to appear on the same line as code | ||
|
||
## License | ||
By contributing to Stetho, you agree that your contributions will be licensed | ||
under its BSD license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
BSD License | ||
|
||
For Stetho software | ||
|
||
Copyright (c) 2015, Facebook, Inc. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name Facebook nor the names of its contributors may be used to | ||
endorse or promote products derived from this software without specific | ||
prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Additional Grant of Patent Rights | ||
|
||
"Software" means the Stetho software distributed by Facebook, Inc. | ||
|
||
Facebook hereby grants you a perpetual, worldwide, royalty-free, non-exclusive, | ||
irrevocable (subject to the termination provision below) license under any | ||
rights in any patent claims owned by Facebook, to make, have made, use, sell, | ||
offer to sell, import, and otherwise transfer the Software. For avoidance of | ||
doubt, no license is granted under Facebook’s rights in any patent claims that | ||
are infringed by (i) modifications to the Software made by you or a third party, | ||
or (ii) the Software in combination with any software or other technology | ||
provided by you or a third party. | ||
|
||
The license granted hereunder will terminate, automatically and without notice, | ||
for anyone that makes any claim (including by filing any lawsuit, assertion or | ||
other action) alleging (a) direct, indirect, or contributory infringement or | ||
inducement to infringe any patent: (i) by Facebook or any of its subsidiaries or | ||
affiliates, whether or not such claim is related to the Software, (ii) by any | ||
party if such claim arises in whole or in part from any software, product or | ||
service of Facebook or any of its subsidiaries or affiliates, whether or not | ||
such claim is related to the Software, or (iii) by any party relating to the | ||
Software; or (b) that any right in any patent claim of Facebook is invalid or | ||
unenforceable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# Stetho | ||
Stetho is a sophisticated debug bridge for Android applications. When enabled, | ||
developers have access to the Chrome Developer Tools feature natively part of | ||
the Chrome desktop browser. Developers can also choose to enable the optional | ||
`dumpapp` tool which offers a powerful command-line interface to application | ||
internals. | ||
|
||
## Features | ||
|
||
### WebKit Inspector | ||
WebKit Inspector is the internal name of the Chrome Developer Tools feature. | ||
It is implemented using a client/server protocol which the Stetho software | ||
provides for your application. Once your application is integrated, simply | ||
navigate to `chrome://inspect` and click "Inspect" to get started! | ||
|
||
 | ||
|
||
#### Network inspection | ||
Network inspection is possible with the full spectrum of Chrome Developer Tools features, including image preview, JSON response helpers, and even exporting traces to the HAR format. | ||
|
||
 | ||
|
||
#### Database inspection | ||
SQLite databases can be visualized and interactively explored with full read/write capabilities. | ||
|
||
 | ||
|
||
### dumpapp | ||
Dumpapp extends beyond the Inspector UI features shown above to provide a much | ||
more extensible, command-line interface to application components. A default | ||
set of plugins is provided, but the real power of dumpapp is the ability to | ||
easily create your own! | ||
|
||
 | ||
|
||
## Integration | ||
Integrating with Stetho is intended to be seamless and straightforward for | ||
most existing Android applications. There is a simple initialization step | ||
which occurs in your `Application` class: | ||
|
||
```java | ||
public class MyApplication extends Application { | ||
public void onCreate() { | ||
super.onCreate(); | ||
Stetho.initialize( | ||
Stetho.newInitializerBuilder(this) | ||
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this)) | ||
.enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this)) | ||
.build()); | ||
} | ||
} | ||
``` | ||
|
||
This brings up most of the default configuration but does not enable some | ||
additional hooks (most notably, network inspection). See below for specific | ||
details on individual subsystems. | ||
|
||
### Enable network inspection | ||
If you are using the popular [OkHttp](http://https://github.com/square/okio) | ||
library at the 2.2.x+ release, you can use the | ||
[Interceptors](https://github.com/square/okhttp/wiki/Interceptors) system to | ||
automatically hook into your existing stack. This is currently the simplest | ||
and most straightforward way to enable network inspection: | ||
|
||
```java | ||
OkHttpClient client = new OkHttpClient(); | ||
client.networkInterceptors().add(new StethoInterceptor()); | ||
``` | ||
|
||
If you are using any of other network stack options, you will need to manually | ||
provide data to the `NetworkEventReporter` interface. The general pattern for implementing this is: | ||
|
||
```java | ||
NetworkEventReporter reporter = NetworkEventReporterImpl.get(); | ||
// Important to check if it is enabled first so as not to add overhead to | ||
// the common case that is not under scrutiny. | ||
if (reporter.isEnabled()) { | ||
reporter.requestWillBeSent(new MyInspectorRequest(request)); | ||
} | ||
``` | ||
|
||
See the `stetho-sample` project for more details. | ||
|
||
### Custom dumpapp plugins | ||
Custom plugins are the preferred means of extending the `dumpapp` system and | ||
can be added easily during configuration. Simply replace your configuration | ||
step as such: | ||
|
||
```java | ||
Stetho.initialize(Stetho.newInitializerBuilder(context) | ||
.enableDumpapp(new MyDumperPluginsProvider(context)) | ||
.build()) | ||
|
||
private static class MyDumperPluginsProvider implements DumperPluginsProvider { | ||
... | ||
|
||
public Iterable<DumperPlugin> get() { | ||
ArrayList<DumperPlugin> plugins = new ArrayList<DumperPlugin>(); | ||
for (DumperPlugin defaultPlugin : Stetho.defaultDumperPluginsProvider(mContext).get()) { | ||
plugins.add(defaultPlugin); | ||
} | ||
plugins.add(new MyDumperPlugin()); | ||
return plugins; | ||
} | ||
} | ||
``` | ||
|
||
See the `stetho-sample` project for more details. | ||
|
||
## Improve Stetho! | ||
See the CONTRIBUTING.md file for how to help out. | ||
|
||
## License | ||
Stetho is BSD-licensed. We also provide an additional patent grant. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:1.0.0' | ||
classpath 'org.robolectric:robolectric-gradle-plugin:0.14.+' | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
jcenter() | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Wed Jan 28 14:53:04 PST 2015 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-bin.zip |
Oops, something went wrong.