Cs.hx 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package runci.targets;
  2. import sys.FileSystem;
  3. import runci.System.*;
  4. import runci.Config.*;
  5. class Cs {
  6. static public function getCsDependencies() {
  7. switch (systemName) {
  8. case "Linux":
  9. if (commandSucceed("mono", ["--version"]))
  10. infoMsg('mono has already been installed.');
  11. else
  12. Linux.requireAptPackages(["mono-devel", "mono-mcs"]);
  13. runCommand("mono", ["--version"]);
  14. case "Mac":
  15. if (commandSucceed("mono", ["--version"]))
  16. infoMsg('mono has already been installed.');
  17. else
  18. runCommand("brew", ["install", "mono"], true);
  19. runCommand("mono", ["--version"]);
  20. case "Windows":
  21. switch (ci) {
  22. case AppVeyor:
  23. addToPATH("C:\\Program Files (x86)\\Mono\\bin");
  24. runCommand("mono", ["--version"]);
  25. case _:
  26. //pass
  27. }
  28. }
  29. haxelibInstallGit("HaxeFoundation", "hxcs", true);
  30. }
  31. static public function runCs(exe:String, ?args:Array<String>):Void {
  32. if (args == null) args = [];
  33. exe = FileSystem.fullPath(exe);
  34. switch (systemName) {
  35. case "Linux", "Mac":
  36. runCommand("mono", [exe].concat(args));
  37. case "Windows":
  38. runCommand(exe, args);
  39. }
  40. }
  41. static public function run(args:Array<String>) {
  42. getCsDependencies();
  43. var compl = switch [ci, systemName] {
  44. case [TravisCI, "Linux"]:
  45. "-travis";
  46. case _:
  47. "";
  48. };
  49. for (fastcast in [[], ["-D", "fast_cast"]])
  50. for (noroot in [[], ["-D", "no_root"]])
  51. for (erasegenerics in [[], ["-D", "erase_generics"]])
  52. {
  53. var extras = fastcast.concat(erasegenerics).concat(noroot);
  54. runCommand("haxe", ['compile-cs$compl.hxml'].concat(extras));
  55. runCs("bin/cs/bin/TestMain-Debug.exe");
  56. runCommand("haxe", ['compile-cs-unsafe$compl.hxml'].concat(extras));
  57. runCs("bin/cs_unsafe/bin/TestMain-Debug.exe");
  58. }
  59. runCommand("haxe", ['compile-cs$compl.hxml','-dce','no']);
  60. runCs("bin/cs/bin/TestMain-Debug.exe");
  61. changeDirectory(sysDir);
  62. runCommand("haxe", ["compile-cs.hxml",'-D','fast_cast']);
  63. runCs("bin/cs/bin/Main-Debug.exe", []);
  64. // changeDirectory(threadsDir);
  65. // runCommand("haxe", ["build.hxml", "-cs", "export/cs"]);
  66. // runCs("export/cs/bin/Main.exe");
  67. changeDirectory(miscDir + "csTwoLibs");
  68. for (i in 1...5)
  69. {
  70. runCommand("haxe", ['compile-$i.hxml','-D','fast_cast']);
  71. runCs("bin/main/bin/Main.exe");
  72. }
  73. }
  74. }