-
Notifications
You must be signed in to change notification settings - Fork 289
/
build.gradle
154 lines (130 loc) · 4.27 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
buildscript {
dependencies {
classpath "pl.allegro.tech.build:axion-release-plugin:1.14.4"
}
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module("com.jcraft:jsch") using module("com.github.mwiede:jsch:0.2.17") because "jcraft is unmaintained"
substitute module("com.jcraft:jsch.agentproxy") using module("com.github.mwiede:jsch:0.2.17") because "jcraft is unmaintained"
substitute module("com.jcraft:jzlib") using module("com.github.mwiede:jsch:0.2.17") because "jcraft is unmaintained"
}
}
}
plugins {
id "datadog.dependency-locking"
id "com.diffplug.spotless" version "6.13.0"
id 'com.github.spotbugs' version '5.0.14'
id "de.thetaphi.forbiddenapis" version "3.5.1"
id 'pl.allegro.tech.build.axion-release' version '1.14.4'
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
id "com.github.johnrengelman.shadow" version "7.1.2" apply false
id "me.champeau.jmh" version "0.7.0" apply false
id 'org.gradle.playframework' version '0.13' apply false
id 'info.solidsoft.pitest' version '1.9.11' apply false
}
description = 'dd-trace-java'
def isCI = System.getenv("CI") != null
apply from: "$rootDir/gradle/scm.gradle"
spotless {
// only resolve the spotless dependencies once in the build
predeclareDeps()
}
spotlessPredeclare {
// these need to align with the types and versions in gradle/spotless.gradle
java {
// This is the last Google Java Format version that supports Java 8
googleJavaFormat('1.7')
}
groovyGradle {
greclipse()
}
groovy {
greclipse()
}
kotlinGradle {
ktlint('0.41.0')
}
kotlin {
ktlint('0.41.0')
}
scala {
scalafmt('2.7.5')
}
}
apply from: "$rootDir/gradle/spotless.gradle"
def compileTask = tasks.register("compile")
allprojects {
group = 'com.datadoghq'
version = scmVersion.version
if (isCI) {
buildDir = "$rootDir/workspace/${projectDir.path.replace(rootDir.path, '')}/build/"
}
apply from: "$rootDir/gradle/dependencies.gradle"
apply from: "$rootDir/gradle/util.gradle"
compileTask.configure {
dependsOn tasks.withType(AbstractCompile)
}
}
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
tasks.register("latestDepTest")
nexusPublishing {
repositories {
def forceLocal = project.hasProperty('forceLocal') && forceLocal
if (forceLocal && !isCI) {
local {
// For testing use with https://hub.docker.com/r/sonatype/nexus
// docker run --rm -d -p 8081:8081 --name nexus sonatype/nexus:oss
// ./gradlew publishToLocal
// Doesn't work for testing releases though... (due to staging)
nexusUrl = uri("http://localhost:8081/nexus/content/repositories/releases/")
snapshotRepositoryUrl = uri("http://localhost:8081/nexus/content/repositories/snapshots/")
username = "admin"
password = "admin123"
allowInsecureProtocol = true
}
} else {
sonatype {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_PASSWORD")
}
}
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
tasks.register('writeMuzzleTasksToFile') {
doLast {
def muzzleFile = file("${buildDir}/muzzleTasks")
assert muzzleFile.parentFile.mkdirs() || muzzleFile.parentFile.directory
muzzleFile.text = subprojects.findAll { subproject -> subproject.plugins.hasPlugin('muzzle') }
.collect { it.path + ":muzzle" }
.join('\n')
}
}
def writeMainVersionFileTask = tasks.register('writeMainVersionFile') {
def versionFile = file("${rootProject.buildDir}/main.version")
inputs.property "version", scmVersion.version
outputs.file versionFile
doFirst {
assert versionFile.parentFile.mkdirs() || versionFile.parentFile.directory
versionFile.text = "${inputs.properties.version}"
}
}
allprojects {
tasks.withType(JavaForkOptions).configureEach {
maxHeapSize = System.properties["datadog.forkedMaxHeapSize"]
minHeapSize = System.properties["datadog.forkedMinHeapSize"]
jvmArgs "-XX:ErrorFile=/tmp/hs_err_pid%p.log"
jvmArgs "-XX:+HeapDumpOnOutOfMemoryError"
jvmArgs "-XX:HeapDumpPath=/tmp"
}
tasks.withType(PublishToMavenLocal).configureEach {
it.finalizedBy(writeMainVersionFileTask)
}
}
apply from: "$rootDir/gradle/ci_jobs.gradle"