Skip to content

Commit

Permalink
chore: Update AGP
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Mar 16, 2024
1 parent 7965ae4 commit 90f77cf
Show file tree
Hide file tree
Showing 20 changed files with 171 additions and 201 deletions.
74 changes: 11 additions & 63 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,6 @@ jobs:
runs-on: ubuntu-latest
needs:
- native
strategy:
matrix:
flavor:
# - FullRelease
- MiniRelease
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -227,88 +222,41 @@ jobs:
- name: Release Build
run: |
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
./gradlew TMessagesProj:assemble${{ matrix.flavor }}
./gradlew TMessagesProj:assembleRelease
APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk')
APK=$(dirname $APK)
echo "APK=$APK" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.flavor }}
name: Release
path: ${{ env.APK }}
upload:
name: Upload release
if: github.event.inputs.upload != 'y'
runs-on: ubuntu-latest
needs:
- build
- telegram-bot-api
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Donwload Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Download Telegram Bot API Binary
uses: actions/download-artifact@master
- name: Set up Python
uses: actions/setup-python@v5
with:
name: telegram-bot-api-binary
path: .
python-version: 3.12
- name: Send to Telegram
run: |
chmod +x telegram-bot-api-binary
function start() {
./telegram-bot-api-binary --api-id=11535358 --api-hash=33d372962fadb01df47e6ceed4e33cd6 --local 2>&1 > /dev/null &
}
start
curl http://127.0.0.1:8081/ || start
curl http://127.0.0.1:8081/ || start
curl http://127.0.0.1:8081/ || start
# send release via telegram bot api
export mini64=$(find artifacts -name "*arm64-v8a.apk")
export mini32=$(find artifacts -name "*armeabi-v7a.apk")
# export full64=$(find artifacts -name "*full-arm64-v8a.apk")
# export full32=$(find artifacts -name "*full-armeabi-v7a.apk")
# export mini64nogcm=$(find artifacts -name "*arm64-v8aNoGcm.apk")
# export mini32nogcm=$(find artifacts -name "*armeabi-v7aNoGcm.apk")
# export full64nogcm=$(find artifacts -name "*full-arm64-v8aNoGcm.apk")
# export full32nogcm=$(find artifacts -name "*full-armeabi-v7aNoGcm.apk")
echo $mini64
curl --http0.9 http://127.0.0.1:8081/bot${{ secrets.HELPER_BOT_TOKEN }}/sendMediaGroup --form-string chat_id=${{ secrets.HELPER_BOT_TARGET }} --form apk1=@"${mini64}" --form apk2=@"${mini32}" --form-string media="[{\"type\": \"document\",\"media\": \"attach://apk1\",\"caption\": \"\",\"parse_mode\": \"Markdown\"},{\"type\": \"document\",\"media\": \"attach://apk2\",\"caption\": \"${{ github.event.head_commit.message }}\",\"parse_mode\": \"Markdown\"}]" --verbose >/dev/null
echo $mini32
pkill telegram-bot
telegram-bot-api:
name: Telegram Bot API
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Clone Telegram Bot API
run: |
git clone --recursive https://github.com/tdlib/telegram-bot-api.git
git status telegram-bot-api >> telegram-bot-api-status
- name: Cache Bot API Binary
id: cache-bot-api
uses: actions/cache@v2
with:
path: telegram-bot-api-binary
key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }}
- name: Compile Telegram Bot API
if: steps.cache-bot-api.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++
cd telegram-bot-api
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. ..
cmake --build . --target install -j$(nproc)
cd ../..
ls -l telegram-bot-api/bin/telegram-bot-api*
cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary
- name: Upload Binary
uses: actions/upload-artifact@master
with:
name: telegram-bot-api-binary
path: telegram-bot-api-binary
python -m pip install -r bin/scripts/requirements.txt
git log -1 --pretty=format:"%s" > artifacts/caption.txt
python bin/scripts/upload.py ${{ secrets.HELPER_BOT_TOKEN }} ${{ secrets.HELPER_BOT_TARGET }} release
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
build/
local.properties
obj/
service_account_credentials.json
service_account_credentials.json
__pycache__/
110 changes: 19 additions & 91 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import cn.hutool.core.util.RuntimeUtil

apply plugin: "com.android.application"
apply plugin: "kotlin-android"

Expand Down Expand Up @@ -69,7 +67,7 @@ def nativeTarget = System.getenv("NATIVE_TARGET")
if (nativeTarget == null) nativeTarget = ""

android {
compileSdkVersion 33
compileSdk 33
buildToolsVersion "33.0.0"
ndkVersion rootProject.ext.ndkVersion

Expand All @@ -83,12 +81,12 @@ android {
universalApk true
} else {
enable true
reset()
universalApk false
if (!nativeTarget.isBlank()) {
reset()
include nativeTarget
universalApk false
} else {
universalApk true
include 'armeabi-v7a', 'arm64-v8a'
}
}
}
Expand Down Expand Up @@ -174,20 +172,6 @@ android {
signingConfig signingConfigs.release
}

releaseNoGcm {
debuggable false
jniDebuggable false
minifyEnabled true
shrinkResources true
multiDexEnabled true
zipAlignEnabled true
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
matchingFallbacks = ["release", "debug"]
signingConfig signingConfigs.release

buildConfigField "int", "IS_NO_GCM", "1"
}

