dev
This commit is contained in:
@@ -10,7 +10,7 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode rootProject.ext.android.versionCode
|
||||
versionCode generateVersionCode()
|
||||
versionName "${rootProject.ext.android.versionName}.${getMonthAndDay()}"
|
||||
applicationId rootProject.ext.android.applicationId
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@@ -84,6 +84,41 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
def generateVersionCode() {
|
||||
String vn = rootProject.ext.android.versionName
|
||||
String[] versions = vn.split("\\.")
|
||||
if (versions.length == 3) {
|
||||
int num1 = Integer.valueOf(versions[0])
|
||||
int num2 = Integer.valueOf(versions[1])
|
||||
int num3 = Integer.valueOf(versions[2])
|
||||
if (num1 < 1 || num1 > 99){
|
||||
throw new GradleException("版本号必须定义为 x.y.z,x[1,99], y[0, 99], z[0, 99])")
|
||||
}
|
||||
if (num2 < 0 || num2 > 99){
|
||||
throw new GradleException("版本号必须定义为 x.y.z,x[1,99], y[0, 99], z[0, 99])")
|
||||
}
|
||||
if (num3 < 0 || num3 > 99){
|
||||
throw new GradleException("版本号必须定义为 x.y.z,x[1,99], y[0, 99], z[0, 99])")
|
||||
}
|
||||
StringBuilder builder = new StringBuilder()
|
||||
builder.append(num1)
|
||||
if( num2 > 9 ){
|
||||
builder.append(num2)
|
||||
} else {
|
||||
builder.append("0").append(num2)
|
||||
}
|
||||
if( num3 > 9 ){
|
||||
builder.append(num3)
|
||||
} else {
|
||||
builder.append("0").append(num3)
|
||||
}
|
||||
println("last versionCode ${builder}")
|
||||
return Integer.valueOf(builder.toString())
|
||||
} else {
|
||||
throw new GradleException("版本号必须定义为 x.y.z,x[1,99], y[0, 99], z[0, 99])")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
@@ -103,19 +138,19 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.guideshowprovider
|
||||
implementation rootProject.ext.dependencies.guideshow
|
||||
implementation rootProject.ext.dependencies.modulemedia
|
||||
implementation rootProject.ext.dependencies.modulefreshnews,{
|
||||
exclude group:'com.mogo.module',module:'module-onlinecar'
|
||||
implementation rootProject.ext.dependencies.modulefreshnews, {
|
||||
exclude group: 'com.mogo.module', module: 'module-onlinecar'
|
||||
}
|
||||
|
||||
implementation rootProject.ext.dependencies.modulepush,{
|
||||
exclude group:'com.mogo.module',module:'module-common'
|
||||
implementation rootProject.ext.dependencies.modulepush, {
|
||||
exclude group: 'com.mogo.module', module: 'module-common'
|
||||
}
|
||||
implementation rootProject.ext.dependencies.moduleadcard
|
||||
|
||||
implementation rootProject.ext.dependencies.moduleonlinecar
|
||||
implementation rootProject.ext.dependencies.moduleV2x
|
||||
implementation rootProject.ext.dependencies.moduletanlu,{
|
||||
exclude group:'com.mogo.module',module:'module-share'
|
||||
implementation rootProject.ext.dependencies.moduletanlu, {
|
||||
exclude group: 'com.mogo.module', module: 'module-share'
|
||||
}
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
@@ -145,7 +180,7 @@ android.applicationVariants.all { variant ->
|
||||
}
|
||||
|
||||
|
||||
def getMonthAndDay(){
|
||||
def getMonthAndDay() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MMddHH")
|
||||
return sdf.format(new Date())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user