Skip to content

Commit

Permalink
Include the JNA path workaround.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderpann committed Jan 30, 2024
1 parent 86acb4e commit 99e9006
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ val defaultScriptArgs = mapOf(
"jdk.util.zip.disableZip64ExtraFieldValidation" to true
)

fun scriptFile(relativePath: String):File = File("$rootDir/build/scripts/patched/$relativePath")

tasks {
val configureJava by registering {
val downloadJbr = named("downloadJbr", DownloadJbrForPlatform::class)
Expand Down Expand Up @@ -180,24 +182,45 @@ tasks {
description = "Set up MPS project libraries. Libraries are read in from projectlibraries.properties file."
}

val build_allScripts by registering(BuildLanguages::class) {
val build_allScripts_unpatched by registering(BuildLanguages::class) {
dependsOn(resolveMps, resolveLanguageLibs)
script = "$buildDir/scripts/build_all_scripts.xml"
}

// Patch JNA path in generated build scripts until https://github.com/JetBrains/MPS/pull/71 is fixed
val patch_allScripts by registering(Copy::class) {
dependsOn(build_allScripts_unpatched)
from("build/scripts")
exclude("patched")
exclude("build")
into("build/scripts/patched")

val isAarch64 = System.getProperty("os.arch") == "aarch64"
val jnaArch = if (isAarch64) "aarch64" else "amd64"

filter { line: String ->
line.replace("\"-Djna.boot.library.path=${'$'}{artifacts.mps}/lib/jna\"",
"\"-Djna.boot.library.path=${'$'}{artifacts.mps}/lib/jna/" + jnaArch + "\"")
}
}

val build_allScripts by registering {
dependsOn(patch_allScripts, resolveLanguageLibs)
}

val build_formal_languages by registering(BuildLanguages::class) {
dependsOn(build_allScripts)
script = "$buildDir/scripts/build-formal-languages.xml"
script = scriptFile("build-formal-languages.xml")
}

val build_fasten_safety_distribution by registering(BuildLanguages::class) {
dependsOn(build_formal_languages)
script = "$buildDir/scripts/build-fasten-safe-distribution.xml"
script = scriptFile("build-fasten-safe-distribution.xml")
}

val run_smv_tests by registering(TestLanguages::class) {
description = "Will execute all tests from command line"
script = "$buildDir/scripts/build-nusmv-tests.xml"
script = scriptFile("build-nusmv-tests.xml")
doLast {
ant.withGroovyBuilder {
"taskdef"("name" to "junitreport",
Expand All @@ -214,7 +237,7 @@ tasks {

val run_safety_tests by registering(TestLanguages::class) {
description = "Will execute all tests from command line"
script = "$buildDir/scripts/build-safety-tests.xml"
script = scriptFile("build-safety-tests.xml")
doLast {
ant.withGroovyBuilder {
"taskdef"("name" to "junitreport",
Expand All @@ -232,7 +255,7 @@ tasks {
val run_all_tests by registering(TestLanguages::class) {
dependsOn(configureJava)
description = "Will execute all tests from command line"
script = "$buildDir/scripts/build-all-tests.xml"
script = scriptFile("build-all-tests.xml")
doLast {
ant.withGroovyBuilder {
"taskdef"("name" to "junitreport",
Expand Down Expand Up @@ -260,7 +283,7 @@ tasks {

val build_assurance_languages by registering(BuildLanguages::class) {
dependsOn(build_allScripts)
script = "$buildDir/scripts/build-assurance-languages.xml"
script = scriptFile("build-assurance-languages.xml")
}

val package_assurance by registering(Zip::class) {
Expand Down

0 comments on commit 99e9006

Please sign in to comment.