Skip to content

Commit ede40dd

Browse files
Patch JNA path in build scripts
Necessary to run tests on macOS until JetBrains/MPS#71 is fixed
1 parent a4fe817 commit ede40dd

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

build.gradle

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ ext.extensions_home = '-Dextensions.home=' + rootDir
211211

212212
// ___________________ utilities ___________________
213213
File scriptFile(String relativePath) {
214-
new File("$rootDir/build/generated/$relativePath")
214+
new File("$rootDir/build/patched/$relativePath")
215215
}
216216

217217
def defaultScriptArgs = [mps_home, build_dir, artifacts_dir, ext.buildDate, ext.pluginVersion]
@@ -254,15 +254,30 @@ task resolved_diagram_dependencies(type: Copy) {
254254
}
255255
}
256256

257-
task build_allScripts(type: BuildLanguages, dependsOn: [
258-
'downloadJbr',
259-
resolveMps,
260-
resolved_diagram_dependencies,
261-
copyModelApi,
262-
]) {
257+
def build_allScripts_unpatched = tasks.register('build_allScripts_unpatched', BuildLanguages) {
258+
dependsOn 'downloadJbr', resolveMps, copyModelApi, resolved_diagram_dependencies
263259
script "$rootDir/scripts/build.xml"
264260
}
265261

262+
// Patch JNA path in generated build scripts until https://github.com/JetBrains/MPS/pull/71 is fixed
263+
def patch_allScripts = tasks.register('patch_allScripts', Copy) {
264+
dependsOn build_allScripts_unpatched
265+
from 'build/generated'
266+
into 'build/patched'
267+
268+
def isAarch64 = System.getProperty('os.arch') == 'aarch64'
269+
def jnaArch = isAarch64 ? 'aarch64' : 'amd64'
270+
271+
filter {
272+
it.replace('"-Djna.boot.library.path=${artifacts.mps}/lib/jna"',
273+
'"-Djna.boot.library.path=${artifacts.mps}/lib/jna/' + jnaArch + '"')
274+
}
275+
}
276+
277+
task build_allScripts {
278+
dependsOn patch_allScripts
279+
}
280+
266281
task build_languages(type: BuildLanguages, dependsOn: [build_allScripts]) {
267282
script scriptFile('languages/build.xml')
268283
}

0 commit comments

Comments
 (0)