-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
146 lines (125 loc) · 3.97 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
plugins {
id 'java-library'
id 'org.sonarqube' version '4.4.1.3373'
id "com.diffplug.spotless" version "6.2.0"
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
}
ext {
JAVA_VERSION = 21
SLF4J_VERSION = '1.7.32'
SONAR_VERSION = '9.9.1.69595'
SONAR_API_VERSION = '10.1.0.809'
libraries = [
// Implementation
guava : 'com.google.guava:guava:33.2.1-jre',
lsp4j : 'org.eclipse.lsp4j:org.eclipse.lsp4j:0.22.0',
dom4j : 'org.dom4j:dom4j:2.1.3',
slf4j_api : "org.slf4j:slf4j-api:${SLF4J_VERSION}",
slf4j_simple : "org.slf4j:slf4j-simple:${SLF4J_VERSION}",
slf4j_nop : "org.slf4j:slf4j-nop:${SLF4J_VERSION}",
slf4j_utillogging : "org.slf4j:slf4j-jdk14:${SLF4J_VERSION}",
reflections : 'org.reflections:reflections:0.10.2',
picocli : 'info.picocli:picocli:4.6.3',
sonarqube_api : "org.sonarsource.api.plugin:sonar-plugin-api:${SONAR_API_VERSION}",
sonarqube_test_fixtures : "org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures:${SONAR_API_VERSION}",
sonarqube_test_api : "org.sonarsource.sonarqube:sonar-plugin-api-impl:${SONAR_VERSION}",
// Test
junit_jupiter : 'org.junit:junit-bom:5.8.2',
assertJ : 'org.assertj:assertj-core:3.23.1',
mockito : 'org.mockito:mockito-core:5.10.0',
archUnit: 'com.tngtech.archunit:archunit:0.22.0'
]
}
spotless {
format 'gradle', {
target '.gradle'
indentWithTabs()
}
java {
target '**/src/*/java/**/*.java'
toggleOffOn('"""', '"""')
indentWithTabs()
eclipse().configFile('EclipseFormatter.xml')
}
}
allprojects {
apply plugin: 'java-library'
apply plugin: 'jacoco'
group = 'org.amshove.natural'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(JAVA_VERSION)
}
}
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile).configureEach {
options.release.set(JAVA_VERSION)
}
repositories {
mavenCentral()
}
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
}
subprojects {
dependencies {
implementation libraries.guava
testImplementation libraries.assertJ
testImplementation(platform(libraries.junit_jupiter))
testImplementation('org.junit.jupiter:junit-jupiter')
}
test {
useJUnitPlatform()
testLogging {
events "skipped", "failed"
testLogging.showStandardStreams = true
testLogging.exceptionFormat = 'full'
}
}
jacocoTestReport {
reports {
html.required = true
xml.required = true
csv.required = false
}
}
}
task cover(type: JacocoReport) {
dependsOn = subprojects.test
dependsOn += test
additionalSourceDirs.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories.setFrom files(subprojects.sourceSets.main.output)
executionData.setFrom project.fileTree(dir: '.', include: '**/build/jacoco/test.exec')
reports {
html.required = true
xml.required = true
csv.required = false
}
}
task testReport(type: TestReport) {
destinationDirectory = file("$buildDir/reports/allTests")
testResults.from(subprojects.collect { it.tasks.withType(Test) })
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
sonarqube {
properties {
property "sonar.projectKey", "MarkusAmshove_natls"
property "sonar.organization", "markusamshove"
property "sonar.host.url", "https://sonarcloud.io"
property 'sonar.coverage.jacoco.xmlReportPaths', "${rootProject.buildDir}/reports/jacoco/cover/cover.xml"
property 'sonar.coverage.exclusions', 'tools/**/*,libs/natlint/src/main/java/org/amshove/natlint/cli/sinks/*.*'
}
}
project.tasks.getByPath('natlint:test').dependsOn(project.tasks.getByPath('natparse:test'))
project.tasks['sonarqube'].dependsOn cover
project.tasks['cover'].dependsOn spotlessJava
project.tasks['cover'].dependsOn spotlessGradle