aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoracolyer <acolyer>2006-05-16 18:44:41 +0000
committeracolyer <acolyer>2006-05-16 18:44:41 +0000
commit40c0d949493e14806799cb4975135998b707c9f2 (patch)
tree100742686291e96c6fa6d074cf749e4b42b51a16 /org.aspectj.ajdt.core
parentb166a7e6163889eb951f82655f0f49bfc26a49f0 (diff)
downloadaspectj-40c0d949493e14806799cb4975135998b707c9f2.tar.gz
aspectj-40c0d949493e14806799cb4975135998b707c9f2.zip
progress on enh 101983 (allow separate output folders for separate source folders)
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java46
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java10
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java10
3 files changed, 65 insertions, 1 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java
new file mode 100644
index 000000000..9c544594f
--- /dev/null
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java
@@ -0,0 +1,46 @@
+/* *******************************************************************
+ * Copyright (c) 2006 Contributors.
+ * 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
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.ajdt.internal.compiler;
+
+import java.io.File;
+
+/**
+ * acts as a bridge from ajde's OutputLocationManager interface to the compiler internals
+ * @author adrian
+ *
+ */
+public interface CompilationResultDestinationManager {
+
+ /**
+ * Return the directory root under which the results of compiling the given
+ * source file. For example, if the source file contains the type a.b.C, and
+ * this method returns "target/classes" the resulting class file will be written
+ * to "target/classes/a/b/C.class"
+ *
+ * @param compilationUnitName the fully-qualified name of the compilation unit that has been
+ * compiled
+ * @return a File object representing the root directory under which compilation results for this
+ * unit should be written
+ */
+ File getOutputLocationForClass(String compilationUnitName);
+
+ /**
+ * When copying resources from source folders to output location, return the
+ * root directory under which the resource should be copied.
+ *
+ * @param resourceName the fully-qualified name of the resource to be copied
+ * @return a File object representing the root directory under which this resource
+ * should be copied
+ */
+ File getOutputLocationForResource(String resourceName);
+
+}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java
index 472180fd6..9e5f37b90 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java
@@ -25,6 +25,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.aspectj.ajdt.internal.compiler.CompilationResultDestinationManager;
import org.aspectj.util.FileUtil;
/**
@@ -43,6 +44,7 @@ public class AjBuildConfig {
private File outputDir;
private File outputJar;
private String outxmlName;
+ private CompilationResultDestinationManager compilationResultDestinationManager = null;
private List/*File*/ sourceRoots = new ArrayList();
private List/*File*/ files = new ArrayList();
private List /*File*/ binaryFiles = new ArrayList(); // .class files in indirs...
@@ -131,7 +133,15 @@ public class AjBuildConfig {
public File getOutputDir() {
return outputDir;
}
+
+ public CompilationResultDestinationManager getCompilationResultDestinationManager() {
+ return this.compilationResultDestinationManager;
+ }
+ public void setCompilationResultDestinationManager(CompilationResultDestinationManager mgr) {
+ this.compilationResultDestinationManager = mgr;
+ }
+
public void setFiles(List files) {
this.files = files;
}
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 7e6678278..a6fbe2970 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
@@ -501,8 +501,12 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
zos.write(content);
zos.closeEntry();
} else {
+ File destDir = buildConfig.getOutputDir();
+ if (buildConfig.getCompilationResultDestinationManager() != null) {
+ destDir = buildConfig.getCompilationResultDestinationManager().getOutputLocationForResource(srcLocation.getAbsolutePath());
+ }
OutputStream fos =
- FileUtil.makeOutputStream(new File(buildConfig.getOutputDir(),filename));
+ FileUtil.makeOutputStream(new File(destDir,filename));
fos.write(content);
fos.close();
}
@@ -940,6 +944,10 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
String filename)
throws IOException {
File destinationPath = buildConfig.getOutputDir();
+ if (buildConfig.getCompilationResultDestinationManager() != null) {
+ destinationPath =
+ buildConfig.getCompilationResultDestinationManager().getOutputLocationForClass(new String(unitResult.fileName));
+ }
String outFile;
if (destinationPath == null) {
outFile = new File(filename).getName();