-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathextension-build.gradle
181 lines (152 loc) · 5.42 KB
/
extension-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
buildscript {
repositories {
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'io.github.gradle-nexus.publish-plugin:io.github.gradle-nexus.publish-plugin.gradle.plugin:1.1.0'
classpath 'net.nemerosa.versioning:net.nemerosa.versioning.gradle.plugin:2.14.0'
classpath 'net.researchgate.release:net.researchgate.release.gradle.plugin:2.8.1'
classpath 'org.ajoberstar:gradle-git-publish:3.0.0'
}
}
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'wrapper'
apply plugin: io.github.gradlenexus.publishplugin.NexusPublishPlugin
apply plugin: net.nemerosa.versioning.VersioningPlugin
apply plugin: net.researchgate.release.ReleasePlugin
apply plugin: org.ajoberstar.gradle.git.publish.GitPublishPlugin
ext {
githubUrl = "https://github.com/concordion/${project.name}"
issuesUrl = "${githubUrl}/issues"
vcsUrl = "${githubUrl}.git"
gitRepoUri = "git@github.com:concordion/${project.name}.git"
vcsConnection = "scm:git:git://github.com/concordion/${project.name}.git"
if (!project.hasProperty("sonatypeUsername")) {
sonatypeUsername = ''
}
if (!project.hasProperty("sonatypePassword")) {
sonatypePassword = ''
}
}
repositories {
mavenCentral()
}
wrapper {
gradleVersion = "7.1"
}
dependencies {
implementation 'org.concordion:concordion:4.0.0'
testImplementation 'org.concordion:concordion:4.0.0:tests'
}
compileJava {
sourceCompatibility = 8
targetCompatibility = 8
}
java {
withJavadocJar()
withSourcesJar()
}
group='org.concordion'
jar {
manifest {
attributes 'Specification-Title' : project.name,
'Implementation-Title' : project.name,
'Specification-Version' : project.version.substring(0, project.version.lastIndexOf(".")),
'Implementation-Version': project.version,
'Implementation-Vendor' : 'concordion.org',
'Specification-Vendor' : 'concordion.org',
'Created-By' : System.getProperty('java.version') + ' (' + System.getProperty('java.vendor') + ')',
'Built-With' : "gradle-${project.getGradle().getGradleVersion()}, groovy-${GroovySystem.getVersion()}",
'Build-Time' : String.format("%tFT%<tRZ", Calendar.getInstance(TimeZone.getTimeZone("Z"))),
'Build-Revision' : versioning.info.commit,
'Build-OS' : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
}
}
test {
systemProperties['concordion.output.dir'] = "$reporting.baseDir/spec"
outputs.upToDateWhen { false } // force it to run even if test code hasn't changed
testLogging {
events "passed", "skipped", "failed", "standardError"
}
}
gitPublishCopy.dependsOn test
gitPublishCopy.dependsOn javadoc
task publishDocs(dependsOn: ['gitPublishPush'])
task publishRelease(dependsOn: ['clean', 'build', 'publishDocs', 'release'])
gitPublish {
// where to publish to (repo must exist)
repoUri = gitRepoUri.toString()
// branch will be created if it doesn't exist
branch = 'gh-pages'
// what to publish, this is a standard CopySpec
contents {
from 'docs'
from ('build/reports/spec') {
into 'spec'
}
from('build/docs/javadoc/') {
into 'api'
}
}
// message used when committing changes
commitMessage = 'Publishing new Github pages' // defaults to 'Generated by gradle-git-publish'
}
tasks.named("gitPublishCopy") {
duplicatesStrategy = 'exclude'
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name project.name
description project.description
url githubUrl
packaging 'jar'
inceptionYear inceptionYear
scm {
url vcsUrl
connection vcsConnection
developerConnection vcsConnection
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.html'
distribution 'repo'
}
}
issueManagement{
system 'GitHub Issues'
url issuesUrl
}
developers developers
}
asNode().dependencies.'*'.findAll() {
it.scope.text() == 'runtime' && project.configurations.implementation.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each() {
it.scope*.value = 'compile'
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
username = sonatypeUsername
password = sonatypePassword
}
}
}
signing {
sign publishing.publications.mavenJava
}