-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
196 lines (156 loc) · 5.83 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
group 'io.github.vantiv'
version JAR_VERSION
apply plugin : 'eclipse'
apply plugin : 'java'
apply plugin : 'maven-publish'
apply plugin : 'jacoco'
repositories {
maven { url 'http://repo1.maven.org/maven2' }
jcenter { url 'http://jcenter.bintray.com/' }
}
configurations {
generateJAXB.extendsFrom mainRuntime
}
jacocoTestReport {
executionData(fileTree(dir:"${buildDir}/jacoco/", include:"*.exec"))
reports {
xml.enabled true
html.enabled true
}
}
sourceSets {
main{
java{
srcDirs += "$buildDir/generated"
}
}
}
dependencies {
implementation group:'com.jcraft', name:'jsch', version:'0.1.54'
implementation group:'commons-io', name:'commons-io', version:'2.5'
implementation group:'org.apache.httpcomponents', name:'httpclient', version:'4.5.2'
//implementation group: 'org.apache.httpcomponents.client5', name: 'httpclient5', version: '5.2.1'
testImplementation group: 'junit', name: 'junit', version: '4.12'
implementation group: 'org.jacoco', name: 'org.jacoco.agent', version: '0.8.1'
generateJAXB group:'com.sun.xml.bind', name:'jaxb-core', version:'2.2.7'
generateJAXB group:'com.sun.xml.bind', name:'jaxb-impl', version:'2.2.5-5'
generateJAXB group:'com.sun.xml.bind', name:'jaxb-xjc', version:'2.2.5'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '4.11.0'
}
sourceCompatibility=1.7
clean {
delete 'build'
}
jar{
manifest {
attributes("Implementation-Title":"Payfac Merchant Provisioner SDK For Java 1.5 and greater", "Implementation-Version":"${JAR_VERSION}","Implementation-Vendor":"worldpay","Main-Class":"com.cnp.sdk.Setup")
}
getDestinationDirectory().set(file("${buildDir}/lib"))
getArchiveFileName().set("${JAR_NAME}-${JAR_VERSION}.jar")
}
javadoc{
destinationDir = file("$buildDir/${RELEASE_ARTIFACTS_DIR}/doc")
}
task generateJaxbClasses() {
compileJava.dependsOn it
eclipseClasspath.dependsOn it
ext.bindingsFile = "src/main/xsd/bindings.xml"
ext.generatedDir = "${buildDir}/generated"
inputs.file bindingsFile
outputs.dir generatedDir
doFirst {
mkdir generatedDir
}
doLast {
ant.taskdef(name: "xjc", classname:"com.sun.tools.xjc.XJCTask", classpath:configurations.generateJAXB.asPath)
ant.xjc(destdir:"${generatedDir}", package: "io.github.vantiv.mp.sdk", binding:bindingsFile, extension:'true'){
schema(dir:"src/main/xsd/", includes:"merchant-onboard-api-v${SCHEMA_VERSION}.xsd")
}
}
}
task sourceJar(type:Jar) {
dependsOn generateJaxbClasses
getDestinationDirectory().set(file("${buildDir}/libs"))
getArchiveClassifier().set('sources')
from "src/main/java"
from generateJaxbClasses.generatedDir
}
task copyJarsToKit(type:Copy, dependsOn:[check,jar,sourceJar]){
from "${buildDir}/libs/${JAR_NAME}-${JAR_VERSION}.jar"
from "LICENSE"
from "${buildDir}/libs/${JAR_NAME}-${JAR_VERSION}-sources.jar"
from "${buildDir}/${JAR_NAME}-${JAR_VERSION}.pom"
into "$buildDir/${RELEASE_ARTIFACTS_DIR}"
}
task copyLibsToKit(type:Copy, dependsOn:check){
from configurations.runtimeClasspath.asFileTree.matching{
include '**/commons-io*'
include '**/commons-codec*'
include '**/httpclient*'
include '**/jsch*'
include '**/*jacoco*'
}
into "$buildDir/${RELEASE_ARTIFACTS_DIR}/dependencies"
}
task tarKit(type:Tar, dependsOn:[copyJarsToKit, copyLibsToKit]){
compression = Compression.GZIP
getDestinationDirectory().set(file("$buildDir/${DIST_DIR}"))
getArchiveFileName().set("${JAR_NAME}-${JAR_VERSION}.tar.gz")
from "$buildDir/${RELEASE_ARTIFACTS_DIR}"
}
task zipKit(type:Zip, dependsOn:[copyJarsToKit, copyLibsToKit]){
getDestinationDirectory().set(file("$buildDir/${DIST_DIR}"))
getArchiveFileName().set("${JAR_NAME}-${JAR_VERSION}.zip")
from "$buildDir/${RELEASE_ARTIFACTS_DIR}"
}
task kit(dependsOn:[tarKit, zipKit]){
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
dependsOn javadoc
}
publishing {
publications {
maven(MavenPublication) {
from components.java
pom {
name = 'mp-sdk-for-java'
description = 'Vantiv eCommerce Java SDK is a Java implementation of the Vantiv Payfac XML API'
url = 'https://github.com/Vantiv/payfac-mp-sdk-java'
groupId = 'io.github.vantiv'
artifactId = "${JAR_NAME}"
version = "${JAR_VERSION}"
licenses {
license {
name = 'License'
url = 'https://github.com/Vantiv/payfac-mp-sdk-java/blob/14.x/LICENSE'
}
}
developers{
developer{
id = 'vantivSDKSupport'
name = 'VantivSDKSupport'
email = 'sdksupport@worldpay.com'
}
}
scm {
connection = 'scm:git:github.com/Vantiv/payfac-mp-sdk-for-java.git'
developerConnection = 'scm:git:ssh://github.com/Vantiv/payfac-mp-sdk-for-java.git'
url = 'https://github.com/Vantiv/payfac-mp-sdk-java.git'
}
}
}
}
}
tasks.register("copyPomToRoot") {
def publication = publishing.publications.maven
def generatePom = tasks.named("generatePomFileFor${publication.name.capitalize()}Publication")
dependsOn(generatePom)
def output = rootProject.file("${publication.artifactId}-${publication.version}.pom")
outputs.file(output)
doLast { output.bytes = generatePom.get().destination.bytes }
}