@@ -374,55 +374,73 @@ def getTargetArch() {
374374}
375375
376376task win64BuildDecompilerRust (type : Exec ) {
377- workingDir " ./src/decompile"
377+ if (isCurrentWindows()) {
378+ exec {
379+ workingDir " ./src/decompile"
378380
379- def arch = null
381+ def arch = null
380382
381- try {
382- arch = getTargetArch()
383- } catch (Exception e) {
384- throw new TaskExecutionException (it, e)
385- }
386-
387- def target = " ${ arch} -pc-windows-msvc"
388-
389-
390- commandLine ' cargo' , ' build' , ' --release' , ' --target' , target, ' -Z' , ' unstable-options' , ' --out-dir' , ' ../../build/os/win64'
383+ try {
384+ arch = getTargetArch()
385+ } catch (Exception e) {
386+ throw new TaskExecutionException (it, e)
387+ }
391388
389+ def target = " ${ arch} -pc-windows-msvc"
390+ commandLine ' cargo' , ' build' , ' --release' , ' --target' , target, ' -Z' , ' unstable-options' , ' --out-dir' , ' ../../build/os/win_x86_64'
391+ }
392+ }
392393}
393394
394395task linux64BuildDecompilerRust (type : Exec ) {
395- workingDir " ./src/decompile"
396+ if (isCurrentLinux()) {
397+ exec {
398+ workingDir " ./src/decompile"
396399
397- def arch = null
400+ def out_path = null
401+ def arch = null
398402
399- try {
400- arch = getTargetArch()
401- } catch (Exception e) {
402- throw new TaskExecutionException (it, e)
403- }
404-
405- def target = " ${ arch} -unknown-linux-gnu"
403+ try {
404+ arch = getTargetArch()
405+ } catch (Exception e) {
406+ throw new TaskExecutionException (it, e)
407+ }
406408
407- commandLine ' cargo' , ' build' , ' --release' , ' --target' , target, ' -Z' , ' unstable-options' , ' --out-dir' , ' ../../build/os/linux64'
409+ if (arch == " aarch64" ) {
410+ out_path = " ../../build/os/linux_arm_64"
411+ } else {
412+ out_path = " ../../build/os/linux_x86_64"
413+ }
408414
415+ def target = " ${ arch} -unknown-linux-gnu"
416+ commandLine ' cargo' , ' build' , ' --release' , ' --target' , target, ' -Z' , ' unstable-options' , ' --out-dir' , out_path
417+ }
418+ }
409419}
410420
411421task osx64BuildDecompilerRust (type : Exec ) {
412- workingDir " ./src/decompile"
422+ if (isCurrentMac()) {
423+ exec {
424+ workingDir " ./src/decompile"
425+ def out_path = null
426+ def arch = null
427+
428+ try {
429+ arch = getTargetArch()
430+ } catch (Exception e) {
431+ throw new TaskExecutionException (it, e)
432+ }
413433
414- def arch = null
434+ if (arch == " aarch64" ) {
435+ out_path = " ../../build/os/mac_arm_64"
436+ } else {
437+ out_path = " ../../build/os/mac_x86_64"
438+ }
415439
416- try {
417- arch = getTargetArch()
418- } catch (Exception e) {
419- throw new TaskExecutionException (it, e)
440+ def target = " ${ arch} -apple-darwin"
441+ commandLine ' cargo' , ' build' , ' --release' , ' --target' , target, ' -Z' , ' unstable-options' , ' --out-dir' , out_path
442+ }
420443 }
421-
422- def target = " ${ arch} -apple-darwin"
423-
424- commandLine ' cargo' , ' build' , ' --release' , ' --target' , target, ' -Z' , ' unstable-options' , ' --out-dir' , ' ../../build/os/osx64'
425-
426444}
427445
428446model {
0 commit comments