Skip to content

Commit

Permalink
add runtime plugin for generating stand-alone images
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenbaker committed Jul 30, 2024
1 parent 779ef70 commit 1c8befc
Showing 1 changed file with 41 additions and 3 deletions.
44 changes: 41 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}


Expand Down Expand Up @@ -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}'"
Expand All @@ -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"
Expand Down Expand Up @@ -200,7 +201,7 @@ tasks.named("checkstyleTest") {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
languageVersion = JavaLanguageVersion.of(17)
}
}

Expand All @@ -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

Expand Down

0 comments on commit 1c8befc

Please sign in to comment.