From c7febb89c5f6a7ab4aeb7482b739ec7ca7682c16 Mon Sep 17 00:00:00 2001 From: Cjt Date: Sat, 17 Sep 2022 23:30:41 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E4=BF=A1=E6=81=AF=E3=80=81=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/javadoc/dev_utils/ApiConfig.java | 24 ++-- .../java/javadoc/dev_utils/DevVersion.java | 136 ++++++++++++++++++ versions.gradle | 61 ++++++++ 3 files changed, 209 insertions(+), 12 deletions(-) create mode 100644 src/main/java/javadoc/dev_utils/DevVersion.java create mode 100644 versions.gradle diff --git a/src/main/java/javadoc/dev_utils/ApiConfig.java b/src/main/java/javadoc/dev_utils/ApiConfig.java index ddc2574..1e39ed4 100644 --- a/src/main/java/javadoc/dev_utils/ApiConfig.java +++ b/src/main/java/javadoc/dev_utils/ApiConfig.java @@ -56,7 +56,7 @@ private ApiConfig() { // ========== // DevApp 版本号 - public static final String DEV_APP_VERSION = "2.4.1"; + public static final String DEV_APP_VERSION = DevVersion.DEV_APP_VERSION; // DevApp 文件路径 public static final String DEV_APP_PATH = PROJECT_LOCAL_PATH + "/DevUtils/lib/DevApp/src/main/java/dev"; // DevApp Utils 文件路径 @@ -73,7 +73,7 @@ private ApiConfig() { // ============= // DevAssist 版本号 - public static final String DEV_ASSIST_VERSION = "1.3.7"; + public static final String DEV_ASSIST_VERSION = DevVersion.DEV_ASSIST_VERSION; // 包目录名 public static final String DEV_ASSIST_PACKAGE = "dev"; // DevAssist 文件路径 @@ -90,7 +90,7 @@ private ApiConfig() { // =========== // DevBase 版本号 - public static final String DEV_BASE_VERSION = "1.1.3"; + public static final String DEV_BASE_VERSION = DevVersion.DEV_BASE_VERSION; // 包目录名 public static final String DEV_BASE_PACKAGE = "dev.base"; // DevBase 文件路径 @@ -107,7 +107,7 @@ private ApiConfig() { // =============== // DevBaseMVVM 版本号 - public static final String DEV_BASE_MVVM_VERSION = "1.1.1"; + public static final String DEV_BASE_MVVM_VERSION = DevVersion.DEV_BASE_MVVM_VERSION; // 包目录名 public static final String DEV_BASE_MVVM_PACKAGE = "dev.base"; // DevBaseMVVM 文件路径 @@ -124,7 +124,7 @@ private ApiConfig() { // ============= // DevEngine 版本号 - public static final String DEV_ENGINE_VERSION = "1.0.9"; + public static final String DEV_ENGINE_VERSION = DevVersion.DEV_ENGINE_VERSION; // 包目录名 public static final String DEV_ENGINE_PACKAGE = "dev.engine"; // DevEngine 文件路径 @@ -141,7 +141,7 @@ private ApiConfig() { // ================== // DevHttpCapture 版本号 - public static final String DEV_HTTP_CAPTURE_VERSION = "1.1.2"; + public static final String DEV_HTTP_CAPTURE_VERSION = DevVersion.DEV_HTTP_CAPTURE_VERSION; // 包目录名 public static final String DEV_HTTP_CAPTURE_PACKAGE = "dev"; // DevHttpCapture 文件路径 @@ -158,7 +158,7 @@ private ApiConfig() { // ========================== // DevHttpCaptureCompiler 版本号 - public static final String DEV_HTTP_CAPTURE_COMPILER_VERSION = DEV_HTTP_CAPTURE_VERSION; + public static final String DEV_HTTP_CAPTURE_COMPILER_VERSION = DevVersion.DEV_HTTP_CAPTURE_COMPILER_VERSION; // 包目录名 public static final String DEV_HTTP_CAPTURE_COMPILER_PACKAGE = "dev"; // DevHttpCaptureCompiler 文件路径 @@ -175,7 +175,7 @@ private ApiConfig() { // ================== // DevHttpManager 版本号 - public static final String DEV_HTTP_MANAGER_VERSION = "1.0.2"; + public static final String DEV_HTTP_MANAGER_VERSION = DevVersion.DEV_HTTP_MANAGER_VERSION; // 包目录名 public static final String DEV_HTTP_MANAGER_PACKAGE = "dev"; // DevHttpManager 文件路径 @@ -192,7 +192,7 @@ private ApiConfig() { // =============== // DevRetrofit 版本号 - public static final String DEV_RETROFIT_VERSION = "1.0.1"; + public static final String DEV_RETROFIT_VERSION = DevVersion.DEV_RETROFIT_VERSION; // 包目录名 public static final String DEV_RETROFIT_PACKAGE = "dev"; // DevRetrofit 文件路径 @@ -209,7 +209,7 @@ private ApiConfig() { // ============= // DevWidget 版本号 - public static final String DEV_WIDGET_VERSION = "1.1.9"; + public static final String DEV_WIDGET_VERSION = DevVersion.DEV_WIDGET_VERSION; // 包目录名 public static final String DEV_WIDGET_PACKAGE = "dev"; // DevWidget 文件路径 @@ -226,7 +226,7 @@ private ApiConfig() { // ================== // DevEnvironment 版本号 - public static final String DEV_ENVIRONMENT_VERSION = "1.1.1"; + public static final String DEV_ENVIRONMENT_VERSION = DevVersion.DEV_ENVIRONMENT_VERSION; // DevEnvironment API 文件保存路径 public static final String DEV_ENVIRONMENT_API_FILE_SAVE_PATH = API_LIB_FILE_SAVE_PATH + "/Environment/"; // DevEnvironment Template Readme @@ -237,7 +237,7 @@ private ApiConfig() { // =========== // DevJava 版本号 - public static final String DEV_JAVA_VERSION = "1.4.7"; + public static final String DEV_JAVA_VERSION = DevVersion.DEV_JAVA_VERSION; // DevJava 文件路径 public static final String DEV_JAVA_PATH = PROJECT_LOCAL_PATH + "/DevUtils/lib/DevJava/src/main/java/dev"; // DevJava Utils 文件路径 diff --git a/src/main/java/javadoc/dev_utils/DevVersion.java b/src/main/java/javadoc/dev_utils/DevVersion.java new file mode 100644 index 0000000..a73958b --- /dev/null +++ b/src/main/java/javadoc/dev_utils/DevVersion.java @@ -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; + } +} \ No newline at end of file diff --git a/versions.gradle b/versions.gradle new file mode 100644 index 0000000..af3a04e --- /dev/null +++ b/versions.gradle @@ -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", + ] +} \ No newline at end of file