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
0 parents
commit 49f9e34
Showing
231 changed files
with
56,809 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,45 @@ | ||
--- | ||
AccessModifierOffset: -1 | ||
AlignEscapedNewlinesLeft: true | ||
AlignTrailingComments: false | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortIfStatementsOnASingleLine: true | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BreakBeforeBinaryOperators: false | ||
BreakBeforeBraces: Attach | ||
BreakConstructorInitializersBeforeComma: false | ||
ColumnLimit: 80 | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false | ||
ExperimentalAutoDetectBinPacking: true | ||
IndentCaseLabels: false | ||
IndentFunctionDeclarationAfterType: false | ||
IndentWidth: 2 | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCSpaceBeforeProtocolList: false | ||
PenaltyBreakBeforeFirstCallParameter: 10 | ||
PenaltyBreakComment: 60 | ||
PenaltyBreakFirstLessLess: 20 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 200 | ||
PointerAlignment: Left | ||
SpaceAfterControlStatementKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
Standard: Cpp11 | ||
TabWidth: 8 | ||
UseTab: Never | ||
... |
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,51 @@ | ||
# Contributing to ReDex | ||
|
||
We want to make contributing to this project as easy and transparent as | ||
possible. | ||
|
||
## Our Development Process | ||
|
||
This project is developed internally at Facebook inside a private repository. | ||
Internal changes are periodically pushed to the open-source branch. Pull | ||
requests are integrated manually into our private repository first, and they | ||
then get propagated to the public repository with the next push. | ||
|
||
## 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. 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 | ||
|
||
Our only hard-and-fast coding style rules are: | ||
* 2 spaces for indentation rather than tabs | ||
* 80 character line length | ||
|
||
In general, if you use our .clang-format file in the root of this repo, no one | ||
will complain. | ||
|
||
## License | ||
|
||
By contributing to ReDex, 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 ReDex software | ||
|
||
Copyright (c) 2016-present, 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,125 @@ | ||
AUTOMAKE_OPTIONS = foreign | ||
|
||
CXXFLAGS = --std=gnu++11 -O3 -Wall -g | ||
|
||
bin_PROGRAMS = redex-all | ||
|
||
bin_SCRIPTS = redex | ||
CLEANFILES = $(bin_SCRIPTS) | ||
EXTRA_DIST = redex.py | ||
|
||
redex: redex.py Makefile | ||
cp $(srcdir)/redex.py redex | ||
chmod +x redex | ||
|
||
includes = \ | ||
configparser \ | ||
include \ | ||
liblocator \ | ||
libresource \ | ||
libresource/android \ | ||
libresource/androidfw \ | ||
libresource/cutils \ | ||
libresource/system \ | ||
libresource/utils \ | ||
facebook/opt/cleanup_providers \ | ||
opt \ | ||
opt/all-static \ | ||
opt/annoclasskill \ | ||
opt/annokill \ | ||
opt/bridge \ | ||
opt/delinit \ | ||
opt/delsuper \ | ||
opt/final_inline \ | ||
opt/interdex \ | ||
opt/local-dce \ | ||
opt/peephole \ | ||
opt/rebindrefs \ | ||
opt/remove_empty_classes \ | ||
opt/renameclasses \ | ||
opt/shorten-srcstrings \ | ||
opt/staticrelo \ | ||
opt/simpleinline \ | ||
opt/singleimpl \ | ||
opt/staticrelo \ | ||
opt/static-sink \ | ||
opt/synth \ | ||
opt/unterface \ | ||
tools/redex-all \ | ||
util | ||
|
||
redex_all_CPPFLAGS = $(foreach i, $(includes), -I$(top_srcdir)/$i) | ||
redex_all_LDADD = -lboost_filesystem -lboost_system -lpthread | ||
|
||
redex_all_SOURCES = \ | ||
configparser/keeprules.cc \ | ||
configparser/generated_files/parser.cc \ | ||
configparser/generated_files/tokenizer.cc \ | ||
liblocator/locator.cpp \ | ||
libredex/Creators.cpp \ | ||
libredex/Debug.cpp \ | ||
libredex/DexAnnotation.cpp \ | ||
libredex/DexClass.cpp \ | ||
libredex/DexDebugOpcode.cpp \ | ||
libredex/DexIdx.cpp \ | ||
libredex/DexLoader.cpp \ | ||
libredex/DexOpcode.cpp \ | ||
libredex/DexOutput.cpp \ | ||
libredex/DexUtil.cpp \ | ||
libredex/JarLoader.cpp \ | ||
libredex/PassManager.cpp \ | ||
libredex/PgoFiles.cpp \ | ||
libredex/ProguardLoader.cpp \ | ||
libredex/ProguardMap.cpp \ | ||
libredex/ReachableClasses.cpp \ | ||
libredex/RedexContext.cpp \ | ||
libredex/RegAlloc.cpp \ | ||
libredex/Resolver.cpp \ | ||
libredex/Show.cpp \ | ||
libredex/Trace.cpp \ | ||
libredex/Transform.cpp \ | ||
libredex/Vinfo.cpp \ | ||
libredex/Warning.cpp \ | ||
libredex/WorkQueue.cpp \ | ||
libresource/FileMap.cpp \ | ||
libresource/RedexResources.cpp \ | ||
libresource/ResourceTypes.cpp \ | ||
libresource/SharedBuffer.cpp \ | ||
libresource/Static.cpp \ | ||
libresource/String16.cpp \ | ||
libresource/String8.cpp \ | ||
libresource/TypeWrappers.cpp \ | ||
libresource/Unicode.cpp \ | ||
libresource/VectorImpl.cpp \ | ||
facebook/opt/cleanup_providers/CleanupProviders.cpp \ | ||
opt/annoclasskill/AnnoClassKill.cpp \ | ||
opt/annokill/AnnoKill.cpp \ | ||
opt/bridge/Bridge.cpp \ | ||
opt/delinit/DelInit.cpp \ | ||
opt/delsuper/DelSuper.cpp \ | ||
opt/final_inline/FinalInline.cpp \ | ||
opt/interdex/InterDex.cpp \ | ||
opt/local-dce/LocalDce.cpp \ | ||
opt/peephole/Peephole.cpp \ | ||
opt/rebindrefs/ReBindRefs.cpp \ | ||
opt/remove_empty_classes/RemoveEmptyClasses.cpp \ | ||
opt/renameclasses/RenameClasses.cpp \ | ||
opt/shorten-srcstrings/Shorten.cpp \ | ||
opt/simpleinline/Deleter.cpp \ | ||
opt/simpleinline/Devirtualizer.cpp \ | ||
opt/simpleinline/InlineHelper.cpp \ | ||
opt/simpleinline/SimpleInline.cpp \ | ||
opt/singleimpl/SingleImpl.cpp \ | ||
opt/singleimpl/SingleImplAnalyze.cpp \ | ||
opt/singleimpl/SingleImplOptimize.cpp \ | ||
opt/singleimpl/SingleImplStats.cpp \ | ||
opt/singleimpl/SingleImplUtil.cpp \ | ||
opt/staticrelo/StaticRelo.cpp \ | ||
opt/static-sink/StaticSink.cpp \ | ||
opt/staticrelo/StaticRelo.cpp \ | ||
opt/synth/Synth.cpp \ | ||
opt/unterface/Unterface.cpp \ | ||
opt/unterface/UnterfaceOpt.cpp \ | ||
tools/redex-all/main.cpp \ | ||
tools/redex-all/Passes.cpp \ | ||
util/Sha1.cpp |
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,33 @@ | ||
Additional Grant of Patent Rights Version 2 | ||
|
||
"Software" means the ReDex software distributed by Facebook, Inc. | ||
|
||
Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software | ||
("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable | ||
(subject to the termination provision below) license under any Necessary | ||
Claims, 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 any third party or (ii) the Software in | ||
combination with any software or other technology. | ||
|
||
The license granted hereunder will terminate, automatically and without notice, | ||
if you (or any of your subsidiaries, corporate affiliates or agents) initiate | ||
directly or indirectly, or take a direct financial interest in, any Patent | ||
Assertion: (i) against Facebook or any of its subsidiaries or corporate | ||
affiliates, (ii) against any party if such Patent Assertion arises in whole or | ||
in part from any software, technology, product or service of Facebook or any of | ||
its subsidiaries or corporate affiliates, or (iii) against any party relating | ||
to the Software. Notwithstanding the foregoing, if Facebook or any of its | ||
subsidiaries or corporate affiliates files a lawsuit alleging patent | ||
infringement against you in the first instance, and you respond by filing a | ||
patent infringement counterclaim in that lawsuit against that party that is | ||
unrelated to the Software, the license granted hereunder will not terminate | ||
under section (i) of this paragraph due to such counterclaim. | ||
|
||
A "Necessary Claim" is a claim of a patent owned by Facebook that is | ||
necessarily infringed by the Software standing alone. | ||
|
||
A "Patent Assertion" is any lawsuit or other action alleging direct, indirect, | ||
or contributory infringement or inducement to infringe any patent, including a | ||
cross-claim or counterclaim. |
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,53 @@ | ||
ReDex: An Android Bytecode Optimizer | ||
------------------------------------ | ||
|
||
ReDex is an Android bytecode (dex) optimizer originally developed at | ||
Facebook. It provides a framework for reading, writing, and analyzing .dex | ||
files, and a set of optimization passes that use this framework to improve the | ||
bytecode. An APK optimized by ReDex should be smaller and faster than its | ||
source. | ||
|
||
# Quick Start Guide | ||
|
||
### Dependencies | ||
|
||
ReDex depends on folly, glog, double-conversion, boost and zlib, and uses | ||
autoconf/automake for building. Getting these dependences is easiest using a | ||
package manager. | ||
|
||
Mac OS X: | ||
``` | ||
brew install boost autoconf automake folly glog double-conversion | ||
``` | ||
|
||
Ubuntu 14.04 LTS: | ||
``` | ||
apt-get install \ | ||
autoconf \ | ||
build-essential \ | ||
libboost-all-dev \ | ||
zlib1g-dev \ | ||
libdouble-conversion-dev \ | ||
libgoogle-glog-dev | ||
``` | ||
You will also need to build and install | ||
[folly](https://github.com/facebook/folly) from source. | ||
|
||
### Build and Install | ||
|
||
Build ReDex using autoconf and make: | ||
``` | ||
autoreconf -ivf && ./configure && make && make install | ||
``` | ||
|
||
### Usage | ||
To use ReDex, first build your app and find the APK for it. Then run: | ||
``` | ||
redex path/to/your.apk -o path/to/output.apk | ||
``` | ||
With any luck, the result `output.apk` should be smaller and faster than the | ||
input. Enjoy! | ||
|
||
# License | ||
|
||
ReDex is BSD-licensed. We also provide an additional patent grant. |
Oops, something went wrong.