mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[build scripts] Build linux-aarch64 snap (IJPL-35309)
* Migrate to core22 since only that version supports multi-arch snaps * Use jetbrains/snapcraft docker image to build snaps GitOrigin-RevId: 18b6d7d559146d31fdacd72cff944cbe58a3d1b2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c1c0d49b2c
commit
8d9bcbbe47
@@ -8,4 +8,4 @@ launcherBuild=243.15355
|
||||
nsisBuild=1
|
||||
restarterBuild=243.6005
|
||||
runtimeBuild=21.0.4b607.1
|
||||
snapDockerImage=snapcore/snapcraft:stable@sha256:6d771575c134569e28a590f173f7efae8bf7f4d1746ad8a474c98e02f4a3f627
|
||||
snapDockerImage=jetbrains/snapcraft:latest@sha256:0059496b7a941e27937bc523621a336bddc1327de8dcd03f6b0bd0b57892ce43
|
||||
|
||||
@@ -8,11 +8,13 @@ description: |-
|
||||
$DESCRIPTION$
|
||||
grade: $GRADE$
|
||||
confinement: classic
|
||||
base: core18
|
||||
base: core22
|
||||
compression: lzo
|
||||
architectures:
|
||||
- build-on: [amd64, arm64]
|
||||
run-on: amd64
|
||||
build-for: amd64
|
||||
- build-on: [amd64, arm64]
|
||||
build-for: arm64
|
||||
|
||||
apps:
|
||||
$NAME$:
|
||||
|
||||
@@ -110,13 +110,7 @@ class LinuxDistributionBuilder(
|
||||
buildTarGz(arch, runtimeDir, osAndArchSpecificDistPath, suffix(arch))
|
||||
}
|
||||
launch(Dispatchers.IO) {
|
||||
if (arch == JvmArchitecture.x64) {
|
||||
buildSnapPackage(runtimeDir, osAndArchSpecificDistPath, arch)
|
||||
}
|
||||
else {
|
||||
// TODO: Add snap for aarch64
|
||||
Span.current().addEvent("skip building Snap packages for non-x64 arch")
|
||||
}
|
||||
buildSnapPackage(runtimeDir, osAndArchSpecificDistPath, arch)
|
||||
}
|
||||
|
||||
if (tarGzPath != null ) {
|
||||
@@ -198,13 +192,19 @@ class LinuxDistributionBuilder(
|
||||
"${appInfo.majorVersion}.${appInfo.minorVersion}${if (versionSuffix.isEmpty()) "" else "-${versionSuffix}"}"
|
||||
}
|
||||
|
||||
private val snapArtifactName: String? by lazy {
|
||||
"${customizer.snapName ?: return@lazy null}_${snapVersion}_amd64.snap"
|
||||
private fun getSnapArchName(arch: JvmArchitecture) = when (arch) {
|
||||
JvmArchitecture.x64 -> "amd64"
|
||||
JvmArchitecture.aarch64 -> "arm64"
|
||||
}
|
||||
|
||||
private fun getSnapArtifactName(arch: JvmArchitecture): String? {
|
||||
val snapName = customizer.snapName ?: return null
|
||||
return "${snapName}_${snapVersion}_${getSnapArchName(arch)}.snap"
|
||||
}
|
||||
|
||||
private suspend fun buildSnapPackage(runtimeDir: Path, unixDistPath: Path, arch: JvmArchitecture) {
|
||||
val snapName = customizer.snapName
|
||||
val snapArtifactName = this.snapArtifactName
|
||||
val snapArtifactName = this.getSnapArtifactName(arch)
|
||||
if (snapName == null || snapArtifactName == null) {
|
||||
Span.current().addEvent("Linux .snap package build skipped because of missing snapName in ${customizer::class.java.simpleName}")
|
||||
return
|
||||
@@ -214,9 +214,12 @@ class LinuxDistributionBuilder(
|
||||
return
|
||||
}
|
||||
|
||||
val snapDir = context.paths.buildOutputDir.resolve("dist.snap")
|
||||
val architecture = getSnapArchName(arch)
|
||||
val snapDir = context.paths.buildOutputDir.resolve("dist.snap.${architecture}")
|
||||
|
||||
spanBuilder("build Linux .snap package")
|
||||
.setAttribute("snapName", snapName)
|
||||
.setAttribute("arch", arch.name)
|
||||
.use { span ->
|
||||
if (SystemInfoRt.isWindows) {
|
||||
span.addEvent(".snap cannot be built on Windows, skipped")
|
||||
@@ -266,7 +269,7 @@ class LinuxDistributionBuilder(
|
||||
|# </${snapcraftConfig.name}>
|
||||
""".trimMargin()
|
||||
)
|
||||
val productJsonDir = context.paths.tempDir.resolve("linux.dist.snap.product-info.json")
|
||||
val productJsonDir = context.paths.tempDir.resolve("linux.dist.snap.product-info.json.$architecture")
|
||||
val jsonText = generateProductJson(productJsonDir, arch)
|
||||
validateProductJson(
|
||||
jsonText,
|
||||
@@ -293,7 +296,9 @@ class LinuxDistributionBuilder(
|
||||
"--workdir=/build",
|
||||
context.options.snapDockerImage,
|
||||
"snapcraft",
|
||||
"snap", "-o", "result/$snapArtifactName"
|
||||
"snap",
|
||||
"--build-for=$architecture",
|
||||
"-o", "result/$snapArtifactName"
|
||||
),
|
||||
workingDir = snapDir,
|
||||
timeout = context.options.snapDockerBuildTimeoutMin.minutes,
|
||||
@@ -316,7 +321,7 @@ class LinuxDistributionBuilder(
|
||||
val archSuffix = suffix(arch)
|
||||
return sequenceOf("${archSuffix}.tar.gz", "${NO_RUNTIME_SUFFIX}${archSuffix}.tar.gz")
|
||||
.map { suffix -> context.productProperties.getBaseArtifactName(context) + suffix }
|
||||
.plus(snapArtifactName)
|
||||
.plus(getSnapArtifactName(arch))
|
||||
.filterNotNull()
|
||||
.map(context.paths.artifactDir::resolve)
|
||||
.filter { it.exists() }
|
||||
|
||||
Reference in New Issue
Block a user