Skip to content

Commit

Permalink
Update test modules and test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sanfengAndroid committed Dec 11, 2022
1 parent 18a0f09 commit 89a72dd
Show file tree
Hide file tree
Showing 86 changed files with 1,927 additions and 279 deletions.
6 changes: 3 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ AlignArrayOfStructures: Left
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
AlignOperands: false
AlignTrailingComments: true
AlignEscapedNewlines: Right
AlignEscapedNewlines: Right
AllowAllArgumentsOnNextLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: true
BraceWrapping:
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
Expand All @@ -41,7 +41,7 @@ BreakBeforeBraces: Custom
BreakConstructorInitializers: AfterColon
ColumnLimit: 120
ContinuationIndentWidth: 2
IncludeCategories:
IncludeCategories:
- Regex: '^<.*'
Priority: 1
- Regex: '^".*'
Expand Down
107 changes: 55 additions & 52 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,69 @@ name: Android CI

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "temurin"
cache: gradle

- name: Install store file
run: echo ${{ secrets.STORE_FILE }} | base64 -d > fake.jks
- name: Install build configuration
run: |
echo storeFile=`pwd`/fake.jks > local.properties
echo storePassword=${{ secrets.STORE_PASSWORD }} >> local.properties
echo keyAlias=${{ secrets.KEY_ALIAS }} >> local.properties
echo keyPassword=${{ secrets.KEY_PASSWORD }} >> local.properties
echo logLevel=3 >> local.properties
echo targetSdk=33 >> local.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build -PmergeBuild=true -PemulatorBuild=false
- name: Copy output
run: |
mkdir -p out/debug/test_binary out/release/test_binary out/debug/test_apk out/release/test_apk
mv fakelinker-test/src/main/cpp/build/Debug out/debug/test_binary
mv fakelinker-test/src/main/cpp/build/Release out/release/test_binary
mv fakelinker-test/build/outputs/apk/debug/fakelinker-test-debug.apk out/debug/test_apk/fakelinker-test-debug.apk
mv library/build/outputs/aar/library-debug.aar out/faklinker-lib-debug.aar
mv library/build/outputs/aar/library-release.aar out/fakelinker-lib-release.aar
- name: Install store file
run: echo ${{ secrets.STORE_FILE }} | base64 -d > fake.jks
- name: Install build configuration
run: |
echo storeFile=`pwd`/fake.jks > local.properties
echo storePassword=${{ secrets.STORE_PASSWORD }} >> local.properties
echo keyAlias=${{ secrets.KEY_ALIAS }} >> local.properties
echo keyPassword=${{ secrets.KEY_PASSWORD }} >> local.properties
echo logLevel=3 >> local.properties
echo targetSdk=33 >> local.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build -PmergeBuild=true -PemulatorBuild=false
- name: Copy output
run: |
mkdir -p out/debug/test_binary out/release/test_binary
mv emualtor-testapp/build/outputs/apk/debug/emualtor-testapp-debug.apk out/debug/testapp-hook-debug.apk
mv emualtor-testapp/build/outputs/apk/release/emualtor-testapp-release.apk out/release/testapp-hook-release.apk
mv library/src/main/cpp/build/Debug out/debug/test_binary
mv library/src/main/cpp/build/Release out/release/test_binary
mv library/build/outputs/aar/library-debug.aar out/faklinker-debug.aar
mv library/build/outputs/aar/library-release.aar out/fakelinker-release.aar
- name: Build android test version with Gradle
run: ./gradlew fakelinker-test:assembleDebugAndroidTest
- name: Copy android test output
run: |
mv fakelinker-test/build/outputs/apk/androidTest/debug/fakelinker-test-debug-androidTest.apk out/debug/test_apk/fakelinker-androidtest-debug.apk
- name: Build emulator version with Gradle
run: |
./gradlew clean
./gradlew build -PmergeBuild=true -PemulatorBuild=true
- name: Build emulator version with Gradle
run: |
./gradlew clean
./gradlew build -PmergeBuild=true -PemulatorBuild=true
- name: Copy emulator version output
run: |
mv emualtor-testapp/build/outputs/apk/debug/emualtor-testapp-debug.apk out/debug/emulator-testapp-hook-debug.apk
mv emualtor-testapp/build/outputs/apk/release/emualtor-testapp-release.apk out/release/emulator-testapp-hook-release.apk
mv library/build/outputs/aar/library-debug.aar out/faklinker-emualtor-debug.aar
mv library/build/outputs/aar/library-release.aar out/fakelinker-emulator-release.aar
- name: Copy emulator version output
run: |
mv emulator-testapp/build/outputs/apk/debug/emulator-testapp-debug.apk out/debug/test_apk/fakelinker-emulator-test-debug.apk
mv emulator-testapp/build/outputs/apk/release/emulator-testapp-release.apk out/release/fakelinker-emulator-test-release.apk
mv library/build/outputs/aar/library-debug.aar out/faklinker-emulator-lib-debug.aar
mv library/build/outputs/aar/library-release.aar out/fakelinker-emulator-lib-release.aar
- name: Uninstall store file
run: rm -f fake.jks
- name: Upload Build Artifact
uses: actions/upload-artifact@v3.1.1
with:
name: ${{ github.sha }}-build
# A file, directory or wildcard pattern that describes what to upload
path: out

- name: Uninstall store file
run: rm -f fake.jks
- name: Upload Build Artifact
uses: actions/upload-artifact@v3.1.1
with:
name: ${{ github.sha }}-build
# A file, directory or wildcard pattern that describes what to upload
path: out
22 changes: 20 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ repos:
- id: chinese-transform-encoding
- id: crlf-to-lf
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v14.0.6'
rev: "v14.0.6"
hooks:
- id: clang-format
- id: clang-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: double-quote-string-fixer
- id: name-tests-test
- id: requirements-txt-fixer
- id: check-case-conflict
- id: fix-encoding-pragma
- id: mixed-line-ending
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.0
hooks:
- id: autopep8
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.9.0
hooks:
- id: reorder-python-imports
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The module has integrated the installation executable file, and the Java layer c
}
return ret;
}

static void InitHook() {
int error_code;
// Add this hook module to the global module, which will affect all modules loaded later
Expand All @@ -84,4 +84,4 @@ The module has integrated the installation executable file, and the Java layer c
}
```
3. For other more uses
[FakeXposed](https://github.com/sanfengAndroid/FakeXposed) `Xposed``root` Shield detection,File redirection, etc.
[FakeXposed](https://github.com/sanfengAndroid/FakeXposed) `Xposed``root` Shield detection,File redirection, etc.
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
return ret;
}

static void InitHook() {
int error_code;
// 将本Hook模块添加到全局模块中,这会影响之后加载的所有模块
Expand Down
Loading

0 comments on commit 89a72dd

Please # to comment.