Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessor.java')
-rw-r--r--bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessor.java41
1 files changed, 23 insertions, 18 deletions
diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessor.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessor.java
index 235915696..5e6ec83e9 100644
--- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessor.java
+++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/internal/provisional/equinox/p2/jarprocessor/JarProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 IBM Corporation and others.
+ * Copyright (c) 2006, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -256,11 +256,13 @@ public class JarProcessor {
return input;
}
- private void adjustInf(File input, Properties inf) {
+ private boolean adjustInf(File input, Properties inf) {
+ boolean adjusted = false;
for (Iterator iter = steps.iterator(); iter.hasNext();) {
IProcessStep step = (IProcessStep) iter.next();
- step.adjustInf(input, inf, containingInfs);
+ adjusted |= step.adjustInf(input, inf, containingInfs);
}
+ return adjusted;
}
public File processJar(File input) throws IOException {
@@ -307,25 +309,28 @@ public class JarProcessor {
Properties inf = Utils.getEclipseInf(workingFile, verbose);
extractEntries(jar, tempDir, replacements, inf);
+ boolean infAdjusted = false;
if (inf != null)
- adjustInf(workingFile, inf);
+ infAdjusted = adjustInf(workingFile, inf);
//Recreate the jar with replacements.
- //TODO: This is not strictly necessary if we didn't change the inf file and didn't change any content
- File tempJar = null;
- tempJar = new File(tempDir, workingFile.getName());
- File parent = tempJar.getParentFile();
- if (!parent.exists())
- parent.mkdirs();
- JarOutputStream jarOut = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(tempJar)));
- recreateJar(jar, jarOut, replacements, tempDir, inf);
-
- jar.close();
- if (tempJar != null) {
- if (!workingFile.equals(input)) {
- workingFile.delete();
+ //This is not strictly necessary if we didn't change the inf file and didn't change any content
+ if (!replacements.isEmpty() || infAdjusted) {
+ File tempJar = null;
+ tempJar = new File(tempDir, workingFile.getName());
+ File parent = tempJar.getParentFile();
+ if (!parent.exists())
+ parent.mkdirs();
+ JarOutputStream jarOut = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(tempJar)));
+ recreateJar(jar, jarOut, replacements, tempDir, inf);
+
+ jar.close();
+ if (tempJar != null) {
+ if (!workingFile.equals(input)) {
+ workingFile.delete();
+ }
+ workingFile = tempJar;
}
- workingFile = tempJar;
}
//post

Back to the top