Skip to content

Commit

Permalink
AGP 7.1 & 7.2 compatibility support
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsonlee committed Jun 12, 2022
1 parent 894ae4f commit 265d263
Show file tree
Hide file tree
Showing 56 changed files with 2,422 additions and 312 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/build.yml

This file was deleted.

15 changes: 5 additions & 10 deletions .github/workflows/dokka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,16 @@ jobs:
publish:
runs-on: ubuntu-latest
if: github.repository_owner == 'johnsonlee'

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'

- name: Build API reference
cache: 'gradle'
- shell: bash
run: ./gradlew reference -S --no-daemon

- name: Deploy API reference
- shell: bash
working-directory: ./build/reference
run: |
echo "reference.johnsonlee.io" > CNAME
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@ jobs:
publish:
runs-on: ubuntu-latest
if: github.repository_owner == 'johnsonlee'

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'

- name: Publish to Sonatype
cache: 'gradle'
- shell: bash
run: |
echo "Create GPG private key"
echo $GPG_KEY_ARMOR | base64 --decode > $GITHUB_WORKSPACE/secring.gpg
Expand Down
266 changes: 240 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,250 @@ name: Run tests

on:
push:
tags:
- '*'
branches: [ '*' ]
pull_request:
branches: [ '*' ]
repository_dispatch:
types: [test]

env:
JAVA_OPTS: -Xmx8g -XX:MetaspaceSize=2g -Dfile.encoding=UTF-8
JVM_OPTS: -Xmx8g -XX:MetaspaceSize=2g -Dfile.encoding=UTF-8
GPG_KEY_ARMOR: ${{ secrets.GPG_KEY_ARMOR }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_STAGING_PROFILE_ID: ${{ secrets.OSSRH_STAGING_PROFILE_ID }}

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
test:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- uses: actions/cache@v3
with:
path: '**/build'
key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/settings.gradle', '**/build.gradle', '**/gradle.properties') }}
- shell: bash
run: |
echo "Create GPG private key"
echo ${GPG_KEY_ARMOR} | base64 --decode > ${GITHUB_WORKSPACE}/secring.gpg
rm -rvf ~/.m2
./gradlew clean publishToMavenLocal -S --no-daemon -Psigning.keyId=${GPG_KEY_ID} -Psigning.password=${GPG_PASSPHRASE} -Psigning.secretKeyRingFile=${GITHUB_WORKSPACE}/secring.gpg
test:
name: Unit Test
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- uses: actions/cache@v3
with:
path: '**/build'
key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/settings.gradle', '**/build.gradle', '**/gradle.properties') }}
- shell: bash
run: ./gradlew test -S --no-daemon

integration-test-agp-v3_3:
name: AGP 3.3 Integration Test
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
run: ./gradlew booster-android-gradle-v3_3:integrationTest -S --no-daemon

integration-test-agp-v3_4:
name: AGP 3.4 Integration Test
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
run: ./gradlew booster-android-gradle-v3_4:integrationTest -S --no-daemon

integration-test-agp-v3_5:
name: AGP 3.5 Integration Test
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
run: ./gradlew booster-android-gradle-v3_5:integrationTest -S --no-daemon

integration-test-agp-v3_6:
name: AGP 3.6 Integration Test
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
run: ./gradlew booster-android-gradle-v3_6:integrationTest -S --no-daemon

integration-test-agp-v4_0:
name: AGP 4.0 Integration Test
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
run: ./gradlew booster-android-gradle-v4_0:integrationTest -S --no-daemon

integration-test-agp-v4_1:
name: AGP 4.1 Integration Test
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
run: ./gradlew booster-android-gradle-v4_1:integrationTest -S --no-daemon

integration-test-agp-v4_2:
name: AGP 4.2 Integration Test
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
run: ./gradlew booster-android-gradle-v4_2:integrationTest -S --no-daemon

integration-test-agp-v7_0:
name: AGP 7.0 Integration Test
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
run: ./gradlew booster-android-gradle-v7_0:integrationTest -S --no-daemon

integration-test-agp-v7_1:
name: AGP 7.1 Integration Test
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
run: ./gradlew booster-android-gradle-v7_1:integrationTest -S --no-daemon

integration-test-agp-v7_2:
name: AGP 7.2 Integration Test
needs: build
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'

- name: Run tests
run: |
echo "Create GPG private key"
echo $GPG_KEY_ARMOR | base64 --decode > $GITHUB_WORKSPACE/secring.gpg
./gradlew publishToMavenLocal check -POSSRH_USERNAME=${OSSRH_USERNAME} -POSSRH_PASSWORD=${OSSRH_PASSWORD} -POSSRH_STAGING_PROFILE_ID=${OSSRH_STAGING_PROFILE_ID} -Psigning.keyId=${GPG_KEY_ID} -Psigning.password=${GPG_PASSPHRASE} -Psigning.secretKeyRingFile=${GITHUB_WORKSPACE}/secring.gpg -S --no-daemon
env:
JAVA_OPTS: -Xmx8g -XX:MaxPermSize=1g -XX:MetaspaceSize=1g -Dfile.encoding=UTF-8
JVM_OPTS: -Xmx8g -XX:MaxPermSize=1g -XX:MetaspaceSize=1g -Dfile.encoding=UTF-8
GPG_KEY_ARMOR: ${{ secrets.GPG_KEY_ARMOR }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_STAGING_PROFILE_ID: ${{ secrets.OSSRH_STAGING_PROFILE_ID }}
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
run: ./gradlew booster-android-gradle-v7_2:integrationTest -S --no-daemon
2 changes: 2 additions & 0 deletions booster-android-gradle-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ dependencies {
implementation project(':booster-android-gradle-v4_1')
implementation project(':booster-android-gradle-v4_2')
implementation project(':booster-android-gradle-v7_0')
implementation project(':booster-android-gradle-v7_1')
implementation project(':booster-android-gradle-v7_2')
compileOnly 'com.android.tools.build:gradle:3.0.0'
testCompileOnly 'com.android.tools.build:gradle:3.0.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.android.build.gradle.api.BaseVariant
import com.android.build.gradle.internal.publishing.AndroidArtifacts
import com.android.build.gradle.tasks.ProcessAndroidResources
import com.android.builder.core.VariantType
import com.android.sdklib.AndroidVersion
import com.android.builder.model.ApiVersion
import com.android.sdklib.BuildToolInfo
import com.didiglobal.booster.kotlinx.file
import org.gradle.api.Incubating
Expand Down Expand Up @@ -115,7 +115,7 @@ fun BaseVariant.getTaskName(prefix: String, suffix: String): String = AGP.run {
getTaskName(prefix, suffix)
}

val BaseVariant.minSdkVersion: AndroidVersion
val BaseVariant.minSdkVersion: ApiVersion
get() = AGP.run {
minSdkVersion
}
Expand Down
Loading

0 comments on commit 265d263

Please sign in to comment.