Skip to content

Commit

Permalink
Patch JNA path in build scripts
Browse files Browse the repository at this point in the history
Necessary to run tests on macOS until
JetBrains/MPS#71 is fixed
  • Loading branch information
sergej-koscejev committed Jan 28, 2024
1 parent df153fc commit bb24a4f
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ ext.skipUnmodifiedModels = "-Dmps.generator.skipUnmodifiedModels=true" //increme

// ___________________ utilities ___________________
File scriptFile(String relativePath) {
new File("$rootDir/build/generated/$relativePath")
new File("$rootDir/build/patched/$relativePath")
}

def defaultScriptArgs = [mps_home, build_dir, artifacts_dir, ext.buildDate, ext.pluginVersion, ext.skipUnmodifiedModels]
Expand Down Expand Up @@ -272,15 +272,30 @@ task resolved_diagram_dependencies(type: Copy) {
}
}

task build_allScripts(type: BuildLanguages, dependsOn: [
'downloadJbr',
resolveMps,
resolved_diagram_dependencies,
copyModelApi,
]) {
def build_allScripts_unpatched = tasks.register('build_allScripts_unpatched', BuildLanguages) {
dependsOn 'downloadJbr', resolveMps, copyModelApi, resolved_diagram_dependencies
script "$rootDir/scripts/build.xml"
}

// Patch JNA path in generated build scripts until https://github.com/JetBrains/MPS/pull/71 is fixed
def patch_allScripts = tasks.register('patch_allScripts', Copy) {
dependsOn build_allScripts_unpatched
from 'build/generated'
into 'build/patched'

def isAarch64 = System.getProperty('os.arch') == 'aarch64'
def jnaArch = isAarch64 ? 'aarch64' : 'amd64'

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

task build_allScripts {
dependsOn patch_allScripts
}

task build_languages(type: BuildLanguages, dependsOn: [build_allScripts]) {
script scriptFile('languages/build.xml')
}
Expand Down

0 comments on commit bb24a4f

Please sign in to comment.