[2.13.0-arch-opt] add v2x sdk foundation gradle setting

This commit is contained in:
zhongchao
2023-02-23 16:38:43 +08:00
parent 3c9b069f2f
commit a8c80e8095
6 changed files with 122 additions and 77 deletions

View File

@@ -1,7 +1,7 @@
import java.text.SimpleDateFormat
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import java.text.SimpleDateFormat
apply plugin: 'com.android.application'
apply plugin: 'com.alibaba.arouter'
@@ -204,7 +204,7 @@ android {
}
}
flavorDimensions "business","product", "basic", "env"
flavorDimensions "business", "product", "basic", "env"
productFlavors {
// launcher app
@@ -231,24 +231,24 @@ android {
sweeper {
dimension "business"
}
shuttle{
shuttle {
dimension "business"
}
// 配置网络环境QA、线上、演示
qa {
dimension "env"
buildConfigField 'int', 'NET_ENV', '2'
buildConfigField 'String', 'URLs', "\"${readFileToJson("qa").replace("\"","\\\"")}\""
buildConfigField 'String', 'URLs', "\"${readFileToJson("qa").replace("\"", "\\\"")}\""
}
online {
dimension "env"
buildConfigField 'int', 'NET_ENV', '3'
buildConfigField 'String', 'URLs', "\"${readFileToJson("online").replace("\"","\\\"")}\""
buildConfigField 'String', 'URLs', "\"${readFileToJson("online").replace("\"", "\\\"")}\""
}
demo {
dimension "env"
buildConfigField 'int', 'NET_ENV', '4'
buildConfigField 'String', 'URLs', "\"${readFileToJson("demo").replace("\"","\\\"")}\""
buildConfigField 'String', 'URLs', "\"${readFileToJson("demo").replace("\"", "\\\"")}\""
}
}
@@ -266,13 +266,13 @@ android {
def names = variant.flavors*.name
//要检查特定的构建类型请使用variant.buildType.name ==“ <buildType>”
// region 过滤noop 的flavors 不带och业务的
if (names.contains("noop")&&!names.contains("fPadLenovo")) {
if (names.contains("noop") && !names.contains("fPadLenovo")) {
//Gradle会忽略满足上述条件的所有变体
setIgnore(true)
}
// endregion
// region 过滤sweper 的flavors
if (names.contains("sweeper")&&!names.contains("fPadLenovoOchSweeper")) {
if (names.contains("sweeper") && !names.contains("fPadLenovoOchSweeper")) {
//Gradle会忽略满足上述条件的所有变体
setIgnore(true)
}
@@ -281,9 +281,9 @@ android {
// region 过滤shuttle 的flavors
if (names.contains("shuttle")) {
//Gradle会忽略满足上述条件的所有变体
if(names.contains("fPadLenovoOchBus")){
}else if(names.contains("fPadLenovoOchBusPassenger")){
}else {
if (names.contains("fPadLenovoOchBus")) {
} else if (names.contains("fPadLenovoOchBusPassenger")) {
} else {
setIgnore(true)
}
}
@@ -291,11 +291,11 @@ android {
// region 过滤taxibase 的flavors
if (names.contains("taxibase")) {
//Gradle会忽略满足上述条件的所有变体
if(names.contains("fPadLenovoOchTaxi")){
}else if(names.contains("fPadLenovoOchTaxiPassenger")){
}else if(names.contains("fPadLenovo")){
}else if(names.contains("fMultiDisplayOchTaxi")){
}else {
if (names.contains("fPadLenovoOchTaxi")) {
} else if (names.contains("fPadLenovoOchTaxiPassenger")) {
} else if (names.contains("fPadLenovo")) {
} else if (names.contains("fMultiDisplayOchTaxi")) {
} else {
setIgnore(true)
}
}
@@ -303,10 +303,10 @@ android {
// region 过滤taxibase 的flavors
if (names.contains("busbase")) {
//Gradle会忽略满足上述条件的所有变体
if(names.contains("fPadLenovoOchBus")){
}else if(names.contains("fPadLenovoOchBusPassenger")){
}else if(names.contains("fMultiDisplayOchBus")){
}else {
if (names.contains("fPadLenovoOchBus")) {
} else if (names.contains("fPadLenovoOchBusPassenger")) {
} else if (names.contains("fMultiDisplayOchBus")) {
} else {
setIgnore(true)
}
}
@@ -335,8 +335,6 @@ aspectjx {
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
@@ -346,41 +344,23 @@ dependencies {
implementation rootProject.ext.dependencies.android_start_up
implementation rootProject.ext.dependencies.lancetx_runtime
implementation rootProject.ext.dependencies.mogocustommap
implementation project(':core:function-impl:mogo-core-function-startup')
implementation project(':libraries:map-usbcamera')
// // 暂不使用Shizuku-API
// implementation rootProject.ext.dependencies.shizuku_provider
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.ttspad
implementation rootProject.ext.dependencies.mogo_core_function_hmi
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_map
implementation rootProject.ext.dependencies.mogo_core_function_datacenter
implementation rootProject.ext.dependencies.mogo_core_function_devatools
implementation rootProject.ext.dependencies.mogo_core_function_chat
implementation rootProject.ext.dependencies.mogo_core_function_biz
implementation rootProject.ext.dependencies.mogo_core_function_call
androidTestImplementation rootProject.ext.dependencies.mogo_core_function_call
androidTestImplementation rootProject.ext.dependencies.mogo_core_res
} else {
implementation project(':tts:tts-pad')
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-datacenter')
implementation project(':core:function-impl:mogo-core-function-devatools')
implementation project(':core:function-impl:mogo-core-function-chat')
implementation project(':core:function-impl:mogo-core-function-biz')
implementation project(':core:mogo-core-function-call')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-res')
implementation project(':foudations:mogo-commons')
implementation project(':tts:tts-pad')
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-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(':foudations:mogo-commons')
implementation project(':core:mogo-core-function-call')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-res')
androidTestImplementation project(':core:mogo-core-function-call')
androidTestImplementation project(':core:mogo-core-res')
}
androidTestImplementation project(':core:mogo-core-function-call')
androidTestImplementation project(':core:mogo-core-res')
apply from: "./functions/och.gradle"
@@ -496,10 +476,10 @@ boolean isReleaseBuild() {
return false
}
Object readFileToJson(env){
Object readFileToJson(env) {
try {
def businessType = project.hasProperty('business')
if(businessType){
if (businessType) {
println("businessType${businessType}----${business}")
}
// 加载config.json 文件
@@ -507,11 +487,11 @@ Object readFileToJson(env){
def jsonSlurper = new JsonSlurper()
// 解析json
def config = jsonSlurper.parse(file)
def flavorNames = variantName()
def flavorNames = variantName()
def jsonOutput = new JsonOutput()
config.each {key, value ->
config.each { key, value ->
// 匹配flavor对应的 json
if(flavorNames.toLowerCase().contains(key)){
if (flavorNames.toLowerCase().contains(key)) {
return jsonOutput.toJson(value.get(env))
}
}
@@ -526,12 +506,12 @@ Object readFileToJson(env){
def variantName() {
def taskName = getGradle().getStartParameter().getTaskRequests().toString()
def split = taskName.split(":")
if (split.length > 2){
return split[2].toString().split("]")[0].replace("assemble","")
}else {
if(taskName.contains("bus")) {
if (split.length > 2) {
return split[2].toString().split("]")[0].replace("assemble", "")
} else {
if (taskName.contains("bus")) {
return "busbase"
}else {
} else {
return "taxibase"
}
}

View File

@@ -198,10 +198,6 @@ ext {
androidx_datastore : "androidx.datastore:datastore:1.0.0",
android_start_up : "com.mogo:android-startup:1.0.1",
//========================= Shizuku ======================
shizuku_api : "dev.rikka.shizuku:api:12.1.0",
shizuku_provider : "dev.rikka.shizuku:provider:12.1.0",
//========================= Koom ======================
koomnative : "com.kuaishou.koom:koom-native-leak-static:2.2.0",
koomxhook : "com.kuaishou.koom:xhook-static:2.2.0",

View File

@@ -69,4 +69,4 @@ dependencies {
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
//apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -133,12 +133,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
HttpDnsSimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon)
return httpDnsSimpleLocation
}
var mogoLocation: MogoLocation? = null
val locationClient =
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
if (locationClient != null) {
mogoLocation = locationClient
}
val mogoLocation: MogoLocation? = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
if (mogoLocation != null && mogoLocation.latitude != 0.0 && mogoLocation.longitude != 0.0) {
// 更新
httpDnsSimpleLocation = if (

View File

@@ -123,7 +123,7 @@ object FunctionBuildConfig {
/**
* 自车位置使用哪种外部数据源
* 0 = Android系统
* 0 = Android系统/GD
* 1 = 工控机
* 2 = OBU
*/

74
gradle/uploadsdk.gradle Normal file
View File

@@ -0,0 +1,74 @@
apply plugin: 'maven'
apply plugin: 'maven-publish'
task loggerSourcesJar(type: Jar) {
classifier = 'sources'
if (plugins.hasPlugin("java-library")) {
from sourceSets.main.java.srcDirs
} else if (plugins.hasPlugin("com.android.library")) {
from android.sourceSets{
main{
java{
com.mogo.eagle.core.function.datacenter
}
}
}
} else if (plugins.hasPlugin('groovy')) {
from sourceSets.main.groovy.srcDirs
}
}
artifacts {
archives loggerSourcesJar
}
task loggerUpload(dependsOn: [uploadArchives, loggerSourcesJar]) {
}
uploadArchives {
repositories {
mavenDeployer {
println project.name
String versionNameKey = "${project.name.replace("-", "_").toUpperCase()}_VERSION"
String versionName = getVersionNameValue(versionNameKey)
println versionName
if (versionName == null || versionName.equals("")) {
project.logger.error("undefined versionName in root gradle.properties by ${versionNameKey}")
}
pom.project {
packaging = 'aar'
groupId = GROUP
artifactId = POM_ARTIFACT_ID
version = versionName
}
repository(url: rootProject.RELEASE_REPOSITORY_URL) {
authentication(userName: rootProject.USERNAME, password: rootProject.PASSWORD)
}
snapshotRepository(url: rootProject.SNAPSHOT_REPOSITORY_URL) {
authentication(userName: rootProject.USERNAME, password: rootProject.PASSWORD)
}
}
}
}
def getVersionNameValue(String key) {
File file = rootProject.file('gradle.properties')
String value = ""
if (file.exists()) {
//加载资源
InputStream inputStream = file.newDataInputStream();
Properties properties = new Properties()
properties.load(inputStream)
if (properties.containsKey(key)) {
value = properties.getProperty(key)
}
}
return value
}