Skip to content

Commit

Permalink
feat: rip-lib and unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
j-hc committed Jun 22, 2023
1 parent be429a4 commit 6195039
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 56 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/pull_request.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ jobs:
run: npm install
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm exec semantic-release
45 changes: 45 additions & 0 deletions .github/workflows/sync_upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
workflow_call:
workflow_dispatch:
schedule:
- cron: "0 16 * * *"

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.WF_TOKEN }}

- name: sync
id: sync
shell: bash
run: |
git config --global user.name 'j-hc'
git config --global user.email 'j-hc@users.noreply.github.com'
if [[ $(git log | grep Author | head -1) == *"semantic"* ]]; then
git reset --hard HEAD~1
fi
T=$(git tag -l)
git remote add upstream https://github.com/revanced/revanced-cli
git tag -d $T
git fetch upstream --tags -f
C=$(git rev-list --left-right --count origin/main...remotes/upstream/main | awk '{print$2}')
echo "ahead $C commits"
if [ "$C" -gt 0 ]; then
echo "rebasing"
git push origin -d $T
if ! git rebase -X ours upstream/main; then
git diff --name-only --diff-filter=U | xargs git rm
GIT_EDITOR=true git rebase --continue
fi
git push --tags -f
git push -f
else
echo "in sync"
fi
19 changes: 0 additions & 19 deletions .github/workflows/update-documentation.yml

This file was deleted.

7 changes: 0 additions & 7 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@
],
successComment: false
}
],
[
"@saithodev/semantic-release-backmerge",
{
backmergeBranches: [{"from": "main", "to": "dev"}],
clearWorkspace: true
}
]
]
}
6 changes: 4 additions & 2 deletions src/main/kotlin/app/revanced/cli/aligning/Aligning.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import app.revanced.utils.signing.align.zip.structures.ZipEntry
import java.io.File

object Aligning {
fun align(result: PatcherResult, inputFile: File, outputFile: File) {
fun align(result: PatcherResult, inputFile: File, outputFile: File, exclude: Array<String>) {
logger.info("Aligning ${inputFile.name} to ${outputFile.name}")

if (outputFile.exists()) outputFile.delete()
Expand All @@ -28,8 +28,10 @@ object Aligning {
)
}

val inputZipFile = ZipFile(inputFile)
inputZipFile.entries.removeIf { entry -> exclude.any { entry.fileName.startsWith("lib/$it") } }
file.copyEntriesFromFileAligned(
ZipFile(inputFile),
inputZipFile,
ZipAligner::getEntryAlignment
)
}
Expand Down
10 changes: 8 additions & 2 deletions src/main/kotlin/app/revanced/cli/command/MainCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ internal object MainCommand : Runnable {

@Option(names = ["--custom-aapt2-binary"], description = ["Path to custom aapt2 binary"])
var aaptPath: String = ""

@Option(names = ["--unsigned"], description = ["Disable signing of the final apk"])
var unsigned: Boolean = false

@Option(names = ["--rip-lib"], description = ["Rip the libs (arm64-v8a etc.) from APK"])
var ripLibs = arrayOf<String>()
}

override fun run() {
Expand Down Expand Up @@ -169,10 +175,10 @@ internal object MainCommand : Runnable {

// align the file
val alignedFile = cacheDirectory.resolve("${outputFile.nameWithoutExtension}_aligned.apk")
Aligning.align(result, args.inputFile, alignedFile)
Aligning.align(result, args.inputFile, alignedFile, pArgs.ripLibs)

// sign the file
val finalFile = if (!pArgs.mount) {
val finalFile = if (!pArgs.mount && !pArgs.unsigned) {
val signedOutput = cacheDirectory.resolve("${outputFile.nameWithoutExtension}_signed.apk")
Signing.sign(
alignedFile,
Expand Down

0 comments on commit 6195039

Please sign in to comment.