在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):moallemi/gradle-advanced-build-version开源软件地址(OpenSource Url):https://github.com/moallemi/gradle-advanced-build-version开源编程语言(OpenSource Language):Kotlin 100.0%开源软件介绍(OpenSource Introduction):Gradle Advanced Build Version PluginA plugin to generate the Android version code and version name automatically based on git commits number, date and Semantic Versioning. ContentsInstallationAdd the advanced-build-version plugin to your build script and use the property Using the plugins DSL: plugins {
id "me.moallemi.advanced-build-version" version "2.0.0"
} Using legacy plugin application: buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'me.moallemi.gradle:advanced-build-version:2.0.0'
}
}
apply plugin: 'me.moallemi.advanced-build-version' How to use
Version Name ConfigurationYou can customize version name in your advancedVersioning {
nameOptions {
versionMajor 1
versionMinor 3
versionPatch 6
versionBuild 8
}
} the above configuration will output there is no need to specify all params because they will be handled automatically. for example: advancedVersioning {
nameOptions {
versionMajor 1
versionBuild 8
}
} will output advancedVersioning {
nameOptions {
versionMajor 1
versionMinor 3
}
} will output Version Code ConfigurationTo customize version code in your Groovy: advancedVersioning {
codeOptions {
versionCodeType 'GIT_COMMIT_COUNT'
}
} Kotlin: import me.moallemi.gradle.advancedbuildversion.gradleextensions.VersionCodeType.*
advancedVersioning {
codeOptions {
versionCodeType(GIT_COMMIT_COUNT)
}
}
advancedVersioning {
codeOptions {
versionCodeType 'AUTO_INCREMENT_ONE_STEP'
dependsOnTasks 'release' // defaultValue
}
} Setting multiple tasks for advancedVersioning {
codeOptions {
versionCodeType 'AUTO_INCREMENT_ONE_STEP'
dependsOnTasks 'debug', 'release', 'assemble'
}
}
advancedVersioning {
codeOptions {
versionCodeType 'AUTO_INCREMENT_STEP'
versionCodeStep 2
}
} File output optionsYou can also rename the output generated apk file with this plugin. it can be done just by enabling
the advancedVersioning {
outputOptions {
renameOutput true
}
} If your app name is MyApp with 2.7 version name, and you are in debug mode, the output apk file name
will be: NOTE: Android Gradle Plugin 4.1.0 drops support for renaming apk. We are using a workaround to keep renaming option for gradle-advanced-build-version library.
So if you are using AGP 4.1.0+, you have to add advancedVersioning {
outputOptions {
renameOutput true
}
}
android {
...
}
advancedVersioning.renameOutputApk() You can customize the output name by using this params:
Groovy: advancedVersioning {
outputOptions {
renameOutput true
nameFormat '${appName}-${buildType}-${versionName}'
}
} Kotlin: advancedVersioning {
outputOptions {
renameOutput(true)
nameFormat("\${appName}-\${buildType}-\${versionName}-\${versionCode}")
}
} And you can also use custom string in Groovy: advancedVersioning {
outputOptions {
renameOutput true
nameFormat '${appName}-google-play-${versionName}'
}
} Kotlin: advancedVersioning {
outputOptions {
renameOutput(true)
nameFormat("\${appName}-google-play-\${versionName}")
}
} If your app name is MyApp with 4.6.1 version name the output apk file name will be:
License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论