I changed this recently from a collection of scripts to a CLI app. You now invoke patchScripts
and pass it commands.
I used this to manage OpenPDroid source patches and create Autopatcher smali patches. Unless you are building a ROM with OpenPdroid or looking to experiment with the auto-patcher there isn't much of interest here.
####You WILL want to edit the enviromental variables in BUILD
!
The BUILD
file sets the environment and lets you choose your target device and Android version. Use it or WOE BETIDE YOU!
ANDROID_HOME # this is the root of your Android source tree
PATCHES_LOCATION # wherever you git clone https://github.com/OpenPDroid/OpenPDroidPatches
PDROID_DIR # working location to put created jars and create autopatcher patches
Here is the command line help, I have been sitting on this for several months, and wanted to push it up before I shuttered the auto-patcher/OpenPDroid doors for good. Thanks everyone for all the support!
DESCRIPTION:
Small shell app by @mateor. Apply OpenPDroid patches or create auto_patcher patches.
!! You will want to set some environmental variables at the top of BUILD file !!
OPTIONS:
apply <BRANCH>
applies the entire OpD <BRANCH> patch set to source of ANDROID_HOME
remove
removes OpD patches from ANDROID_HOME and (IMPORTANT) resets to last commit
makeFiles ( <ROMTYPE> || <TARGET_VESION> )
: creates only the OpD-related binaries for ROMTYPE
valid ROMTYPES are ( aosp, cm, aokp, omni, pac, pa, vanir, slim)
valid TARGET_VERSION depends on ROMTYPE, but is the Android version:
(2.3, 4.0, 4.1. 4.2. 4.3. 4.4 )
This command will pull sources and lunch for you, if all is working!
makePatches ( <API> )
: makes smali patches for auto-patcher.
<API> is totally optional and not necessary as it is handled
by the program pretty well.
Valid <API> are (10, 15, 16, 17, 18, 19)
You can create just the OpenPDroid related binaries or you can pull source code and nuild an entire ROM. See comments in BUILD file.
Invoking patchScripts makeFiles <ROMTYPE> <TARGET_VERSION>
will:
- repo init and pull source code of ROMTYPE rom
- lunch for your device (edit values in
patchScripts
) - create binaries or full rom.
I half-ass added support to just pass a github default.xml repo as an arg, but final implementation is left as an exercise to the reader (weak, I know.) It works, but only if you specify the proper TARGET_VERSION in BUILD.
You must build two sets of OpD-related binaries. One "stock" (or "unpatched") and one with OpD patches applied. Example:
1) ./patchScripts makeFiles cm 4.4
2) ./patchScripts apply
3) ./patchScripts makeFiles cm 4.4
4) ./patchScripts makePatches
If you want to reset your source tree:
5) ./patchScripts remove
The smali patches will be in $PDROID_DIR/cm/$DATE
.
The final steps of creating actual auto-patcher patches requires further processing of the patches. I refer you to the processing scripts in the auto_patcher, but in the most general sense, you split the patches with split_opd.sh
after they are placed in the autopatcher.
Everything for the auto-patcher and patchScripts is freely available under the MIT License. See the included license for details.