Reviewers: fabbott, Lex,
Description:
Remove the output from the link step before attempting to
write. Fixes a problem when the output has been set to
read only permissions.
Please review this at http://gwt-code-reviews.appspot.com/928801/show
Affected files:
M dev/core/src/com/google/gwt/dev/Link.java
Index: dev/core/src/com/google/gwt/dev/Link.java
===================================================================
--- dev/core/src/com/google/gwt/dev/Link.java (revision 8853)
+++ dev/core/src/com/google/gwt/dev/Link.java (working copy)
@@ -16,6 +16,7 @@
package com.google.gwt.dev;
import com.google.gwt.core.ext.TreeLogger;
+import com.google.gwt.core.ext.TreeLogger.Type;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.linker.Artifact;
import com.google.gwt.core.ext.linker.ArtifactSet;
@@ -189,6 +190,13 @@
PermutationResult permResult, File jarFile,
PrecompileOptions precompileOptions) throws
UnableToCompleteException {
try {
+ if (jarFile.exists()) {
+ boolean success = jarFile.delete();
+ if (!success) {
+ logger.log(Type.ERROR, "Linker output file " + jarFile.getName()
+ + " already exists and can't be deleted.");
+ }
+ }
JarOutputStream jar = new JarOutputStream(new
FileOutputStream(jarFile));
StandardLinkerContext linkerContext = new
StandardLinkerContext(logger,
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors