From 2c55408317cf3c54c20d3aced2d122d7061f1a99 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 16 Feb 2006 09:04:13 +0000 Subject: [PATCH] Support for "-Xset:name=value,name=value,name=value". The name/value data is stored in a properties object in the world and is accessible through getExtraConfiguration(). This will enable easier tailoring of weaver/world behaviour since you wont need to add new X option processing for every little thing. Should possibly only be used for tuning parameters. --- .../org/aspectj/ajdt/ajc/BuildArgParser.java | 2 ++ .../internal/core/builder/AjBuildConfig.java | 8 +++++ .../internal/core/builder/AjBuildManager.java | 1 + .../core/builder/AjCompilerOptions.java | 2 ++ weaver/src/org/aspectj/weaver/World.java | 31 +++++++++++++++++++ 5 files changed, 44 insertions(+) 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 0ab150046..c11e1fc59 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 @@ -549,6 +549,8 @@ public class BuildArgParser extends Main { if (arg.endsWith(":compress")) { showWarning("-Xreweavable:compress is no longer available - reweavable is now default"); } + } else if (arg.startsWith("-Xset:")) { + buildConfig.setXconfigurationInfo(arg.substring(6)); } else if (arg.startsWith("-XnotReweavable")) { buildConfig.setXnotReweavable(true); } else if (arg.equals("-XnoInline")) { 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 70cd246c4..9bf4e865b 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 @@ -386,6 +386,7 @@ public class AjBuildConfig { if (!isXNotReweavable() && global.isXNotReweavable()) { setXnotReweavable(true); } + setXconfigurationInfo(global.getXconfigurationInfo()); } void join(Collection local, Collection global) { @@ -499,6 +500,13 @@ public class AjBuildConfig { options.xNotReweavable = b; } + public void setXconfigurationInfo(String info) { + options.xConfigurationInfo = info; + } + public String getXconfigurationInfo() { + return options.xConfigurationInfo; + } + public void setXHasMemberSupport(boolean enabled) { options.xHasMember = enabled; } 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 4e5230a91..526086446 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 @@ -625,6 +625,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc cp.addAll(buildConfig.getClasspath()); BcelWorld bcelWorld = new BcelWorld(cp, handler, null); bcelWorld.setBehaveInJava5Way(buildConfig.getBehaveInJava5Way()); + bcelWorld.performExtraConfiguration(buildConfig.getXconfigurationInfo()); bcelWorld.setTargetAspectjRuntimeLevel(buildConfig.getTargetAspectjRuntimeLevel()); bcelWorld.setOptionalJoinpoints(buildConfig.getXJoinpoints()); bcelWorld.setXnoInline(buildConfig.isXnoInline()); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java index 1519e462e..636772c00 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java @@ -79,6 +79,8 @@ public class AjCompilerOptions extends CompilerOptions { // Specifies the level of the aspectjrt.jar we are targetting public String targetAspectjRuntimeLevel = Constants.RUNTIME_LEVEL_DEFAULT; + public String xConfigurationInfo; + // these next four not exposed by IDEs public boolean generateModel = false; public boolean generateJavaDocsInModel = false; diff --git a/weaver/src/org/aspectj/weaver/World.java b/weaver/src/org/aspectj/weaver/World.java index 03ff28c3b..38c808c98 100644 --- a/weaver/src/org/aspectj/weaver/World.java +++ b/weaver/src/org/aspectj/weaver/World.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.WeakHashMap; import org.aspectj.asm.IHierarchy; @@ -89,6 +90,7 @@ public abstract class World implements Dump.INode { /** Flags for the new joinpoints that are 'optional' */ private boolean optionalJoinpoint_ArrayConstruction = false; // Command line flag: "arrayconstruction" + private Properties extraConfiguration = null; /** * A list of RuntimeExceptions containing full stack information for every @@ -656,6 +658,35 @@ public abstract class World implements Dump.INode { behaveInJava5Way = b; } + public void performExtraConfiguration(String config) { + if (config==null) return; + // Bunch of name value pairs to split + extraConfiguration = new Properties(); + int pos =-1; + while ((pos=config.indexOf(","))!=-1) { + String nvpair = config.substring(0,pos); + int pos2 = nvpair.indexOf("="); + if (pos2!=-1) { + String n = nvpair.substring(0,pos2); + String v = nvpair.substring(pos2+1); + extraConfiguration.setProperty(n,v); + } + config = config.substring(pos+1); + } + if (config.length()>0) { + int pos2 = config.indexOf("="); + if (pos2!=-1) { + String n = config.substring(0,pos2); + String v = config.substring(pos2+1); + extraConfiguration.setProperty(n,v); + } + } + } + + public Properties getExtraConfiguration() { + return extraConfiguration; + } + public boolean isInJava5Mode() { return behaveInJava5Way; } -- 2.39.5