-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
209 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
package javadoc.dev_utils; | ||
|
||
import dev.utils.common.FileIOUtils; | ||
import dev.utils.common.StringUtils; | ||
|
||
import java.io.File; | ||
import java.util.Properties; | ||
|
||
/** | ||
* detail: Dev 系列库版本读取 | ||
* @author Ttt | ||
*/ | ||
final class DevVersion { | ||
|
||
private DevVersion() { | ||
} | ||
|
||
// ========== | ||
// = 版本信息 = | ||
// ========== | ||
|
||
// DevApp 版本号 | ||
static final String DEV_APP_VERSION; | ||
// DevAssist 版本号 | ||
static final String DEV_ASSIST_VERSION; | ||
// DevBase 版本号 | ||
static final String DEV_BASE_VERSION; | ||
// DevBaseMVVM 版本号 | ||
static final String DEV_BASE_MVVM_VERSION; | ||
// DevEngine 版本号 | ||
static final String DEV_ENGINE_VERSION; | ||
// DevHttpCapture 版本号 | ||
static final String DEV_HTTP_CAPTURE_VERSION; | ||
// DevHttpCaptureCompiler 版本号 | ||
static final String DEV_HTTP_CAPTURE_COMPILER_VERSION; | ||
// DevHttpManager 版本号 | ||
static final String DEV_HTTP_MANAGER_VERSION; | ||
// DevRetrofit 版本号 | ||
static final String DEV_RETROFIT_VERSION; | ||
// DevWidget 版本号 | ||
static final String DEV_WIDGET_VERSION; | ||
// DevEnvironment 版本号 | ||
static final String DEV_ENVIRONMENT_VERSION; | ||
// DevJava 版本号 | ||
static final String DEV_JAVA_VERSION; | ||
|
||
// ========== | ||
// = 内部逻辑 = | ||
// ========== | ||
|
||
static { | ||
File versionsFile = new File( | ||
System.getProperty("user.dir"), | ||
"versions.gradle" | ||
); | ||
// 版本配置属性 | ||
Properties prop = new Properties(); | ||
try { | ||
prop.load(FileIOUtils.getFileInputStream(versionsFile)); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
// =============== | ||
// = 初始化版本信息 = | ||
// =============== | ||
|
||
// DevApp 版本号 | ||
DEV_APP_VERSION = getProperty( | ||
prop, "dev_app_versionName" | ||
); | ||
// DevAssist 版本号 | ||
DEV_ASSIST_VERSION = getProperty( | ||
prop, "dev_assist_versionName" | ||
); | ||
// DevBase 版本号 | ||
DEV_BASE_VERSION = getProperty( | ||
prop, "dev_base_versionName" | ||
); | ||
// DevBaseMVVM 版本号 | ||
DEV_BASE_MVVM_VERSION = getProperty( | ||
prop, "dev_base_mvvm_versionName" | ||
); | ||
// DevEngine 版本号 | ||
DEV_ENGINE_VERSION = getProperty( | ||
prop, "dev_engine_versionName" | ||
); | ||
// DevHttpCapture 版本号 | ||
DEV_HTTP_CAPTURE_VERSION = getProperty( | ||
prop, "dev_http_capture_versionName" | ||
); | ||
// DevHttpCaptureCompiler 版本号 | ||
DEV_HTTP_CAPTURE_COMPILER_VERSION = getProperty( | ||
prop, "dev_http_capture_compiler_version" | ||
); | ||
// DevHttpManager 版本号 | ||
DEV_HTTP_MANAGER_VERSION = getProperty( | ||
prop, "dev_http_manager_versionName" | ||
); | ||
// DevRetrofit 版本号 | ||
DEV_RETROFIT_VERSION = getProperty( | ||
prop, "dev_retrofit_versionName" | ||
); | ||
// DevWidget 版本号 | ||
DEV_WIDGET_VERSION = getProperty( | ||
prop, "dev_widget_versionName" | ||
); | ||
// DevEnvironment 版本号 | ||
DEV_ENVIRONMENT_VERSION = getProperty( | ||
prop, "dev_environment_version" | ||
); | ||
// DevJava 版本号 | ||
DEV_JAVA_VERSION = getProperty( | ||
prop, "dev_java_version" | ||
); | ||
} | ||
|
||
// 未知版本默认值 | ||
private static final String UNKNOWN = "x.y.z"; | ||
|
||
/** | ||
* 获取对应 Key 版本信息 | ||
* @param prop 版本配置属性 | ||
* @param key Key | ||
* @return 对应 Key 版本信息 | ||
*/ | ||
private static String getProperty( | ||
final Properties prop, | ||
final String key | ||
) { | ||
String version = prop.getProperty(key, UNKNOWN); | ||
version = StringUtils.clearSEWiths(version, ","); | ||
version = StringUtils.clearSEWiths(version, "\""); | ||
return version; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
ext { | ||
versions = [ | ||
|
||
// =========== | ||
// = Dev Lib = | ||
// =========== | ||
|
||
// DevApp - Android 工具类库 | ||
dev_app_versionCode : 241, | ||
dev_app_versionName : "2.4.1", | ||
|
||
// DevAssist - 封装逻辑代码, 实现多个快捷功能辅助类、以及 Engine 兼容框架等 | ||
dev_assist_versionCode : 137, | ||
dev_assist_versionName : "1.3.7", | ||
|
||
// DevBase - Base ( Activity、Fragment )、MVP、ViewBinding、ContentLayout 基类库 | ||
dev_base_versionCode : 113, | ||
dev_base_versionName : "1.1.3", | ||
|
||
// DevBaseMVVM - MVVM ( ViewDataBinding + ViewModel ) 基类库 | ||
dev_base_mvvm_versionCode : 111, | ||
dev_base_mvvm_versionName : "1.1.1", | ||
|
||
// DevMVVM - DataBinding 工具类库 | ||
dev_mvvm_versionCode : 100, | ||
dev_mvvm_versionName : "1.0.0", | ||
|
||
// DevEngine - 第三方框架解耦、一键替换第三方库、同类库多 Engine 组件化混合使用 | ||
dev_engine_versionCode : 109, | ||
dev_engine_versionName : "1.0.9", | ||
|
||
// DevHttpCapture - OkHttp 抓包工具库 | ||
dev_http_capture_versionCode : 112, | ||
dev_http_capture_versionName : "1.1.2", | ||
dev_http_capture_compiler_version : "1.1.2", | ||
dev_http_capture_compiler_release_version: "1.1.2", | ||
|
||
// DevHttpManager - OkHttp 管理库 ( Retrofit 多 BaseUrl 管理、Progress 监听 ) | ||
dev_http_manager_versionCode : 102, | ||
dev_http_manager_versionName : "1.0.2", | ||
|
||
// DevRetrofit - Retrofit + Kotlin Coroutines 封装 | ||
dev_retrofit_versionCode : 101, | ||
dev_retrofit_versionName : "1.0.1", | ||
|
||
// DevWidget - 自定义 View UI 库 | ||
dev_widget_versionCode : 119, | ||
dev_widget_versionName : "1.1.9", | ||
|
||
// DevEnvironment - Android 环境配置切换库 | ||
dev_environment_versionCode : 111, | ||
dev_environment_version : "1.1.1", | ||
dev_environment_base_version : "1.1.1", | ||
dev_environment_compiler_version : "1.1.1", | ||
dev_environment_compiler_release_version : "1.1.1", | ||
|
||
// DevJava - Java 工具类库 ( 不依赖 android api ) | ||
dev_java_versionCode : 147, | ||
dev_java_version : "1.4.7", | ||
] | ||
} |