-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.gradle
195 lines (169 loc) · 5.5 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
plugins {
id 'java-gradle-plugin'
id 'maven-publish'
id 'signing'
id 'net.researchgate.release' version '3.0.0'
id 'io.codearte.nexus-staging' version '0.30.0'
id 'com.gradle.plugin-publish' version '0.21.0'
}
apply from: 'gradle/integration-test.gradle'
def pluginDescription = 'Scan, evaluate and audit Gradle projects using Sonatype platforms'
gradlePlugin {
plugins {
scan {
id = 'org.sonatype.gradle.plugins.scan'
implementationClass = 'org.sonatype.gradle.plugins.scan.ScanPlugin'
displayName = project.name
description = pluginDescription
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withJavadocJar()
withSourcesJar()
}
if (JavaVersion.current() != targetCompatibility) {
throw new GradleException(
"The java version used ${JavaVersion.current()} is not the expected version ${project.targetCompatibility}.")
}
jar {
manifest {
attributes(
'Build-Timestamp' : new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ"),
'Build-Revision' : project.version,
'Built-By' : 'Sonatype',
'Created-By' : "Gradle ${gradle.gradleVersion}",
'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
)
}
}
allprojects {
repositories {
mavenCentral()
}
}
ext {
nexusPlatformApiVersion='5.1.2-01'
ossIndexClientVersion='1.8.2'
logbackVersion='1.3.14'
commonsIoVersion='2.16.1'
junitVersion='4.13.2'
mockitoVersion='5.12.0'
assertJVersion='3.25.3'
}
dependencies {
implementation "com.sonatype.nexus:nexus-platform-api:$nexusPlatformApiVersion"
implementation "org.sonatype.ossindex:ossindex-service-client:$ossIndexClientVersion"
implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "commons-io:commons-io:$commonsIoVersion"
testImplementation gradleTestKit()
testImplementation "junit:junit:$junitVersion"
testImplementation "org.assertj:assertj-core:$assertJVersion"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
}
processResources {
filesMatching('com/sonatype/insight/client.properties') {
expand(project.properties)
}
}
test {
maxHeapSize = '512m'
}
publishing {
afterEvaluate {
def pluginUrl = 'https://github.com/sonatype-nexus-community/scan-gradle-plugin'
pluginBundle {
website = pluginUrl
vcsUrl = pluginUrl
description = pluginDescription
tags = ['sonatype', 'scan', 'dependencies', 'ossindex', 'iq server']
System.setProperty('gradle.publish.key', System.getenv('GRADLE_PUBLISH_KEY') ?: '')
System.setProperty('gradle.publish.secret', System.getenv('GRADLE_PUBLISH_SECRET') ?: '')
}
release {
// avoid infinite CircleCI builds triggered by release commits
preCommitText = '[skip ci] '
buildTasks = ['assemble']
}
def sonatypeUsername = System.getenv('SONATYPE_USERNAME')
def sonatypePassword = System.getenv('SONATYPE_PASSWORD')
def serverUrlBase = 'https://repository.sonatype.org:443/service/local/'
repositories {
maven {
name = 'rso'
url = serverUrlBase + 'staging/deploy/maven2/'
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
nexusStaging {
serverUrl = serverUrlBase
stagingProfileId = '97306992c3c7ca'
username = sonatypeUsername
password = sonatypePassword
numberOfRetries = 40
delayBetweenRetriesInMillis = 5000
}
publications {
withType(MavenPublication) {
pom {
name = project.name
description = pluginDescription
url = 'https://github.com/sonatype-nexus-community/scan-gradle-plugin'
organization {
name = 'Sonatype'
url = 'https://www.sonatype.org'
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/sonatype-nexus-community/scan-gradle-plugin/issues'
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
connection = 'scm:git:git://github.com/sonatype-nexus-community/scan-gradle-plugin.git'
developerConnection = 'scm:git:ssh://git@github.com:sonatype-nexus-community/scan-gradle-plugin.git'
url = 'https://github.com/sonatype-nexus-community/scan-gradle-plugin'
}
developers {
developer {
name = 'Guillermo Varela'
}
developer {
name = 'Usman Shaikh'
}
}
}
artifactId = project.name
}
}
// configure signing if performing release
if ('do-release' == System.getenv('CIRCLE_JOB')) {
signing {
def final encodedKey = System.getenv('SECRING_GPG_ASC_BASE64')
def final signingKey = new String(encodedKey.decodeBase64())
allprojects {
println 'setup gpg signing with in-memory key'
useInMemoryPgpKeys(
signingKey,
System.getenv('GPG_PASSPHRASE')
)
}
sign publishing.publications.pluginMaven
sign publishing.publications.scanPluginMarkerMaven
}
}
}
}
afterReleaseBuild.dependsOn publish
publish.finalizedBy closeAndReleaseRepository
publish.finalizedBy publishPlugins