Skip to content

Commit 22a8f7f

Browse files
committed
Update build script: simplify properties, fix javadoc build for non UTF8 default encoding
1 parent 1356308 commit 22a8f7f

File tree

7 files changed

+33
-58
lines changed

7 files changed

+33
-58
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ jobs:
3838
with:
3939
java-version: 11
4040
- name: 'Test'
41-
shell: bash
41+
shell: cmd
4242
run: |
43-
./gradlew --no-parallel build
43+
./gradlew --no-parallel --no-daemon build javadoc
4444
4545
mac:
4646
name: 'macOS (JDK 13)'
@@ -55,4 +55,4 @@ jobs:
5555
java-version: 13
5656
- name: 'Test'
5757
run: |
58-
./gradlew --no-parallel build
58+
./gradlew --no-parallel --no-daemon build javadoc

build.gradle.kts

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ import com.github.vlsi.gradle.crlf.CrLfSpec
2121
import com.github.vlsi.gradle.crlf.LineEndings
2222
import com.github.vlsi.gradle.git.FindGitAttributes
2323
import com.github.vlsi.gradle.git.dsl.gitignore
24+
import com.github.vlsi.gradle.properties.dsl.lastEditYear
25+
import com.github.vlsi.gradle.properties.dsl.props
26+
import com.github.vlsi.gradle.properties.dsl.toBool
2427
import com.github.vlsi.gradle.release.RepositoryType
2528
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
2629
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApisExtension
@@ -41,6 +44,7 @@ plugins {
4144
id("com.github.vlsi.ide")
4245
// Release
4346
id("com.github.vlsi.crlf")
47+
id("com.github.vlsi.gradle-extensions")
4448
id("com.github.vlsi.license-gather") apply false
4549
id("com.github.vlsi.stage-vote-release")
4650
}
@@ -50,53 +54,20 @@ repositories {
5054
mavenCentral()
5155
}
5256

53-
fun Project.boolProp(name: String) =
54-
findProperty(name)
55-
// Project properties include tasks, extensions, etc, and we want only String properties
56-
// We don't want to use "task" as a boolean property
57-
?.let { it as? String }
58-
?.equals("false", ignoreCase = true)?.not()
59-
60-
fun reportsForHumans() = !(System.getenv()["CI"]?.toBoolean() ?: false)
61-
62-
val lastEditYear by extra {
63-
file("$rootDir/NOTICE")
64-
.readLines()
65-
.first { it.contains("Copyright") }
66-
.let {
67-
"""Copyright \d{4}-(\d{4})""".toRegex()
68-
.find(it)?.groupValues?.get(1)
69-
?: throw IllegalStateException("Unable to identify copyright year from $rootDir/NOTICE")
70-
}
71-
}
57+
fun reportsForHumans() = !System.getenv()["CI"].toBool(default = false)
7258

73-
// Do not enable spotbugs by default. Execute it only when -Pspotbugs is present
74-
val enableSpotBugs by extra {
75-
// TODO: this activates spotbuts on CI only. Should this be corrected to "enable always"?
76-
boolProp("spotbugs") ?: !reportsForHumans()
77-
}
59+
val lastEditYear by extra(lastEditYear())
7860

79-
val skipCheckstyle by extra {
80-
boolProp("skipCheckstyle") ?: false
81-
}
82-
83-
val skipJavadoc by extra {
84-
boolProp("skipJavadoc") ?: false
85-
}
86-
87-
val enableMavenLocal by extra {
88-
boolProp("enableMavenLocal") ?: false
89-
}
90-
91-
val enableGradleMetadata by extra {
92-
boolProp("enableGradleMetadata") ?: false
93-
}
61+
// Do not enable spotbugs by default. Execute it only when -Pspotbugs is present
62+
val enableSpotBugs = props.bool("spotbugs", default = false)
63+
val skipCheckstyle by props()
64+
val skipJavadoc by props()
65+
val enableMavenLocal by props()
66+
val enableGradleMetadata by props()
9467

9568
// By default use Java implementation to sign artifacts
9669
// When useGpgCmd=true, then gpg command line tool is used for signing
97-
val useGpgCmd by extra {
98-
boolProp("useGpgCmd") ?: false
99-
}
70+
val useGpgCmd by props()
10071

