-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
136 lines (119 loc) · 3.21 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
plugins {
id "java"
id "maven-publish"
id "application"
id "com.diffplug.gradle.spotless" version "4.3.0"
id "io.toolebox.git-versioner" version "1.6.7"
id "com.github.gmazzo.buildconfig" version "3.1.0"
id "org.sonarqube" version "3.3"
id "jacoco"
}
application {
mainClassName = 'com.javastreets.mulefd.Main'
}
repositories {
mavenCentral()
}
// Reproducible build to preserve checksum value with rebuilds
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
xml.enabled true
html.enabled true
csv.enabled false
html.destination file("${buildDir}/jacocoHtml")
xml.destination file("${buildDir}/jacocoXml")
}
}
dependencies {
implementation 'guru.nidi:graphviz-java-all-j2v8:0.17.0'
implementation 'info.picocli:picocli:4.7.5'
implementation 'org.slf4j:slf4j-nop:1.7.30'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.3'
testImplementation 'org.assertj:assertj-core:3.26.3'
testImplementation 'org.mockito:mockito-inline:4.9.0'
}
spotless {
format 'misc', {
target '**/*.gradle', '**/*.adoc', '**/.gitignore'
targetExclude 'src/main/scripts/container/README.md', 'build/container/README.md'
trimTrailingWhitespace()
indentWithTabs(4) // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
importOrder 'java', 'javax', 'org', 'com', 'com.github.manikmagar', ''
targetExclude 'build/generated/**/*.*'
removeUnusedImports()
eclipse().configFile "eclipse-java-google-style.xml"
}
}
task versionTxt() {
doLast {
new File(project.buildDir, "tmp/version.txt").text = project.version
}
}
distZip.dependsOn(versionTxt)
distTar.dependsOn(versionTxt)
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
versioner {
startFrom {
major = 0
minor = 0
patch = 1
}
git {
authentication {
https {
token = System.getenv("GITHUB_TOKEN") != null ? System.getenv("GITHUB_TOKEN") : "unknown_github_token"
}
}
}
}
buildConfig {
buildConfigField('String', 'APP_NAME', "\"${project.name}\"")
buildConfigField('String', 'APP_VERSION', provider { "\"${project.version}\"" })
buildConfigField('long', 'BUILD_TIME', "${System.currentTimeMillis()}L")
packageName('com.javastreets.mulefd.app')
}
task tag(type: Exec) {
doFirst {
println 'Creating tag v' + project.version
commandLine 'git', 'tag', '-a', 'v' + project.version, '-m', 'Release v' + project.version
}
}
compileJava {
options.encoding = 'UTF-8'
// options.compilerArgs << "-Xlint:unchecked"
}
compileTestJava {
options.encoding = 'UTF-8'
// options.compilerArgs << "-Xlint:unchecked"
}
sonarqube {
properties {
property "sonar.projectKey", "manikmagar_mulefd"
property "sonar.organization", "manikmagar"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/jacocoXml"
}
}
group = 'com.javastreets'
sourceCompatibility = '8'
targetCompatibility = '8'