158 lines
5.0 KiB
Groovy
158 lines
5.0 KiB
Groovy
import java.text.SimpleDateFormat
|
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
android {
|
|
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
|
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
|
defaultConfig {
|
|
minSdkVersion rootProject.ext.android.minSdkVersion
|
|
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
|
versionCode rootProject.ext.android.versionCode
|
|
versionName rootProject.ext.android.versionName
|
|
applicationId rootProject.ext.android.applicationId
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
javaCompileOptions {
|
|
annotationProcessorOptions {
|
|
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
|
}
|
|
}
|
|
|
|
multiDexEnabled true
|
|
externalNativeBuild {
|
|
ndk {
|
|
// 设置支持的SO库架构
|
|
abiFilters 'armeabi-v7a'
|
|
}
|
|
}
|
|
}
|
|
signingConfigs {
|
|
release {
|
|
keyAlias = 'CarLauncher'
|
|
storeFile file('../keystore/car_launcher.jks')
|
|
storePassword 'ZDauto123456'
|
|
keyPassword 'ZDauto123456'
|
|
}
|
|
}
|
|
buildTypes {
|
|
debug {
|
|
signingConfig signingConfigs.release
|
|
debuggable = true
|
|
buildConfigField 'int', 'NET_ENV', '2'
|
|
}
|
|
release {
|
|
minifyEnabled false
|
|
signingConfig signingConfigs.release
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
buildConfigField 'int', 'NET_ENV', '2'
|
|
}
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility 1.8
|
|
targetCompatibility 1.8
|
|
}
|
|
|
|
flavorDimensions "default"
|
|
|
|
productFlavors {
|
|
//诺威达
|
|
nwd {
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile 'src/nwd/AndroidManifest.xml'
|
|
}
|
|
}
|
|
}
|
|
zhidao {
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile 'src/main/AndroidManifest.xml'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
|
|
//Crash日志收集
|
|
implementation rootProject.ext.dependencies.crashSdk
|
|
implementation rootProject.ext.dependencies.androidxappcompat
|
|
implementation rootProject.ext.dependencies.arouter
|
|
implementation rootProject.ext.dependencies.androidxmultidex
|
|
debugImplementation rootProject.ext.dependencies.leakcanary
|
|
testImplementation rootProject.ext.dependencies.leakcanary
|
|
releaseImplementation rootProject.ext.dependencies.leakcanarynoop
|
|
|
|
// implementation rootProject.ext.dependencies.moduledemo
|
|
// implementation rootProject.ext.dependencies.moduledemo2
|
|
implementation rootProject.ext.dependencies.carcallprovider
|
|
implementation rootProject.ext.dependencies.carcall
|
|
implementation rootProject.ext.dependencies.modulemedia
|
|
implementation rootProject.ext.dependencies.modulefreshnews
|
|
|
|
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'
|
|
}
|
|
|
|
if (Boolean.valueOf(RELEASE)) {
|
|
api rootProject.ext.dependencies.modulemain
|
|
api rootProject.ext.dependencies.mogocommons
|
|
implementation rootProject.ext.dependencies.modulecommon
|
|
implementation rootProject.ext.dependencies.modulesearch
|
|
implementation rootProject.ext.dependencies.mogomoduleback
|
|
} else {
|
|
implementation project(':modules:mogo-module-main')
|
|
implementation project(':foudations:mogo-commons')
|
|
implementation project(':modules:mogo-module-common')
|
|
implementation project(':modules:mogo-module-search')
|
|
implementation project(':modules:mogo-module-back')
|
|
}
|
|
}
|
|
|
|
android.applicationVariants.all { variant ->
|
|
variant.outputs.all { //这里修改apk文件名
|
|
outputFileName = "Launcher2.0_V${android.defaultConfig.versionName}_${getCurrentDate()}_${variant.name}_${getGitCommit()}.apk"
|
|
println outputFileName
|
|
}
|
|
}
|
|
|
|
def getCurrentDate() {
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss")
|
|
return sdf.format(new Date())
|
|
}
|
|
|
|
def getGitCommit() {
|
|
def gitDir = new File("${new File("${rootDir}")}/.git")
|
|
if (!gitDir.isDirectory()) {
|
|
return 'non_git_build'
|
|
}
|
|
|
|
def cmd = 'git log --pretty=format:%h -1'
|
|
def gitCommit = cmd.execute().text.trim()
|
|
|
|
print gitCommit
|
|
|
|
def cmd2 = 'git status -s'
|
|
def gitStatus = cmd2.execute().text.trim()
|
|
|
|
println '---------'
|
|
|
|
print gitStatus
|
|
if (gitStatus != null && !gitStatus.isEmpty()) {
|
|
return 'local-build'
|
|
}
|
|
|
|
assert !gitCommit.isEmpty()
|
|
gitCommit
|
|
}
|