|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<project name="ux-livesearch" default=".help"> |
| 3 | + |
| 4 | + <script language="javascript"> |
| 5 | + <![CDATA[ |
| 6 | + var dir = project.getProperty("basedir"), |
| 7 | + cmdDir = project.getProperty("cmd.dir"), |
| 8 | + cmdLoaded = project.getReference("senchaloader"); |
| 9 | +
|
| 10 | + if (!cmdLoaded) { |
| 11 | + function echo(message, file) { |
| 12 | + var e = project.createTask("echo"); |
| 13 | + e.setMessage(message); |
| 14 | + if (file) { |
| 15 | + e.setFile(file); |
| 16 | + } |
| 17 | + e.execute(); |
| 18 | + }; |
| 19 | +
|
| 20 | + if (!cmdDir) { |
| 21 | +
|
| 22 | + function exec(args) { |
| 23 | + var process = java.lang.Runtime.getRuntime().exec(args), |
| 24 | + input = new java.io.BufferedReader(new java.io.InputStreamReader(process.getInputStream())), |
| 25 | + headerFound = false, |
| 26 | + line; |
| 27 | +
|
| 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 | +
|
| 43 | + if (!exec(["sencha", "which"])) { |
| 44 | + var tmpFile = "tmp.sh"; |
| 45 | + echo("source ~/.bash_profile; sencha " + whichArgs.join(" "), tmpFile); |
| 46 | + exec(["/bin/sh", tmpFile]); |
| 47 | + new java.io.File(tmpFile)['delete'](); |
| 48 | + } |
| 49 | + } |
| 50 | + } |
| 51 | +
|
| 52 | + if (cmdDir && !project.getTargets().containsKey("init-cmd")) { |
| 53 | + var importDir = project.getProperty("build-impl.dir") || |
| 54 | + (cmdDir + "/ant/build/package/build-impl.xml"); |
| 55 | + var importTask = project.createTask("import"); |
| 56 | +
|
| 57 | + importTask.setOwningTarget(self.getOwningTarget()); |
| 58 | + importTask.setLocation(self.getLocation()); |
| 59 | + importTask.setFile(importDir); |
| 60 | + importTask.execute(); |
| 61 | + } |
| 62 | + ]]> |
| 63 | + </script> |
| 64 | + |
| 65 | + <!-- |
| 66 | + The following targets can be provided to inject logic before and/or after key steps |
| 67 | + of the build process: |
| 68 | +
|
| 69 | + The "init-local" target is used to initialize properties that may be personalized |
| 70 | + for the local machine. |
| 71 | +
|
| 72 | + <target name="-before-init-local"/> |
| 73 | + <target name="-after-init-local"/> |
| 74 | +
|
| 75 | + The "clean" target is used to clean build output from the build.dir. |
| 76 | +
|
| 77 | + <target name="-before-clean"/> |
| 78 | + <target name="-after-clean"/> |
| 79 | +
|
| 80 | + The general "init" target is used to initialize all other properties, including |
| 81 | + those provided by Sencha Cmd. |
| 82 | +
|
| 83 | + <target name="-before-init"/> |
| 84 | + <target name="-after-init"/> |
| 85 | +
|
| 86 | + The "build" target performs the call to Sencha Cmd to build the application. |
| 87 | +
|
| 88 | + <target name="-before-build"/> |
| 89 | + <target name="-after-build"/> |
| 90 | + --> |
| 91 | + |
| 92 | +</project> |
0 commit comments