merge of gradle.pro
This commit is contained in:
35
app/README.md
Normal file
35
app/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# APP 壳
|
||||
|
||||
## 加载模块
|
||||
|
||||
## 初始化部分服务
|
||||
|
||||
## 定义 flavor
|
||||
|
||||
### basic 维度
|
||||
|
||||
产品形态:区别 applicationId,定义服务加载
|
||||
|
||||
1. independent:独立app,作为普通 app 运行在系统
|
||||
2. launcher:作为 launcher 运行在系统
|
||||
|
||||
### product 维度
|
||||
|
||||
产品线,各个产品线引入不同服务,实现不同服务内容
|
||||
|
||||
1. f8xx: 分体机 - launcher
|
||||
2. e8xx: E系列m4(2+32) - launcher
|
||||
3. em4: E系列m4(2+32) - launcher
|
||||
4. em3: E系列m3(2+32) - independent
|
||||
5. em1: E系列m1(1+16) - independent
|
||||
6. d8xx: D系列(2+32) - independent
|
||||
7. d82x: D系列(1+16) - independent
|
||||
8. byd: 比亚迪应用市场 - independent
|
||||
|
||||
### env 维度
|
||||
|
||||
1. online: 线上环境
|
||||
2. qa: 测试环境
|
||||
3. demo: 演示环境(大部分时候都是测试环境)
|
||||
|
||||
## 区分 flavor 功能引入
|
||||
@@ -25,7 +25,7 @@ android {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters 'armeabi-v7a'
|
||||
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,8 +82,8 @@ android {
|
||||
applicationId rootProject.ext.android.independentApplicationId
|
||||
// 是否启动位置服务
|
||||
buildConfigField 'boolean', 'LAUNCH_LOCATION_SERVICE', 'false'
|
||||
// 是否使用自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'true'
|
||||
// 是否作为 launcher 运行
|
||||
buildConfigField 'boolean', 'IS_LAUNCHER', 'false'
|
||||
}
|
||||
@@ -93,7 +93,7 @@ android {
|
||||
applicationId rootProject.ext.android.launcherApplicationId
|
||||
// 是否启动位置服务
|
||||
buildConfigField 'boolean', 'LAUNCH_LOCATION_SERVICE', 'true'
|
||||
// 是否使用自定义导航
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'true'
|
||||
// 是否作为 launcher 运行
|
||||
buildConfigField 'boolean', 'IS_LAUNCHER', 'true'
|
||||
@@ -246,7 +246,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.carcallprovider
|
||||
implementation rootProject.ext.dependencies.carcall
|
||||
|
||||
implementation rootProject.ext.dependencies.moduleV2x
|
||||
implementation rootProject.ext.dependencies.moduletanlu, {
|
||||
exclude group: 'com.mogo.module', module: 'module-share'
|
||||
}
|
||||
@@ -268,6 +267,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.modulemedia
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
implementation rootProject.ext.dependencies.modulesplash
|
||||
implementation rootProject.ext.dependencies.moduleV2x
|
||||
// 事件面板分渠道引用
|
||||
d82xImplementation rootProject.ext.dependencies.moduleventpanelnoop
|
||||
em1Implementation rootProject.ext.dependencies.moduleventpanelnoop
|
||||
@@ -301,6 +301,7 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-media')
|
||||
implementation project(':modules:mogo-module-service')
|
||||
implementation project(':modules:mogo-module-splash')
|
||||
implementation project(':modules:mogo-module-v2x')
|
||||
// 事件面板分渠道引用
|
||||
d82xImplementation project(':modules:mogo-module-event-panel-noop')
|
||||
em1Implementation project(':modules:mogo-module-event-panel-noop')
|
||||
@@ -320,6 +321,8 @@ dependencies {
|
||||
f8xxImplementation project(':modules:mogo-module-left-panel-noop')
|
||||
em3Implementation project(':modules:mogo-module-left-panel-noop')
|
||||
}
|
||||
|
||||
apply from: "./functions/baseservices.gradle"
|
||||
}
|
||||
|
||||
//android.applicationVariants.all { variant ->
|
||||
|
||||
1
app/functions/README.md
Normal file
1
app/functions/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# 不同渠道,依赖的实现不一样,需要各个渠道都去依赖各自需要的实现,渠道太多导致build.gradle 文件臃肿,可以通过分gradle文件方式减少臃肿
|
||||
26
app/functions/baseservices.gradle
Normal file
26
app/functions/baseservices.gradle
Normal file
@@ -0,0 +1,26 @@
|
||||
// 基础服务:仅比亚迪渠道用sdk方式实现,其他都基于apk基础服务
|
||||
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydImplementation rootProject.ext.dependencies.mogobaseservicesdk
|
||||
|
||||
d82xImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
em1Implementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
d8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
em4Implementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
e8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
e8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
f8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
em3Implementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
} else {
|
||||
bydImplementation project(':foudations:mogo-base-services-sdk')
|
||||
|
||||
d82xImplementation project(':foudations:mogo-base-services-apk')
|
||||
em1Implementation project(':foudations:mogo-base-services-apk')
|
||||
d8xxImplementation project(':foudations:mogo-base-services-apk')
|
||||
em4Implementation project(':foudations:mogo-base-services-apk')
|
||||
e8xxImplementation project(':foudations:mogo-base-services-apk')
|
||||
f8xxImplementation project(':foudations:mogo-base-services-apk')
|
||||
em3Implementation project(':foudations:mogo-base-services-apk')
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import com.auto.zhidao.logsdk.CrashSystem;
|
||||
import com.bytedance.boost_multidex.BoostMultiDex;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
|
||||
import com.mogo.module.carchatting.card.CallChatConstant;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
@@ -19,8 +21,12 @@ import com.mogo.module.push.base.PushUIConstants;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.passport.IMogoPassportManager;
|
||||
import com.mogo.service.passport.IMogoTicketCallback;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.LogLevel;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.boot.persistent.lib.PersistentManager;
|
||||
@@ -43,66 +49,79 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
super.onCreate();
|
||||
// Crash 日志收集
|
||||
final long start = System.currentTimeMillis();
|
||||
CrashSystem crashSystem = CrashSystem.getInstance(this);
|
||||
CrashSystem crashSystem = CrashSystem.getInstance( this );
|
||||
crashSystem.init();
|
||||
//设置debug模式,日志不上传
|
||||
crashSystem.setDebug(BuildConfig.DEBUG);
|
||||
Logger.init(BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF);
|
||||
crashSystem.setDebug( BuildConfig.DEBUG );
|
||||
Logger.init( BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF );
|
||||
|
||||
// MogoModulePaths.addModule(new MogoModule(PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(AuthorizeConstant.PATH_AGREEMENT_FRAGMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME));
|
||||
MogoModulePaths.addModule( new MogoModule( AuthorizeConstant.PATH_AGREEMENT_FRAGMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME ) );
|
||||
|
||||
//运营位卡片,需要默认显示,放在第一个加载
|
||||
if (DebugConfig.isLauncher()) {
|
||||
MogoModulePaths.addModule(new MogoModule(MediaConstants.TAG, MediaConstants.MODULE_TYPE));
|
||||
if ( DebugConfig.isLauncher() ) {
|
||||
MogoModulePaths.addModule( new MogoModule( MediaConstants.TAG, MediaConstants.MODULE_TYPE ) );
|
||||
}
|
||||
|
||||
MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(TanluConstants.TAG, TanluConstants.MODEL_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_SHARE, "ShareControl"));
|
||||
MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, TanluConstants.MODEL_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SHARE, "ShareControl" ) );
|
||||
|
||||
MogoModulePaths.addModule(new MogoModule(EventPanelConstants.PATH_NAME,
|
||||
EventPanelConstants.MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(LeftPanelConst.PATH_NAME,
|
||||
LeftPanelConst.MODULE_NAME));
|
||||
MogoModulePaths.addModule( new MogoModule( EventPanelConstants.PATH_NAME,
|
||||
EventPanelConstants.MODULE_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( LeftPanelConst.PATH_NAME,
|
||||
LeftPanelConst.MODULE_NAME ) );
|
||||
|
||||
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) );
|
||||
MogoModulePaths.addModule(new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME));
|
||||
MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) );
|
||||
|
||||
if (!DebugConfig.isLauncher()) {
|
||||
PersistentManager.getInstance().initManager(this);
|
||||
Intent intent = new Intent(this, MogoMainService.class);
|
||||
startService(intent);
|
||||
if ( !DebugConfig.isLauncher() ) {
|
||||
PersistentManager.getInstance().initManager( this );
|
||||
Intent intent = new Intent( this, MogoMainService.class );
|
||||
startService( intent );
|
||||
}
|
||||
Log.i("timer", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
private void initDebugConfig(){
|
||||
DebugConfig.setNetMode(BuildConfig.NET_ENV);
|
||||
DebugConfig.setDebug(BuildConfig.DEBUG);
|
||||
DebugConfig.setAIType(BuildConfig.AIType);
|
||||
DebugConfig.setLaunchLocationService(BuildConfig.LAUNCH_LOCATION_SERVICE);
|
||||
DebugConfig.setUseCustomNavi(BuildConfig.USE_CUSTOM_NAVI);
|
||||
DebugConfig.setLauncher(BuildConfig.IS_LAUNCHER);
|
||||
private void initDebugConfig() {
|
||||
DebugConfig.setNetMode( BuildConfig.NET_ENV );
|
||||
DebugConfig.setDebug( BuildConfig.DEBUG );
|
||||
DebugConfig.setAIType( BuildConfig.AIType );
|
||||
DebugConfig.setLaunchLocationService( BuildConfig.LAUNCH_LOCATION_SERVICE );
|
||||
DebugConfig.setUseCustomNavi( BuildConfig.USE_CUSTOM_NAVI );
|
||||
DebugConfig.setLauncher( BuildConfig.IS_LAUNCHER );
|
||||
DebugConfig.setActiveAIAssistFlag( BuildConfig.AI_ASSIST_ACTIVE_STAUTS );
|
||||
DebugConfig.setCarMachineType(BuildConfig.CAR_MACHINE_TYPE);
|
||||
DebugConfig.setCarMachineType( BuildConfig.CAR_MACHINE_TYPE );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
IMogoSocketManager mMogoSocketManager = ARouter.getInstance().navigation(IMogoSocketManager.class);
|
||||
if (mMogoSocketManager != null) {
|
||||
mMogoSocketManager.init(getApplicationContext(), "com.mogo.launcher");
|
||||
} else {
|
||||
Logger.e(TAG, "init socket server error.");
|
||||
}
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
final IMogoServiceApis apis = ARouter.getInstance().navigation( IMogoServiceApis.class );
|
||||
apis.getSocketManagerApi( getApplicationContext() ).init( getApplicationContext(), "com.mogo.launcher" );
|
||||
apis.getPassportManagerApi().requestTicket( new IMogoTicketCallback() {
|
||||
@Override
|
||||
public void onSuccess( String ticket ) {
|
||||
Logger.d( TAG, "ticket = %s", ticket );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( int code, String msg ) {
|
||||
Logger.w( TAG, "code = %s, msg = %s", code, msg );
|
||||
}
|
||||
} );
|
||||
apis.getLocationInfoApi().start();
|
||||
apis.getMapServiceApi().getSingletonLocationClient( getApplicationContext() ).addLocationListener( location -> {
|
||||
apis.getLocationInfoApi().provideLocation( location );
|
||||
} );
|
||||
}, 2_000L );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
BoostMultiDex.install(base);
|
||||
protected void attachBaseContext( Context base ) {
|
||||
super.attachBaseContext( base );
|
||||
BoostMultiDex.install( base );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user