buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/PythonTask.java
equal
deleted
inserted
replaced
21 import java.io.FileWriter; |
21 import java.io.FileWriter; |
22 import java.io.IOException; |
22 import java.io.IOException; |
23 import java.io.PrintWriter; |
23 import java.io.PrintWriter; |
24 |
24 |
25 import org.apache.tools.ant.BuildException; |
25 import org.apache.tools.ant.BuildException; |
|
26 import org.apache.tools.ant.Project; |
26 import org.apache.tools.ant.Task; |
27 import org.apache.tools.ant.Task; |
27 import org.apache.tools.ant.taskdefs.ExecTask; |
28 import org.apache.tools.ant.taskdefs.ExecTask; |
28 import org.apache.tools.ant.types.Commandline; |
29 import org.apache.tools.ant.types.Commandline; |
29 |
30 |
30 /** |
31 /** |
151 execTask.setResultProperty(resultProperty); |
152 execTask.setResultProperty(resultProperty); |
152 execTask.setDir(dir); |
153 execTask.setDir(dir); |
153 execTask.setOutput(output); |
154 execTask.setOutput(output); |
154 try { |
155 try { |
155 execTask.execute(); |
156 execTask.execute(); |
156 } catch (BuildException t) { |
157 } catch (BuildException ex) { |
157 if (iFailonerror) |
158 if (iFailonerror) { |
158 throw new BuildException(t.getMessage()); |
159 throw new BuildException(ex.getMessage(), ex); |
159 else |
160 } else { |
160 log(t.getMessage(), 0); // MSG_ERR=0 |
161 log(ex.getMessage(), Project.MSG_ERR); |
|
162 } |
161 } |
163 } |
162 } else if (iText != null) { |
164 } else if (iText != null) { |
163 // Write the content of the script using Echo task |
165 // Write the content of the script using Echo task |
164 File tempfile = null; |
166 File tempfile = null; |
165 try { |
167 try { |
186 // Delete temporary script file |
188 // Delete temporary script file |
187 boolean fileDeleted = tempfile.delete(); |
189 boolean fileDeleted = tempfile.delete(); |
188 if (!fileDeleted && iFailonerror) { |
190 if (!fileDeleted && iFailonerror) { |
189 throw new BuildException("Could not delete script file!"); |
191 throw new BuildException("Could not delete script file!"); |
190 } |
192 } |
191 } catch (IOException e) { |
193 } catch (IOException ex) { |
192 if (iFailonerror) { |
194 if (iFailonerror) { |
193 throw new BuildException(e.getMessage()); |
195 throw new BuildException(ex.getMessage(), ex); |
194 } |
196 } |
195 log("Error while running python task " + e.getMessage()); |
197 log("Error while running python task: " + ex.getMessage(), Project.MSG_ERR); |
196 } finally { |
198 } finally { |
197 // make sure we delete the file anyway |
199 // make sure we delete the file anyway |
198 if (tempfile != null) |
200 if (tempfile != null) { |
199 tempfile.delete(); |
201 tempfile.delete(); |
|
202 } |
200 } |
203 } |
201 } |
204 } |
202 } |
205 } |
203 |
206 |
204 } |
207 } |