|
Lines 12-17
Link Here
|
| 12 |
|
12 |
|
| 13 |
import java.io.*; |
13 |
import java.io.*; |
| 14 |
import java.util.*; |
14 |
import java.util.*; |
|
|
15 |
import org.eclipse.core.runtime.*; |
| 16 |
import org.eclipse.pde.internal.build.IPDEBuildConstants; |
| 15 |
|
17 |
|
| 16 |
/** |
18 |
/** |
| 17 |
* Class for producing Ant scripts. Contains convenience methods for creating the |
19 |
* Class for producing Ant scripts. Contains convenience methods for creating the |
|
Lines 20-40
Link Here
|
| 20 |
*/ |
22 |
*/ |
| 21 |
public class AntScript { |
23 |
public class AntScript { |
| 22 |
|
24 |
|
|
|
25 |
/** |
| 26 |
* Converts the specified task to a String. |
| 27 |
* @param task |
| 28 |
* @return a String reprecentation of an ITask. |
| 29 |
*/ |
| 30 |
public static String taskAsString(ITask task) throws CoreException { |
| 31 |
if (null == task) |
| 32 |
return null; |
| 33 |
|
| 34 |
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| 35 |
try { |
| 36 |
AntScript script = new AntScript(out, false); |
| 37 |
task.print(script); |
| 38 |
script.close(); |
| 39 |
return out.toString("UTF8"); //$NON-NLS-1$ |
| 40 |
} catch (IOException e) { |
| 41 |
String message = e.getMessage(); |
| 42 |
throw new CoreException(new Status(IStatus.ERROR, IPDEBuildConstants.PI_PDEBUILD, IPDEBuildConstants.EXCEPTION_WRITING_SCRIPT, message, null)); |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 23 |
protected OutputStream out; |
46 |
protected OutputStream out; |
| 24 |
protected PrintWriter output; |
47 |
protected PrintWriter output; |
| 25 |
protected final String XML_PROLOG = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$ |
48 |
protected final String XML_PROLOG = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$ |
|
|
49 |
|
| 26 |
protected int indent = 0; |
50 |
protected int indent = 0; |
| 27 |
|
51 |
|
| 28 |
/** |
52 |
/** |
| 29 |
* Constructor for the class. |
53 |
* Creates a new Ant script including the XML prolog <code><?xml ... ?></code>. |
| 30 |
* |
54 |
* |
| 31 |
* @param out the output stream to write the script to |
55 |
* @param out the output stream to write the script to |
| 32 |
* @throws IOException |
56 |
* @throws IOException |
| 33 |
*/ |
57 |
*/ |
| 34 |
public AntScript(OutputStream out) throws IOException { |
58 |
public AntScript(OutputStream out) throws IOException { |
|
|
59 |
this(out, true); |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Constructor for the class. |
| 64 |
* |
| 65 |
* @param out the output stream to write the script to |
| 66 |
* @param writeXMLProlog indicates if the XML prolog should be written |
| 67 |
* @throws IOException |
| 68 |
*/ |
| 69 |
public AntScript(OutputStream out, boolean writeXMLProlog) throws IOException { |
| 35 |
this.out = out; |
70 |
this.out = out; |
| 36 |
output = new PrintWriter(new OutputStreamWriter(out, "UTF8")); //$NON-NLS-1$ |
71 |
output = new PrintWriter(new OutputStreamWriter(out, "UTF8")); //$NON-NLS-1$ |
| 37 |
output.println(XML_PROLOG); |
72 |
if(writeXMLProlog) |
|
|
73 |
output.println(XML_PROLOG); |
| 38 |
} |
74 |
} |
| 39 |
|
75 |
|
| 40 |
/** |
76 |
/** |
|
Lines 53-58
Link Here
|
| 53 |
} |
89 |
} |
| 54 |
|
90 |
|
| 55 |
/** |
91 |
/** |
|
|
92 |
* Print the given char sequence to the Ant script. |
| 93 |
* |
| 94 |
* @param charSequence the char sequence to print |
| 95 |
*/ |
| 96 |
public void print(CharSequence charSequence) { |
| 97 |
output.print(charSequence.toString()); |
| 98 |
} |
| 99 |
|
| 100 |
/** |
| 101 |
* Print the given task to the Ant script. |
| 102 |
* |
| 103 |
* @param task the task to print |
| 104 |
*/ |
| 105 |
public void print(ITask task) { |
| 106 |
task.print(this); |
| 107 |
} |
| 108 |
|
| 109 |
/** |
| 110 |
* Print the given string to the Ant script. |
| 111 |
* |
| 112 |
* @param message |
| 113 |
*/ |
| 114 |
public void print(String message) { |
| 115 |
output.print(message); |
| 116 |
} |
| 117 |
|
| 118 |
/** |
| 56 |
* Print an <code>antcall</code> task to the script. This calls Ant on the given |
119 |
* Print an <code>antcall</code> task to the script. This calls Ant on the given |
| 57 |
* target which is located within the same build file. |
120 |
* target which is located within the same build file. |
| 58 |
* |
121 |
* |
|
Lines 81-133
Link Here
|
| 81 |
output.println("</antcall>"); //$NON-NLS-1$ |
144 |
output.println("</antcall>"); //$NON-NLS-1$ |
| 82 |
} |
145 |
} |
| 83 |
} |
146 |
} |
| 84 |
|
|
|
| 85 |
/** |
| 86 |
* Print a <code>jar</code> Ant task to this script. This jars together a group of |
| 87 |
* files into a single file. |
| 88 |
* |
| 89 |
* @param jarFile the destination file name |
| 90 |
* @param basedir the base directory |
| 91 |
*/ |
| 92 |
public void printJarTask(String jarFile, String basedir, String manifestAttribute) { |
| 93 |
printTab(); |
| 94 |
output.print("<jar"); //$NON-NLS-1$ |
| 95 |
printAttribute("destfile", jarFile, true); //$NON-NLS-1$ |
| 96 |
printAttribute("basedir", basedir, false); //$NON-NLS-1$ |
| 97 |
printAttribute("manifest", manifestAttribute, false); //$NON-NLS-1$ |
| 98 |
output.println("/>"); //$NON-NLS-1$ |
| 99 |
} |
| 100 |
|
| 101 |
/** |
| 102 |
* Print the <code>available</code> Ant task to this script. This task sets a property |
| 103 |
* value if the given file exists at runtime. |
| 104 |
* |
| 105 |
* @param property the property to set |
| 106 |
* @param file the file to look for |
| 107 |
*/ |
| 108 |
public void printAvailableTask(String property, String file) { |
| 109 |
printTab(); |
| 110 |
output.print("<available"); //$NON-NLS-1$ |
| 111 |
printAttribute("property", property, true); //$NON-NLS-1$ |
| 112 |
printAttribute("file", file, false); //$NON-NLS-1$ |
| 113 |
output.println("/>"); //$NON-NLS-1$ |
| 114 |
} |
| 115 |
|
| 116 |
/** |
| 117 |
* Print the <code>available</code> Ant task to this script. This task sets a property |
| 118 |
* to the given value if the given file exists at runtime. |
| 119 |
* |
| 120 |
* @param property the property to set |
| 121 |
* @param file the file to look for |
| 122 |
*/ |
| 123 |
public void printAvailableTask(String property, String file, String value){ |
| 124 |
printTab(); |
| 125 |
output.print("<available"); //$NON-NLS-1$ |
| 126 |
printAttribute("property", property, true); //$NON-NLS-1$ |
| 127 |
printAttribute("file", file, false); //$NON-NLS-1$ |
| 128 |
printAttribute("value", value, false); //$NON-NLS-1$ |
| 129 |
output.println("/>"); //$NON-NLS-1$ |
| 130 |
} |
| 131 |
|
147 |
|
| 132 |
/** |
148 |
/** |
| 133 |
* Print an <code>ant</code> task to this script. This calls Ant on the specified |
149 |
* Print an <code>ant</code> task to this script. This calls Ant on the specified |
|
Lines 144-150
Link Here
|
| 144 |
public void printAntTask(String antfile, String dir, String target, String outputParam, String inheritAll, Map properties ) { |
160 |
public void printAntTask(String antfile, String dir, String target, String outputParam, String inheritAll, Map properties ) { |
| 145 |
printAntTask(antfile, dir, target, outputParam, inheritAll, properties, null ); |
161 |
printAntTask(antfile, dir, target, outputParam, inheritAll, properties, null ); |
| 146 |
} |
162 |
} |
| 147 |
|
163 |
|
| 148 |
/** |
164 |
/** |
| 149 |
* Print an <code>ant</code> task to this script. This calls Ant on the specified |
165 |
* Print an <code>ant</code> task to this script. This calls Ant on the specified |
| 150 |
* target contained in the specified Ant file with the given parameters. |
166 |
* target contained in the specified Ant file with the given parameters. |
|
Lines 196-290
Link Here
|
| 196 |
output.println("</ant>"); //$NON-NLS-1$ |
212 |
output.println("</ant>"); //$NON-NLS-1$ |
| 197 |
} |
213 |
} |
| 198 |
} |
214 |
} |
| 199 |
|
|
|
| 200 |
public void printSubantTask(String antfile, String target, String buildpath, String failOnError, Map properties, Map references) { |
| 201 |
printTab(); |
| 202 |
output.print("<subant"); //$NON-NLS-1$ |
| 203 |
printAttribute("antfile", antfile, false); //$NON-NLS-1$ |
| 204 |
printAttribute("target", target, false); //$NON-NLS-1$ |
| 205 |
printAttribute("failonerror", failOnError, false); //$NON-NLS-1$ |
| 206 |
printAttribute("buildpath", buildpath, false); //$NON-NLS-1$ |
| 207 |
if (properties == null && references == null) |
| 208 |
output.println("/>"); //$NON-NLS-1$ |
| 209 |
else { |
| 210 |
output.println(">"); //$NON-NLS-1$ |
| 211 |
indent++; |
| 212 |
if( properties != null ) { |
| 213 |
Set entries = properties.entrySet(); |
| 214 |
for (Iterator iter = entries.iterator(); iter.hasNext();) { |
| 215 |
Map.Entry entry = (Map.Entry) iter.next(); |
| 216 |
printProperty((String) entry.getKey(), (String) entry.getValue()); |
| 217 |
} |
| 218 |
} |
| 219 |
if( references != null ){ |
| 220 |
Set entries = references.entrySet(); |
| 221 |
for (Iterator iter = entries.iterator(); iter.hasNext();) { |
| 222 |
Map.Entry entry = (Map.Entry) iter.next(); |
| 223 |
printTab(); |
| 224 |
print("<reference refid=\"" + (String)entry.getKey() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ |
| 225 |
if( entry.getValue() != null ){ |
| 226 |
print(" torefid=\"" + (String) entry.getValue() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ |
| 227 |
} |
| 228 |
print("/>"); //$NON-NLS-1$ |
| 229 |
println(); |
| 230 |
} |
| 231 |
} |
| 232 |
indent--; |
| 233 |
printTab(); |
| 234 |
output.println("</subant>"); //$NON-NLS-1$ |
| 235 |
} |
| 236 |
} |
| 237 |
/** |
| 238 |
* Print a <code>zip</code> task to this script. |
| 239 |
* |
| 240 |
* @param zipfile the destination file name |
| 241 |
* @param basedir the source directory to start the zip |
| 242 |
* @param filesOnly <code>true</code> if the resulting zip file should contain only files and not directories |
| 243 |
* @param update ndicates whether to update or overwrite the destination file if it already exists |
| 244 |
* @param fileSets the inclusion/exclusion rules to use when zipping |
| 245 |
*/ |
| 246 |
public void printZipTask(String zipfile, String basedir, boolean filesOnly, boolean update, FileSet[] fileSets) { |
| 247 |
printTab(); |
| 248 |
output.print("<zip"); //$NON-NLS-1$ |
| 249 |
printAttribute("destfile", zipfile, true); //$NON-NLS-1$ |
| 250 |
printAttribute("basedir", basedir, false); //$NON-NLS-1$ |
| 251 |
printAttribute("filesonly", filesOnly ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 252 |
printAttribute("whenempty", "skip", true); //$NON-NLS-1$//$NON-NLS-2$ |
| 253 |
printAttribute("update", update ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 254 |
if (fileSets == null) |
| 255 |
output.println("/>"); //$NON-NLS-1$ |
| 256 |
else { |
| 257 |
output.println(">"); //$NON-NLS-1$ |
| 258 |
indent++; |
| 259 |
for (int i = 0; i < fileSets.length; i++) |
| 260 |
if (fileSets[i] != null) |
| 261 |
fileSets[i].print(this); |
| 262 |
indent--; |
| 263 |
printTab(); |
| 264 |
output.println("</zip>"); //$NON-NLS-1$ |
| 265 |
} |
| 266 |
} |
| 267 |
|
| 268 |
public void printTarTask(String zipfile, String basedir, boolean filesOnly, boolean update, FileSet[] fileSets) { |
| 269 |
printTab(); |
| 270 |
output.print("<tar"); //$NON-NLS-1$ |
| 271 |
printAttribute("destfile", zipfile, true); //$NON-NLS-1$ |
| 272 |
printAttribute("basedir", basedir, false); //$NON-NLS-1$ |
| 273 |
printAttribute("compression", "gzip", true); //$NON-NLS-1$//$NON-NLS-2$ |
| 274 |
if (fileSets == null) |
| 275 |
output.println("/>"); //$NON-NLS-1$ |
| 276 |
else { |
| 277 |
output.println(">"); //$NON-NLS-1$ |
| 278 |
indent++; |
| 279 |
for (int i = 0; i < fileSets.length; i++) |
| 280 |
if (fileSets[i] != null) |
| 281 |
fileSets[i].print(this); |
| 282 |
indent--; |
| 283 |
printTab(); |
| 284 |
output.println("</tar>"); //$NON-NLS-1$ |
| 285 |
} |
| 286 |
} |
| 287 |
|
| 288 |
/** |
215 |
/** |
| 289 |
* Print an <code>arg</code> element to the Ant file. |
216 |
* Print an <code>arg</code> element to the Ant file. |
| 290 |
* |
217 |
* |
|
Lines 298-325
Link Here
|
| 298 |
} |
225 |
} |
| 299 |
|
226 |
|
| 300 |
/** |
227 |
/** |
| 301 |
* Print the given string to the Ant script. |
|
|
| 302 |
* |
| 303 |
* @param string the string to write to the file |
| 304 |
*/ |
| 305 |
public void printString(String string) { |
| 306 |
printTab(); |
| 307 |
output.println(string); |
| 308 |
} |
| 309 |
|
| 310 |
/** |
| 311 |
* Print the given comment to the Ant script. |
| 312 |
* |
| 313 |
* @param comment the comment to write out |
| 314 |
*/ |
| 315 |
public void printComment(String comment) { |
| 316 |
printTab(); |
| 317 |
output.print("<!-- "); //$NON-NLS-1$ |
| 318 |
output.print(comment); |
| 319 |
output.println(" -->"); //$NON-NLS-1$ |
| 320 |
} |
| 321 |
|
| 322 |
/** |
| 323 |
* Add the given name/value attribute pair to the script. Do not write the attribute |
228 |
* Add the given name/value attribute pair to the script. Do not write the attribute |
| 324 |
* if the value is <code>null</code> unless a <code>true</code> is specified |
229 |
* if the value is <code>null</code> unless a <code>true</code> is specified |
| 325 |
* indicating that it is mandatory. |
230 |
* indicating that it is mandatory. |
|
Lines 341-386
Link Here
|
| 341 |
} |
246 |
} |
| 342 |
|
247 |
|
| 343 |
/** |
248 |
/** |
| 344 |
* Print a <code>copy</code> task to the script. The source file is specified |
249 |
* Print the <code>available</code> Ant task to this script. This task sets a property |
| 345 |
* by the <code>file</code> parameter. The destination directory is specified by |
250 |
* value if the given file exists at runtime. |
| 346 |
* the <code>todir</code> parameter. |
251 |
* |
| 347 |
* @param file the source file |
252 |
* @param property the property to set |
| 348 |
* @param todir the destination directory |
253 |
* @param file the file to look for |
| 349 |
* @param fileSets the inclusion/exclusion rules to use when copying |
|
|
| 350 |
* @param overwrite TODO |
| 351 |
*/ |
254 |
*/ |
| 352 |
public void printCopyTask(String file, String todir, FileSet[] fileSets, boolean failOnError, boolean overwrite) { |
255 |
public void printAvailableTask(String property, String file) { |
| 353 |
printTab(); |
256 |
printTab(); |
| 354 |
output.print("<copy"); //$NON-NLS-1$ |
257 |
output.print("<available"); //$NON-NLS-1$ |
|
|
258 |
printAttribute("property", property, true); //$NON-NLS-1$ |
| 355 |
printAttribute("file", file, false); //$NON-NLS-1$ |
259 |
printAttribute("file", file, false); //$NON-NLS-1$ |
| 356 |
printAttribute("todir", todir, false); //$NON-NLS-1$ |
260 |
output.println("/>"); //$NON-NLS-1$ |
| 357 |
printAttribute("failonerror", failOnError ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
|
|
| 358 |
printAttribute("overwrite", overwrite ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 359 |
if (fileSets == null) |
| 360 |
output.println("/>"); //$NON-NLS-1$ |
| 361 |
else { |
| 362 |
output.println(">"); //$NON-NLS-1$ |
| 363 |
indent++; |
| 364 |
for (int i = 0; i < fileSets.length; i++) |
| 365 |
fileSets[i].print(this); |
| 366 |
indent--; |
| 367 |
printTab(); |
| 368 |
output.println("</copy>"); //$NON-NLS-1$ |
| 369 |
} |
| 370 |
} |
261 |
} |
| 371 |
|
262 |
|
| 372 |
public void printMoveTask(String todir, FileSet[] fileSets, boolean failOnError) { |
263 |
/** |
| 373 |
printTab(); |
264 |
* Print the <code>available</code> Ant task to this script. This task sets a property |
| 374 |
output.print("<move"); //$NON-NLS-1$ |
265 |
* to the given value if the given file exists at runtime. |
| 375 |
printAttribute("todir", todir, false); //$NON-NLS-1$ |
266 |
* |
| 376 |
printAttribute("failonerror", failOnError ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
267 |
* @param property the property to set |
| 377 |
output.println(">"); //$NON-NLS-1$ |
268 |
* @param file the file to look for |
| 378 |
indent++; |
269 |
*/ |
| 379 |
for (int i = 0; i < fileSets.length; i++) |
270 |
public void printAvailableTask(String property, String file, String value){ |
| 380 |
fileSets[i].print(this); |
|
|
| 381 |
indent--; |
| 382 |
printTab(); |
271 |
printTab(); |
| 383 |
output.println("</move>"); //$NON-NLS-1$ |
272 |
output.print("<available"); //$NON-NLS-1$ |
|
|
273 |
printAttribute("property", property, true); //$NON-NLS-1$ |
| 274 |
printAttribute("file", file, false); //$NON-NLS-1$ |
| 275 |
printAttribute("value", value, false); //$NON-NLS-1$ |
| 276 |
output.println("/>"); //$NON-NLS-1$ |
| 277 |
} |
| 278 |
|
| 279 |
/** |
| 280 |
* Print a <code>brand</code> task to the Ant script. |
| 281 |
* |
| 282 |
* @param root the location of the launcher to brand. |
| 283 |
* @param icons the list of icons to use in the branding |
| 284 |
* @param name the name of the resultant launcher |
| 285 |
*/ |
| 286 |
public void printBrandTask(String root, String icons, String name, String os) { |
| 287 |
printTab(); |
| 288 |
print("<eclipse.brand"); //$NON-NLS-1$ |
| 289 |
printAttribute("root", root, true); //$NON-NLS-1$ |
| 290 |
if (icons != null) |
| 291 |
printAttribute("icons", icons, true); //$NON-NLS-1$ |
| 292 |
printAttribute("name", name, true); //$NON-NLS-1$ |
| 293 |
printAttribute("os", os, true); //$NON-NLS-1$ |
| 294 |
println("/>"); //$NON-NLS-1$ |
| 295 |
} |
| 296 |
|
| 297 |
public void printChmod(String dir, String rights, String files) { |
| 298 |
printTab(); |
| 299 |
output.print("<chmod perm=\"" + rights + "\" "); //$NON-NLS-1$//$NON-NLS-2$ |
| 300 |
output.print("dir=\"" + dir + "\" "); //$NON-NLS-1$//$NON-NLS-2$ |
| 301 |
output.print("includes=\"" + files + "\" /> "); //$NON-NLS-1$ //$NON-NLS-2$ |
| 302 |
output.println(); |
| 303 |
} |
| 304 |
|
| 305 |
/** |
| 306 |
* Print the given comment to the Ant script. |
| 307 |
* |
| 308 |
* @param comment the comment to write out |
| 309 |
*/ |
| 310 |
public void printComment(String comment) { |
| 311 |
printTab(); |
| 312 |
output.print("<!-- "); //$NON-NLS-1$ |
| 313 |
output.print(comment); |
| 314 |
output.println(" -->"); //$NON-NLS-1$ |
| 315 |
} |
| 316 |
|
| 317 |
/** |
| 318 |
* Print a <code>Condition</code> task with isset test to the script |
| 319 |
* @param property name of the property to set |
| 320 |
* @param value value to set the property to |
| 321 |
* @param testProperty name of the property for the isset test |
| 322 |
*/ |
| 323 |
public void printConditionIsSet(String property, String value, String testProperty) { |
| 324 |
println("<condition property=\"" + property + "\" value=\"" + value + "\">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 325 |
indent++; |
| 326 |
println("<isset property=\"" + testProperty + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 327 |
indent--; |
| 328 |
printEndTag("condition"); //$NON-NLS-1$ |
| 329 |
} |
| 330 |
|
| 331 |
/** |
| 332 |
* Print a <code> eclipse.convertTask</code> task to the script. This task convert a file path to |
| 333 |
* an Eclipse resource or vice-versa. |
| 334 |
* |
| 335 |
* @param toConvert the entry to convert |
| 336 |
* @param propertyName the property where to store the result of the convertion |
| 337 |
* @param isEclipseResource true if toConvert refers to an eclipse resource. |
| 338 |
*/ |
| 339 |
public void printConvertPathTask(String toConvert, String propertyName, boolean isEclipseResource) { |
| 340 |
printTab(); |
| 341 |
output.print("<eclipse.convertPath"); //$NON-NLS-1$ |
| 342 |
if (isEclipseResource == false) |
| 343 |
printAttribute("fileSystemPath", toConvert, true); //$NON-NLS-1$ |
| 344 |
else |
| 345 |
printAttribute("resourcePath", toConvert, true); //$NON-NLS-1$ |
| 346 |
printAttribute("property", propertyName, true); //$NON-NLS-1$ |
| 347 |
output.println("/>"); //$NON-NLS-1$ |
| 384 |
} |
348 |
} |
| 385 |
|
349 |
|
| 386 |
/** |
350 |
/** |
|
Lines 400-405
Link Here
|
| 400 |
} |
364 |
} |
| 401 |
|
365 |
|
| 402 |
/** |
366 |
/** |
|
|
367 |
* Print a <code>copy</code> task to the script. The source file is specified |
| 368 |
* by the <code>file</code> parameter. The destination directory is specified by |
| 369 |
* the <code>todir</code> parameter. |
| 370 |
* @param file the source file |
| 371 |
* @param todir the destination directory |
| 372 |
* @param fileSets the inclusion/exclusion rules to use when copying |
| 373 |
* @param overwrite TODO |
| 374 |
*/ |
| 375 |
public void printCopyTask(String file, String todir, FileSet[] fileSets, boolean failOnError, boolean overwrite) { |
| 376 |
printTab(); |
| 377 |
output.print("<copy"); //$NON-NLS-1$ |
| 378 |
printAttribute("file", file, false); //$NON-NLS-1$ |
| 379 |
printAttribute("todir", todir, false); //$NON-NLS-1$ |
| 380 |
printAttribute("failonerror", failOnError ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 381 |
printAttribute("overwrite", overwrite ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 382 |
if (fileSets == null) |
| 383 |
output.println("/>"); //$NON-NLS-1$ |
| 384 |
else { |
| 385 |
output.println(">"); //$NON-NLS-1$ |
| 386 |
indent++; |
| 387 |
for (int i = 0; i < fileSets.length; i++) |
| 388 |
fileSets[i].print(this); |
| 389 |
indent--; |
| 390 |
printTab(); |
| 391 |
output.println("</copy>"); //$NON-NLS-1$ |
| 392 |
} |
| 393 |
} |
| 394 |
|
| 395 |
/** |
| 396 |
* Print a <code>cvspass</code> task to the Ant script. |
| 397 |
* |
| 398 |
* @param cvsRoot the name of the repository |
| 399 |
* @param password the password |
| 400 |
* @param passFile the name of the password file |
| 401 |
*/ |
| 402 |
public void printCVSPassTask(String cvsRoot, String password, String passFile) { |
| 403 |
printTab(); |
| 404 |
output.print("<cvspass"); //$NON-NLS-1$ |
| 405 |
printAttribute("cvsRoot", cvsRoot, true); //$NON-NLS-1$ |
| 406 |
printAttribute("password", password, true); //$NON-NLS-1$ |
| 407 |
printAttribute("passfile", passFile, false); //$NON-NLS-1$ |
| 408 |
output.println("/>"); //$NON-NLS-1$ |
| 409 |
} |
| 410 |
|
| 411 |
/** |
| 412 |
* Print a <code>cvs</code> task to the Ant script. |
| 413 |
* |
| 414 |
* @param command the CVS command to run |
| 415 |
* @param cvsRoot value for the CVSROOT variable |
| 416 |
* @param dest the destination directory for the checked out resources |
| 417 |
* @param module the module name to check out |
| 418 |
* @param tag the tag of the module to check out |
| 419 |
* @param quiet whether or not to print informational messages to the output |
| 420 |
* @param passFile the name of the password file |
| 421 |
*/ |
| 422 |
public void printCVSTask(String command, String cvsRoot, String dest, String module, String tag, String quiet, String passFile) { |
| 423 |
printTab(); |
| 424 |
output.print("<cvs"); //$NON-NLS-1$ |
| 425 |
printAttribute("command", command, false); //$NON-NLS-1$ |
| 426 |
printAttribute("cvsRoot", cvsRoot, false); //$NON-NLS-1$ |
| 427 |
printAttribute("dest", dest, false); //$NON-NLS-1$ |
| 428 |
printAttribute("package", module, false); //$NON-NLS-1$ |
| 429 |
printAttribute("tag", tag, false); //$NON-NLS-1$ |
| 430 |
printAttribute("quiet", quiet, false); //$NON-NLS-1$ |
| 431 |
printAttribute("passfile", passFile, false); //$NON-NLS-1$ |
| 432 |
output.println("/>"); //$NON-NLS-1$ |
| 433 |
} |
| 434 |
|
| 435 |
/** |
| 403 |
* Print a <code>delete</code> task to the Ant script. At least one of <code>dir</code> |
436 |
* Print a <code>delete</code> task to the Ant script. At least one of <code>dir</code> |
| 404 |
* or <code>file</code> is required unless some <code>fileSets</code> are |
437 |
* or <code>file</code> is required unless some <code>fileSets</code> are |
| 405 |
* present. |
438 |
* present. |
|
Lines 427-432
Link Here
|
| 427 |
} |
460 |
} |
| 428 |
|
461 |
|
| 429 |
/** |
462 |
/** |
|
|
463 |
* Print a <code> dirname </code> task to the script. |
| 464 |
* @param property |
| 465 |
* @param file |
| 466 |
*/ |
| 467 |
public void printDirName(String property, String file) { |
| 468 |
printTab(); |
| 469 |
output.print("<dirname"); //$NON-NLS-1$ |
| 470 |
printAttribute("property", property, true); //$NON-NLS-1$ |
| 471 |
printAttribute("file", file, true); //$NON-NLS-1$ |
| 472 |
output.println("/>"); //$NON-NLS-1$ |
| 473 |
} |
| 474 |
|
| 475 |
/** |
| 476 |
* Print an <code>echo</code> task to the Ant script. |
| 477 |
* |
| 478 |
* @param message the message to echo to the output |
| 479 |
*/ |
| 480 |
public void printEchoTask(String message) { |
| 481 |
printTab(); |
| 482 |
output.print("<echo"); //$NON-NLS-1$ |
| 483 |
printAttribute("message", message, true); //$NON-NLS-1$ |
| 484 |
output.println("/>"); //$NON-NLS-1$ |
| 485 |
} |
| 486 |
|
| 487 |
/** |
| 488 |
* Print an end tag in the Ant script for the given element name. |
| 489 |
* |
| 490 |
* @param tag the name of the element |
| 491 |
*/ |
| 492 |
public void printEndTag(String tag) { |
| 493 |
printTab(); |
| 494 |
output.print("</"); //$NON-NLS-1$ |
| 495 |
output.print(tag); |
| 496 |
output.println(">"); //$NON-NLS-1$ |
| 497 |
} |
| 498 |
|
| 499 |
/** |
| 430 |
* Print an <code>exec</code> task to the Ant script. |
500 |
* Print an <code>exec</code> task to the Ant script. |
| 431 |
* |
501 |
* |
| 432 |
* @param executable the program to execute |
502 |
* @param executable the program to execute |
|
Lines 452-536
Link Here
|
| 452 |
} |
522 |
} |
| 453 |
} |
523 |
} |
| 454 |
|
524 |
|
|
|
525 |
public void printGet(String source, String destination, String login, String password, boolean usetimestamp) { |
| 526 |
printTab(); |
| 527 |
output.print("<get "); //$NON-NLS-1$ |
| 528 |
printAttribute("username", login, false); //$NON-NLS-1$ |
| 529 |
printAttribute("password", password, false); //$NON-NLS-1$ |
| 530 |
printAttribute("src", source, true); //$NON-NLS-1$ |
| 531 |
printAttribute("dest", destination, true); //$NON-NLS-1$ |
| 532 |
printAttribute("usetimestamp", usetimestamp ? "true" : null, false); //$NON-NLS-1$ //$NON-NLS-2$ |
| 533 |
output.println("/>"); //$NON-NLS-1$ |
| 534 |
} |
| 535 |
|
| 536 |
public void printGZip(String source, String destination) { |
| 537 |
printTab(); |
| 538 |
output.println("<gzip src=\"" + source + "\" zipfile=\"" + destination + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 539 |
} |
| 540 |
|
| 455 |
/** |
541 |
/** |
| 456 |
* Print a <code>mkdir</code> task to the Ant script. |
542 |
* Print a <code>jar</code> Ant task to this script. This jars together a group of |
|
|
543 |
* files into a single file. |
| 457 |
* |
544 |
* |
| 458 |
* @param dir the name of the directory to create. |
545 |
* @param jarFile the destination file name |
|
|
546 |
* @param basedir the base directory |
| 459 |
*/ |
547 |
*/ |
| 460 |
public void printMkdirTask(String dir) { |
548 |
public void printJarTask(String jarFile, String basedir, String manifestAttribute) { |
| 461 |
printTab(); |
549 |
printTab(); |
| 462 |
output.print("<mkdir"); //$NON-NLS-1$ |
550 |
output.print("<jar"); //$NON-NLS-1$ |
| 463 |
printAttribute("dir", dir, false); //$NON-NLS-1$ |
551 |
printAttribute("destfile", jarFile, true); //$NON-NLS-1$ |
|
|
552 |
printAttribute("basedir", basedir, false); //$NON-NLS-1$ |
| 553 |
printAttribute("manifest", manifestAttribute, false); //$NON-NLS-1$ |
| 464 |
output.println("/>"); //$NON-NLS-1$ |
554 |
output.println("/>"); //$NON-NLS-1$ |
| 465 |
} |
555 |
} |
| 466 |
|
556 |
|
| 467 |
/** |
557 |
/** |
| 468 |
* Print a <code>brand</code> task to the Ant script. |
558 |
* Print a carriage-return to the Ant script. |
| 469 |
* |
|
|
| 470 |
* @param root the location of the launcher to brand. |
| 471 |
* @param icons the list of icons to use in the branding |
| 472 |
* @param name the name of the resultant launcher |
| 473 |
*/ |
559 |
*/ |
| 474 |
public void printBrandTask(String root, String icons, String name, String os) { |
560 |
public void println() { |
| 475 |
printTab(); |
561 |
output.println(); |
| 476 |
print("<eclipse.brand"); //$NON-NLS-1$ |
|
|
| 477 |
printAttribute("root", root, true); //$NON-NLS-1$ |
| 478 |
if (icons != null) |
| 479 |
printAttribute("icons", icons, true); //$NON-NLS-1$ |
| 480 |
printAttribute("name", name, true); //$NON-NLS-1$ |
| 481 |
printAttribute("os", os, true); //$NON-NLS-1$ |
| 482 |
println("/>"); //$NON-NLS-1$ |
| 483 |
} |
562 |
} |
| 484 |
|
563 |
|
| 485 |
/** |
564 |
/** |
| 486 |
* Print an <code>echo</code> task to the Ant script. |
565 |
* Print the given string to the Ant script followed by a carriage-return. |
| 487 |
* |
566 |
* |
| 488 |
* @param message the message to echo to the output |
567 |
* @param message the string to print |
| 489 |
*/ |
568 |
*/ |
| 490 |
public void printEchoTask(String message) { |
569 |
public void println(String message) { |
| 491 |
printTab(); |
570 |
printTab(); |
| 492 |
output.print("<echo"); //$NON-NLS-1$ |
571 |
output.println(message); |
| 493 |
printAttribute("message", message, true); //$NON-NLS-1$ |
|
|
| 494 |
output.println("/>"); //$NON-NLS-1$ |
| 495 |
} |
572 |
} |
| 496 |
|
573 |
|
| 497 |
/** |
574 |
/** |
| 498 |
* Print a <code>cvs</code> task to the Ant script. |
575 |
* Print a <code>mkdir</code> task to the Ant script. |
| 499 |
* |
576 |
* |
| 500 |
* @param command the CVS command to run |
577 |
* @param dir the name of the directory to create. |
| 501 |
* @param cvsRoot value for the CVSROOT variable |
|
|
| 502 |
* @param dest the destination directory for the checked out resources |
| 503 |
* @param module the module name to check out |
| 504 |
* @param tag the tag of the module to check out |
| 505 |
* @param quiet whether or not to print informational messages to the output |
| 506 |
* @param passFile the name of the password file |
| 507 |
*/ |
578 |
*/ |
| 508 |
public void printCVSTask(String command, String cvsRoot, String dest, String module, String tag, String quiet, String passFile) { |
579 |
public void printMkdirTask(String dir) { |
| 509 |
printTab(); |
580 |
printTab(); |
| 510 |
output.print("<cvs"); //$NON-NLS-1$ |
581 |
output.print("<mkdir"); //$NON-NLS-1$ |
| 511 |
printAttribute("command", command, false); //$NON-NLS-1$ |
582 |
printAttribute("dir", dir, false); //$NON-NLS-1$ |
| 512 |
printAttribute("cvsRoot", cvsRoot, false); //$NON-NLS-1$ |
|
|
| 513 |
printAttribute("dest", dest, false); //$NON-NLS-1$ |
| 514 |
printAttribute("package", module, false); //$NON-NLS-1$ |
| 515 |
printAttribute("tag", tag, false); //$NON-NLS-1$ |
| 516 |
printAttribute("quiet", quiet, false); //$NON-NLS-1$ |
| 517 |
printAttribute("passfile", passFile, false); //$NON-NLS-1$ |
| 518 |
output.println("/>"); //$NON-NLS-1$ |
583 |
output.println("/>"); //$NON-NLS-1$ |
| 519 |
} |
584 |
} |
| 520 |
|
585 |
|
|
|
586 |
public void printMoveTask(String todir, FileSet[] fileSets, boolean failOnError) { |
| 587 |
printTab(); |
| 588 |
output.print("<move"); //$NON-NLS-1$ |
| 589 |
printAttribute("todir", todir, false); //$NON-NLS-1$ |
| 590 |
printAttribute("failonerror", failOnError ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 591 |
output.println(">"); //$NON-NLS-1$ |
| 592 |
indent++; |
| 593 |
for (int i = 0; i < fileSets.length; i++) |
| 594 |
fileSets[i].print(this); |
| 595 |
indent--; |
| 596 |
printTab(); |
| 597 |
output.println("</move>"); //$NON-NLS-1$ |
| 598 |
} |
| 599 |
|
| 521 |
/** |
600 |
/** |
| 522 |
* Print a <code>cvspass</code> task to the Ant script. |
601 |
* Print a <code>param</code> tag to the Ant script. |
| 523 |
* |
602 |
* |
| 524 |
* @param cvsRoot the name of the repository |
603 |
* @param name the parameter name |
| 525 |
* @param password the password |
604 |
* @param value the parameter value |
| 526 |
* @param passFile the name of the password file |
|
|
| 527 |
*/ |
605 |
*/ |
| 528 |
public void printCVSPassTask(String cvsRoot, String password, String passFile) { |
606 |
protected void printParam(String name, String value) { |
| 529 |
printTab(); |
607 |
printTab(); |
| 530 |
output.print("<cvspass"); //$NON-NLS-1$ |
608 |
output.print("<param"); //$NON-NLS-1$ |
| 531 |
printAttribute("cvsRoot", cvsRoot, true); //$NON-NLS-1$ |
609 |
printAttribute("name", name, true); //$NON-NLS-1$ |
| 532 |
printAttribute("password", password, true); //$NON-NLS-1$ |
610 |
printAttribute("value", value, true); //$NON-NLS-1$ |
| 533 |
printAttribute("passfile", passFile, false); //$NON-NLS-1$ |
|
|
| 534 |
output.println("/>"); //$NON-NLS-1$ |
611 |
output.println("/>"); //$NON-NLS-1$ |
| 535 |
} |
612 |
} |
| 536 |
|
613 |
|
|
Lines 564-583
Link Here
|
| 564 |
} |
641 |
} |
| 565 |
printEndTag(tag); |
642 |
printEndTag(tag); |
| 566 |
} |
643 |
} |
| 567 |
|
|
|
| 568 |
/** |
| 569 |
* Print a <code>param</code> tag to the Ant script. |
| 570 |
* |
| 571 |
* @param name the parameter name |
| 572 |
* @param value the parameter value |
| 573 |
*/ |
| 574 |
protected void printParam(String name, String value) { |
| 575 |
printTab(); |
| 576 |
output.print("<param"); //$NON-NLS-1$ |
| 577 |
printAttribute("name", name, true); //$NON-NLS-1$ |
| 578 |
printAttribute("value", value, true); //$NON-NLS-1$ |
| 579 |
output.println("/>"); //$NON-NLS-1$ |
| 580 |
} |
| 581 |
|
644 |
|
| 582 |
/** |
645 |
/** |
| 583 |
* Print a <code>project</code> tag to the Ant script. |
646 |
* Print a <code>project</code> tag to the Ant script. |
|
Lines 637-706
Link Here
|
| 637 |
} |
700 |
} |
| 638 |
|
701 |
|
| 639 |
/** |
702 |
/** |
| 640 |
* Print a start tag in the Ant script for the given element name. |
703 |
* Print a <code>eclipse.refreshLocal</code> task to the script. This task refreshes |
|
|
704 |
* the specified resource in the workspace, to the specified depth. |
| 641 |
* |
705 |
* |
| 642 |
* @param tag the name of the element |
706 |
* @param resource the resource to refresh |
|
|
707 |
* @param depth one of <code>IResource.DEPTH_ZERO</code>, |
| 708 |
* <code>IResource.DEPTH_ONE</code>, or <code>IResource.DEPTH_INFINITY</code> |
| 643 |
*/ |
709 |
*/ |
| 644 |
public void printStartTag(String tag) { |
710 |
public void printRefreshLocalTask(String resource, String depth) { |
| 645 |
printTab(); |
711 |
printTab(); |
| 646 |
output.print("<"); //$NON-NLS-1$ |
712 |
output.print("<eclipse.refreshLocal"); //$NON-NLS-1$ |
| 647 |
output.print(tag); |
713 |
printAttribute("resource", resource, true); //$NON-NLS-1$ |
| 648 |
output.println(">"); //$NON-NLS-1$ |
714 |
printAttribute("depth", depth, false); //$NON-NLS-1$ |
|
|
715 |
output.println("/>"); //$NON-NLS-1$ |
| 649 |
} |
716 |
} |
| 650 |
|
717 |
|
| 651 |
/** |
718 |
/** |
| 652 |
* Print an end tag in the Ant script for the given element name. |
719 |
* Print a start tag in the Ant script for the given element name. |
| 653 |
* |
720 |
* |
| 654 |
* @param tag the name of the element |
721 |
* @param tag the name of the element |
| 655 |
*/ |
722 |
*/ |
| 656 |
public void printEndTag(String tag) { |
723 |
public void printStartTag(String tag) { |
| 657 |
printTab(); |
724 |
printTab(); |
| 658 |
output.print("</"); //$NON-NLS-1$ |
725 |
output.print("<"); //$NON-NLS-1$ |
| 659 |
output.print(tag); |
726 |
output.print(tag); |
| 660 |
output.println(">"); //$NON-NLS-1$ |
727 |
output.println(">"); //$NON-NLS-1$ |
| 661 |
} |
728 |
} |
| 662 |
|
729 |
|
| 663 |
/** |
730 |
/** |
| 664 |
* Print the given number of tabs to the Ant script. |
|
|
| 665 |
*/ |
| 666 |
protected void printTab() { |
| 667 |
for (int i = 0; i < indent; i++) |
| 668 |
output.print("\t"); //$NON-NLS-1$ |
| 669 |
} |
| 670 |
|
| 671 |
/** |
| 672 |
* Print the given string to the Ant script followed by a carriage-return. |
| 673 |
* |
| 674 |
* @param message the string to print |
| 675 |
*/ |
| 676 |
public void println(String message) { |
| 677 |
printTab(); |
| 678 |
output.println(message); |
| 679 |
} |
| 680 |
|
| 681 |
/** |
| 682 |
* Print the given string to the Ant script. |
731 |
* Print the given string to the Ant script. |
| 683 |
* |
732 |
* |
| 684 |
* @param message |
733 |
* @param string the string to write to the file |
| 685 |
*/ |
734 |
*/ |
| 686 |
public void print(String message) { |
735 |
public void printString(String string) { |
| 687 |
output.print(message); |
736 |
printTab(); |
|
|
737 |
output.println(string); |
| 688 |
} |
738 |
} |
| 689 |
|
739 |
|
| 690 |
/** |
740 |
public void printSubantTask(String antfile, String target, String buildpath, String failOnError, Map properties, Map references) { |
| 691 |
* Print a carriage-return to the Ant script. |
741 |
printTab(); |
| 692 |
*/ |
742 |
output.print("<subant"); //$NON-NLS-1$ |
| 693 |
public void println() { |
743 |
printAttribute("antfile", antfile, false); //$NON-NLS-1$ |
| 694 |
output.println(); |
744 |
printAttribute("target", target, false); //$NON-NLS-1$ |
|
|
745 |
printAttribute("failonerror", failOnError, false); //$NON-NLS-1$ |
| 746 |
printAttribute("buildpath", buildpath, false); //$NON-NLS-1$ |
| 747 |
if (properties == null && references == null) |
| 748 |
output.println("/>"); //$NON-NLS-1$ |
| 749 |
else { |
| 750 |
output.println(">"); //$NON-NLS-1$ |
| 751 |
indent++; |
| 752 |
if( properties != null ) { |
| 753 |
Set entries = properties.entrySet(); |
| 754 |
for (Iterator iter = entries.iterator(); iter.hasNext();) { |
| 755 |
Map.Entry entry = (Map.Entry) iter.next(); |
| 756 |
printProperty((String) entry.getKey(), (String) entry.getValue()); |
| 757 |
} |
| 758 |
} |
| 759 |
if( references != null ){ |
| 760 |
Set entries = references.entrySet(); |
| 761 |
for (Iterator iter = entries.iterator(); iter.hasNext();) { |
| 762 |
Map.Entry entry = (Map.Entry) iter.next(); |
| 763 |
printTab(); |
| 764 |
print("<reference refid=\"" + (String)entry.getKey() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ |
| 765 |
if( entry.getValue() != null ){ |
| 766 |
print(" torefid=\"" + (String) entry.getValue() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ |
| 767 |
} |
| 768 |
print("/>"); //$NON-NLS-1$ |
| 769 |
println(); |
| 770 |
} |
| 771 |
} |
| 772 |
indent--; |
| 773 |
printTab(); |
| 774 |
output.println("</subant>"); //$NON-NLS-1$ |
| 775 |
} |
| 695 |
} |
776 |
} |
| 696 |
|
777 |
|
| 697 |
/** |
778 |
/** |
| 698 |
* Print the given task to the Ant script. |
779 |
* Print the given number of tabs to the Ant script. |
| 699 |
* |
|
|
| 700 |
* @param task the task to print |
| 701 |
*/ |
780 |
*/ |
| 702 |
public void print(ITask task) { |
781 |
protected void printTab() { |
| 703 |
task.print(this); |
782 |
for (int i = 0; i < indent; i++) |
|
|
783 |
output.print("\t"); //$NON-NLS-1$ |
| 704 |
} |
784 |
} |
| 705 |
|
785 |
|
| 706 |
/** |
786 |
/** |
|
Lines 732-821
Link Here
|
| 732 |
indent--; |
812 |
indent--; |
| 733 |
printEndTag("target"); //$NON-NLS-1$ |
813 |
printEndTag("target"); //$NON-NLS-1$ |
| 734 |
} |
814 |
} |
| 735 |
|
815 |
|
| 736 |
/** |
816 |
public void printTarTask(String zipfile, String basedir, boolean filesOnly, boolean update, FileSet[] fileSets) { |
| 737 |
* Print a <code>eclipse.refreshLocal</code> task to the script. This task refreshes |
|
|
| 738 |
* the specified resource in the workspace, to the specified depth. |
| 739 |
* |
| 740 |
* @param resource the resource to refresh |
| 741 |
* @param depth one of <code>IResource.DEPTH_ZERO</code>, |
| 742 |
* <code>IResource.DEPTH_ONE</code>, or <code>IResource.DEPTH_INFINITY</code> |
| 743 |
*/ |
| 744 |
public void printRefreshLocalTask(String resource, String depth) { |
| 745 |
printTab(); |
| 746 |
output.print("<eclipse.refreshLocal"); //$NON-NLS-1$ |
| 747 |
printAttribute("resource", resource, true); //$NON-NLS-1$ |
| 748 |
printAttribute("depth", depth, false); //$NON-NLS-1$ |
| 749 |
output.println("/>"); //$NON-NLS-1$ |
| 750 |
} |
| 751 |
|
| 752 |
public void printChmod(String dir, String rights, String files) { |
| 753 |
printTab(); |
| 754 |
output.print("<chmod perm=\"" + rights + "\" "); //$NON-NLS-1$//$NON-NLS-2$ |
| 755 |
output.print("dir=\"" + dir + "\" "); //$NON-NLS-1$//$NON-NLS-2$ |
| 756 |
output.print("includes=\"" + files + "\" /> "); //$NON-NLS-1$ //$NON-NLS-2$ |
| 757 |
output.println(); |
| 758 |
} |
| 759 |
|
| 760 |
public void printGet(String source, String destination, String login, String password, boolean usetimestamp) { |
| 761 |
printTab(); |
| 762 |
output.print("<get "); //$NON-NLS-1$ |
| 763 |
printAttribute("username", login, false); //$NON-NLS-1$ |
| 764 |
printAttribute("password", password, false); //$NON-NLS-1$ |
| 765 |
printAttribute("src", source, true); //$NON-NLS-1$ |
| 766 |
printAttribute("dest", destination, true); //$NON-NLS-1$ |
| 767 |
printAttribute("usetimestamp", usetimestamp ? "true" : null, false); //$NON-NLS-1$ //$NON-NLS-2$ |
| 768 |
output.println("/>"); //$NON-NLS-1$ |
| 769 |
} |
| 770 |
|
| 771 |
public void printGZip(String source, String destination) { |
| 772 |
printTab(); |
| 773 |
output.println("<gzip src=\"" + source + "\" zipfile=\"" + destination + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 774 |
} |
| 775 |
|
| 776 |
/** |
| 777 |
* Print a <code> eclipse.convertTask</code> task to the script. This task convert a file path to |
| 778 |
* an Eclipse resource or vice-versa. |
| 779 |
* |
| 780 |
* @param toConvert the entry to convert |
| 781 |
* @param propertyName the property where to store the result of the convertion |
| 782 |
* @param isEclipseResource true if toConvert refers to an eclipse resource. |
| 783 |
*/ |
| 784 |
public void printConvertPathTask(String toConvert, String propertyName, boolean isEclipseResource) { |
| 785 |
printTab(); |
817 |
printTab(); |
| 786 |
output.print("<eclipse.convertPath"); //$NON-NLS-1$ |
818 |
output.print("<tar"); //$NON-NLS-1$ |
| 787 |
if (isEclipseResource == false) |
819 |
printAttribute("destfile", zipfile, true); //$NON-NLS-1$ |
| 788 |
printAttribute("fileSystemPath", toConvert, true); //$NON-NLS-1$ |
820 |
printAttribute("basedir", basedir, false); //$NON-NLS-1$ |
| 789 |
else |
821 |
printAttribute("compression", "gzip", true); //$NON-NLS-1$//$NON-NLS-2$ |
| 790 |
printAttribute("resourcePath", toConvert, true); //$NON-NLS-1$ |
822 |
if (fileSets == null) |
| 791 |
printAttribute("property", propertyName, true); //$NON-NLS-1$ |
823 |
output.println("/>"); //$NON-NLS-1$ |
| 792 |
output.println("/>"); //$NON-NLS-1$ |
824 |
else { |
|
|
825 |
output.println(">"); //$NON-NLS-1$ |
| 826 |
indent++; |
| 827 |
for (int i = 0; i < fileSets.length; i++) |
| 828 |
if (fileSets[i] != null) |
| 829 |
fileSets[i].print(this); |
| 830 |
indent--; |
| 831 |
printTab(); |
| 832 |
output.println("</tar>"); //$NON-NLS-1$ |
| 833 |
} |
| 793 |
} |
834 |
} |
| 794 |
|
835 |
|
| 795 |
/** |
836 |
/** |
| 796 |
* Print a <code> dirname </code> task to the script. |
837 |
* Print a <code>zip</code> task to this script. |
| 797 |
* @param property |
838 |
* |
| 798 |
* @param file |
839 |
* @param zipfile the destination file name |
|
|
840 |
* @param basedir the source directory to start the zip |
| 841 |
* @param filesOnly <code>true</code> if the resulting zip file should contain only files and not directories |
| 842 |
* @param update ndicates whether to update or overwrite the destination file if it already exists |
| 843 |
* @param fileSets the inclusion/exclusion rules to use when zipping |
| 799 |
*/ |
844 |
*/ |
| 800 |
public void printDirName(String property, String file) { |
845 |
public void printZipTask(String zipfile, String basedir, boolean filesOnly, boolean update, FileSet[] fileSets) { |
| 801 |
printTab(); |
846 |
printTab(); |
| 802 |
output.print("<dirname"); //$NON-NLS-1$ |
847 |
output.print("<zip"); //$NON-NLS-1$ |
| 803 |
printAttribute("property", property, true); //$NON-NLS-1$ |
848 |
printAttribute("destfile", zipfile, true); //$NON-NLS-1$ |
| 804 |
printAttribute("file", file, true); //$NON-NLS-1$ |
849 |
printAttribute("basedir", basedir, false); //$NON-NLS-1$ |
| 805 |
output.println("/>"); //$NON-NLS-1$ |
850 |
printAttribute("filesonly", filesOnly ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 806 |
} |
851 |
printAttribute("whenempty", "skip", true); //$NON-NLS-1$//$NON-NLS-2$ |
| 807 |
|
852 |
printAttribute("update", update ? "true" : "false", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 808 |
/** |
853 |
if (fileSets == null) |
| 809 |
* Print a <code>Condition</code> task with isset test to the script |
854 |
output.println("/>"); //$NON-NLS-1$ |
| 810 |
* @param property name of the property to set |
855 |
else { |
| 811 |
* @param value value to set the property to |
856 |
output.println(">"); //$NON-NLS-1$ |
| 812 |
* @param testProperty name of the property for the isset test |
857 |
indent++; |
| 813 |
*/ |
858 |
for (int i = 0; i < fileSets.length; i++) |
| 814 |
public void printConditionIsSet(String property, String value, String testProperty) { |
859 |
if (fileSets[i] != null) |
| 815 |
println("<condition property=\"" + property + "\" value=\"" + value + "\">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
860 |
fileSets[i].print(this); |
| 816 |
indent++; |
861 |
indent--; |
| 817 |
println("<isset property=\"" + testProperty + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ |
862 |
printTab(); |
| 818 |
indent--; |
863 |
output.println("</zip>"); //$NON-NLS-1$ |
| 819 |
printEndTag("condition"); //$NON-NLS-1$ |
864 |
} |
| 820 |
} |
865 |
} |
| 821 |
} |
866 |
} |