diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e19e6f4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,84 @@ +name: Build + +on: [ push, pull_request ] + +jobs: + build: + name: Build on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, windows-latest, macOS-latest ] + + steps: + - name: Check out + uses: actions/checkout@v2 + with: + submodules: 'recursive' + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: '11' + - name: Build with Gradle + run: ./gradlew :lsplant:publishToMavenLocal + env: + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.maven_pgp_signingKey }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.maven_pgp_signingPassword }} + - name: Upload library + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.os }}-library + path: ~/.m2 + + test: + needs: build + name: Test on API ${{ matrix.api-level }} + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + api-level: [ 28, 29, 30, 31, 32 ] + steps: + - name: checkout + uses: actions/checkout@v2 + with: + submodules: 'recursive' + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: '11' + - name: AVD cache + uses: actions/cache@v2 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-${{ matrix.api-level }} + - name: create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api-level }} + arch: x86_64 + target: google_apis + script: echo "Generated AVD snapshot for caching." + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: false + - name: run tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api-level }} + arch: x86_64 + target: google_apis + script: ./gradlew :test:connectedCheck; ./gradlew :test:connectedCheck + force-avd-creation: false + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + - name: Upload outputs + uses: actions/upload-artifact@v2 + with: + name: test-outputs + path: test/build/outputs diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..b85eada --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,29 @@ +name: Maven + +on: + workflow_dispatch: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v2 + with: + submodules: 'recursive' + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: '11' + - name: Build with Gradle + run: | + sed -i '/withSourcesJar()/d' library/build.gradle + ./gradlew :lsplant:publishToMavenLocal + git reset --hard HEAD + ./gradlew :lsplant:publish + env: + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.maven_pgp_signingKey }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.maven_pgp_signingPassword }} + ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ossrhUsername }} + ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ossrhPassword }} diff --git a/build.gradle.kts b/build.gradle.kts index e26f429..b147f49 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ val androidMinSdkVersion by extra(27) val androidBuildToolsVersion by extra("32.0.0") val androidCompileSdkVersion by extra(32) val androidNdkVersion by extra("23.1.7779620") -val androidCmakeVersion by extra("3.22.1") +val androidCmakeVersion by extra("3.18.1") tasks.register("Delete", Delete::class) { delete(rootProject.buildDir) diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/lsplant/build.gradle.kts b/lsplant/build.gradle.kts index 2ea46d6..7bf41bd 100644 --- a/lsplant/build.gradle.kts +++ b/lsplant/build.gradle.kts @@ -1,5 +1,7 @@ plugins { id("com.android.library") + id("maven-publish") + id("signing") } val androidTargetSdkVersion: Int by rootProject.extra @@ -15,6 +17,7 @@ android { buildToolsVersion = androidBuildToolsVersion buildFeatures { + buildConfig = false prefabPublishing = true } @@ -89,4 +92,61 @@ android { version = androidCmakeVersion } } + + publishing { + singleVariant("release") { + withSourcesJar() + withJavadocJar() + } + } +} + +publishing { + publications { + register("lsplant") { + group = "org.lsposed.lsplant" + artifactId = "lsplant" + version = "1.0" + afterEvaluate { + from(components.getByName("release")) + } + pom { + name.set("LSPlant") + description.set("A hook framework for Android Runtime (ART)") + url.set("https://github.com/LSPosed/LSPlant") + licenses { + license { + name.set("GNU Lesser General Public License v3.0") + url.set("https://github.com/LSPosed/LSPlant/blob/master/LICENSE") + } + } + developers { + developer { + name.set("Lsposed") + url.set("https://lsposed.org") + } + } + scm { + connection.set("scm:git:https://github.com/LSPosed/LSPlant.git") + url.set("https://github.com/LSPosed/LSPlant") + } + } + } + } + repositories { + maven { + name = "ossrh" + url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") + credentials(PasswordCredentials::class) + } + } +} + +signing { + val signingKey = findProperty("signingKey") as String? + val signingPassword = findProperty("signingPassword") as String? + if (signingKey != null && signingPassword != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } + sign(publishing.publications) } diff --git a/test/build.gradle.kts b/test/build.gradle.kts index dc21e90..c703d7a 100644 --- a/test/build.gradle.kts +++ b/test/build.gradle.kts @@ -15,6 +15,7 @@ android { buildToolsVersion = androidBuildToolsVersion buildFeatures { + buildConfig = false prefab = true }