build.xml 3.4 KB

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