apply plugin: 'com.android.application' apply plugin: 'com.alibaba.arouter' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'android-aspectjx' apply plugin: 'bugly' //apply ByteX宿主 if (!isAndroidTestBuild()) { apply plugin: 'bytex' ByteX { enable true enableInDebug true logLevel "DEBUG" } } if (!isAndroidTestBuild()) { apply plugin: 'chain.log.hook' hooklog{ enableLoggerToServer true } } //if (!isAndroidTestBuild()) { // apply plugin: 'apm-plugin' //} //if (!isAndroidTestBuild()) { // apply plugin: 'bytex.threadOpt' // thread_opt { // enable true // enableInDebug true // rxJavaIoReplacer 'com/mogo/eagle/core/utilcode/util/ThreadUtils@@getIoPool@@()Ljava/util/concurrent/ExecutorService;' // rxJavaComputationReplacer 'com/mogo/eagle/core/utilcode/util/ThreadUtils@@getCpuPool@@()Ljava/util/concurrent/ExecutorService;' // coroutineIoReplacer 'com/mogo/eagle/core/utilcode/util/ThreadUtils@@getIoPool@@()Ljava/util/concurrent/ExecutorService;' // coroutineDefaultReplacer 'com/mogo/eagle/core/utilcode/util/ThreadUtils@@getCpuPool@@()Ljava/util/concurrent/ExecutorService;' // } // // /** // * 方便使用systrace工具,在工程侧打点,便于分析工程侧性能问题 // */ // apply plugin: 'bytex.systrace' // systrace { // /** // * 交付时要关闭,会有性能损耗 // */ // enable false // enableInDebug false // /** // * - 是否使用[Trace.beginAsyncSection(String, int)/Trace.endAsyncSection(String, int)]进行打点 // * - 默认使用[Trace.beginSection(String)/Trace.endSection()]进行打点 // */ // isTraceAsync false // /** // * - 是否在运行时只针对主线程打点,其它线程不打 // */ // isOnlyMainThread false // // /** // * - 是否忽略对类的静态构造方法打点 // * - 默认不忽略 // */ // isIgnoreClinitMethod false // // /** // * - 是否忽略对类中的简单方法打点 // * 简单方法定义: // * - 空方法 // * - get/set 方法 // * - 单独的方法,方法体内没有调用其它方法 // * - 默认不忽略 // */ // isIgnoreSampleMethod false // // /** // * - 针对特定类集合,配置打点白名单,在此集合中的类中的所有方法不打点 // * - 支持正则表达式 // */ // whiteListForClass = [] // // /** // * - 针对特定包名集合,配置打点白名单,所有类以此包名为前缀的类不打点 // * - 支持正则表达式 // */ // whiteListForPackage = [] // } //} bugly { appId = 'ac71228f85' // 注册时分配的App ID appKey = '3c736249-d6be-4066-b577-b7a6dc975cf7' // 注册时分配的App Key } Properties properties = new Properties(); properties.load(project.rootProject.file("gradle.properties").newDataInputStream()) 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.applicationId testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" javaCompileOptions { annotationProcessorOptions { arguments = [AROUTER_MODULE_NAME: project.getName()] } } multiDexEnabled true } packagingOptions { exclude 'META-INF/proguard/coroutines.pro' exclude 'META-INF/*' } signingConfigs { release { keyAlias = 'CarLauncher' storeFile file('../keystore/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") ] } 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") ] } } compileOptions { sourceCompatibility 1.8 targetCompatibility 1.8 } kotlinOptions { jvmTarget = '1.8' } sourceSets { main { manifest.srcFile 'src/main/AndroidManifest.xml' } } flavorDimensions "product", "basic", "env" productFlavors { // launcher app launcher { dimension "basic" // 是否启动位置服务 buildConfigField 'boolean', 'LAUNCH_LOCATION_SERVICE', 'true' // 是否作为 launcher 运行 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 'boolean', 'IS_SUPPORT_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH', 'false' } // 配置网络环境,QA、线上、演示 qa { dimension "env" buildConfigField 'int', 'NET_ENV', '2' } online { dimension "env" buildConfigField 'int', 'NET_ENV', '3' } demo { dimension "env" buildConfigField 'int', 'NET_ENV', '4' } } // 配置不同渠道参数,直接影响功能完整度 apply from: "./productFlavors/fPadLenovo.gradle" apply from: "./productFlavors/fPadLenovoOchBus.gradle" apply from: "./productFlavors/fPadLenovoOchTaxi.gradle" apply from: "./productFlavors/fPadLenovoOchBusPassenger.gradle" apply from: "./productFlavors/fPadLenovoOchTaxiPassenger.gradle" packagingOptions { exclude 'META-INF/io.netty.versions.properties' } useLibrary 'android.test.runner' useLibrary 'android.test.base' useLibrary 'android.test.mock' } repositories { flatDir { dirs 'libs' } } aspectjx { include "com.mogo.eagle.core.function.chat" } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) //Crash日志收集 implementation rootProject.ext.dependencies.crashSdk implementation rootProject.ext.dependencies.androidxappcompat implementation rootProject.ext.dependencies.arouter implementation rootProject.ext.dependencies.boostmultidex compileOnly rootProject.ext.dependencies.adasapi compileOnly rootProject.ext.dependencies.adasconfigapi debugImplementation rootProject.ext.dependencies.debugleakcanary releaseImplementation rootProject.ext.dependencies.releaseleakcanary if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_function_main implementation rootProject.ext.dependencies.ttspad androidTestImplementation rootProject.ext.dependencies.mogo_core_function_call androidTestImplementation rootProject.ext.dependencies.mogo_core_res androidTestImplementation rootProject.ext.dependencies.mogo_core_function_hmi androidTestImplementation rootProject.ext.dependencies.mogo_core_function_notice } else { implementation project(':core:function-impl:mogo-core-function-main') implementation project(':tts:tts-pad') androidTestImplementation project(':core:mogo-core-function-call') androidTestImplementation project(':core:mogo-core-res') androidTestImplementation project(':core:function-impl:mogo-core-function-hmi') androidTestImplementation project(':core:function-impl:mogo-core-function-notice') } apply from: "./functions/och.gradle" 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 } //if (!isAndroidTestBuild()) { // ApmPlugin { // // 是否进行插桩 // enable true // // 是否在Debug包插桩,默认不插桩 // enableInDebug true // // DEBUG("DEBUG"), INFO("INFO"), WARN("WARN"), ERROR("ERROR"); // // INFO 级别Log会汇总所有被插桩处理的类供查看,路径 app/build/ByteX/ApmPlugin // logLevel "DEBUG" // // 启动分析开关:监控App启动耗时,需要同时开启pageLoadSwitch // startSwitch = true // // 页面响应开关:监控Activity的生命周期耗时 // pageLoadSwitch = true // // 网络监控开关:监控okhttp3的网络请求 // okHttp3Switch = true // // 白名单下的包进行插桩,需要填写要插装类所在的包名,支持前缀配置 // whiteList = [ // "com.mogo" // ] // // 黑名单包下类不进行插桩,可以配置包名和类名,没有可以填空 // blackList = [ // // ] // } //} 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}\"" } boolean isAndroidTestBuild() { for (String s : gradle.startParameter.taskNames) { if (s.contains("AndroidTest")) { return true } } return false }