Nagram/TMessagesProj/build.gradle
xtaodada c7fec5ea79
feat: parse flac and ogg audio file
从这个版本开始,播放 flac 和 ogg 格式的音频文件将会从原文件中读取歌曲封面,而不是仅仅通过 Apple Music 搜索获取封面,解决了匹配错误和库中无相关歌曲时无法加载封面的问题。

Beginning with this update, playing audio files in the flac and ogg formats will read the song cover directly from the original file rather than just looking for it on Apple Music. This will fix the issue where the cover won't load when there is a match error and no pertinent song in the library.
2022-09-27 23:20:03 +08:00

402 lines
12 KiB
Groovy

import cn.hutool.core.util.RuntimeUtil
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
def verName = "8.9.3"
def verCode = 1111
if (System.getenv("DEBUG_BUILD") == "true") {
verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:%h -n 1").trim()
}
def officialVer = "8.9.3"
def officialCode = 2757
configurations {
compile.exclude module: "support-v4"
}
def keystorePwd = null
def alias = null
def pwd = null
def disableCMakeRelWithDebInfo = System.getenv("COMPILE_NATIVE") == null
Properties properties
def base64 = System.getenv("LOCAL_PROPERTIES")
if (base64 != null && !base64.isBlank()) {
properties = new Properties()
properties.load(new ByteArrayInputStream(Base64.decoder.decode(base64)))
} else if (project.rootProject.file("local.properties").exists()) {
properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())
}
if (properties != null) {
keystorePwd = properties.getProperty("KEYSTORE_PASS")
alias = properties.getProperty("ALIAS_NAME")
pwd = properties.getProperty("ALIAS_PASS")
}
keystorePwd = keystorePwd ?: System.getenv("KEYSTORE_PASS")
alias = alias ?: System.getenv("ALIAS_NAME")
pwd = pwd ?: System.getenv("ALIAS_PASS")
def targetTask = ""
if (!gradle.startParameter.taskNames.isEmpty()) {
if (gradle.startParameter.taskNames.size == 1) {
targetTask = gradle.startParameter.taskNames[0].toLowerCase()
}
}
def nativeTarget = System.getenv("NATIVE_TARGET")
if (nativeTarget == null) nativeTarget = ""
android {
compileSdkVersion 32
buildToolsVersion "32.0.0"
ndkVersion rootProject.ext.ndkVersion
defaultConfig.applicationId = "xyz.nextalone.nagram"
splits {
abi {
if (targetTask.contains("fdroid")) {
enable false
universalApk true
} else {
enable true
universalApk false
if (!nativeTarget.isBlank()) {
reset()
include nativeTarget
}
}
}
}
defaultConfig {
minSdkVersion 21
//noinspection ExpiredTargetSdkVersion,OldTargetApi
targetSdkVersion 30
versionName verName
versionCode verCode
def appId = "11535358"
def appHash = "33d372962fadb01df47e6ceed4e33cd6"
//obtain your own keys at https://core.telegram.org/api/obtaining_api_id
if (properties != null) {
appId = properties.getProperty("TELEGRAM_APP_ID") ?: System.getenv("TELEGRAM_APP_ID") ?: appId
appHash = properties.getProperty("TELEGRAM_APP_HASH") ?: System.getenv("TELEGRAM_APP_HASH") ?: appHash
}
buildConfigField "String", "OFFICIAL_VERSION", "\"" + officialVer + "\""
buildConfigField "int", "OFFICIAL_VERSION_CODE", officialCode + ""
buildConfigField "int", "APP_ID", appId
buildConfigField "String", "APP_HASH", "\"" + appHash + "\""
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_static", "-DANDROID_PLATFORM=android-21"
}
}
}
bundle {
language {
enableSplit = false
}
}
externalNativeBuild {
cmake {
path "jni/CMakeLists.txt"
}
}
lintOptions {
disable "MissingTranslation"
disable "ExtraTranslation"
disable "BlockedPrivateApi"
}
packagingOptions {
exclude "/fabric/**"
exclude "/META-INF/*.version"
exclude "/META-INF/*.kotlin_module"
exclude "/META-INF/native-image/**"
exclude "/builddef.lst"
exclude "/*.txt"
exclude "/DebugProbesKt.bin"
exclude "/okhttp3/internal/publicsuffix/NOTICE"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
coreLibraryDesugaringEnabled true
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
testOptions {
unitTests.includeAndroidResources = true
}
signingConfigs {
release {
storeFile project.file("release.keystore")
storePassword keystorePwd
keyAlias alias
keyPassword pwd
}
}
buildTypes {
debug {
isDefault true
debuggable true
jniDebuggable true
multiDexEnabled true
zipAlignEnabled true
signingConfig signingConfigs.release
ndk.debugSymbolLevel = "FULL"
}
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
}
release {
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
}
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 = ["./jni/"]
manifest {
srcFile "src/gservcies/AndroidManifest.xml"
}
}
releaseNoGcm {
jni.srcDirs = []
jniLibs {
srcDir "src/main/libs"
}
}
release {
java {
srcDirs "src/main/java", "src/gservcies/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
manifestPlaceholders = [is_full_version: "false"]
}
full {
manifestPlaceholders = [is_full_version: "true"]
}
}
sourceSets.all { set ->
if (set.name.startsWith("full")) {
set.dependencies {
implementation fileTree("libs")
}
}
}
tasks.all { 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
}
if (task.name.contains("uploadCrashlyticsMappingFile")) {
enabled = false
}
if (disableCMakeRelWithDebInfo && task.name.contains("CMakeRelWithDebInfo") && !targetTask.contains("fdroid")) {
enabled = false
}
}
applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = outputFileName.replace("TMessagesProj", "Nagram-v" + versionName + "(" + versionCode + ")").replace("-release", "")
}
}
}
def okHttpVersion = "5.0.0-alpha.9"
def fcmVersion = "23.0.7"
def crashlyticsVersion = "18.2.12"
def playCoreVersion = "1.10.3"
dependencies {
implementation "androidx.browser:browser:1.4.0"
implementation "androidx.core:core-ktx:1.8.0"
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.viewpager:viewpager:1.0.0"
implementation "androidx.exifinterface:exifinterface:1.3.3"
implementation "androidx.interpolator:interpolator:1.0.0"
implementation "androidx.dynamicanimation:dynamicanimation:1.0.0"
implementation "androidx.multidex:multidex:2.0.1"
implementation "androidx.sharetarget:sharetarget:1.1.0"
compileOnly "org.checkerframework:checker-qual:3.16.0"
compileOnly "org.checkerframework:checker-compat-qual:2.5.5"
// don"t change this :)
//noinspection GradleDependency
implementation "com.googlecode.mp4parser:isoparser:1.0.6"
implementation "com.google.code.gson:gson:2.8.8"
implementation "org.osmdroid:osmdroid-android:6.1.10"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
implementation 'dnsjava:dnsjava:3.4.1'
implementation "org.dizitart:nitrite:3.4.3"
implementation "cn.hutool:hutool-core:5.7.13"
implementation "cn.hutool:hutool-crypto:5.7.13"
implementation 'cn.hutool:hutool-http:5.7.5'
implementation "com.jakewharton:process-phoenix:2.1.2"
implementation 'org:jaudiotagger:2.0.3'
compileOnly 'org.yaml:snakeyaml:1.29'
fullImplementation 'org.yaml:snakeyaml:1.29'
implementation project(":openpgp-api")
compileOnly fileTree("libs")
compileOnly "com.google.firebase:firebase-messaging:$fcmVersion"
compileOnly "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
compileOnly "com.google.android.play:core:$playCoreVersion"
// TODO: Remove in nogcm vesion
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.android.gms:play-services-location:20.0.0'
debugImplementation "com.google.firebase:firebase-messaging:$fcmVersion"
debugImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
debugImplementation "com.google.android.play:core:$playCoreVersion"
releaseImplementation "com.google.firebase:firebase-messaging:$fcmVersion"
releaseImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
releaseImplementation "com.google.android.play:core:$playCoreVersion"
testImplementation "junit:junit:4.13.2"
testImplementation "androidx.test:core:1.4.0"
testImplementation "org.robolectric:robolectric:4.5.1"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.0"
}
dependencies {
// add for undo and redo
implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3'
// add splash screen
implementation("androidx.core:core-splashscreen:1.0.0-beta02")
}
apply plugin: "com.google.gms.google-services"
apply plugin: "com.google.firebase.crashlytics"
android {
tasks.all { task ->
if (task.name.startsWith("uploadCrashlyticsMappingFile")) {
task.enabled = false
} else if (task.name.contains("Crashlytics") && task.name.contains("NoGcm")) {
task.enabled = false
} else if (task.name.endsWith("GoogleServices") && task.name.contains("NoGcm")) {
task.enabled = false
}
}
}