Skip to content

Commit

Permalink
Merge pull request #750 from JetBrains/feature/patch-jna-path
Browse files Browse the repository at this point in the history
Patch JNA path in build scripts
  • Loading branch information
sergej-koscejev authored Jan 28, 2024
2 parents 2cb0a2a + bb24a4f commit 92d868c
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 @@ -211,7 +211,7 @@ ext.extensions_home = '-Dextensions.home=' + rootDir

// ___________________ 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]
Expand Down Expand Up @@ -254,15 +254,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 92d868c

Please sign in to comment.