release {
debuggable false
jniDebuggable false
Expand All @@ -199,88 +183,36 @@ android {
matchingFallbacks = ["release", "debug"]
signingConfig signingConfigs.release
}

foss {
debuggable false
jniDebuggable false
minifyEnabled true
shrinkResources true
multiDexEnabled true
zipAlignEnabled true
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
matchingFallbacks = ["release", "debug"]
}

fdroidRelease {
initWith foss
matchingFallbacks = ["release", "debug"]
}
}

sourceSets {

main {
jni.srcDirs = []
assets.srcDirs = ["src/main/assets", "src/emojis/twitter"]
}

debug {
java {
srcDirs "src/main/java", "src/gservcies/java"
}
jni.srcDirs = []
jniLibs {
srcDir "src/main/libs"
}
manifest {
srcFile "src/gservcies/AndroidManifest.xml"
srcDirs "src/main/java"
}
}

releaseNoGcm {
jni.srcDirs = []
jniLibs {
srcDir "src/main/libs"
}
}

release {
java {
srcDirs "src/main/java", "src/gservcies/java"
srcDirs "src/main/java"
}
jni.srcDirs = []
jniLibs {
srcDir "src/main/libs"
}
manifest {
srcFile "src/gservcies/AndroidManifest.xml"
}
}

foss {
jni {
srcDirs = ["./jni/"]
}
}

fdroidRelease {
jni {
srcDirs = ["./jni/"]
}
jniLibs.srcDirs = []
}

}

flavorDimensions "version"

productFlavors {
mini {
isDefault true
}
}

tasks.all { task ->
tasks.configureEach { task ->
if (((task.name.endsWith("Ndk") || task.name.startsWith("generateJsonModel") || task.name.startsWith("externalNativeBuild"))) && !(task.name.contains("Debug") || task.name.contains("Foss") || task.name.contains("Fdroid"))) {
task.enabled = false
}
Expand All @@ -292,27 +224,26 @@ android {
}
}

applicationVariants.all { variant ->
variant.outputs.all { output ->
applicationVariants.configureEach { variant ->
variant.outputs.configureEach { output ->
String gramName = "PagerGram"
String first = String.format("%s-v%s(%s)", gramName, versionName, versionCode)
String name = outputFileName.replace("TMessagesProj", first)
name = name.replace("-release", "")
name = name.replace("-mini", "")
outputFileName = name
}
}

}

def fcmVersion = "23.0.7"
def crashlyticsVersion = "18.2.12"
def fcmVersion = "23.4.1"
def crashlyticsVersion = "18.6.2"
def playCoreVersion = "1.10.3"

dependencies {

implementation "androidx.browser:browser:1.5.0"
implementation 'androidx.fragment:fragment:1.2.0'
implementation "androidx.fragment:fragment:1.2.0"
implementation "androidx.core:core-ktx:1.9.0"
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.viewpager:viewpager:1.0.0"
Expand Down Expand Up @@ -348,9 +279,6 @@ dependencies {

implementation 'com.google.android.gms:play-services-mlkit-subject-segmentation:16.0.0-beta1'

compileOnly 'org.yaml:snakeyaml:1.29'
implementation 'org.yaml:snakeyaml:1.29'

implementation project(":openpgp-api")

compileOnly fileTree("libs")
Expand All @@ -360,10 +288,8 @@ dependencies {
compileOnly "com.google.android.play:core:$playCoreVersion"

implementation 'com.google.android.gms:play-services-vision:20.1.3'
debugImplementation 'com.google.android.gms:play-services-maps:18.1.0'
debugImplementation 'com.google.android.gms:play-services-location:20.0.0'
releaseImplementation 'com.google.android.gms:play-services-maps:18.1.0'
releaseImplementation 'com.google.android.gms:play-services-location:20.0.0'
implementation 'com.google.android.gms:play-services-maps:18.2.0'
implementation 'com.google.android.gms:play-services-location:21.2.0'

debugImplementation "com.google.firebase:firebase-messaging:$fcmVersion"
debugImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
Expand All @@ -387,7 +313,7 @@ dependencies {
// add for music tag flac...
implementation 'org:jaudiotagger:2.0.3'
// add for auto translate
implementation 'com.google.mlkit:language-id:17.0.4'
implementation 'com.google.mlkit:language-id:17.0.5'
// add for emoji
implementation 'com.jaredrummler:truetypeparser-light:1.0.0'
}
Expand Down Expand Up @@ -416,8 +342,11 @@ android {
lint {
disable 'MissingTranslation', 'ExtraTranslation', 'BlockedPrivateApi'
}
buildFeatures {
buildConfig true
}

tasks.all { task ->
tasks.configureEach { task ->
if (task.name.startsWith("uploadCrashlyticsMappingFile")) {
task.enabled = false
} else if (task.name.contains("Crashlytics") && task.name.contains("NoGcm")) {
Expand All @@ -426,5 +355,4 @@ android {
task.enabled = false
}
}

}
8 changes: 8 additions & 0 deletions TMessagesProj/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,11 @@
-dontwarn org.osmdroid.**

-keepattributes SourceFile,LineNumberTable

-dontwarn java.beans.**
-dontwarn java.lang.management.**
-dontwarn javax.swing.**
-dontwarn lombok.**
-dontwarn org.slf4j.**
-dontwarn org.w3c.dom.bootstrap.**
-dontwarn sun.net.spi.nameservice.**
30 changes: 0 additions & 30 deletions TMessagesProj/src/gservcies/AndroidManifest.xml

This file was deleted.

Loading

0 comments on commit 90f77cf

Please sign in to comment.