-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
154 lines (133 loc) · 4.09 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
plugins {
id 'maven-publish'
id 'signing'
id 'base'
id 'io.freefair.lombok' version '8.6' apply false
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
}
description = 'Utility classes for working with the REST API interfaces provided by the various Fortify products'
// Returns true for -PsomeProperty or -PsomeProperty=true, false if undefined or other value
ext.isPropertyTrue = { p -> project.properties[p]=='' || project.properties[p]=='true' }
ext {
// version.txt is generated by GitHub release-please-action, and contains
// the version number of the latest release version.
versionFile = rootProject.file('version.txt')
latestReleaseVersion = versionFile.exists() ? versionFile.text.trim() : '0.1.0'
// Add version suffix depending on whether we are building a release or not.
// According to Gradle conventions, SP is a successor of a release, i.e:
// 1.0.0.RELEASE < 1.0.0.SP-SNAPSHOT < 1.0.1.RELEASE
versionSuffix = isPropertyTrue('isReleaseVersion') ? '.RELEASE' : '.SP-SNAPSHOT'
}
version = latestReleaseVersion+versionSuffix
nexusPublishing {
repositories {
OSSRH {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
allprojects {
apply plugin: 'signing'
apply plugin: 'maven-publish'
group = 'com.fortify.client.api'
version = rootProject.version
println "Configuring ${project.group}:${project.name}:${project.version}"
publishing {
publications {
mavenJava(MavenPublication) {
pom {
afterEvaluate {
groupId = project.group
artifactId = project.name
name = project.name
version = project.version
description = project.description
}
url = 'https://github.com/fortify-ps/fortify-client-api'
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'rsenden'
name = 'Ruud Senden'
email = '[email protected]'
organization = 'Micro Focus Fortify'
organizationUrl = 'https://www.microfocus.com/en-us/cyberres/application-security'
}
}
scm {
connection = "scm:git:https://github.com/fortify-ps/${rootProject.name}.git"
developerConnection = "scm:git:https://github.com/fortify-ps/${rootProject.name}.git"
url = "https://github.com/fortify-ps/${rootProject.name}"
}
}
}
}
}
// Publish to Maven local repository when publish task is executed
publish.finalizedBy publishToMavenLocal
// Sign using ORG_GRADLE_PROJECT_signingKey and ORG_GRADLE_PROJECT_signingPassword environment variables
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
required { gradle.taskGraph.hasTask("publishToOSSRH") }
sign publishing.publications.mavenJava
}
}
configure(subprojects.findAll {new File(it.projectDir, "src/main").exists()}) {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
dependencies {
api platform(project(':fortify-client-api-bom'))
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}
test {
useJUnitPlatform()
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
task myjavadoc(type: Javadoc) {
source = sourceSets.main.allJava
classpath = sourceSets.main.compileClasspath
failOnError = false
}
task javadocJar(type: Jar) {
from myjavadoc
archiveClassifier = 'javadoc'
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}
}
configure(subprojects.findAll {new File(it.projectDir, "src/main/lombok").exists()}) {
apply plugin: 'io.freefair.lombok'
// TODO For a single-module project we don't have to modify source sets, why do we need this?
sourceSets {
main {
java {
srcDir 'src/main/lombok'
}
}
}
myjavadoc {
source = delombok
}
}