From 1c8befc0ac0d9a8eb141ccf4fd5af646c287542f Mon Sep 17 00:00:00 2001 From: Hayden Baker Date: Tue, 30 Jul 2024 11:18:15 -0700 Subject: [PATCH 1/2] add runtime plugin for generating stand-alone images --- build.gradle | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 339f1131..fae24875 100644 --- a/build.gradle +++ b/build.gradle @@ -33,10 +33,10 @@ plugins { id "application" id "maven-publish" - id "signing" id "com.palantir.git-version" version "0.12.3" id "checkstyle" id "org.jreleaser" version "1.13.0" + id 'org.beryx.runtime' version '1.13.1' } @@ -69,6 +69,8 @@ task javadocJar(type: Jar) { ext { // Load the Smithy Language Server version from VERSION. libraryVersion = project.file("VERSION").getText('UTF-8').replace(System.lineSeparator(), "") + imageJreVersion = "17" + correttoRoot = "https://corretto.aws/downloads/latest/amazon-corretto-${imageJreVersion}" } println "Smithy Language Server version: '${libraryVersion}'" @@ -78,7 +80,6 @@ def stagingDirectory = rootProject.layout.buildDirectory.dir("staging") allprojects { apply plugin: "java" apply plugin: "maven-publish" - apply plugin: "signing" group = "software.amazon.smithy" version = libraryVersion description = "Language Server Protocol implementation for Smithy" @@ -200,7 +201,7 @@ tasks.named("checkstyleTest") { java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(17) } } @@ -223,6 +224,43 @@ jar { } } + +runtime { + addOptions("--compress", "2", "--strip-debug", "--no-header-files", "--no-man-pages") + addModules("java.logging") + + launcher { + jvmArgs = [ + '-XX:-UsePerfData', + '-Xshare:auto', + '-XX:SharedArchiveFile={{BIN_DIR}}/../lib/smithy.jsa' + ] + } + + targetPlatform("linux-x86_64") { + jdkHome = jdkDownload("${correttoRoot}-x64-linux-jdk.tar.gz") + } + + targetPlatform("linux-aarch64") { + jdkHome = jdkDownload("${correttoRoot}-aarch64-linux-jdk.tar.gz") + } + + targetPlatform("darwin-x86_64") { + jdkHome = jdkDownload("${correttoRoot}-x64-macos-jdk.tar.gz") + } + + targetPlatform("darwin-aarch64") { + jdkHome = jdkDownload("${correttoRoot}-aarch64-macos-jdk.tar.gz") + } + + targetPlatform("windows-x64") { + jdkHome = jdkDownload("${correttoRoot}-x64-windows-jdk.zip") + } + + // Because we're using target-platforms, it will use this property as a prefix for each target zip + imageZip = layout.buildDirectory.file("image/smithy-language-server.zip") +} + jreleaser { dryrun = false From 0c3374da0f1ee21eb98c8d56836ae1f90524c18c Mon Sep 17 00:00:00 2001 From: Hayden Baker Date: Tue, 30 Jul 2024 11:43:15 -0700 Subject: [PATCH 2/2] add JReleaser configuration for github release and runtimes --- build.gradle | 93 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 79 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index fae24875..fa6d0411 100644 --- a/build.gradle +++ b/build.gradle @@ -261,31 +261,96 @@ runtime { imageZip = layout.buildDirectory.file("image/smithy-language-server.zip") } +tasks["assembleDist"].dependsOn("publish") +tasks["assembleDist"].dependsOn("runtimeZip") + jreleaser { dryrun = false - // Used for creating a tagged release, uploading files and generating changelog. - // In the future we can set this up to push release tags to GitHub, but for now it's - // set up to do nothing. - // https://jreleaser.org/guide/latest/reference/release/index.html + project { + website = 'https://smithy.io' + authors = ['Smithy'] + vendor = "Smithy" + license = 'Apache-2.0' + description = "Smithy Language Server - A Language Server Protocol implementation for the Smithy IDL." + copyright = "2019" + } + release { - generic { - enabled = true - skipRelease = true + github { + overwrite = true + tagName = '{{projectVersion}}' + releaseName = 'Smithy Language Server v{{{projectVersion}}}' + changelog { + enabled = false + } + commitAuthor { + name = "smithy-automation" + email = "github-smithy-automation@amazon.com" + } + } + } + + files { + active = "ALWAYS" + artifact { + // We'll include the VERSION file in the release artifacts so that the version can be easily + // retrieving by hitting the GitHub `releases/latest` url + path = "VERSION" + extraProperties.put('skipSigning', true) + } + } + + platform { + // These replacements are for the names of files that are released, *not* for names within this build config + replacements = [ + 'osx': 'darwin', + 'aarch_64': 'aarch64', + 'windows_x86_64': 'windows_x64' + ] + } + + distributions { + 'smithy-language-server' { + distributionType = 'JLINK' + stereotype = 'CLI' + + artifact { + path = "build/image/smithy-language-server-linux-x86_64.zip" + platform = "linux-x86_64" + } + + artifact { + path = "build/image/smithy-language-server-linux-aarch64.zip" + platform = "linux-aarch_64" + } + + artifact { + path = "build/image/smithy-language-server-darwin-x86_64.zip" + platform = "osx-x86_64" + } + + artifact { + path = "build/image/smithy-language-server-darwin-aarch64.zip" + platform = "osx-aarch_64" + } + + artifact { + path = "build/image/smithy-language-server-windows-x64.zip" + platform = "windows-x86_64" + } } } - // Used to announce a release to configured announcers. - // https://jreleaser.org/guide/latest/reference/announce/index.html - announce { - active = "NEVER" + checksum { + individual = true + files = false } - // Signing configuration. - // https://jreleaser.org/guide/latest/reference/signing.html signing { - active = "ALWAYS" + active = "RELEASE" armored = true + verify = true } // Configuration for deploying to Maven Central.