forked from adobe/target-java-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
177 lines (151 loc) · 4.24 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
import com.diffplug.gradle.spotless.JavaExtension
plugins {
id "idea"
id "jacoco"
id "maven-publish"
id "signing"
id "com.diffplug.spotless" version "5.6.1"
}
apply plugin: "java"
apply plugin: "java-library"
build.dependsOn spotlessApply
defaultTasks "spotlessApply", "build"
repositories {
mavenLocal()
mavenCentral()
}
javadoc {
source = sourceSets.main.allJava
classpath = configurations.compile
exclude "com/fasterxml/jackson/**"
}
task sourcesJar(type: Jar) {
archiveClassifier = "sources"
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
archiveClassifier = "javadoc"
from javadoc.destinationDir
dependsOn javadoc
}
task codegen(type: Exec) {
workingDir "./codegeneration"
commandLine "./codegen.sh"
}
task copyProperties(type: Copy) {
from './gradle.properties'
into 'src/main/resources'
}
classes.dependsOn copyProperties
compileJava {
options.encoding = "UTF-8"
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
compileTestJava {
options.encoding = "UTF-8"
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
spotless {
java {
target "src/*/java/**/*.java"
googleJavaFormat()
removeUnusedImports() // removes any unused imports
licenseHeaderFile "config/formatter/adobe.header.txt"
endWithNewline()
}
}
spotless {
format "javaGeneratedFiles", JavaExtension, {
target "src/**/delivery/**/*.java"
licenseHeaderFile "config/formatter/adobe.header.generated.txt"
}
}
publishing {
repositories {
maven {
name = "mvnCentral"
url = mavenCentralUrl
credentials {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_PASSWORD")
}
}
}
publications {
external(MavenPublication) {
artifactId = rootProject.name
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = rootProject.name
description = pomDescription
url = pomURL
scm {
url = pomScmURL
}
developers {
developer {
id = pomDevId
name = pomDevName
organization = pomDevName
organizationUrl = pomDevOrgURL
}
}
licenses {
license {
name = pomLicenseName
url = pomLicenseUrl
}
}
}
}
}
}
ext."signing.gnupg.executable"="gpg"
ext."signing.gnupg.keyName"=System.getenv("GPG_KEY_ID")
ext."signing.gnupg.passphrase"=System.getenv("GPG_PASSPHRASE")
signing {
useGpgCmd()
required {
tasks.withType(PublishToMavenRepository).find {
gradle.taskGraph.hasTask it
}
}
sign publishing.publications
}
dependencies {
api "com.adobe.experiencecloud.ecid:ecid-service:1.0.3"
implementation "org.slf4j:slf4j-api:1.7.30"
implementation "com.fasterxml.jackson.core:jackson-annotations:2.11.3"
implementation "com.fasterxml.jackson.core:jackson-core:2.11.3"
implementation "com.fasterxml.jackson.core:jackson-databind:2.11.3"
implementation "com.konghq:unirest-java:3.11.02"
implementation "io.github.jamsesso:json-logic-java:1.0.5"
implementation "com.google.guava:guava:16.0.1"
testImplementation "org.slf4j:slf4j-simple:1.7.30"
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.5.2"
testImplementation "org.mockito:mockito-junit-jupiter:3.0.0"
}
test {
useJUnitPlatform()
}
// JACOCO CONFIGURATION | HTML output is omitted in favour of just the XML output that Jenkins can parse
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
// JACOCO COVERAGE THRESHOLD | Builds will fail if the computed code coverage is less than the configured percentage
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.43
}
}
}
}