Files
waf-platform/EdgeHttpDNS/sdk/android/httpdns-sdk/build.gradle
2026-03-02 20:07:53 +08:00

121 lines
3.3 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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", "new-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.newsdk.ams:new-android-logger:${loggerVersion}"
implementation "com.newsdk.ams:new-android-crashdefend:${crashDefendVersion}"
implementation "com.newsdk.ams:new-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("new-android")) {
copy {
from file
into 'build/outputs/dependencies'
}
}
}
}
}
}