forked from smithy-lang/smithy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
108 lines (92 loc) · 3.58 KB
/
build.gradle.kts
File metadata and controls
108 lines (92 loc) · 3.58 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
import org.jreleaser.gradle.plugin.JReleaserExtension
import org.jreleaser.model.Active
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
plugins {
java
alias(libs.plugins.jreleaser)
}
// Load the Smithy version from VERSION.
val libraryVersion = project.file("VERSION").readText().trim()
println("Smithy version: '$libraryVersion'")
// Verify Java version is 17+
// Since most plugins are not toolchain-aware, we can't rely on gradle toolchains, which means we'll have to enforce
// that the global java version (i.e. whatever JAVA_HOME is set to and what Gradle uses) is set to 17+
val javaVersion = JavaVersion.current()
check(javaVersion.isCompatibleWith(JavaVersion.VERSION_17)) {
"Building this project requires Java 17 or later. You are currently running Java ${javaVersion.majorVersion}."
}
allprojects {
group = "software.amazon.smithy"
version = libraryVersion
}
// Consolidated Javadoc creation
afterEvaluate {
tasks {
javadoc {
title = "Smithy API ${version}"
setDestinationDir(layout.buildDirectory.dir("docs/javadoc/latest").get().asFile)
// Only include subprojects that apply the java plugin (excludes java-platform projects like the BOM).
val javaSubprojects = subprojects.filter { it.plugins.hasPlugin("java") }
// Add an explicit dependencies on the compilation of each subproject because we need
// the compile classpath, which we can only get after the compile task has completed.
dependsOn(javaSubprojects.map { it.tasks.named("compileJava") })
classpath = files(provider {
javaSubprojects.flatMap { subproject ->
subproject.configurations.getByName("compileClasspath").resolve()
}
})
source(provider { javaSubprojects.map { project -> project.sourceSets.main.get().allJava } })
options.encoding = "UTF-8"
(options as StandardJavadocDocletOptions).apply {
addStringOption("Xdoclint:-html", "-quiet")
}
}
}
}
configure<JReleaserExtension> {
dryrun = false
release {
generic {
skipTag = true
}
}
// Used to announce a release to configured announcers.
// https://jreleaser.org/guide/latest/reference/announce/index.html
announce {
active = Active.NEVER
}
// Signing configuration.
// https://jreleaser.org/guide/latest/reference/signing.html
signing {
active = Active.ALWAYS
armored = true
}
// Configuration for deploying to Maven Central.
// https://jreleaser.org/guide/latest/examples/maven/maven-central.html#_gradle
deploy {
maven {
mavenCentral {
create("maven-central") {
active = Active.ALWAYS
url = "https://central.sonatype.com/api/v1/publisher"
stagingRepository(stagingDir().get().asFile.path)
maxRetries = 100
retryDelay = 60
}
}
}
}
}