Skip to content

Commit

Permalink
Bump to 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 committed Oct 30, 2022
1 parent a180081 commit 7055cfa
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 68 deletions.
32 changes: 15 additions & 17 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,29 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'

- name: Build with Gradle
run: ./gradlew assembleRelease

- name: Sign app APK
- name: Write key
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: r0adkll/sign-android-release@v1
# ID used to access action output
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
run: |
if [ ! -z "${{ secrets.KEY_STORE }}" ]; then
echo releaseStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> gradle.properties
echo releaseKeyAlias='${{ secrets.ALIAS }}' >> gradle.properties
echo releaseKeyPassword='${{ secrets.KEY_PASSWORD }}' >> gradle.properties
echo releaseStoreFile='key.jks' >> gradle.properties
echo ${{ secrets.SIGNING_KEY }} | base64 --decode > key.jks
fi
- name: Build with Gradle
run: ./gradlew assembleRelease assembleDebug

- name: Upload artifact
if: steps.sign_app.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: Signed app bundle
path: ${{steps.sign_app.outputs.signedReleaseFile}}
path: app/build/outputs/apk
47 changes: 0 additions & 47 deletions app/build.gradle

This file was deleted.

94 changes: 94 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import java.nio.file.Paths

plugins {
id("com.android.application")
}

val releaseStoreFile: String? by rootProject
val releaseStorePassword: String? by rootProject
val releaseKeyAlias: String? by rootProject
val releaseKeyPassword: String? by rootProject

android {
compileSdk = 33
buildToolsVersion = "33.0.0"
defaultConfig {
applicationId = "com.coderstory.toolkit"
minSdk = 29
targetSdk = 33
versionCode = 1989
versionName = "4.1"
}

signingConfigs {
create("config") {
releaseStoreFile?.also {
storeFile = rootProject.file(it)
storePassword = releaseStorePassword
keyAlias = releaseKeyAlias
keyPassword = releaseKeyPassword
}
}
}
packagingOptions {
jniLibs {
excludes += "META-INF/**"
}
resources {
excludes += "META-INF/**"
}
}


buildTypes {
all {
signingConfig =
if (releaseStoreFile.isNullOrEmpty()) signingConfigs.getByName("debug") else signingConfigs.getByName(
"config"
)
}
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles("proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility(JavaVersion.VERSION_11)
targetCompatibility(JavaVersion.VERSION_11)
}
lint {
abortOnError = false
}
namespace = "com.coderstory.toolkit"
}

dependencies {
compileOnly("de.robv.android.xposed:api:82")
}
val optimizeReleaseRes = task("optimizeReleaseRes").doLast {
val aapt2 = Paths.get(
project.android.sdkDirectory.path,
"build-tools", project.android.buildToolsVersion, "aapt2"
)
val zip = Paths.get(
project.buildDir.path, "intermediates",
"optimized_processed_res", "release", "resources-release-optimize.ap_"
)
val optimized = File("${zip}.opt")
val cmd = exec {
commandLine(aapt2, "optimize", "--collapse-resource-names", "-o", optimized, zip)
isIgnoreExitValue = true
}
if (cmd.exitValue == 0) {
delete(zip)
optimized.renameTo(zip.toFile())
}
}
tasks.whenTaskAdded {
when (name) {
"optimizeReleaseResources" -> {
finalizedBy(optimizeReleaseRes)
}
}
}
4 changes: 2 additions & 2 deletions build.gradle → build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath("com.android.tools.build:gradle:7.3.1")
}
}

allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jcenter.bintray.com" }
maven(url = "https://jcenter.bintray.com")
}
}

6 changes: 5 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@
# org.gradle.parallel=true
#Fri Nov 17 23:21:15 CST 2017
android.useAndroidX=true
android.enableJetifier=true
android.nonTransitiveRClass=true
android.enableAppCompileTimeRClass=true
android.enableR8.fullMode=true
android.experimental.enableNewResourceShrinker=true
android.experimental.enableNewResourceShrinker.preciseShrinking=true
1 change: 0 additions & 1 deletion settings.gradle

This file was deleted.

1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include(":app")

0 comments on commit 7055cfa

Please sign in to comment.