-
Notifications
You must be signed in to change notification settings - Fork 437
Expand file tree
/
Copy pathrelease.gradle
More file actions
215 lines (177 loc) · 7.31 KB
/
release.gradle
File metadata and controls
215 lines (177 loc) · 7.31 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
import java.nio.file.Files
import java.nio.file.Paths
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
ext {
// Increment the minor version (second number) rather than just the patch
// level (third number) if:
// * any new checkers have been added, or
// * backward-incompatible changes have been made to APIs or elsewhere.
// To make a snapshot release, version should end in "-SNAPSHOT", then: ./gradlew publish
releaseVersion = "4.0.1-SNAPSHOT"
releaseVersionRegex = "\\d\\.\\d+\\.\\d+(?:\\.\\d)?"
// Date in ISO format.
currentDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))
}
// Note about update tasks:
// It's not possible to update the version numbers in place, so first
// updateVersionNumbersInDocs and updateVersionNumbersAFU copy to a temporary
// directory with a filter to do replacement, then updateVersionNumbers copies
// the changed files back to their original locations.
tasks.register("updateVersionNumbers", Copy) {
// See documentation above.
dependsOn("updateVersionNumbersInDocs")
dependsOn("updateVersionNumbersAFU")
from(layout.buildDirectory.file("updateVersionNumbers/"))
into(layout.projectDirectory)
}
tasks.register("updateVersionNumbersAFU", Copy) {
// See documentation above.
String classFileReader = "annotation-file-utilities/src/main/java/org/checkerframework/afu/scenelib/io/classfile/ClassFileReader.java"
doFirst {
if (!file("annotation-file-utilities/${classFileReader}").exists()) {
throw new GradleException("File annotation-file-utilities/${classFileReader} not found.")
}
}
into(layout.buildDirectory.file("updateVersionNumbers/annotation-file-utilities"))
from("annotation-file-utilities")
include(classFileReader)
filter { String line ->
line.replaceAll("Annotation File Utilities v${releaseVersionRegex}", "Annotation File Utilities v${releaseVersion}")
}
}
tasks.register("updateVersionNumbersInDocs", Copy) {
// See documentation above.
into(layout.buildDirectory.file("updateVersionNumbers/docs/"))
from("docs/") {
include("annotation-file-utilities/annotation-file-utilities.html",
"checker-framework-quick-start.html",
"checker-framework-webpage.html",
"manual/introduction.tex")
filter { String line ->
line = line.replaceAll("checker-framework-${releaseVersionRegex}", "checker-framework-${releaseVersion}")
String releaseDatePrefix = "<!-- checker-framework-date -->"
String releaseDateSuffix = "<!-- /checker-framework-date -->"
line.replaceAll("${releaseDatePrefix}(.*)${releaseDateSuffix}", releaseDatePrefix + currentDate + releaseDateSuffix)
}
}
from("docs") {
include("manual/external-tools.tex")
filter { String line ->
line = line.replaceAll("checker(|-framework|-qual|-util)([-/])${releaseVersionRegex}") { "checker${it[1]}${it[2]}${releaseVersion}" }
line = line.replaceAll("/${releaseVersionRegex}/jar", "/${releaseVersion}/jar")
line.replaceAll("ext.checkerFrameworkVersion = \"${releaseVersionRegex}\"", "ext.checkerFrameworkVersion = \"${releaseVersion}\"")
}
}
from("docs") {
include("manual/manual.tex")
filter { String line ->
line = line.replaceAll("ReleaseDate\\}\\{(.*)\\}", "ReleaseDate}{${currentDate}}")
line.replaceAll("ReleaseVersion\\}\\{(.*)\\}", "ReleaseVersion}{${releaseVersion}}")
}
}
from("docs") {
include("examples/MavenExample/pom.xml")
filter { String line ->
line.replaceAll("<!-- checker-framework-version -->(.*)<!-- /checker-framework-version -->", "<!-- checker-framework-version -->${releaseVersion}<!-- /checker-framework-version -->")
}
}
}
tasks.register("zipMavenExamples", Zip) {
description = "Creates a zip archive for the Maven examples."
archiveFileName = "mvn-examples.zip"
def cfWebsite = providers.gradleProperty("cfWebsite")
destinationDirectory = file(cfWebsite.getOrElse(layout.buildDirectory.file("cfWebsite").get().toString()))
from("docs/examples/MavenExample")
}
tasks.register("copyToWebsite", Copy) {
description = "Copy files to location set in the property cfWebsite."
dependsOn(":allJavadoc", ":manual", ":zip", "zipMavenExamples")
String cfWebsite = findProperty("cfWebsite") ?: layout.buildDirectory.file("cfWebsite").get().toString()
destinationDir = file(cfWebsite)
from(tasks.named("zip", Zip).get().archiveFile.get().toString())
from("docs") {
include("checker-framework-webpage.html", "CHANGELOG.md")
}
from("docs/manual") {
into("manual")
include("manual.pdf")
rename {"checker-framework-manual.pdf"}
}
from("docs/logo/Logo/CFLogo.png") {
into("tutorial/")
}
from("docs/logo/Logo/CFLogo.png") {
into("tutorial/webpages")
}
from("docs/logo/Logo/CFLogo.png") {
into("manual")
}
// Copy favicon
from("docs/logo/Checkmark/CFCheckmark_favicon.png") {
rename("CFCheckmark_favicon.png", "favicon-checkerframework.png")
}
from("docs/logo/Checkmark/CFCheckmark_favicon.png") {
into("manual")
rename("CFCheckmark_favicon.png", "favicon-checkerframework.png")
}
// Copy manual files
from("docs/manual") {
into("manual")
include("manual.html",
"manual.pdf",
"*.svg",
"manual001.png")
}
// Copy developer docs
from("docs/developer") {
into("manual")
include("developer-manual.html",
"gsoc-ideas.html",
"new-contributor-projects.html")
}
// Copy Dataflow manual
from("dataflow/manual/checker-framework-dataflow-manual.pdf") {
into("manual")
}
// Copy tutorial
from("docs/tutorial") {
into("tutorial")
}
// Copy Javadoc
from("docs/api") {
into("api")
}
from("docs/annotation-file-utilities") {
include("annotation-file-utilities.html")
include("annotation-file-format.html")
include("annotation-file-format.pdf")
include("figures/*.svg")
include("figures/*.png")
include("figures/*.gif")
into("annotation-file-utilities")
}
doFirst {
delete(cfWebsite)
}
doLast {
delete("${cfWebsite}/index.html")
Files.createSymbolicLink(file("${cfWebsite}/index.html").toPath(), Paths.get("checker-framework-webpage.html"))
delete("${cfWebsite}/manual/index.html")
Files.createSymbolicLink(file("${cfWebsite}/manual/index.html").toPath(), Paths.get("manual.html"))
delete("${cfWebsite}/annotation-file-utilities/index.html")
Files.createSymbolicLink(file("${cfWebsite}/annotation-file-utilities/index.html").toPath(), Paths.get("annotation-file-utilities.html"))
}
}
tasks.register("updateCopyMavenExample", Copy) {
// This task is used during the release in "sanity_checks.py" to check that the Maven artifacts were uploaded correctly.
description = "Copies the Maven example to the location in property destDir."
// Defer reading of destDir until execution time and set the task's
// destination directory so it affects all subsequent `into` clauses.
def destDir = providers.gradleProperty("destDir").map { it + "/MavenExample" }
destinationDir = file(destDir.getOrElse(layout.buildDirectory.file("cfWebsite/MavenExample").get().toString()))
from("docs/examples/MavenExample")
filter { String line ->
line.replaceAll("<!-- checker-framework-version -->(.*)<!-- /checker-framework-version -->", "<!-- checker-framework-version -->${releaseVersion}<!-- /checker-framework-version -->")
}
}