forked from palantir/atlasdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
158 lines (138 loc) · 6.32 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
155
156
157
158
import org.gradle.plugins.ide.idea.model.IdeaModel
buildscript {
repositories {
mavenCentral() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
gradlePluginPortal() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
}
dependencies {
classpath 'com.palantir.jakartapackagealignment:jakarta-package-alignment:0.6.0'
classpath 'com.netflix.nebula:gradle-info-plugin:13.3.0'
classpath 'com.netflix.nebula:nebula-publishing-plugin:21.1.0'
classpath 'com.palantir.baseline:gradle-baseline-java:6.1.0'
classpath 'com.palantir.gradle.conjure:gradle-conjure:5.51.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.29.0'
classpath 'com.palantir.gradle.docker:gradle-docker:0.35.0'
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.19.0'
classpath 'com.palantir.gradle.failure-reports:gradle-failure-reports:1.13.0'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:3.1.0'
classpath 'com.palantir.gradle.jdks:gradle-jdks:0.56.0'
classpath 'com.palantir.gradle.jdkslatest:gradle-jdks-latest:0.16.0'
classpath 'com.palantir.javaformat:gradle-palantir-java-format:2.50.0'
classpath 'com.palantir.metricschema:gradle-metric-schema:0.32.0'
classpath 'com.palantir.sls-packaging:gradle-sls-packaging:7.13.0'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.4'
classpath 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2'
classpath 'gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.16.1'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.7.0'
classpath 'org.unbroken-dome.gradle-plugins:gradle-testsets-plugin:4.1.0'
classpath 'com.palantir.gradle.revapi:gradle-revapi:1.8.0'
}
}
apply plugin: 'java'
apply plugin: 'com.palantir.baseline'
apply plugin: 'com.palantir.baseline-java-versions'
apply plugin: 'com.palantir.consistent-versions'
apply plugin: 'com.palantir.external-publish'
apply plugin: 'com.palantir.failure-reports'
apply plugin: 'com.palantir.git-version'
apply plugin: 'com.palantir.jdks'
apply plugin: 'com.palantir.jdks.latest'
javaVersions {
libraryTarget = 17
}
group = 'com.palantir.atlasdb'
version = sanitizeVersion()
description = 'Transactional distributed database layer'
def sanitizeVersion() {
def isClean = "git status --porcelain".execute().text.isEmpty()
def pluginReportedVersion = gitVersion()
def dirtySuffix = ".dirty"
if (isClean && pluginReportedVersion.endsWith(dirtySuffix)) {
return pluginReportedVersion.substring(0, pluginReportedVersion.length() - dirtySuffix.length())
}
return pluginReportedVersion
}
task printLastVersion {
doLast {
def details = versionDetails()
println details.lastTag
}
}
allprojects {
repositories {
mavenCentral() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
}
apply plugin: 'java-library'
apply plugin: 'org.inferred.processors' // installs the "processor" configuration needed for baseline-error-prone
apply plugin: 'com.palantir.java-format'
apply plugin: 'com.palantir.jakarta-package-alignment'
// temporary until this is merged/fixed inside gradle-processors
configurations.allProcessors {
canBeConsumed = false
attributes {
attribute Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_API)
}
}
configurations.all {
resolutionStrategy.dependencySubstitution {
it.substitute it.module('org.glassfish.hk2.external:javax.inject') using it.module('javax.inject:javax.inject:1')
it.substitute it.module('org.glassfish.hk2.external:jakarta.inject') using it.module('javax.inject:javax.inject:1')
// See internal migration plugin PR 26: this direction is intentional.
it.substitute it.module('javax.el:javax.el-api') using it.module('org.glassfish:jakarta.el:3.0.4')
it.substitute it.module('jakarta.el:jakarta.el-api') using it.module('org.glassfish:jakarta.el:3.0.4')
}
}
tasks.withType(JavaCompile) {
options.compilerArgs += ['-Werror']
// temporarily relax constraints until we can fix all violations
options.errorprone.disable 'CloseableProvides',
'DangerousCompletableFutureUsage',
'EqualsGetClass',
'FutureReturnValueIgnored',
'NarrowingCompoundAssignment',
'Slf4jLogsafeArgs',
'StaticAssignmentInConstructor',
'StrictUnusedVariable'
options.errorprone.error 'SafeLoggingPropagation'
}
tasks.check.dependsOn checkImplicitDependenciesMain, checkUnusedDependenciesMain
}
subprojects {
task allDeps(type: DependencyReportTask) {}
}
afterEvaluate {
configure(subprojects.findAll {!it.getPath().startsWith(":examples")}) {
if (!project.plugins.hasPlugin('com.palantir.external-publish-dist')) {
apply from: "$rootDir/gradle/publish-jars.gradle"
}
}
}
// Setup copyright notice as a block comment, and no newline after it
project.afterEvaluate {
def ideaRootModel = project.rootProject.extensions.findByType(IdeaModel)
if (ideaRootModel) {
ideaRootModel.project.ipr.withXml { provider ->
def node = provider.asNode()
def copyrightManager = node.component.find { it.'@name' == 'CopyrightManager' }
copyrightManager.append(new XmlParser().parseText("""
<LanguageOptions name="__TEMPLATE__">
<option name="addBlankAfter" value="false" />
<option name="separateBefore" value="true" />
<option name="lenBefore" value="2" />
</LanguageOptions>
""".stripIndent()))
copyrightManager.append(new XmlParser().parseText("""
<LanguageOptions name="JAVA">
<option name="fileTypeOverride" value="3" />
</LanguageOptions>
""".stripIndent()))
}
}
}
allprojects {
// This allows tests that require an artefact to exist to
// decide whether to call gradle themselves or not
tasks.withType(Test) {
systemProperty 'RUNNING_IN_GRADLE', 'true'
}
}