Skip to content

Commit

Permalink
genmonkefull (#17)
Browse files Browse the repository at this point in the history
* adds new genmonke script

* updates readme
  • Loading branch information
FoseFx authored Feb 17, 2021
1 parent 4b21806 commit 5d2e860
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 24 deletions.
23 changes: 7 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ A mod of the Twitch Android Mobile App adding BetterTTV and FrankerFaceZ emotes
## Build it yourself

> This patch is meant to be applied to version **10.1.0** of the official twitch app
> Make soure you use this version before you create an issue!
## Prerequisites:

Expand Down Expand Up @@ -40,7 +41,7 @@ Do the following once:
1. Intialize the workspace as described above
2. Rename `disass` to `extracted`

3. Now you can build the java source code in (`source`) using `./buildsource`.
3. Now you can build the java source code in (`source`) using `./buildsource extracted`.
This will result in the creation of a directory called `sourceout`.
It will also automaticly dex the class files and baksmali them.
I recommend to scim through the script so you can set your environment variables.
Expand Down Expand Up @@ -90,28 +91,18 @@ You need to nothing else, you can commit your code and start a pull request!

(i.e. changes to resources)

Just run the `./genmonkey` script and commit it. Your PR should only contain changes in `monke.patch`.
Just run the `./genmonkeyonly` script and commit it. Your PR should only contain changes in `monke.patch`.

#### Both source and monkey patch changes

Do the following:
Run `./genmonkefull` script and commit it. Your PR will contain both changes to `source/` and `monke.patch`.
If, for whatever reason, the script fails¹ you might need to `cd` into `extracted` run `git checkout master` and `git stash pop` to get your changes back.

1. `cd` into `extraced`
2. Stash your changes using `git stash`
> Your changes will appear as gone. Dont panic!
> You can get them back using `git stash pop`, like you will see later.
3. Change the branch to `javaonly` using `git checkout javaonly`
4. Go back to the main repo and run `./buildsources`
5. Back in `extracted` create a commit like this: `git commit -m "new changes"`
6. Go back to the master branch: `git checkout master`
7. Get your changes back: `git stash pop`
8. Run `./genmonke` form the main repo

Your pull request will contain changes in `sources` and `monke.patch`!
¹: If the script stops, because it detected no changes, you do not need to do that.

# Best practices for contributers

Everytime you get a new version of the code (e.g. using git pull) remove `extraced` and run `./initworkspace` again.
Everytime you get a new version of the code (e.g. using git pull or git checkout) remove `extraced` and run `./initworkspace` again.

[baksmali]: https://github.com/JesusFreke/smali
[uber]: https://github.com/patrickfav/uber-apk-signer/releases/latest
Expand Down
2 changes: 1 addition & 1 deletion buildsource
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[ -z "$JAVAC_PATH" ] && JAVAC_PATH=javac
[ -z "$BUILDTOOLS_PATH" ] && BUILDTOOLS_PATH=~/Android/Sdk/build-tools/30.0.3
[ -z "$BAKSMALI_PATH" ] && BAKSMALI_PATH=/opt/baksmali/baksmali-2.4.0.jar
[ -z "$TARGETDIR" ] && TARGETDIR=extracted
[ -z "$1" ] && TARGETDIR=extracted || TARGETDIR=$1

echo "JAVA_PATH: $JAVA_PATH"
echo "JAVAC_PATH: $JAVAC_PATH"
Expand Down
6 changes: 0 additions & 6 deletions genmonke

This file was deleted.

29 changes: 29 additions & 0 deletions genmonkefull
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

[ -z "$1" ] && echo "usage: ./genmonkefull <targetdir>" && echo "e.g.: ./genmonkefull extracted" && exit 1

cd $1
if [ $(git status --short | wc -l) = "0" ]; then
echo "No changes in $1 found, no need to generate monke.patch"
exit 1
fi
git stash &&
git checkout javaonly &&
cd .. &&
./buildsource $1 &&
cd $1 &&
if [ $(git status --short | wc -l) = "0" ]; then
echo ""
echo "== No changes caused by sources, please run ./genmokeonly instead! =="
echo ""
exit 1
git checkout master
git stash pop --quiet
exit 1
fi
git add . &&
git commit -m "new sources" &&
git checkout master &&
git stash pop --quiet &&
cd .. &&
./genmonkeonly $1
12 changes: 12 additions & 0 deletions genmonkeonly
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

[ -z "$1" ] && echo "usage: ./genmonkeyonly <targetdir>" && echo "e.g.: ./genmonkeyonly extracted" && exit 1

cd $1 &&
if [ $(git status --short | wc -l) = "0" ]; then
echo "No changes in $1 found, no need to generate monke.patch"
exit 1
fi
git checkout master &&
git diff --binary -U1 javaonly > ../monke.patch &&
echo "done"
2 changes: 1 addition & 1 deletion initworkspace
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ git checkout javaonly &&
cd .. &&
echo "" &&
echo "=== Build source (4/$STEPS) ===" &&
TARGETDIR=disass ./buildsource &&
./buildsource disass &&
echo "" &&
echo "=== Create reference (5/$STEPS) ===" &&
cd disass &&
Expand Down

0 comments on commit 5d2e860

Please sign in to comment.