16
16
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
17
17
import org.gradle.api.tasks.testing.logging.TestLogEvent
18
18
19
+ import java.util.regex.Pattern
19
20
20
21
buildscript {
21
22
repositories {
@@ -33,10 +34,13 @@ plugins {
33
34
id " application"
34
35
35
36
id " maven-publish"
36
- id " signing"
37
37
id " com.palantir.git-version" version " 0.12.3"
38
38
id " checkstyle"
39
39
id " org.jreleaser" version " 1.13.0"
40
+
41
+ // Fork of runtime plugin with java 21 support, until https://github.com/beryx/badass-runtime-plugin/issues/153
42
+ // is resolved.
43
+ id " com.dua3.gradle.runtime" version " 1.13.1-patch-1"
40
44
}
41
45
42
46
@@ -69,6 +73,8 @@ task javadocJar(type: Jar) {
69
73
ext {
70
74
// Load the Smithy Language Server version from VERSION.
71
75
libraryVersion = project. file(" VERSION" ). getText(' UTF-8' ). replace(System . lineSeparator(), " " )
76
+ imageJreVersion = " 21"
77
+ correttoRoot = " https://corretto.aws/downloads/latest/amazon-corretto-${ imageJreVersion} "
72
78
}
73
79
74
80
println " Smithy Language Server version: '${ libraryVersion} '"
@@ -78,7 +84,6 @@ def stagingDirectory = rootProject.layout.buildDirectory.dir("staging")
78
84
allprojects {
79
85
apply plugin : " java"
80
86
apply plugin : " maven-publish"
81
- apply plugin : " signing"
82
87
group = " software.amazon.smithy"
83
88
version = libraryVersion
84
89
description = " Language Server Protocol implementation for Smithy"
@@ -228,31 +233,154 @@ jar {
228
233
}
229
234
}
230
235
236
+
237
+ runtime {
238
+ addOptions(" --compress" , " 2" , " --strip-debug" , " --no-header-files" , " --no-man-pages" )
239
+ addModules(" java.logging" )
240
+
241
+ launcher {
242
+ jvmArgs = [
243
+ ' -XX:-UsePerfData' ,
244
+ ' -Xshare:auto' ,
245
+ ' -XX:SharedArchiveFile={{BIN_DIR}}/../lib/smithy.jsa'
246
+ ]
247
+ }
248
+
249
+ targetPlatform(" linux-x86_64" ) {
250
+ jdkHome = jdkDownload(" ${ correttoRoot} -x64-linux-jdk.tar.gz" )
251
+ }
252
+
253
+ targetPlatform(" linux-aarch64" ) {
254
+ jdkHome = jdkDownload(" ${ correttoRoot} -aarch64-linux-jdk.tar.gz" )
255
+ }
256
+
257
+ targetPlatform(" darwin-x86_64" ) {
258
+ jdkHome = jdkDownload(" ${ correttoRoot} -x64-macos-jdk.tar.gz" )
259
+ }
260
+
261
+ targetPlatform(" darwin-aarch64" ) {
262
+ jdkHome = jdkDownload(" ${ correttoRoot} -aarch64-macos-jdk.tar.gz" )
263
+ }
264
+
265
+ targetPlatform(" windows-x64" ) {
266
+ jdkHome = jdkDownload(" ${ correttoRoot} -x64-windows-jdk.zip" )
267
+ }
268
+
269
+ // Because we're using target-platforms, it will use this property as a prefix for each target zip
270
+ imageZip = layout. buildDirectory. file(" image/smithy-language-server.zip" )
271
+ }
272
+
273
+ tasks[" assembleDist" ]. dependsOn(" publish" )
274
+ tasks[" assembleDist" ]. dependsOn(" runtimeZip" )
275
+
276
+ // Generate a changelog that only includes the changes for the latest version
277
+ // which Jreleaser will add to the release notes of the github release.
278
+ def releaseChangelogFile = project. layout. buildDirectory. file(" resources/RELEASE_CHANGELOG.md" ). get(). asFile
279
+ tasks. register(" createReleaseChangelog" ) {
280
+ dependsOn processResources
281
+
282
+ doLast {
283
+ def changelog = project. file(" CHANGELOG.md" ). text
284
+ // Copy the text in between the first two version headers
285
+ def matcher = Pattern . compile(" ^## \\ d+\\ .\\ d+\\ .\\ d+" , Pattern . MULTILINE ). matcher(changelog)
286
+ def getIndex = {
287
+ matcher. find()
288
+ return matcher. start()
289
+ }
290
+ def result = changelog. substring(getIndex(), getIndex()). trim()
291
+ releaseChangelogFile. write(result)
292
+ }
293
+ }
294
+
295
+ tasks. jreleaserRelease. dependsOn(tasks. createReleaseChangelog)
296
+
231
297
jreleaser {
232
298
dryrun = false
233
299
234
- // Used for creating a tagged release, uploading files and generating changelog.
235
- // In the future we can set this up to push release tags to GitHub, but for now it's
236
- // set up to do nothing.
237
- // https://jreleaser.org/guide/latest/reference/release/index.html
300
+ project {
301
+ website = ' https://smithy.io'
302
+ authors = [' Smithy' ]
303
+ vendor = " Smithy"
304
+ license = ' Apache-2.0'
305
+ description = " Smithy Language Server - A Language Server Protocol implementation for the Smithy IDL."
306
+ copyright = " 2019"
307
+ }
308
+
238
309
release {
239
- generic {
240
- enabled = true
241
- skipRelease = true
310
+ github {
311
+ overwrite = true
312
+ tagName = ' {{projectVersion}}'
313
+ releaseName = ' Smithy Language Server v{{{projectVersion}}}'
314
+ changelog {
315
+ external = releaseChangelogFile. absolutePath
316
+ }
317
+ commitAuthor {
318
+ name = " smithy-automation"
319
+
320
+ }
242
321
}
243
322
}
244
323
245
- // Used to announce a release to configured announcers.
246
- // https://jreleaser.org/guide/latest/reference/announce/index.html
247
- announce {
248
- active = " NEVER"
324
+ files {
325
+ active = " ALWAYS"
326
+ artifact {
327
+ // We'll include the VERSION file in the release artifacts so that the version can be easily
328
+ // retrieving by hitting the GitHub `releases/latest` url
329
+ path = " VERSION"
330
+ extraProperties. put(' skipSigning' , true )
331
+ }
332
+ }
333
+
334
+ platform {
335
+ // These replacements are for the names of files that are released, *not* for names within this build config
336
+ replacements = [
337
+ ' osx' : ' darwin' ,
338
+ ' aarch_64' : ' aarch64' ,
339
+ ' windows_x86_64' : ' windows_x64'
340
+ ]
341
+ }
342
+
343
+ distributions {
344
+ ' smithy-language-server' {
345
+ distributionType = ' JLINK'
346
+ stereotype = ' CLI'
347
+
348
+ artifact {
349
+ path = " build/image/smithy-language-server-linux-x86_64.zip"
350
+ platform = " linux-x86_64"
351
+ }
352
+
353
+ artifact {
354
+ path = " build/image/smithy-language-server-linux-aarch64.zip"
355
+ platform = " linux-aarch_64"
356
+ }
357
+
358
+ artifact {
359
+ path = " build/image/smithy-language-server-darwin-x86_64.zip"
360
+ platform = " osx-x86_64"
361
+ }
362
+
363
+ artifact {
364
+ path = " build/image/smithy-language-server-darwin-aarch64.zip"
365
+ platform = " osx-aarch_64"
366
+ }
367
+
368
+ artifact {
369
+ path = " build/image/smithy-language-server-windows-x64.zip"
370
+ platform = " windows-x86_64"
371
+ }
372
+ }
373
+ }
374
+
375
+ checksum {
376
+ individual = true
377
+ files = false
249
378
}
250
379
251
- // Signing configuration.
252
- // https://jreleaser.org/guide/latest/reference/signing.html
253
380
signing {
254
- active = " ALWAYS "
381
+ active = " RELEASE "
255
382
armored = true
383
+ verify = true
256
384
}
257
385
258
386
// Configuration for deploying to Maven Central.
0 commit comments