From a8c80e80955c6efe00e4c9de6655134144a282d4 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Thu, 23 Feb 2023 16:38:43 +0800 Subject: [PATCH] [2.13.0-arch-opt] add v2x sdk foundation gradle setting --- app/build.gradle | 110 +++++++----------- config.gradle | 4 - .../build.gradle | 2 +- .../startup/stageone/HttpDnsStartUp.kt | 7 +- .../core/data/config/FunctionBuildConfig.kt | 2 +- gradle/uploadsdk.gradle | 74 ++++++++++++ 6 files changed, 122 insertions(+), 77 deletions(-) create mode 100644 gradle/uploadsdk.gradle diff --git a/app/build.gradle b/app/build.gradle index 38eaa76d91..455fd7f487 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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 ==“ ” // 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" } } diff --git a/config.gradle b/config.gradle index fd51e09b27..d71b4c64df 100644 --- a/config.gradle +++ b/config.gradle @@ -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", diff --git a/core/function-impl/mogo-core-function-datacenter/build.gradle b/core/function-impl/mogo-core-function-datacenter/build.gradle index fab4051ccf..2d31c61812 100644 --- a/core/function-impl/mogo-core-function-datacenter/build.gradle +++ b/core/function-impl/mogo-core-function-datacenter/build.gradle @@ -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() diff --git a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt index 34b96faae4..fc6d116c92 100644 --- a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt +++ b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt @@ -133,12 +133,7 @@ class HttpDnsStartUp : AndroidStartup() { 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 ( diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt index 9e6508a3d3..8831a67f91 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt @@ -123,7 +123,7 @@ object FunctionBuildConfig { /** * 自车位置使用哪种外部数据源 - * 0 = Android系统 + * 0 = Android系统/GD * 1 = 工控机 * 2 = OBU */ diff --git a/gradle/uploadsdk.gradle b/gradle/uploadsdk.gradle new file mode 100644 index 0000000000..1da0e1cf8e --- /dev/null +++ b/gradle/uploadsdk.gradle @@ -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 +}