Skip to content

Commit bb24a4f

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

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
@@ -229,7 +229,7 @@ ext.skipUnmodifiedModels = "-Dmps.generator.skipUnmodifiedModels=true" //increme
229229

230230
// ___________________ utilities ___________________
231231
File scriptFile(String relativePath) {
232-
new File("$rootDir/build/generated/$relativePath")
232+
new File("$rootDir/build/patched/$relativePath")
233233
}
234234

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

275-
task build_allScripts(type: BuildLanguages, dependsOn: [
276-
'downloadJbr',
277-
resolveMps,
278-
resolved_diagram_dependencies,
279-
copyModelApi,
280-
]) {
275+
def build_allScripts_unpatched = tasks.register('build_allScripts_unpatched', BuildLanguages) {
276+
dependsOn 'downloadJbr', resolveMps, copyModelApi, resolved_diagram_dependencies
281277
script "$rootDir/scripts/build.xml"
282278
}
283279

280+
// Patch JNA path in generated build scripts until https://github.com/JetBrains/MPS/pull/71 is fixed
281+
def patch_allScripts = tasks.register('patch_allScripts', Copy) {
282+
dependsOn build_allScripts_unpatched
283+
from 'build/generated'
284+
into 'build/patched'
285+
286+
def isAarch64 = System.getProperty('os.arch') == 'aarch64'
287+
def jnaArch = isAarch64 ? 'aarch64' : 'amd64'
288+
289+
filter {
290+
it.replace('"-Djna.boot.library.path=${artifacts.mps}/lib/jna"',
291+
'"-Djna.boot.library.path=${artifacts.mps}/lib/jna/' + jnaArch + '"')
292+
}
293+
}
294+
295+
task build_allScripts {
296+
dependsOn patch_allScripts
297+
}
298+
284299
task build_languages(type: BuildLanguages, dependsOn: [build_allScripts]) {
285300
script scriptFile('languages/build.xml')
286301
}

0 commit comments

Comments
 (0)