summaryrefslogtreecommitdiffstats
path: root/ajde/src
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 /ajde/src
parentb166a7e6163889eb951f82655f0f49bfc26a49f0 (diff)
downloadaspectj-40c0d949493e14806799cb4975135998b707c9f2.tar.gz
aspectj-40c0d949493e14806799cb4975135998b707c9f2.zip
progress on enh 101983 (allow separate output folders for separate source folders)
Diffstat (limited to 'ajde/src')
-rw-r--r--ajde/src/org/aspectj/ajde/OutputLocationManager.java47
-rw-r--r--ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java6
-rw-r--r--ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java6
-rw-r--r--ajde/src/org/aspectj/ajde/internal/OutputLocationAdapter.java35
4 files changed, 94 insertions, 0 deletions
diff --git a/ajde/src/org/aspectj/ajde/OutputLocationManager.java b/ajde/src/org/aspectj/ajde/OutputLocationManager.java
new file mode 100644
index 000000000..9a8c46d5f
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/OutputLocationManager.java
@@ -0,0 +1,47 @@
+/* *******************************************************************
+ * 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.ajde;
+
+import java.io.File;
+
+/**
+ * Interface to be implemented by clients that wish to control the output
+ * folder used to write the results of compiling individual source files.
+ * @author adrian colyer
+ *
+ */
+public interface OutputLocationManager {
+
+ /**
+ * 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/ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java b/ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java
index 19d08e4a3..b48c062bc 100644
--- a/ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java
+++ b/ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java
@@ -44,6 +44,12 @@ public interface ProjectPropertiesAdapter {
public String getClasspath();
public String getOutputPath();
+
+ /**
+ * A non-null OutputLocationManager takes precedence over getOutputPath...
+ * @return
+ */
+ public OutputLocationManager getOutputLocationManager();
// public String getAjcWorkingDir();
diff --git a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
index 47f1e32c9..9afe186a7 100644
--- a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
+++ b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
@@ -576,6 +576,12 @@ public class CompilerAdapter {
config.setOutputJar(new File( outJar ) );
}
}
+
+ // set compilation result destination manager if not set
+ if (config.getCompilationResultDestinationManager() == null &&
+ properties.getOutputLocationManager() != null) {
+ config.setCompilationResultDestinationManager(new OutputLocationAdapter(properties.getOutputLocationManager()));
+ }
join(config.getSourceRoots(), properties.getSourceRoots());
join(config.getInJars(), properties.getInJars());
diff --git a/ajde/src/org/aspectj/ajde/internal/OutputLocationAdapter.java b/ajde/src/org/aspectj/ajde/internal/OutputLocationAdapter.java
new file mode 100644
index 000000000..81c54b457
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/internal/OutputLocationAdapter.java
@@ -0,0 +1,35 @@
+/* *******************************************************************
+ * 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.ajde.internal;
+
+import java.io.File;
+
+import org.aspectj.ajde.OutputLocationManager;
+import org.aspectj.ajdt.internal.compiler.CompilationResultDestinationManager;
+
+public class OutputLocationAdapter implements CompilationResultDestinationManager {
+
+ private OutputLocationManager locationManager;
+
+ public OutputLocationAdapter(OutputLocationManager mgr) {
+ this.locationManager = mgr;
+ }
+
+ public File getOutputLocationForClass(String compilationUnitName) {
+ return this.locationManager.getOutputLocationForClass(compilationUnitName);
+ }
+
+ public File getOutputLocationForResource(String resourceName) {
+ return this.locationManager.getOutputLocationForResource(resourceName);
+ }
+
+}