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 Dec 14, 2022
1 parent 81bb4f3 commit 7321fc4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 4 deletions.
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 @@
name: Sync upstream
on:
workflow_dispatch:
schedule:
- cron: "0 15 * * *"

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
git remote add upstream https://github.com/revanced/revanced-cli
T=$(git tag --sort=creatordate | tail -1)
git tag -d $(git tag -l)
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 --delete $T
git rebase -X ours upstream/main
git push --tags -f
git push -f
echo ::set-output name=SYNC::1
else
echo "in sync"
echo ::set-output name=SYNC::0
fi
12 changes: 8 additions & 4 deletions src/main/kotlin/app/revanced/cli/command/MainCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ private class CLIVersionProvider : IVersionProvider {
}

@Command(
name = "ReVanced-CLI",
mixinStandardHelpOptions = true,
versionProvider = CLIVersionProvider::class
name = "ReVanced-CLI", mixinStandardHelpOptions = true, versionProvider = CLIVersionProvider::class
)
internal object MainCommand : Runnable {
val logger = DefaultCliLogger()
Expand Down Expand Up @@ -119,8 +117,14 @@ internal object MainCommand : Runnable {
)
var clean: Boolean = false

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

@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
}

override fun run() {
Expand Down Expand Up @@ -161,7 +165,7 @@ internal object MainCommand : Runnable {
Aligning.align(result, args.inputFile, alignedFile)

// 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
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ internal class ZipFileSystemUtils(

private fun Path.getRelativePath(path: Path): Path = zipFileSystem.getPath(path.relativize(this).toString())

internal fun deleteRecursively(path: String) = zipFileSystem.getPath(path).deleteRecursively()

// TODO: figure out why the file system is uncompressed by default and how to fix it
internal fun uncompress(vararg paths: String) =
paths.forEach { Files.setAttribute(zipFileSystem.getPath(it), "zip:method", ZipEntry.STORED) }
Expand Down

0 comments on commit 7321fc4

Please sign in to comment.