121 lines
3.4 KiB
Groovy
121 lines
3.4 KiB
Groovy
plugins {
|
||
id 'com.android.library'
|
||
id 'maven-publish'
|
||
}
|
||
apply from: 'version.gradle'
|
||
|
||
|
||
android {
|
||
compileSdk 33
|
||
defaultConfig {
|
||
minSdkVersion 19
|
||
targetSdkVersion 33
|
||
versionCode 1
|
||
versionName httpdnsDebugVersion
|
||
setProperty("archivesBaseName", "alicloud-android-httpdns-$versionName")
|
||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||
buildConfigField "String", "VERSION_NAME", "\"${httpdnsDebugVersion}\""
|
||
|
||
}
|
||
buildTypes {
|
||
release {
|
||
minifyEnabled true
|
||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||
}
|
||
|
||
debug {
|
||
minifyEnabled true
|
||
proguardFiles getDefaultProguardFile("proguard-android.txt"), 'proguard-rules.pro'
|
||
}
|
||
|
||
forTest {
|
||
initWith release
|
||
debuggable true
|
||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-for-test.pro'
|
||
}
|
||
}
|
||
|
||
flavorDimensions += "version"
|
||
|
||
productFlavors {
|
||
normal {
|
||
|
||
}
|
||
|
||
intl {
|
||
|
||
}
|
||
|
||
end2end {
|
||
|
||
}
|
||
}
|
||
|
||
variantFilter { variant ->
|
||
def names = variant.flavors*.name
|
||
def type = variant.buildType.name
|
||
// To check for a certain build type, use variant.buildType.name == "<buildType>"
|
||
if ((names.contains("normal") && type.contains("forTest"))
|
||
|| (names.contains("intl") && type.contains("forTest"))
|
||
|| (names.contains("end2end") && type.contains("release"))
|
||
|| (names.contains("end2end") && type.contains("debug"))
|
||
) {
|
||
// Gradle ignores any variants that satisfy the conditions above.
|
||
setIgnore(true)
|
||
}
|
||
}
|
||
|
||
testOptions {
|
||
unitTests {
|
||
all {
|
||
jvmArgs '-noverify'
|
||
systemProperty 'robolectric.logging.enable', true
|
||
}
|
||
}
|
||
}
|
||
|
||
lintOptions {
|
||
abortOnError false
|
||
}
|
||
}
|
||
|
||
dependencies {
|
||
|
||
//noinspection GradleDependency 高版本 jdk和androidx有一些依赖,暂时不升级
|
||
testEnd2endImplementation "org.robolectric:robolectric:3.8"
|
||
//noinspection GradleDependency
|
||
testEnd2endImplementation 'junit:junit:4.12'
|
||
//noinspection GradleDependency
|
||
testEnd2endImplementation 'org.mockito:mockito-core:2.15.0'
|
||
testEnd2endImplementation 'com.squareup.okhttp3:mockwebserver:3.9.0'
|
||
|
||
implementation "com.aliyun.ams:alicloud-android-logger:${loggerVersion}"
|
||
implementation "com.aliyun.ams:alicloud-android-crashdefend:${crashDefendVersion}"
|
||
implementation "com.aliyun.ams:alicloud-android-ipdetector:${ipdetectorVersion}"
|
||
}
|
||
|
||
ext.getIntlVersion = { version ->
|
||
if (version.endsWith("-SNAPSHOT")) {
|
||
return version.replace("-SNAPSHOT", "-intl-SNAPSHOT");
|
||
} else {
|
||
return version + "-intl";
|
||
}
|
||
}
|
||
|
||
task copyDependencies {
|
||
doLast {
|
||
def config = configurations.findByName("normalReleaseRuntimeClasspath")
|
||
if (config != null) {
|
||
config.resolvedConfiguration.resolvedArtifacts.each { artifact ->
|
||
def file = artifact.file
|
||
if (file.name.contains("alicloud-android")) {
|
||
copy {
|
||
from file
|
||
into 'build/outputs/dependencies'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|