aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-03-17 09:32:42 +0000
committeracolyer <acolyer>2004-03-17 09:32:42 +0000
commitbe76ce460676d1dbc75b95c32358412c4d5ed7f1 (patch)
tree3b4c357ba21f52f50c66ff9732720f7db883197c
parent17f57d3764cf1f12cbbd013d9c659994ed94617a (diff)
downloadaspectj-be76ce460676d1dbc75b95c32358412c4d5ed7f1.tar.gz
aspectj-be76ce460676d1dbc75b95c32358412c4d5ed7f1.zip
fix for Bugzilla Bug 54622
Incremental support ignores resources (part II) don't copy resources from in *dirs* doh.
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java27
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java2
2 files changed, 19 insertions, 10 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
index 0ee4c1a6d..6a6e0aa8f 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
@@ -45,6 +45,7 @@ import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
public class AjBuildManager implements IOutputClassFileNameProvider,ICompilerAdapterFactory {
private static final String CANT_WRITE_RESULT = "unable to write compilation result";
+ static final boolean COPY_INPATH_DIR_RESOURCES = false;
static final boolean FAIL_IF_RUNTIME_NOT_FOUND = false;
private IProgressListener progressListener = null;
@@ -238,7 +239,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider,ICompilerAda
for (Iterator i = buildConfig.getInpath().iterator(); i.hasNext(); ) {
File inPathElement = (File)i.next();
- if (inPathElement.isDirectory()) {
+ if (inPathElement.isDirectory()) {
copyResourcesFromDirectory(inPathElement);
} else {
copyResourcesFromJarFile(inPathElement);
@@ -248,8 +249,8 @@ public class AjBuildManager implements IOutputClassFileNameProvider,ICompilerAda
if (buildConfig.getSourcePathResources() != null) {
for (Iterator i = buildConfig.getSourcePathResources().keySet().iterator(); i.hasNext(); ) {
String resource = (String)i.next();
- copyResourcesFromFile((File)buildConfig.getSourcePathResources().get(resource),
- resource);
+ File from = (File)buildConfig.getSourcePathResources().get(resource);
+ copyResourcesFromFile(from,resource,from);
}
}
}
@@ -266,7 +267,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider,ICompilerAda
if (!entry.isDirectory() && acceptResource(filename)) {
byte[] bytes = FileUtil.readAsByteArray(inStream);
- writeResource(filename,bytes);
+ writeResource(filename,bytes,jarFile);
}
inStream.closeEntry();
@@ -277,6 +278,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider,ICompilerAda
}
private void copyResourcesFromDirectory(File dir) throws IOException {
+ if (!COPY_INPATH_DIR_RESOURCES) return;
// Get a list of all files (i.e. everything that isnt a directory)
File[] files = FileUtil.listFiles(dir,new FileFilter() {
public boolean accept(File f) {
@@ -291,11 +293,11 @@ public class AjBuildManager implements IOutputClassFileNameProvider,ICompilerAda
// or we are in trouble...
String filename = files[i].getAbsolutePath().substring(
dir.getAbsolutePath().length()+1);
- copyResourcesFromFile(files[i],filename);
+ copyResourcesFromFile(files[i],filename,dir);
}
}
- private void copyResourcesFromFile(File f,String filename) throws IOException {
+ private void copyResourcesFromFile(File f,String filename,File src) throws IOException {
if (!acceptResource(filename)) return;
FileInputStream fis = null;
try {
@@ -303,14 +305,21 @@ public class AjBuildManager implements IOutputClassFileNameProvider,ICompilerAda
byte[] bytes = FileUtil.readAsByteArray(fis);
// String relativePath = files[i].getPath();
- writeResource(filename,bytes);
+ writeResource(filename,bytes,src);
} finally {
if (fis != null) fis.close();
}
}
- private void writeResource(String filename, byte[] content) throws IOException {
- if (state.resources.contains(filename)) return;
+ private void writeResource(String filename, byte[] content, File srcLocation) throws IOException {
+ if (state.resources.contains(filename)) {
+ IMessage msg = new Message("duplicate resource: '" + filename + "'",
+ IMessage.WARNING,
+ null,
+ new SourceLocation(srcLocation,0));
+ handler.handleMessage(msg);
+ return;
+ }
if (zos != null) {
ZipEntry newEntry = new ZipEntry(filename); //??? get compression scheme right
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
index f37763901..a63847a06 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
@@ -172,7 +172,7 @@ public class AjState {
// with incremental compilation
for (Iterator i = buildConfig.getInpath().iterator(); i.hasNext(); ) {
File inPathElement = (File)i.next();
- if (inPathElement.isDirectory()) {
+ if (inPathElement.isDirectory() && AjBuildManager.COPY_INPATH_DIR_RESOURCES) {
deleteResourcesFromDirectory(inPathElement,oldResources);
}
}