Files
MoGoEagleEye/app/build.gradle
yangyakun 319b42f228 Merge branch 'dev_robotaxi-d_250603_8.1.0' into dev_robotaxi-d_250417_8.0.0_routing
# Conflicts:
#	OCH/common/biz/src/main/java/com/mogo/och/biz/routing/ui/runing/taxi/TaxiRunningModel.kt
#	OCH/common/common/src/main/java/com/mogo/och/common/module/constant/OchCommonConst.kt
#	OCH/common/common/src/main/java/com/mogo/och/common/module/manager/logchainanalytic/OchChainLogManager.kt
2025-06-27 15:22:56 +08:00

387 lines
14 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import java.text.SimpleDateFormat
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: ly.count.android.plugins.UploadSymbolsPlugin
apply from: rootProject.file('gradle/bytex/bytex.gradle')
Properties properties = new Properties()
properties.load(project.rootProject.file("gradle.properties").newDataInputStream())
def getBooleanProperty(String key, boolean defaultValue) {
return project.hasProperty(key) ? project.property(key).toBoolean() : defaultValue
}
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.versionCode as int
versionName rootProject.versionName
applicationId rootProject.ext.android.fLauncherApplicationId
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
buildConfigField 'boolean', 'IS_LAUNCHER', 'true'
buildConfigField 'String', 'SOCKET_APP_ID', '\"com.mogo.launcher\"'
buildConfigField 'String', 'WORKING_BRANCH_NAME', getWorkingBranchName()
buildConfigField 'String', 'WORKING_BRANCH_HASH', getWorkingBranchHash()
buildConfigField 'String', 'APP_BUILD_TIME', getBuildTime()
buildConfigField 'String', 'MAP_SDK_VERSION', "\"${MAP_SDK_VERSION}\""
buildConfigField 'String', 'MAP_SDK_OPT_VERSION', "\"${MAP_SDK_OPERATION_VERSION}\""
buildConfigField "boolean", "enableSweeper", "${getBooleanProperty('enableSweeper', false)}"
// ②车机类型主要用于区分自研车机还是别人家的车机自研车机类型为0
buildConfigField 'int', 'CAR_MACHINE_TYPE', '2'
// ④GPS数据提供源 0-Android系统1-工控机2-OBU
buildConfigField 'int', 'GPS_PROVIDER', "1"
// ⑤构建的是否是演示(美化)模式
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
buildConfigField 'String', 'ADAS_CONNECT_IP', "\"192.168.8.102\""
// 是否支持卡顿检测
buildConfigField 'boolean', 'IS_SUPPORT_JUNK_DETECT', "${rootProject.isJunkDetectEnable()}"
buildConfigField 'String', 'SWEEPER_DEFAULT_MODE', '\"Cloud\"'
buildConfigField 'boolean', 'SWEEPER_CAN_SWITCH_MODE', 'true'
multiDexEnabled true
}
sourceSets {
main {
if (rootProject.isJunkDetectEnable()) {
java.srcDirs = ['src/main/java', 'src/block/java']
} else {
java.srcDirs = ['src/main/java']
}
}
}
packagingOptions {
exclude 'META-INF/proguard/coroutines.pro'
exclude 'META-INF/*'
exclude "/lib/armeabi-v7a/*.so"
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst "META-INF/com.android.tools/proguard/coroutines.pro"
}
signingConfigs {
release {
keyAlias = 'CarLauncher'
storeFile file('../keystore/car_launcher.jks')
storePassword 'ZDauto123456'
keyPassword 'ZDauto123456'
}
releaseEB5 {
keyAlias = 'android_platform'
storeFile file('../keystore/EB5/car_launcher.jks')
storePassword 'ZDauto123456'
keyPassword 'ZDauto123456'
}
}
buildTypes {
debug {
debuggable true
minifyEnabled false
zipAlignEnabled false
shrinkResources false
signingConfig signingConfigs.release
manifestPlaceholders = [
MAP_SDK_VERSION : properties.getProperty("MAP_SDK_VERSION"),
// 高德地图鉴权信息
AMAP_API_VALUE : rootProject.ext.android.fLauncherAmapApiValue,
]
}
release {
debuggable false
minifyEnabled false
zipAlignEnabled false
shrinkResources false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
manifestPlaceholders = [
MAP_SDK_VERSION : properties.getProperty("MAP_SDK_VERSION"),
// 高德地图鉴权信息
AMAP_API_VALUE : rootProject.ext.android.fLauncherAmapApiValue,
]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
}
}
// 项目 business
// 业务线 product
// 车型 vehicle
flavorDimensions "project","role", "env"
productFlavors {
}
apply from: "./script/projectFlavors/project.gradle"
apply from: "./script/roleFlavors/driver.gradle"
apply from: "./script/roleFlavors/passenger.gradle"
// apply from: "./script/roleFlavors/driverpassenger.gradle"
// apply from: "./script/flavorfilter/flavorsFilterConfig.gradle"
packagingOptions {
exclude 'META-INF/io.netty.versions.properties'
doNotStrip '*/armeabi-v7a/*.so'
doNotStrip '*/armeabi/*.so'
doNotStrip '*/x86_64/*.so'
doNotStrip '*/x86/*.so'
}
useLibrary 'android.test.runner'
useLibrary 'android.test.base'
useLibrary 'android.test.mock'
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.boostmultidex
// debugImplementation rootProject.ext.dependencies.debugleakcanary
// releaseImplementation rootProject.ext.dependencies.releaseleakcanary
implementation rootProject.ext.dependencies.android_start_up
implementation rootProject.ext.dependencies.lancetx_runtime
if (rootProject.isJunkDetectEnable()) {
implementation rootProject.ext.dependencies.lancetx_compiler_lib
implementation rootProject.ext.dependencies.handler_proxy_runtime
kapt rootProject.ext.dependencies.lancetx_compiler
annotationProcessor rootProject.ext.dependencies.lancetx_compiler
annotationProcessor rootProject.ext.dependencies.google_auto_service
kapt rootProject.ext.dependencies.google_auto_service
compileOnly rootProject.ext.dependencies.google_auto_service
compileOnly rootProject.ext.dependencies.serialport
}
implementation rootProject.ext.dependencies.mogocustommap
implementation project(':core:function-impl:mogo-core-function-startup')
implementation project(':core:function-impl:mogo-core-function-devatools')
implementation project(':core:function-impl:mogo-core-function-devatools-rviz')
implementation project(':core:function-impl:mogo-core-function-datacenter')
implementation project(':core:function-impl:mogo-core-function-biz')
implementation project(':core:function-impl:mogo-core-function-hmi')
implementation project(':core:function-impl:mogo-core-function-map')
implementation project(':core:function-impl:mogo-core-function-chat')
implementation project(':core:function-impl:mogo-core-function-patch')
implementation project(':foudations:mogo-commons')
implementation project(':core:mogo-core-function-call')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-res')
implementation project(':tts:tts-iflytek')
androidTestImplementation project(':core:mogo-core-function-call')
androidTestImplementation project(':core:mogo-core-res')
implementation project(':OCH:facade')
androidTestImplementation rootProject.ext.dependencies.androidx_test_core
androidTestImplementation rootProject.ext.dependencies.androidx_test_core_ktx
androidTestImplementation rootProject.ext.dependencies.androidx_unit_ext
androidTestImplementation rootProject.ext.dependencies.androidx_unit_ext_ktx
androidTestImplementation rootProject.ext.dependencies.androidx_runner
androidTestImplementation rootProject.ext.dependencies.androidx_espresso_core
androidTestImplementation rootProject.ext.dependencies.localbroadcastmanager
androidTestImplementation rootProject.ext.dependencies.downloader
androidTestImplementation project(":libraries:mogo-map")
androidTestImplementation rootProject.ext.dependencies.jts_core
}
android.applicationVariants.all { variant ->
def buildTime = new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+08:00"))
def flavor = variant.productFlavors.collect { it.name }.join('-')
variant.outputs.all { output ->
outputFileName = [
rootProject.applicationName,
"v${variant.versionName}",
buildTime,
flavor.length() > 0 ? "[${flavor}]" : "",
variant.buildType.name
].findAll { it.length() > 0 }.join('_') << ".apk"
}
}
apply from: "./regroup.gradle"
/**
* @return 获取当前分支名称
*/
def getWorkingBranchName() {
def workingBranchName = ""
def proc = "git rev-parse --abbrev-ref HEAD".execute()
proc.in.eachLine { line -> workingBranchName = line }
proc.err.eachLine { line -> println line }
proc.waitFor()
workingBranchName = "\"${workingBranchName}\""
println "Working branch name: " + workingBranchName
return workingBranchName
}
/**
* @return 获取当前分支hash
*/
def getWorkingBranchHash() {
def workingBranchHash = ""
def proc = "git log -n1 --format=format:%h".execute()
proc.in.eachLine { line -> workingBranchHash = line }
proc.err.eachLine { line -> println line }
proc.waitFor()
println "Working branch hash: " + workingBranchHash
return "\"${workingBranchHash}\""
}
static def getBuildTime() {
def buildTimeFormat = "yyyy-MM-dd HH:mm:ss"
//设置时间格式
SimpleDateFormat formatter = new SimpleDateFormat(buildTimeFormat, Locale.getDefault())
//获取当前时间
Date curDate = new Date(System.currentTimeMillis())
def buildTime = formatter.format(curDate)
return "\"${buildTime}\""
}
Object readFileToJson(env) {
try {
println "对比结果${env}----------"
// 加载config.json 文件
File file = new File("${rootDir}/app/config/urlConfig.json")
def jsonSlurper = new JsonSlurper()
// 解析json
def config = jsonSlurper.parse(file)
def flavorNames = variantName()
def jsonOutput = new JsonOutput()
config.each {key, value ->
// 匹配flavor对应的 json
if(flavorNames.toLowerCase().contains(key)){
return jsonOutput.toJson(value.get(env))
}
}
// 保底原则
return jsonOutput.toJson(config.get(env).get(flavorNames))
} catch (IOException e) {
e.printStackTrace()
}
return null
}
def variantName() {
if(gradle.startParameter.taskNames.size()>0) {
for (String taskName : gradle.startParameter.taskNames) {
println "对比结果----------${taskName}"
// if (taskName.contains("Yantai")) {
// project.dependencies.add('implementation', project.project(':tts:tts-iflytek'))
// }else if (taskName.contains("Mogo")) {
// if(taskName.contains("Passenger")&&taskName.contains("T1T2")) {
// println "Mogo环境T1T2车 引入小智----------${taskName}"
// project.dependencies.add('implementation', project.project(':tts:tts-zhi'))
// }else {
// project.dependencies.add('implementation', project.project(':tts:tts-pad'))
// }
// }else if (taskName.contains("Dali")) {
// project.dependencies.add('implementation', project.project(':tts:tts-pad'))
// }else if (taskName.contains("Saas")) {
// if(taskName.contains("Passenger")&&taskName.contains("T1T2")) {
// println "Saas环境T1T2车 引入小智----------${taskName}"
// project.dependencies.add('implementation', project.project(':tts:tts-zhi'))
// }else {
// project.dependencies.add('implementation', project.project(':tts:tts-pad'))
// }
// }else {
// // 不能再else 加任何逻辑 是android dlc的特效
// println("-----------$taskName")
// }
taskName = taskName.replace("Debug", "")
taskName = taskName.replace("Release", "")
if (taskName.endsWith("Qa")) {
return "qa"
} else if (taskName.endsWith("Online")) {
return "online"
} else if (taskName.endsWith("Demo")) {
return "demo"
}
}
}
return "qa"
}
countly {
// required by both tasks
server "http://countly.zhidaozhixing.com"
// same app_key used for SDK integration
app_key "45cccb4a005ca14b79fca7d24b69e1a67730e325"
// location of mapping.txt file relative to project build directory
mappingFile "outputs/mapping/release/mapping.txt"
// note that will be saved with the upload and can be checked in the UI
noteJava "sdk-plugin automatic upload of mapping.txt"
// optional properties for uploadNativeSymbols. Shown are the default values.
// directory of .so files relative to project build directory.
// you can check the tar.gz file created under intermediates/countly
// BUILD_TYPE could be debug or release
nativeObjectFilesDir "intermediates/merged_native_libs/BUILD_TYPE"
// path for breakpad tool dump_syms executable
dumpSymsPath "/usr/bin"
// note that will be saved with the upload and can be checked in the UI
noteNative "sdk-plugin automatic upload of breakpad symbols"
}