-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathbuild.gradle
174 lines (149 loc) · 4.71 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
plugins {
id 'java'
id 'com.github.sherter.google-java-format' version '0.8'
id 'signing'
id 'maven-publish'
id 'io.codearte.nexus-staging' version '0.21.2'
}
group 'com.cisco.trex'
ext {
projectName = "TRex Java Sdk"
projectDescription = "Java client SDK provides an implementation for TRex RPC APIs"
projectUrl = "https://github.com/cisco-system-traffic-generator/trex-java-sdk"
licenseName = "The Apache Software License, Version 2.0"
licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0.txt"
scmConnection = "scm:git:git://github.com/cisco-system-traffic-generator/trex-java-sdk.git"
scmDeveloperConnection = "scm:git:ssh://github.com:cisco-system-traffic-generator/trex-java-sdk.git"
scmUrl = "https://github.com/cisco-system-traffic-generator/trex-java-sdk"
develop1Name = "Leo Ma"
develop1Mail = "[email protected]"
develop2Name = "Emil Gustafsson"
develop2Mail = "[email protected]"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
googleJavaFormat {
toolVersion = '1.7'
}
dependencies {
compile group: 'org.pcap4j', name: 'pcap4j-packetfactory-static', version:'1.7.7' //1.8.0+ requires java 9
compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.9'
compile group: 'org.slf4j', name: 'slf4j-api', version: '2.0.16'
compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j2-impl', version: '2.24.3'
compile group: 'org.zeromq', name: 'jeromq', version:'0.5.1'
compile group: 'com.google.code.gson', name: 'gson', version:'2.8.5'
compile group: 'com.google.guava', name: 'guava', version: '27.1-jre'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version:'2.9.10'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.28.2'
sourceSets {
e2eTest {
compileClasspath = sourceSets.main.output + configurations.testRuntime
runtimeClasspath = output + sourceSets.main.output + configurations.testRuntime
java {
srcDirs = ["src/e2e-test/java"]
}
}
}
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
test {
testLogging {
events "passed", "skipped" , "failed"
}
}
task e2eTest(type: Test) {
group 'verification'
description 'Runs E2E testing on trex-java-sdk'
outputs.upToDateWhen { false }
testClassesDirs = sourceSets.e2eTest.output.classesDirs
classpath = sourceSets.e2eTest.runtimeClasspath
test {
testLogging {
events "passed", "skipped" , "failed"
exceptionFormat "full"
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId archivesBaseName
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = projectName
packaging = 'jar'
description = projectDescription
url = projectUrl
licenses {
license {
name = licenseName
url = licenseUrl
}
}
scm {
connection = scmConnection
developerConnection = scmDeveloperConnection
url = scmUrl
}
developers {
developer {
name = develop1Name
email = develop1Mail
}
developer {
name = develop2Name
email = develop2Mail
}
}
}
}
}
repositories {
maven {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username project.findProperty('nexusUsername') ?: 'secured'
password project.findProperty('nexusPassword') ?: 'secured'
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
generatePomFileForMavenJavaPublication {
destination = file("pom.xml")
}
jar {
dependsOn generatePomFileForMavenJavaPublication
into("META-INF/maven/$project.group/$project.name") {
from("pom.xml")
}
}
task jarWithDependencies(type: Jar) {
dependsOn generatePomFileForMavenJavaPublication
baseName = project.name + '-with-dependencies'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
nexusStaging {
numberOfRetries = 40
delayBetweenRetriesInMillis = 5000
}