-
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
5 changed files
with
244 additions
and
30 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,91 @@ | ||
apply from: rootProject.file("versions.gradle") | ||
|
||
// 是否升级版本 | ||
def upgradeVersion = false | ||
|
||
// 生成 versions.gradle | ||
tasks.register('generateVersionsGradle') { | ||
// 是否全部版本进行升级 | ||
if (upgradeVersion) { | ||
def templateFile = new File(rootDir, "file/versions_template.txt") | ||
def content = new String(templateFile.readBytes()) | ||
|
||
// =========== | ||
// = Dev Lib = | ||
// =========== | ||
|
||
// DevApp - Android 工具类库 | ||
content = formatVersion(content, "DevApp", versions.dev_app_versionCode) | ||
|
||
// DevAssist - 封装逻辑代码, 实现多个快捷功能辅助类、以及 Engine 兼容框架等 | ||
content = formatVersion(content, "DevAssist", versions.dev_assist_versionCode) | ||
|
||
// DevBase - Base ( Activity、Fragment )、MVP、ViewBinding、ContentLayout 基类库 | ||
content = formatVersion(content, "DevBase", versions.dev_base_versionCode) | ||
|
||
// DevBaseMVVM - MVVM ( ViewDataBinding + ViewModel ) 基类库 | ||
content = formatVersion(content, "DevBaseMVVM", versions.dev_base_mvvm_versionCode) | ||
|
||
// DevMVVM - DataBinding 工具类库 | ||
content = formatVersion(content, "DevMVVM", versions.dev_mvvm_versionCode) | ||
|
||
// DevEngine - 第三方框架解耦、一键替换第三方库、同类库多 Engine 组件化混合使用 | ||
content = formatVersion(content, "DevEngine", versions.dev_engine_versionCode) | ||
|
||
// DevHttpCapture - OkHttp 抓包工具库 | ||
content = formatVersion(content, "DevHttpCapture", versions.dev_http_capture_versionCode) | ||
|
||
// DevHttpManager - OkHttp 管理库 ( Retrofit 多 BaseUrl 管理、Progress 监听 ) | ||
content = formatVersion(content, "DevHttpManager", versions.dev_http_manager_versionCode) | ||
|
||
// DevRetrofit - Retrofit + Kotlin Coroutines 封装 | ||
content = formatVersion(content, "DevRetrofit", versions.dev_retrofit_versionCode) | ||
|
||
// DevWidget - 自定义 View UI 库 | ||
content = formatVersion(content, "DevWidget", versions.dev_widget_versionCode) | ||
|
||
// DevEnvironment - Android 环境配置切换库 | ||
content = formatVersion(content, "DevEnvironment", versions.dev_environment_versionCode) | ||
|
||
// DevJava - Java 工具类库 ( 不依赖 android api ) | ||
content = formatVersion(content, "DevJava", versions.dev_java_versionCode) | ||
|
||
// =========== | ||
// = Dev Lib = | ||
// =========== | ||
|
||
// 写入 versions.gradle | ||
def versionsFile = new File(rootDir, "file/versions.txt") | ||
versionsFile.withPrintWriter { | ||
it.print(content) | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* versionCode to versionName | ||
* 123 转换为 1.2.3 | ||
*/ | ||
private static def createVersionName(Object versionCode) { | ||
def value = versionCode.toString().chars | ||
def builder = new StringBuilder() | ||
builder.append(value[0]) | ||
int len = value.length | ||
for (int i = 1; i < len; i++) { | ||
builder.append(".") | ||
builder.append(value[i]) | ||
} | ||
return builder.toString() | ||
} | ||
|
||
/** | ||
* 格式化版本处理 | ||
*/ | ||
private static def formatVersion(String content, String tag, Object version) { | ||
def vc = "【" + tag + "】" | ||
def vn = "【" + tag + "-vn】" | ||
def newVersion = version + 1 | ||
def versionName = createVersionName(newVersion) | ||
return content.replaceAll(vc, newVersion.toString()) | ||
.replaceAll(vn, versionName) | ||
} |
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 : 243, | ||
dev_app_versionName : "2.4.3", | ||
|
||
// DevAssist - 封装逻辑代码, 实现多个快捷功能辅助类、以及 Engine 兼容框架等 | ||
dev_assist_versionCode : 139, | ||
dev_assist_versionName : "1.3.9", | ||
|
||
// DevBase - Base ( Activity、Fragment )、MVP、ViewBinding、ContentLayout 基类库 | ||
dev_base_versionCode : 115, | ||
dev_base_versionName : "1.1.5", | ||
|
||
// DevBaseMVVM - MVVM ( ViewDataBinding + ViewModel ) 基类库 | ||
dev_base_mvvm_versionCode : 113, | ||
dev_base_mvvm_versionName : "1.1.3", | ||
|
||
// DevMVVM - DataBinding 工具类库 | ||
dev_mvvm_versionCode : 101, | ||
dev_mvvm_versionName : "1.0.1", | ||
|
||
// DevEngine - 第三方框架解耦、一键替换第三方库、同类库多 Engine 组件化混合使用 | ||
dev_engine_versionCode : 111, | ||
dev_engine_versionName : "1.1.1", | ||
|
||
// DevHttpCapture - OkHttp 抓包工具库 | ||
dev_http_capture_versionCode : 114, | ||
dev_http_capture_versionName : "1.1.4", | ||
dev_http_capture_compiler_version : "1.1.4", | ||
dev_http_capture_compiler_release_version: "1.1.4", | ||
|
||
// DevHttpManager - OkHttp 管理库 ( Retrofit 多 BaseUrl 管理、Progress 监听 ) | ||
dev_http_manager_versionCode : 104, | ||
dev_http_manager_versionName : "1.0.4", | ||
|
||
// DevRetrofit - Retrofit + Kotlin Coroutines 封装 | ||
dev_retrofit_versionCode : 103, | ||
dev_retrofit_versionName : "1.0.3", | ||
|
||
// DevWidget - 自定义 View UI 库 | ||
dev_widget_versionCode : 121, | ||
dev_widget_versionName : "1.2.1", | ||
|
||
// DevEnvironment - Android 环境配置切换库 | ||
dev_environment_versionCode : 113, | ||
dev_environment_version : "1.1.3", | ||
dev_environment_base_version : "1.1.3", | ||
dev_environment_compiler_version : "1.1.3", | ||
dev_environment_compiler_release_version : "1.1.3", | ||
|
||
// DevJava - Java 工具类库 ( 不依赖 android api ) | ||
dev_java_versionCode : 149, | ||
dev_java_version : "1.4.9", | ||
] | ||
} |
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 : 【DevApp】, | ||
dev_app_versionName : "【DevApp-vn】", | ||
|
||
// DevAssist - 封装逻辑代码, 实现多个快捷功能辅助类、以及 Engine 兼容框架等 | ||
dev_assist_versionCode : 【DevAssist】, | ||
dev_assist_versionName : "【DevAssist-vn】", | ||
|
||
// DevBase - Base ( Activity、Fragment )、MVP、ViewBinding、ContentLayout 基类库 | ||
dev_base_versionCode : 【DevBase】, | ||
dev_base_versionName : "【DevBase-vn】", | ||
|
||
// DevBaseMVVM - MVVM ( ViewDataBinding + ViewModel ) 基类库 | ||
dev_base_mvvm_versionCode : 【DevBaseMVVM】, | ||
dev_base_mvvm_versionName : "【DevBaseMVVM-vn】", | ||
|
||
// DevMVVM - DataBinding 工具类库 | ||
dev_mvvm_versionCode : 【DevMVVM】, | ||
dev_mvvm_versionName : "【DevMVVM-vn】", | ||
|
||
// DevEngine - 第三方框架解耦、一键替换第三方库、同类库多 Engine 组件化混合使用 | ||
dev_engine_versionCode : 【DevEngine】, | ||
dev_engine_versionName : "【DevEngine-vn】", | ||
|
||
// DevHttpCapture - OkHttp 抓包工具库 | ||
dev_http_capture_versionCode : 【DevHttpCapture】, | ||
dev_http_capture_versionName : "【DevHttpCapture-vn】", | ||
dev_http_capture_compiler_version : "【DevHttpCapture-vn】", | ||
dev_http_capture_compiler_release_version: "【DevHttpCapture-vn】", | ||
|
||
// DevHttpManager - OkHttp 管理库 ( Retrofit 多 BaseUrl 管理、Progress 监听 ) | ||
dev_http_manager_versionCode : 【DevHttpManager】, | ||
dev_http_manager_versionName : "【DevHttpManager-vn】", | ||
|
||
// DevRetrofit - Retrofit + Kotlin Coroutines 封装 | ||
dev_retrofit_versionCode : 【DevRetrofit】, | ||
dev_retrofit_versionName : "【DevRetrofit-vn】", | ||
|
||
// DevWidget - 自定义 View UI 库 | ||
dev_widget_versionCode : 【DevWidget】, | ||
dev_widget_versionName : "【DevWidget-vn】", | ||
|
||
// DevEnvironment - Android 环境配置切换库 | ||
dev_environment_versionCode : 【DevEnvironment】, | ||
dev_environment_version : "【DevEnvironment-vn】", | ||
dev_environment_base_version : "【DevEnvironment-vn】", | ||
dev_environment_compiler_version : "【DevEnvironment-vn】", | ||
dev_environment_compiler_release_version : "【DevEnvironment-vn】", | ||
|
||
// DevJava - Java 工具类库 ( 不依赖 android api ) | ||
dev_java_versionCode : 【DevJava】, | ||
dev_java_version : "【DevJava-vn】", | ||
] | ||
} |
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