forked from square/anvil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
107 lines (92 loc) · 3.23 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
buildscript {
apply from: rootProject.file('dependencies.gradle')
repositories {
google()
gradlePluginPortal()
mavenCentral()
}
dependencies {
classpath deps.android_gradle_plugin
classpath deps.kotlin.dokka
classpath deps.kotlin.gradle_plugin
classpath deps.ktlint_plugin
classpath deps.anvil_plugin
classpath deps.maven_publishing_plugin
}
}
println "Versions: " + [
"Kotlin": ext.kotlinVersion,
"Gradle": gradle.gradleVersion,
"Kotlin use IR": ext.kotlinUseIR
]
allprojects {
repositories {
google()
mavenCentral()
}
}
boolean configureOnDemandEnabled = getProperty("org.gradle.configureondemand", "false").toBoolean()
subprojects {
if (buildFile.exists()) {
apply plugin: 'org.jlleitschuh.gradle.ktlint'
ktlint {
version = rootProject.ext.ktlintVersion
verbose = true
}
}
tasks.withType(Test).configureEach {
testLogging {
events 'passed', 'failed', 'skipped', 'standardOut', 'standardError'
exceptionFormat 'FULL'
showCauses true
showExceptions true
showStackTraces true
showStandardStreams true
}
}
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
//noinspection UnnecessaryQualifiedReference
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
useIR = rootProject.ext.kotlinUseIR
allWarningsAsErrors = rootProject.ext.makeWarningsErrors
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"]
boolean optInExperimental = project.name != "annotations"
&& project.name != "scopes"
&& project.name != "dagger-factories-only"
if (optInExperimental) {
freeCompilerArgs += "-Xopt-in=com.squareup.anvil.annotations.ExperimentalAnvilApi"
}
}
}
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module("com.squareup.anvil:annotations") with project(':annotations')
substitute module("com.squareup.anvil:compiler") with project(':compiler')
substitute module("com.squareup.anvil:compiler-api") with project(':compiler-api')
substitute module("com.squareup.anvil:compiler-utils") with project(':compiler-utils')
}
}
// We disable configure on demand in the local gradle.properties, but you can override this flag
// either in the CLI command or in ~/.gradle/gradle.properties. We really need to disable
// configure on demand in order to support the dependency substitution feature above. As a
// workaround force the evaluation of subprojects.
//
// The other option would be to stop the build if we detect configure on the demand, but some
// folks (including myself 🙃) set the flag globally in the Gradle home dir. The workaround
// is good enough for now.
if (configureOnDemandEnabled) {
//noinspection UnnecessaryQualifiedReference
(it as org.gradle.api.internal.project.DefaultProject).evaluate()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
def getProperty(String name, String defaultValue) {
return project.hasProperty(name) ? project.getProperty(name) : defaultValue
}