代码拉取完成,页面将自动刷新
/**
* 该脚本是为了同时打出国内版和海外版,使用 ./gradlew build 命令可以打出四个apk release debug releaseOversea debugOversea
*
*
*/
buildscript {
repositories {
mavenLocal()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
android{
signingConfigs {
debug {
storeFile file("xjjsiterwell.jks")
storePassword '123456'
keyAlias '123456'
keyPassword '123456'
}
release {
storeFile file("xjjsiterwell.jks")
storePassword '123456'
keyAlias '123456'
keyPassword '123456'
}
}
buildTypes {
releaseOversea {
minifyEnabled true
buildConfigField "String", "BUILD_COUNTRY","\"OVERSEA\"" //海外
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}//debug 默认不开混淆
debugOversea {
minifyEnabled false
buildConfigField "String", "BUILD_COUNTRY","\"OVERSEA\""
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
//国内环境采用默认的安全图片
release {
resources.srcDirs = ['src/main/res']
res.srcDirs = ['src/main/res']
}
debug {
resources.srcDirs = ['src/main/res']
res.srcDirs = ['src/main/res']
}
//海外版采用 src/oversea/res 路径下的安全图片
releaseOversea {
resources.srcDirs = ['src/oversea/res']
res.srcDirs = ['src/oversea/res']
}
debugOversea {
resources.srcDirs = ['src/oversea/res']
res.srcDirs = ['src/oversea/res']
}
}
}
tasks.whenTaskAdded { task ->
if (task.name.startsWith('merge') && task.name.endsWith("Resources") && !task.name.contains("Patch")&&!task.name.contains("AndroidTest")) {
println(" ******************* task:" + task.name)
task.doFirst {
//复制oversea 安全图片
File overseaSourceDir = new File(project.getProjectDir().getAbsolutePath() + "/src/oversea/res/drawable/")
if (overseaSourceDir != null) {
println("delete cache file " + overseaSourceDir.name)
}
if (overseaSourceDir.isDirectory()) {
List<File> resFileList = overseaSourceDir.listFiles()
if (!resFileList.isEmpty()) {
for (File f : resFileList) {
if ("yw_1222_114d.jpg".equalsIgnoreCase(f.getName())) {
println("================== start to delete :" + f.getAbsolutePath())
f.delete()
}
}
}
}
File overseaDesDir = new File(project.getProjectDir().getAbsolutePath() + "/configure/oversea/yw_1222_114d.jpg")
if (overseaDesDir.exists()) {
println(overseaDesDir.getAbsoluteFile())
org.apache.commons.io.FileUtils.copyFile(task.project.file(overseaDesDir),
task.project.file(overseaSourceDir.getAbsolutePath() +"/yw_1222_114d.jpg"), true)
} else {
throw new IllegalArgumentException("未找到海外环境的安全图片,请重新检查configure/oversea/目录下,是否存在名称为yw_1222_114d.jpg")
}
//复制china 安全图片
File chinaSourceDir = new File(project.getProjectDir().getAbsolutePath() + "/src/main/res/drawable/")
if (chinaSourceDir != null) {
println("delete cache file " + chinaSourceDir.name)
}
if (chinaSourceDir.isDirectory()) {
List<File> resFileList = chinaSourceDir.listFiles()
if (!resFileList.isEmpty()) {
for (File f : resFileList) {
if ("yw_1222_114d.jpg".equalsIgnoreCase(f.getName())) {
println("================== start to delete :" + f.getAbsolutePath())
f.delete()
}
}
}
}
File chinaDesDir = new File(project.getProjectDir().getAbsolutePath() + "/configure/china/yw_1222_114d.jpg")
if (chinaDesDir.exists()) {
println(chinaDesDir.getAbsoluteFile())
org.apache.commons.io.FileUtils.copyFile(task.project.file(chinaDesDir),
task.project.file(chinaSourceDir.getAbsolutePath() +"/yw_1222_114d.jpg"), true)
} else {
throw new IllegalArgumentException("未找到国内环境的安全图片,请重新检查configure/china/目录下,是否存在名称为yw_1222_114d.jpg")
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。