10172
ide {
10273
copyrightToAsf()
@@ -230,6 +201,8 @@ allprojects {
230201
tasks {
231202
withType<Javadoc>().configureEach {
232203
(options as StandardJavadocDocletOptions).apply {
204+
// Please refrain from using non-ASCII chars below since the options are passed as
205+
// javadoc.options file which is parsed with "default encoding"
233206
noTimestamp.value = true
234207
showFromProtected()
235208
// javadoc: error - The code being documented uses modules but the packages
@@ -242,7 +215,7 @@ allprojects {
242215
windowTitle = "Apache Calcite Avatica ${project.name} API"
243216
header = "<b>Apache Calcite Avatica</b>"
244217
bottom =
245-
"Copyright © 2012-$lastEditYear Apache Software Foundation. All Rights Reserved."
218+
"Copyright &copy; 2012-$lastEditYear Apache Software Foundation. All Rights Reserved."
246219
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
247220
addBooleanOption("html5", true)
248221
links("https://docs.oracle.com/javase/9/docs/api/")

gradle.properties

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ calcite.avatica.version=1.16.0
3434
# Plugins
3535
com.github.johnrengelman.shadow.version=5.1.0
3636
com.github.spotbugs.version=2.0.0
37-
com.github.vlsi.crlf.version=1.46.0
38-
com.github.vlsi.ide.version=1.46.0
39-
com.github.vlsi.license-gather.version=1.46.0
40-
com.github.vlsi.stage-vote-release.version=1.46.0
37+
com.github.vlsi.vlsi-release-plugins.version=1.47.0
4138
com.google.protobuf.version=0.8.10
4239
de.thetaphi.forbiddenapis.version=2.7
4340
org.jetbrains.gradle.plugin.idea-ext.version=0.5

release/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ for (archive in listOf(Zip::class, Tar::class)) {
185185
wa1191SetInputs(gitProps)
186186
with(sourceLayout())
187187
}
188+
doLast {
189+
logger.lifecycle("Source distribution is created: ${archiveFile.get().asFile}")
190+
}
188191
}
189192
releaseArtifacts {
190193
artifact(archiveTask)

settings.gradle.kts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818

1919
pluginManagement {
2020
plugins {
21-
fun PluginDependenciesSpec.idv(id: String) = id(id) version extra["$id.version"].toString()
21+
fun String.v() = extra["$this.version"].toString()
22+
fun PluginDependenciesSpec.idv(id: String, key: String = id) = id(id) version key.v()
2223

2324
idv("com.github.johnrengelman.shadow")
2425
idv("com.github.spotbugs")
25-
idv("com.github.vlsi.crlf")
26-
idv("com.github.vlsi.ide")
27-
idv("com.github.vlsi.license-gather")
28-
idv("com.github.vlsi.stage-vote-release")
26+
idv("com.github.vlsi.crlf", "com.github.vlsi.vlsi-release-plugins")
27+
idv("com.github.vlsi.gradle-extensions", "com.github.vlsi.vlsi-release-plugins")
28+
idv("com.github.vlsi.ide", "com.github.vlsi.vlsi-release-plugins")
29+
idv("com.github.vlsi.license-gather", "com.github.vlsi.vlsi-release-plugins")
30+
idv("com.github.vlsi.stage-vote-release", "com.github.vlsi.vlsi-release-plugins")
2931
idv("com.google.protobuf")
3032
idv("de.thetaphi.forbiddenapis")
3133
idv("org.jetbrains.gradle.plugin.idea-ext")

site/_docs/howto.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fi
150150
Also, ensure that `default-cache-ttl 6000` is set in `~/.gnupg/gpg-agent.conf`
151151
to guarantee that your credentials will be cached for the duration of the build.
152152

153-
## Set up Maven repository credentials (for Calcite committers)
153+
## Set up Nexus repository credentials (for Calcite committers)
154154

155155
Gradle provides multiple ways to [configure project properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties).
156156
For instance, you could update `$HOME/.gradle/gradle.properties`.
@@ -265,7 +265,7 @@ docker-compose run -v /c/Users/username/AppData/Roaming/gnupg:/.gnupg dry-run
265265
* For each .jar (for example `core/build/libs/avatica-core-X.Y.Z.jar`
266266
and `server/build/libs/avatica-server-X.Y.Z-sources.jar`),
267267
verify that the `META-INF` directory contains the correct
268-
contents for `DEPENDENCIES`, `LICENSE` and `NOTICE` per the
268+
contents for `LICENSE` and `NOTICE` per the
269269
source/classes contained. Refer to the ASF licensing documentation on
270270
what is required.
271271
* Check PGP, per [this](https://httpd.apache.org/dev/verification.html)

site/develop/avatica.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ then build using maven:
4949

5050
{% highlight bash %}
5151
$ git clone git://github.com/apache/calcite-avatica.git avatica
52-
$ cd avatica
52+
$ cd calcite-avatica
5353
$ ./gradlew build
5454
{% endhighlight %}
5555

0 commit comments

Comments
 (0)