build.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <project name="theme-aria" 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="-before-init-local">
  78. <property name="slice.extension" value="gif"/>
  79. </target>
  80. <!--regenerate the example page to pick up changes to relative path to packages-->
  81. <target name="-before-slice">
  82. <local name="replace.pattern"/>
  83. <local name="package.sass.example.dir"/>
  84. <local name="theme.html.content"/>
  85. <local name="ext.js.path"/>
  86. <local name="ext.js.path.detected"/>
  87. <local name="ext.js.path.exists"/>
  88. <local name="fwk.rel.path"/>
  89. <local name="fwk.rel.path.actual"/>
  90. <property name="replace.pattern"
  91. value="src=&quot;(.*/ext(.*)?.js)&quot;"/>
  92. <property name="package.sass.example.dir"
  93. value="${package.dir}/sass/example"/>
  94. <loadfile srcfile="${package.sass.example.dir}/theme.html"
  95. property="theme.html.content"/>
  96. <propertyregex property="ext.js.path"
  97. input="${theme.html.content}"
  98. regexp="${replace.pattern}"
  99. select="\1"
  100. casesensitive="false"/>
  101. <available file="${package.sass.example.dir}/${ext.js.path}"
  102. property="ext.js.path.exists"/>
  103. <if>
  104. <not>
  105. <isset property="ext.js.path.exists"/>
  106. </not>
  107. <then>
  108. <x-get-relative-path
  109. from="${package.sass.example.dir}"
  110. to="${framework.dir}"
  111. property="fwk.rel.path"
  112. />
  113. <available file="${package.sass.example.dir}/${fwk.rel.path}/extjs/ext-all-debug.js"
  114. property="sencha.is.sdk.repo"/>
  115. <if>
  116. <isset property="sencha.is.sdk.repo"/>
  117. <then>
  118. <property name="fwk.rel.path.actual" value="${fwk.rel.path}/extjs"/>
  119. </then>
  120. <else>
  121. <property name="fwk.rel.path.actual" value="${fwk.rel.path}"/>
  122. </else>
  123. </if>
  124. <property name="ext.js.path.detected"
  125. value="${fwk.rel.path.actual}/ext-all-debug.js"/>
  126. <echo>Updating theme.html reference '${ext.js.path}' to '${ext.js.path.detected}'</echo>
  127. <replace token="${ext.js.path}"
  128. value="${ext.js.path.detected}"
  129. file="${package.sass.example.dir}/theme.html"/>
  130. </then>
  131. </if>
  132. </target>
  133. <target name="-before-build">
  134. <if>
  135. <isset property="build.number"/>
  136. <then>
  137. <echo>Setting package version to ${build.number}</echo>
  138. <x-script-def name="x-update-version-number">
  139. <attribute name="jsonfile"/>
  140. <attribute name="version"/>
  141. <script src="${cmd.config.dir}/ant/JSON.js"/>
  142. <script src="${cmd.config.dir}/ant/ant-util.js"/>
  143. <![CDATA[
  144. var jsonFile = attributes.get("jsonfile"),
  145. ver = attributes.get("version") + '',
  146. config = readJson(jsonFile);
  147. config.version = ver;
  148. writeJson(jsonFile, config);
  149. ]]>
  150. </x-script-def>
  151. <x-update-version-number jsonfile="${package.dir}/package.json"
  152. version="${build.number}"/>
  153. </then>
  154. </if>
  155. </target>
  156. </project>