forked from microsoft/ApplicationInsights-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
138 lines (114 loc) · 3.71 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id "idea"
id "com.github.johnrengelman.shadow" apply false
id "org.owasp.dependencycheck" version "6.1.5"
id "com.diffplug.spotless"
id "net.ltgt.errorprone" apply false
id "com.github.ben-manes.versions" version "0.38.0"
}
ext.buildScriptsDir = "$rootDir/gradle"
apply from: "$buildScriptsDir/common.gradle"
ext {
isBuildServer = (System.properties["isBuildServer"] ?: "false").toBoolean()
isRelease = (System.properties["isRelease"] ?: "false").toBoolean()
if (isBuildServer) {
logger.lifecycle "Building on SERVER"
} else {
logger.lifecycle "Building on DESKTOP"
}
}
spotless {
// this formatting is applied at the root level, as some of these files are not in a submodules
// and would be missed otherwise
format 'misc', {
target '.gitignore', '*.md', 'docs/**/*.md'
indentWithSpaces()
trimTrailingWhitespace()
endWithNewline()
}
}
allprojects {
if (!it.path.startsWith(":test")) {
configurations {
runtimeClasspath {
resolutionStrategy.activateDependencyLocking()
}
}
}
task generateLockfiles {
doFirst {
assert gradle.startParameter.writeDependencyLocks
// meaning you must run with --write-locks parameter
}
doLast {
if (configurations.findByName("runtimeClasspath") != null) {
configurations.runtimeClasspath.resolve()
}
}
}
task downloadDependencies {
doLast {
[configurations, buildscript.configurations].flatten().findAll {
// dependencyManagement gets in the way of resolving the "default" configuration
it.canBeResolved && it.name != "default"
}.each {
it.resolve()
}
}
}
tasks.withType(ShadowJar) {
exclude "META-INF/maven/**"
exclude "META-INF/LICENSE*"
exclude "META-INF/DEPENDENCIES"
exclude "META-INF/NOTICE*"
from "${rootProject.projectDir}/NOTICE"
from "${rootProject.projectDir}/LICENSE"
}
tasks.withType(Jar) {
from "${rootProject.projectDir}/NOTICE"
from "${rootProject.projectDir}/LICENSE"
}
plugins.withId("net.ltgt.errorprone") {
dependencies {
errorprone "com.google.errorprone:error_prone_core:2.7.1"
}
tasks.withType(JavaCompile).configureEach {
options.errorprone {
enabled = rootProject.findProperty("disableErrorProne") != "true"
disableWarningsInGeneratedCode = true
allDisabledChecksAsWarnings = true
excludedPaths = ".*/build/generated/.*"
// TEMPORARILY until time to revisit
disable("WildcardImport")
disable("BadImport")
disable("BooleanParameter")
disable("JavaUtilDate")
disable("HashCodeToString")
disable("ImmutableEnumChecker")
disable("JavaTimeDefaultTimeZone")
// Doesn't work well with Java 8
disable("FutureReturnValueIgnored")
// Require Guava
disable("AutoValueImmutableFields")
disable("StringSplitter")
disable("ImmutableMemberCollection")
// Don't currently use this (to indicate a local variable that's mutated) but could
// consider for future.
disable("Var")
// Don't support Android without desugar
disable("AndroidJdkLibsChecker")
disable("Java7ApiChecker")
disable("StaticOrDefaultInterfaceMethod")
// Common to avoid an allocation. Revisit if it's worth opt-in suppressing instead of
// disabling entirely.
disable("MixedMutabilityReturnType")
// Limits API possibilities
disable("NoFunctionalReturnType")
// We don't use tools that recognize.
disable("InlineMeSuggester")
disable("DoNotCallSuggester")
}
}
}
}