Skip to content

Commit

Permalink
ci: WIP riscv64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
imkiva committed Sep 26, 2023
1 parent 76c3818 commit 5a81d33
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
15 changes: 13 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,24 @@ javaVersion = libs.versions.java.get().toInt()
// Workaround that `libs` is not available in `jacoco {}` block
var jacocoVersion = libs.versions.jacoco.get()

// Platforms we build jlink-ed aya for
// Platforms we build jlink-ed aya for:
// The "current" means the "current platform", as it is unnecessary to detect what the current system is,
// as calling jlink with default arguments will build for the current platform.
currentPlatform = "current"
supportedPlatforms = if (System.getenv("CI") == null) listOf(currentPlatform) else listOf(

// In case we are in CI, or we are debugging CI locally, we build for all platforms
fun buildAllPlatforms(): Boolean {
if (System.getenv("CI") != null) return true
if (System.getProperty("user.name").contains("kiva")
&& project.rootDir.resolve(".git/HEAD").readLines().joinToString().contains("refs/heads/ci")) return true
return false
}
supportedPlatforms = if (!buildAllPlatforms()) listOf(currentPlatform) else listOf(
"windows-aarch64",
"windows-x64",
"linux-aarch64",
"linux-x64",
// "linux-riscv64",
"macos-aarch64",
"macos-x64",
)
Expand Down
13 changes: 12 additions & 1 deletion ide-lsp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,25 @@ object Constants {

val supportedPlatforms: List<String> by rootProject.ext
val currentPlatform: String by rootProject.ext
var javaVersion: Int by rootProject.ext

fun jdkUrl(platform: String): String {
fun libericaJDK(platform: String): String {
val libericaJdkVersion = System.getProperty("java.vm.version")
// ^ In CI, we always use Liberica JDK, so we can use the version string to get the download URL.
val fixAmd64 = platform.replace("x64", "amd64")
val suffix = if (platform.contains("linux")) "tar.gz" else "zip"
return "https://download.bell-sw.com/java/${libericaJdkVersion}/bellsoft-jdk${libericaJdkVersion}-${fixAmd64}.$suffix"
}

fun riscv64JDK(platform: String): String {
return "https://builds.shipilev.net/openjdk-jdk$javaVersion/openjdk-jdk$javaVersion-$platform-server-release-gcc12-glibc2.36.tar.xz"
}

fun jdkUrl(platform: String): String = when {
platform.contains("linux") && platform.contains("riscv") -> riscv64JDK(platform)
else -> libericaJDK(platform)
}

val allPlatformImageDir = layout.buildDirectory.asFile.get().resolve("image-all-platforms")
jlink {
addOptions("--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages")
Expand Down

0 comments on commit 5a81d33

Please sign in to comment.