-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
172 lines (153 loc) · 5.39 KB
/
Copy pathbuild.gradle
File metadata and controls
172 lines (153 loc) · 5.39 KB
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
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'jacoco'
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
}
group = 'com.perforce'
version = project.hasProperty('ver') ? project.ext.ver : 'PREP-TEST_ONLY'
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
repositories {
maven { url "https://repo.maven.apache.org/maven2" }
maven { url "https://artifactory.bnr.perforce.com/artifactory/snapshots/" }
}
dependencies {
api 'com.jcraft:jzlib:1.1.3'
api 'org.apache.commons:commons-lang3:3.18.0'
api 'commons-codec:commons-codec:1.15'
api 'commons-io:commons-io:2.17.0'
api 'com.google.code.findbugs:jsr305:3.0.2'
testImplementation 'org.slf4j:slf4j-api:1.7.36'
testImplementation 'org.slf4j:slf4j-simple:1.7.36'
testImplementation 'org.apache.commons:commons-exec:1.3'
testImplementation 'org.apache.commons:commons-compress:1.21'
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.mockito:mockito-core:5.5.0'
testImplementation 'com.googlecode.java-diff-utils:diffutils:1.3.0'
}
jar {
into("META-INF/maven/$project.group/$project.name") {
from { tasks.named("generatePomFileForMavenJavaPublication") }
rename ".*", "pom.xml"
}
manifest {
attributes["Name"] = "com/perforce/p4java/"
attributes["Main-Class"] = "com.perforce.p4java.Metadata"
attributes["Implementation-Title"] = "p4java"
attributes["Implementation-Version"] = archiveVersion
attributes["Implementation-Vendor-Id"] = "com.perforce"
attributes["Implementation-Vendor"] = "Perforce Software"
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'Perforce Java API'
description = 'P4Java, the Perforce Java API is a Java-native API for accessing Perforce SCM services from within Java'
url = 'https://github.com/perforce/p4java'
organization {
name = 'Perforce Software'
url = 'http://www.perforce.com'
}
licenses {
license {
name = 'Perforce Software'
url = 'https://www.perforce.com/perforce/doc.current/user/p4java_eula.txt'
}
}
developers {
developer {
id = 'p4java'
name = 'Perforce Software'
email = 'support+java@perforce.com'
}
}
scm {
connection = 'scm:git:https://github.com/perforce/p4java.git'
developerConnection = 'scm:git:https://github.com/perforce/p4java.git'
url = 'https://github.com/perforce/p4java'
}
}
}
}
repositories {
def artifactoryUser = project.hasProperty('artifactoryUser') ? project.ext.artifactoryUser : ''
def artifactoryPassword = project.hasProperty('artifactoryPassword') ? project.ext.artifactoryPassword : ''
def artifactorySnapshotUrl = project.hasProperty('artifactorySnapshotUrl') ? project.ext.artifactorySnapshotUrl : ''
def artifactoryReleaseUrl = project.hasProperty('artifactoryReleaseUrl') ? project.ext.artifactoryReleaseUrl : ''
maven {
name = 'artifactory-snapshots'
url = artifactorySnapshotUrl
credentials {
username = artifactoryUser
password = artifactoryPassword
}
}
maven {
name = 'artifactory-release'
url = artifactoryReleaseUrl
credentials {
username = artifactoryUser
password = artifactoryPassword
}
}
}
}
nexusPublishing {
def mavenUser = project.hasProperty('mavenUser') ? project.ext.mavenUser : ''
def mavenPassword = project.hasProperty('mavenPassword') ? project.ext.mavenPassword : ''
repositories {
sonatype {
nexusUrl = uri('https://ossrh-staging-api.central.sonatype.com/service/local/')
snapshotRepositoryUrl = uri('https://central.sonatype.com/repository/maven-snapshots/')
username = mavenUser
password = mavenPassword
}
}
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
tasks.withType(Javadoc).configureEach {
(options as StandardJavadocDocletOptions).addStringOption("Xmaxwarns", "500")
(options as StandardJavadocDocletOptions).addStringOption("Xmaxerrs", "500")
}
// Report lint check details
tasks.withType(JavaCompile).configureEach {
options.compilerArgs.add("-Xlint:deprecation")
options.compilerArgs.add("-Xlint:unchecked")
}
jacoco {
toolVersion = "0.8.12"
}
test {
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
}
}
signing {
sign publishing.publications
}