176 lines
6.1 KiB
Groovy
176 lines
6.1 KiB
Groovy
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||
apply from: "config.gradle"
|
||
apply from: "javadoc.gradle"
|
||
|
||
buildscript {
|
||
apply from: rootProject.file('gradle/ext.gradle')
|
||
repositories {
|
||
mavenLocal()
|
||
maven { url 'https://nexus.zhidaoauto.com/repository/maven-snapshot/' }
|
||
maven { url 'https://nexus.zhidaoauto.com/repository/maven-releases/' }
|
||
maven { url 'https://nexus.zhidaoauto.com/repository/maven-public/' }
|
||
maven { url 'https://storage.zego.im/maven' }
|
||
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
|
||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
|
||
maven { url 'https://maven.aliyun.com/repository/jcenter' }
|
||
maven { url "https://plugins.gradle.org/m2/" }
|
||
maven { url "https://artifact.bytedance.com/repository/Volcengine/" }
|
||
maven { url "https://artifact.bytedance.com/repository/byteX/" }
|
||
gradlePluginPortal()
|
||
// mavenCentral()
|
||
google()
|
||
}
|
||
dependencies {
|
||
classpath "com.android.tools.build:gradle:${gradle_version}"
|
||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_plugin_version}"
|
||
classpath "com.alibaba:arouter-register:10.0.5_mogo"
|
||
classpath "com.bytedance.android.byteX:base-plugin:${plugin_version}"
|
||
classpath "com.mogo.cloud:hook:${service_chain_version}"
|
||
classpath "com.mogo.cloud:bizconfig:${plugin_version}"
|
||
classpath "com.mogo.thread.opt:plg:10.10.0"
|
||
classpath "com.mogo.cloud:systrace:${plugin_version}"
|
||
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
|
||
classpath "com.mogo.sticky:service:${plugin_version}"
|
||
classpath "io.github.knight-zxw:lancet-plugin:${lancetx_version}"
|
||
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0"
|
||
classpath 'com.mogo.cloud:matrix:1.0.2'
|
||
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.4.0.2513'
|
||
classpath 'com.mogo.eagle.core.handler.proxy:plugin:10.0.10'
|
||
classpath 'com.gradle:gradle-enterprise-gradle-plugin:3.15.1'
|
||
// classpath 'com.bytedance.btrace:rhea-gradle-plugin:2.0.0'
|
||
}
|
||
// 遇无法更新依赖情况(针对Snapshot无法刷新)然后sync project即可,刷新完成注释该代码
|
||
// configurations.all {
|
||
// // 缓存时间设置为0,立即更新
|
||
// resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
|
||
// }
|
||
|
||
}
|
||
|
||
allprojects {
|
||
repositories {
|
||
mavenLocal()
|
||
maven { url 'http://nexus.zhidaoauto.com/repository/maven-releases/' }
|
||
maven { url 'http://nexus.zhidaoauto.com/repository/maven-public/' }
|
||
maven { url 'https://storage.zego.im/maven' }
|
||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
|
||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
|
||
maven { url 'https://maven.aliyun.com/repository/jcenter' }
|
||
maven { url 'https://plugins.gradle.org/m2/' }
|
||
// mavenCentral()
|
||
|
||
maven {
|
||
url "https://artifact.bytedance.com/repository/Volcengine/"
|
||
}
|
||
maven {
|
||
url "https://artifact.bytedance.com/repository/byteX/"
|
||
}
|
||
google()
|
||
}
|
||
|
||
if (isCodeInspectEnable) {
|
||
def basePath = new File(codequality, 'code_inspect_increment.gradle').path
|
||
apply from: "$basePath"
|
||
def pmdPath = new File(codequality, 'pmd.gradle').path
|
||
apply from: "$pmdPath"
|
||
def detektPath = new File(codequality, 'detekt.gradle').path
|
||
apply from: "$detektPath"
|
||
def codeInspectPath = new File(codequality, 'code_inspect.gradle').path
|
||
apply from: "$codeInspectPath"
|
||
}
|
||
}
|
||
|
||
apply plugin: 'jacoco'
|
||
apply from: rootProject.file('codequality/sonar.gradle')
|
||
|
||
task clean(type: Delete) {
|
||
delete rootProject.buildDir
|
||
}
|
||
|
||
|
||
task cleanAll(type: Delete) {
|
||
group = "custom"
|
||
rootProject.allprojects {
|
||
//println "delete ${it.buildDir}"
|
||
delete it.buildDir
|
||
}
|
||
}
|
||
|
||
def getValueFromRootProperties(String key) {
|
||
File file = rootProject.file('gradle.properties')
|
||
String value = "";
|
||
if (file.exists()) {
|
||
//加载资源
|
||
InputStream inputStream = file.newDataInputStream();
|
||
Properties properties = new Properties()
|
||
properties.load(inputStream)
|
||
|
||
if (properties.containsKey(key)) {
|
||
value = properties.getProperty(key)
|
||
}
|
||
}
|
||
return value
|
||
}
|
||
|
||
afterEvaluate {
|
||
rootProject.subprojects { project ->
|
||
project.afterEvaluate {
|
||
dependencies {
|
||
components {
|
||
all { ComponentMetadataDetails details ->
|
||
if (details.toString().endsWith("-SNAPSHOT")) {
|
||
details.changing = true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
it.configurations.all {
|
||
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
subprojects.each {
|
||
Class<?> kotlinCompile = null
|
||
try {
|
||
kotlinCompile = Class.forName("org.jetbrains.kotlin.gradle.tasks.KotlinCompile")
|
||
} catch (Throwable t) {
|
||
t.printStackTrace()
|
||
}
|
||
if (kotlinCompile != null) {
|
||
it.tasks.withType(kotlinCompile).configureEach {
|
||
kotlinOptions {
|
||
jvmTarget = '1.8'
|
||
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
boolean isAndroidTestBuild() {
|
||
for (String s : gradle.startParameter.taskNames) {
|
||
if (s.contains("AndroidTest")) {
|
||
return true
|
||
}
|
||
}
|
||
return false
|
||
}
|
||
|
||
boolean isReleaseBuild() {
|
||
for (String s : gradle.startParameter.taskNames) {
|
||
if (s.contains("Release") | s.contains("release")) {
|
||
return true
|
||
}
|
||
}
|
||
return false
|
||
}
|
||
|
||
boolean isJunkDetectEnable() {
|
||
return !isReleaseBuild()
|
||
} |