build.xml 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <project name="saas-operation" default=".help">
  3. <!-- Find and load Sencha Cmd ant tasks -->
  4. <script language="javascript">
  5. <![CDATA[
  6. var dir = project.getProperty("basedir"),
  7. cmdDir = project.getProperty("cmd.dir"),
  8. cmdLoaded = project.getReference("senchaloader");
  9. if (!cmdLoaded) {
  10. function echo(message, file) {
  11. var e = project.createTask("echo");
  12. e.setMessage(message);
  13. if (file) {
  14. e.setFile(file);
  15. }
  16. e.execute();
  17. };
  18. if (!cmdDir) {
  19. function exec(args) {
  20. var process = java.lang.Runtime.getRuntime().exec(args),
  21. input = new java.io.BufferedReader(new java.io.InputStreamReader(process.getInputStream())),
  22. headerFound = false,
  23. line;
  24. while (line = input.readLine()) {
  25. line = line + '';
  26. java.lang.System.out.println(line);
  27. if (line.indexOf("Sencha Cmd") > -1) {
  28. headerFound = true;
  29. }
  30. else if (headerFound && !cmdDir) {
  31. cmdDir = line;
  32. project.setProperty("cmd.dir", cmdDir);
  33. }
  34. }
  35. process.waitFor();
  36. return !!cmdDir;
  37. }
  38. if (!exec(["sencha", "which"])) {
  39. var tmpFile = "tmp.sh";
  40. echo("source ~/.bash_profile; sencha " + whichArgs.join(" "), tmpFile);
  41. exec(["/bin/sh", tmpFile]);
  42. new java.io.File(tmpFile)['delete']();
  43. }
  44. }
  45. }
  46. if (cmdDir && !project.getTargets().containsKey("init-cmd")) {
  47. var importDir = project.getProperty("build-impl.dir") ||
  48. (cmdDir + "/ant/build/app/build-impl.xml");
  49. var importTask = project.createTask("import");
  50. importTask.setOwningTarget(self.getOwningTarget());
  51. importTask.setLocation(self.getLocation());
  52. importTask.setFile(importDir);
  53. importTask.execute();
  54. }
  55. ]]>
  56. </script>
  57. <!--
  58. The following targets can be provided to inject logic before and/or after key steps
  59. of the build process:
  60. The "init-local" target is used to initialize properties that may be personalized
  61. for the local machine.
  62. <target name="-before-init-local"/>
  63. <target name="-after-init-local"/>
  64. The "clean" target is used to clean build output from the build.dir.
  65. <target name="-before-clean"/>
  66. <target name="-after-clean"/>
  67. The general "init" target is used to initialize all other properties, including
  68. those provided by Sencha Cmd.
  69. <target name="-before-init"/>
  70. <target name="-after-init"/>
  71. The "page" target performs the call to Sencha Cmd to build the 'all-classes.js' file.
  72. <target name="-before-page"/>
  73. <target name="-after-page"/>
  74. The "build" target performs the call to Sencha Cmd to build the application.
  75. <target name="-before-build"/>
  76. <target name="-after-build"/>
  77. -->
  78. </project>