From 5f2f2653b6ba47d401e3df9034cdf4a384225a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Mon, 25 Jan 2021 17:14:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=EF=BC=8C=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 16 ++++++----- .../java/com/mogo/cloud/MoGoApplication.java | 2 +- foudations/mogo-commons/build.gradle | 7 +++-- foudations/mogo-httpdns/gradle.properties | 2 +- foudations/mogo-passport/build.gradle | 11 +++++--- .../cloud/passport/MoGoAiCloudClient.java | 6 +++-- foudations/mogo-socket/build.gradle | 12 ++++++--- gradle.properties | 13 +++++---- gradle/upload.gradle | 27 ++++++++++++++++++- modules.txt | 6 +++++ modules/mogo-realtime/build.gradle | 11 +++++--- modules/mogo-tanlu/build.gradle | 7 +++-- upload.sh | 3 +++ 13 files changed, 90 insertions(+), 33 deletions(-) create mode 100644 modules.txt create mode 100755 upload.sh diff --git a/app/build.gradle b/app/build.gradle index 15001c0..264531f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -36,14 +36,16 @@ dependencies { implementation rootProject.ext.dependencies.androidxappcompat implementation rootProject.ext.dependencies.androidxconstraintlayout -// implementation project(path: ':foudations:mogo-passport') - implementation 'com.mogo.cloud:passport:1.0.2-SNAPSHOT' -// implementation project(path: ':foudations:mogo-commons') - implementation 'com.mogo.cloud:commons:1.0.2-SNAPSHOT' - -// implementation project(path: ':modules:mogo-tanlu') - implementation 'com.mogo.cloud:tanlu:1.0.1-SNAPSHOT' + if (Boolean.valueOf(RELEASE)) { + implementation "com.mogo.cloud:commons:${MOGO_COMMONS_VERSION}" + implementation "com.mogo.cloud:socket:${MOGO_SOCKET_VERSION}" + implementation "com.mogo.cloud:tanlu:${MOGO_TANLU_VERSION}" + } else { + implementation project(":foudations:mogo-socket") + implementation project(":foudations:mogo-commons") + implementation project(path: ':modules:mogo-tanlu') + } implementation rootProject.ext.dependencies.rxjava implementation rootProject.ext.dependencies.rxandroid diff --git a/app/src/main/java/com/mogo/cloud/MoGoApplication.java b/app/src/main/java/com/mogo/cloud/MoGoApplication.java index b87e639..17d2762 100644 --- a/app/src/main/java/com/mogo/cloud/MoGoApplication.java +++ b/app/src/main/java/com/mogo/cloud/MoGoApplication.java @@ -43,7 +43,7 @@ public class MoGoApplication extends MultiDexApplication { } }); - MoGoAiCloudClient.getInstance().init(this, clientConfig); + MoGoAiCloudClient.getInstance().init(this, clientConfig, null); } } diff --git a/foudations/mogo-commons/build.gradle b/foudations/mogo-commons/build.gradle index 67e6d0a..2c8f9e8 100644 --- a/foudations/mogo-commons/build.gradle +++ b/foudations/mogo-commons/build.gradle @@ -59,7 +59,10 @@ dependencies { implementation rootProject.ext.dependencies.retrofitconvertergson implementation rootProject.ext.dependencies.retrofitconverterscalars -// api project(path: ':foudations:mogo-passport') - api 'com.mogo.cloud:passport:1.0.2-SNAPSHOT' + if (Boolean.valueOf(RELEASE)) { + api "com.mogo.cloud:passport:${MOGO_PASSPORT_VERSION}" + } else { + api project(path: ':foudations:mogo-passport') + } } \ No newline at end of file diff --git a/foudations/mogo-httpdns/gradle.properties b/foudations/mogo-httpdns/gradle.properties index 91b4997..7f693e7 100644 --- a/foudations/mogo-httpdns/gradle.properties +++ b/foudations/mogo-httpdns/gradle.properties @@ -1,4 +1,4 @@ GROUP=com.mogo.cloud POM_ARTIFACT_ID=httpdns VERSION_CODE=1 -VERSION_NAME=1.0.0 \ No newline at end of file +VERSION_NAME=1.0.0-SNAPSHOT \ No newline at end of file diff --git a/foudations/mogo-passport/build.gradle b/foudations/mogo-passport/build.gradle index 052799b..d51b6a0 100644 --- a/foudations/mogo-passport/build.gradle +++ b/foudations/mogo-passport/build.gradle @@ -31,11 +31,14 @@ dependencies { implementation rootProject.ext.dependencies.androidxappcompat api rootProject.ext.dependencies.mogoutils // passport - implementation 'com.zhidao.thirdlogin:third-login:1.0.1' - implementation 'com.zhidao.account:accountsdk:1.0.16.1' + implementation 'com.zhidao.thirdlogin:third-login:1.0.2' + + if (Boolean.valueOf(RELEASE)) { + api "com.mogo.cloud:httpdns:${MOGO_HTTPDNS_VERSION}" + } else { + api project(path: ':foudations:mogo-httpdns') + } -// api project(path: ':foudations:mogo-httpdns') - api 'com.mogo.cloud:httpdns:1.0.0' } apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() \ No newline at end of file diff --git a/foudations/mogo-passport/src/main/java/com/mogo/cloud/passport/MoGoAiCloudClient.java b/foudations/mogo-passport/src/main/java/com/mogo/cloud/passport/MoGoAiCloudClient.java index fbea8b4..bf16e12 100644 --- a/foudations/mogo-passport/src/main/java/com/mogo/cloud/passport/MoGoAiCloudClient.java +++ b/foudations/mogo-passport/src/main/java/com/mogo/cloud/passport/MoGoAiCloudClient.java @@ -47,14 +47,16 @@ public class MoGoAiCloudClient { * * @param context 上下文 * @param aiCloudClientConfig SDK配置信息 + * @param tokenCallback 获取令牌回调,使用端可根据回调的方法判断是否获取令牌成功,可为空 */ public MoGoAiCloudClient init(Context context, - MoGoAiCloudClientConfig aiCloudClientConfig + MoGoAiCloudClientConfig aiCloudClientConfig, + final IMoGoTokenCallback tokenCallback ) { mContext = context; mAiCloudClientConfig = aiCloudClientConfig; // 刷新令牌 - refreshToken(null); + refreshToken(tokenCallback); return sInstance; } diff --git a/foudations/mogo-socket/build.gradle b/foudations/mogo-socket/build.gradle index 3aa48c4..f3b5e2d 100644 --- a/foudations/mogo-socket/build.gradle +++ b/foudations/mogo-socket/build.gradle @@ -27,12 +27,16 @@ android { dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) // 长链 - api 'com.zhidao.socket:built-in-socket:1.0.17' + api 'com.zhidao.socket:built-in-socket:1.0.21' // 上报位置 - implementation 'com.zhidao.locupload:loc-upload-sdk:1.1.7' + implementation 'com.zhidao.locupload:loc-upload-sdk:1.1.8' + + if (Boolean.valueOf(RELEASE)) { + implementation "com.mogo.cloud:passport:${MOGO_PASSPORT_VERSION}" + } else { + implementation project(path: ':foudations:mogo-passport') + } -// implementation project(path: ':foudations:mogo-passport') - implementation 'com.mogo.cloud:passport:1.0.2-SNAPSHOT' } diff --git a/gradle.properties b/gradle.properties index 5d0e279..5fba8d5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,9 +22,12 @@ RELEASE_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-releases/ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/ USERNAME=xintai PASSWORD=xintai2018 +# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本 +RELEASE=false # AI CLOUD 云平台 -MOGO_CLOUD_COMMONS_VERSION= 1.0.0 -MOGO_CLOUD_HTTPDNS_VERSION= 1.0.0 -MOGO_CLOUD_PASSPORT_VERSION=1.0.0 -MOGO_CLOUD_TANLU_VERSION= 1.0.0 -MOGO_CLOUD_REALTIME_VERSION=1.0.0 \ No newline at end of file +MOGO_COMMONS_VERSION=1.0.4-SNAPSHOT +MOGO_HTTPDNS_VERSION=1.0.4-SNAPSHOT +MOGO_PASSPORT_VERSION=1.0.4-SNAPSHOT +MOGO_SOCKET_VERSION=1.0.4-SNAPSHOT +MOGO_REALTIME_VERSION=1.0.4-SNAPSHOT +MOGO_TANLU_VERSION=1.0.4-SNAPSHOT diff --git a/gradle/upload.gradle b/gradle/upload.gradle index c1c3455..908c41b 100644 --- a/gradle/upload.gradle +++ b/gradle/upload.gradle @@ -26,11 +26,20 @@ uploadArchives { 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 = VERSION_NAME + version = versionName } repository(url: rootProject.RELEASE_REPOSITORY_URL) { @@ -43,3 +52,19 @@ uploadArchives { } } } + +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 +} diff --git a/modules.txt b/modules.txt new file mode 100644 index 0000000..b761e77 --- /dev/null +++ b/modules.txt @@ -0,0 +1,6 @@ +:foudations:mogo-httpdns +:foudations:mogo-passport +:foudations:mogo-commons +:foudations:mogo-socket +:modules:mogo-realtime +:modules:mogo-tanlu \ No newline at end of file diff --git a/modules/mogo-realtime/build.gradle b/modules/mogo-realtime/build.gradle index 3301054..dc28e0e 100644 --- a/modules/mogo-realtime/build.gradle +++ b/modules/mogo-realtime/build.gradle @@ -29,9 +29,12 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation project(path: ':foudations:mogo-passport') -// implementation project(":foudations:mogo-commons") - implementation 'com.mogo.cloud:commons:1.0.2-SNAPSHOT' -// implementation project(":foudations:mogo-socket") - implementation 'com.mogo.cloud:socket:1.0.2-SNAPSHOT' + if (Boolean.valueOf(RELEASE)) { + implementation "com.mogo.cloud:commons:${MOGO_COMMONS_VERSION}" + implementation "com.mogo.cloud:socket:${MOGO_SOCKET_VERSION}" + } else { + implementation project(":foudations:mogo-socket") + implementation project(":foudations:mogo-commons") + } } \ No newline at end of file diff --git a/modules/mogo-tanlu/build.gradle b/modules/mogo-tanlu/build.gradle index 0bf8d65..ee138d7 100644 --- a/modules/mogo-tanlu/build.gradle +++ b/modules/mogo-tanlu/build.gradle @@ -38,8 +38,11 @@ dependencies { implementation rootProject.ext.dependencies.rxjava implementation rootProject.ext.dependencies.rxandroid -// implementation project(path: ':foudations:mogo-commons') - implementation 'com.mogo.cloud:commons:1.0.2-SNAPSHOT' + if (Boolean.valueOf(RELEASE)) { + implementation "com.mogo.cloud:commons:${MOGO_COMMONS_VERSION}" + } else { + implementation project(path: ':foudations:mogo-commons') + } } diff --git a/upload.sh b/upload.sh new file mode 100755 index 0000000..a7ff20c --- /dev/null +++ b/upload.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +./gradlew :foudations:mogo-httpdns:clean :foudations:mogo-httpdns:uploadArchives