build.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <project name="locale" default=".help">
  3. <!--
  4. The build-impl.xml file imported here contains the guts of the build process. It is
  5. a great idea to read that file to understand how the process works, but it is best to
  6. limit your changes to this file.
  7. -->
  8. <script language="javascript">
  9. <![CDATA[
  10. var dir = project.getProperty("basedir"),
  11. cmdDir = project.getProperty("cmd.dir"),
  12. cmdLoaded = project.getReference("senchaloader");
  13. if (!cmdLoaded) {
  14. function echo(message, file) {
  15. var e = project.createTask("echo");
  16. e.setMessage(message);
  17. if (file) {
  18. e.setFile(file);
  19. }
  20. e.execute();
  21. };
  22. if (!cmdDir) {
  23. function exec(args) {
  24. var process = java.lang.Runtime.getRuntime().exec(args),
  25. input = new java.io.BufferedReader(new java.io.InputStreamReader(process.getInputStream())),
  26. headerFound = false,
  27. line;
  28. while (line = input.readLine()) {
  29. line = line + '';
  30. java.lang.System.out.println(line);
  31. if (line.indexOf("Sencha Cmd") > -1) {
  32. headerFound = true;
  33. }
  34. else if (headerFound && !cmdDir) {
  35. cmdDir = line;
  36. project.setProperty("cmd.dir", cmdDir);
  37. }
  38. }
  39. process.waitFor();
  40. return !!cmdDir;
  41. }
  42. if (!exec(["sencha", "which"])) {
  43. var tmpFile = "tmp.sh";
  44. echo("source ~/.bash_profile; sencha " + whichArgs.join(" "), tmpFile);
  45. exec(["/bin/sh", tmpFile]);
  46. new java.io.File(tmpFile)['delete']();
  47. }
  48. }
  49. }
  50. if (cmdDir && !project.getTargets().containsKey("init-cmd")) {
  51. var importTask = project.createTask("import");
  52. importTask.setOwningTarget(self.getOwningTarget());
  53. importTask.setLocation(self.getLocation());
  54. importTask.setFile(cmdDir + "/ant/build/package/build-impl.xml");
  55. importTask.execute();
  56. }
  57. ]]>
  58. </script>
  59. <!--
  60. The following targets can be provided to inject logic before and/or after key steps
  61. of the build process:
  62. The "init-local" target is used to initialize properties that may be personalized
  63. for the local machine.
  64. <target name="-before-init-local"/>
  65. <target name="-after-init-local"/>
  66. The "clean" target is used to clean build output from the build.dir.
  67. <target name="-before-clean"/>
  68. <target name="-after-clean"/>
  69. The general "init" target is used to initialize all other properties, including
  70. those provided by Sencha Cmd.
  71. <target name="-before-init"/>
  72. <target name="-after-init"/>
  73. The "build" target performs the call to Sencha Cmd to build the application.
  74. <target name="-before-build"/>
  75. <target name="-after-build"/>
  76. -->
  77. <target name="build" depends="init,build-all"/>
  78. <target name="build-all" depends="init,-build-all,pkg"/>
  79. <target name="-build-all">
  80. <for param="build.locale.dir">
  81. <dirset dir="${package.dir}/overrides" includes="*"/>
  82. <sequential>
  83. <local name="build.locale"/>
  84. <basename file="@{build.locale.dir}"
  85. property="build.locale"/>
  86. <echo>Building locale ${build.locale}</echo>
  87. <concat encoding="UTF-8" outputencoding="UTF-8" destfile="${build.dir}/${package.name}-${build.locale}-debug.js">
  88. <fileset dir="@{build.locale.dir}" includes="**/*.js"/>
  89. <filterchain>
  90. <deletecharacters chars="&#xFEFF;" />
  91. </filterchain>
  92. </concat>
  93. <x-compress-js srcfile="${build.dir}/${package.name}-${build.locale}-debug.js"
  94. outfile="${build.dir}/${package.name}-${build.locale}.js"/>
  95. <!--
  96. <ant antfile="${package.dir}/build.xml"
  97. inheritall="false"
  98. target="js"
  99. useNativeBasedir="true"
  100. inheritrefs="true">
  101. <property name="package.framework" value="ext"/>
  102. <property name="cmd.dir" value="${cmd.dir}"/>
  103. <property name="compiler.ref.id"
  104. value="${compiler.ref.id}-${build.locale}"/>
  105. <property name="package.locale" value="${build.locale}"/>
  106. <property name="build.name.prefix" value="${package.name}-${build.locale}"/>
  107. <property name="build.name.css.prefix" value="${package.name}-${build.locale}"/>
  108. </ant>
  109. -->
  110. </sequential>
  111. </for>
  112. </target>
  113. </project>