forked from fortify/fortify-ssc-parser-util
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
executable file
·137 lines (116 loc) · 3.67 KB
/
build.gradle
File metadata and controls
executable file
·137 lines (116 loc) · 3.67 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
plugins {
id 'maven-publish'
id 'signing'
id 'base'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'io.freefair.lombok' version '8.3'
}
description = 'Fortify SSC Parser Utilities (root project)'
// 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 = rootProject.group
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-ssc-parser-util'
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'rsenden'
name = 'Ruud Senden'
email = 'ruud.senden@microfocus.com'
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}"
}
}
}
}
}
// 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/java").exists()}) {
apply plugin: 'java-library'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}
dependencies {
api platform(project(':fortify-ssc-parser-util-bom'))
// dependencies provided by plugin runtime
compileOnly "com.fortify.plugin:plugin-api"
compileOnly "org.slf4j:slf4j-api"
}
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
}
}
}
}