From d5ea336dac0b484629f6453afcc7b271446732d4 Mon Sep 17 00:00:00 2001 From: mkersten Date: Wed, 23 Jul 2003 17:23:22 +0000 Subject: [PATCH] Fix for AJDT bug 40380. --- .../ajde/internal/CompilerAdapter.java | 26 +++++++++++-------- .../src/org/aspectj/ajdt/ajc/AjdtCommand.java | 4 +-- .../org/aspectj/ajdt/ajc/BuildArgParser.java | 21 ++++++++++++--- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java index 0722b425a..cbd31eb93 100644 --- a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java +++ b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java @@ -16,12 +16,22 @@ package org.aspectj.ajde.internal; +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; + import org.aspectj.ajde.Ajde; import org.aspectj.ajde.BuildOptionsAdapter; import org.aspectj.ajde.BuildProgressMonitor; import org.aspectj.ajde.ProjectPropertiesAdapter; import org.aspectj.ajde.TaskListManager; import org.aspectj.ajdt.ajc.AjdtCommand; +import org.aspectj.ajdt.ajc.BuildArgParser; import org.aspectj.ajdt.internal.core.builder.AjBuildConfig; import org.aspectj.ajdt.internal.core.builder.AjBuildManager; import org.aspectj.bridge.AbortException; @@ -34,15 +44,6 @@ import org.aspectj.util.LangUtil; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; - public class CompilerAdapter { private Map optionsMap; @@ -158,10 +159,13 @@ public class CompilerAdapter { String[] args = new String[] { "@" + config.getAbsolutePath() }; CountingMessageHandler counter = CountingMessageHandler.makeCountingMessageHandler(messageHandler); - AjBuildConfig local = AjdtCommand.genBuildConfig(args, counter); + BuildArgParser parser = new BuildArgParser(); + AjBuildConfig local = parser.genBuildConfig(args, counter, false); + if (counter.hasErrors()) { return null; - } + } + local.setConfigFile(config); // -- get globals, treat as defaults used if no local values diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/AjdtCommand.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/AjdtCommand.java index d1444a4e0..57c3de9d2 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/AjdtCommand.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/AjdtCommand.java @@ -120,7 +120,7 @@ public class AjdtCommand implements ICommand { } return false; } - + /** * This creates a build configuration for the arguments. * Errors reported to the handler: @@ -138,7 +138,7 @@ public class AjdtCommand implements ICommand { AjBuildConfig config = parser.genBuildConfig(args, handler); String message = parser.getOtherMessages(true); - if (null != message) { + if (null != message) { IMessage.Kind kind = inferKind(message); IMessage m = new Message(message, kind, null, null); handler.handleMessage(m); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java index 415d0a977..bcc220888 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java @@ -90,16 +90,29 @@ public class BuildArgParser extends Main { public BuildArgParser() { this(new StringPrintWriter(new StringWriter())); } - + + /** + * Generate build configuration for the input args, + * passing to handler any error messages. + * @param args the String[] arguments for the build configuration + * @param handler the IMessageHandler handler for any errors + * @return AjBuildConfig per args, + * which will be invalid unless there are no handler errors. + */ + public AjBuildConfig genBuildConfig(String[] args, IMessageHandler handler) { + return genBuildConfig(args, handler, true); + } + /** * Generate build configuration for the input args, * passing to handler any error messages. * @param args the String[] arguments for the build configuration * @param handler the IMessageHandler handler for any errors + * @param setClasspath determines if the classpath should be parsed and set on the build configuration * @return AjBuildConfig per args, * which will be invalid unless there are no handler errors. */ - public AjBuildConfig genBuildConfig(String[] args, IMessageHandler handler) { + public AjBuildConfig genBuildConfig(String[] args, IMessageHandler handler, boolean setClasspath) { AjBuildConfig buildConfig = new AjBuildConfig(); try { // sets filenames to be non-null in order to make sure that file paramters are ignored @@ -153,7 +166,9 @@ public class BuildArgParser extends Main { buildConfig.setOutputDir(new File(destinationPath)); } - buildConfig.setClasspath(getClasspath(parser)); + if (setClasspath) { + buildConfig.setClasspath(getClasspath(parser)); + } if (incrementalMode && (0 == buildConfig.getSourceRoots().size())) { -- 2.39.5