@@ -159,53 +159,76 @@ tasks.withType(RunAntScript).configureEach {
159159 dependsOn(configureJava, resolveMps)
160160}
161161
162- task build_allScripts ( type : BuildLanguages , dependsOn : [resolveMps, configureJava] ) {
162+ def build_allScripts_unpatched = tasks . register( ' build_allScripts_unpatched ' , BuildLanguages ) {
163163 script " $buildDir /scripts/build_all_scripts.xml"
164164}
165165
166+ // Patch JNA path in generated build scripts until https://github.com/JetBrains/MPS/pull/71 is fixed
167+ def patch_allScripts = tasks. register(' patch_allScripts' , Copy ) {
168+ dependsOn build_allScripts_unpatched
169+ from ' build/scripts'
170+ into ' build/patched-scripts'
171+
172+ def isAarch64 = System . getProperty(' os.arch' ) == ' aarch64'
173+ def jnaArch = isAarch64 ? ' aarch64' : ' amd64'
174+
175+ filter {
176+ it. replace(' "-Djna.boot.library.path=${artifacts.mps}/lib/jna"' ,
177+ ' "-Djna.boot.library.path=${artifacts.mps}/lib/jna/' + jnaArch + ' "' )
178+ }
179+ }
180+
181+ task build_allScripts {
182+ dependsOn patch_allScripts
183+ }
184+
185+ File scriptFile (String name ) {
186+ file(" $buildDir /patched-scripts/$name " )
187+ }
188+
166189// All other MPS tasks depend on build_allScripts
167190tasks. withType(RunAntScript ). configureEach {
168- if (it != build_allScripts ) {
191+ if (it. name != build_allScripts_unpatched . name ) {
169192 it. dependsOn(build_allScripts)
170193 }
171194}
172195
173196task build_base_languages (type : BuildLanguages ) {
174- script " $b uildDir /scripts/ build-base-languages.xml"
197+ script scriptFile( ' build-base-languages.xml' )
175198}
176199
177200task build_testing_languages (type : BuildLanguages , dependsOn : [build_base_languages]) {
178- script " $b uildDir /scripts/ build-testing-languages.xml"
201+ script scriptFile( ' build-testing-languages.xml' )
179202}
180203
181204task test_testing (type : TestLanguages , dependsOn : [build_testing_languages]) {
182205 // MPS build language generator is confused about the basedir of the generated script so we set it manually
183206 scriptArgs = [" -Dbasedir=${ file('code/languages/org.mpsqa.testing')} " ]
184- script " $b uildDir /scripts/ test-testing.xml"
207+ script scriptFile( " test-testing.xml" )
185208}
186209
187210task build_clones_languages (type : BuildLanguages , dependsOn : [build_base_languages]) {
188- script " $b uildDir /scripts/ build-clones-languages.xml"
211+ script scriptFile( " build-clones-languages.xml" )
189212}
190213
191214task build_mutant_languages (type : BuildLanguages , dependsOn : []) {
192- script " $b uildDir /scripts/ build-mutant-languages.xml"
215+ script scriptFile( " build-mutant-languages.xml" )
193216}
194217
195218task build_unused_languages (type : BuildLanguages , dependsOn : []) {
196- script " $b uildDir /scripts/ build-unused-languages-analysis.xml"
219+ script scriptFile( " build-unused-languages-analysis.xml" )
197220}
198221
199222task build_arch_languages (type : BuildLanguages , dependsOn : []) {
200- script " $b uildDir /scripts/ build-arch-analysis-languages.xml"
223+ script scriptFile( " build-arch-analysis-languages.xml" )
201224}
202225
203226task build_deprecation_analysis_languages (type : BuildLanguages , dependsOn : []) {
204- script " $b uildDir /scripts/ build-deprecated-analysis-languages.xml"
227+ script scriptFile( " build-deprecated-analysis-languages.xml" )
205228}
206229
207230task build_lint_analysis_languages (type : BuildLanguages , dependsOn : []) {
208- script " $b uildDir /scripts/ build-lint-analysis-languages.xml"
231+ script scriptFile( " build-lint-analysis-languages.xml" )
209232}
210233
211234task build_allInOne_package (type : BuildLanguages , dependsOn : [build_allScripts]) {
@@ -217,7 +240,7 @@ task build_allInOne_package(type: BuildLanguages, dependsOn: [build_allScripts])
217240 dependsOn ' build_arch_languages'
218241 dependsOn ' build_deprecation_analysis_languages'
219242 dependsOn ' build_lint_analysis_languages'
220- script " $b uildDir /scripts/ build-allInOne-package.xml"
243+ script scriptFile( " build-allInOne-package.xml" )
221244}
222245
223246task package_mpsqa (type : Zip , dependsOn : build_allInOne_package) {
@@ -228,12 +251,12 @@ task package_mpsqa(type: Zip, dependsOn: build_allInOne_package) {
228251
229252task test_clones (type : TestLanguages , dependsOn : build_clones_languages) {
230253 description " Will execute clones tests from command line"
231- script new File ( " $b uildDir /scripts/ test-clones.xml" )
254+ script scriptFile( " test-clones.xml" )
232255}
233256
234257task test_lint (type : TestLanguages , dependsOn : build_lint_analysis_languages) {
235258 description " Will execute lint tests from command line"
236- script " $b uildDir /scripts/ build-lint-tests.xml"
259+ script scriptFile( " build-lint-tests.xml" )
237260}
238261
239262check. dependsOn(tasks. withType(TestLanguages ))
0 commit comments