Bug 433105 - Configure build paths for a target weaving scheme
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java
index aa670df..9f1a250 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/JDTLaunchingAdaptor.java
@@ -1,13 +1,12 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2008, 2010 Technical University Berlin, Germany.
+ * Copyright 2008, 2014 Technical University Berlin, Germany.
*
* 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://www.eclipse.org/legal/epl-v10.html
- * $Id: JDTLaunchingAdaptor.java 23456 2010-02-04 20:44:45Z stephan $
*
* Please visit http://www.eclipse.org/objectteams for updates and contact.
*
@@ -137,7 +136,7 @@
this.fAdaptor = null;
return;
}
- this.fAdaptor = new OTVMRunnerAdaptor();
+ this.fAdaptor = new OTVMRunnerAdaptor(getJavaProject(config));
this.fAdaptor.setAdaptationArgs(config, mode, launch);
// install OT-breakpoints
if (ILaunchManager.DEBUG_MODE.equals(mode))
diff --git a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTVMRunnerAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTVMRunnerAdaptor.java
index c7bdf18..9cdc767 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTVMRunnerAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug/src/org/eclipse/objectteams/otdt/debug/OTVMRunnerAdaptor.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2004, 2014 Fraunhofer Gesellschaft, Munich, Germany,
* for its Fraunhofer Institute for Computer Architecture and Software
* Technology (FIRST), Berlin, Germany and Technical University Berlin,
* Germany.
@@ -10,7 +10,6 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- * $Id$
*
* Please visit http://www.eclipse.org/objectteams for updates and contact.
*
@@ -24,9 +23,11 @@
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
@@ -34,9 +35,13 @@
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.objectteams.otdt.core.ext.OTDREContainer;
import org.eclipse.objectteams.otdt.core.ext.OTREContainer;
+import org.eclipse.objectteams.otdt.core.ext.WeavingScheme;
+import org.eclipse.objectteams.otdt.core.ext.OTJavaNature;
import org.eclipse.objectteams.otdt.debug.internal.TempFileManager;
@@ -51,12 +56,17 @@
private static final String OT_DEBUG_VMARG = "-Dot.debug";
private static final String OT_DEBUG_CALLIN_STEPPING_VMARG = "-Dot.debug.callin.stepping";
private static final String OT_TEAMCONFIG_VMARG = "-Dot.teamconfig";
- private static List<String> JPLIS_VMARGS;
+ private static Map<WeavingScheme,List<String>> JPLIS_VMARGS = new HashMap<WeavingScheme, List<String>>();
private ILaunchConfiguration _launchConfig;
private String _mode;
private ILaunch _launch;
-
+ private WeavingScheme weavingScheme;
+
+ public OTVMRunnerAdaptor(IJavaProject javaProject) {
+ this.weavingScheme = OTJavaNature.getWeavingScheme(javaProject);
+ }
+
/**
* Store the original arguments as passed to {@link ILaunchConfigurationDelegate#launch(ILaunchConfiguration, String, ILaunch, org.eclipse.core.runtime.IProgressMonitor)}
* @param configuration see first argument of {@link ILaunchConfigurationDelegate#launch(ILaunchConfiguration, String, ILaunch, org.eclipse.core.runtime.IProgressMonitor) launch(..)}
@@ -101,14 +111,23 @@
}
private List<String> getJplisVmargs() {
- if (JPLIS_VMARGS == null) {
- JPLIS_VMARGS = new ArrayList<String>();
- JPLIS_VMARGS.add("-Dot.otdt");
- JPLIS_VMARGS.add("-javaagent:" + "\""+OTREContainer.getOtreAgentJarPath().toOSString()+'"'); // support blanks in path
+ List<String> args = JPLIS_VMARGS.get(this.weavingScheme);
+ if (args == null) {
+ args = new ArrayList<String>();
+ args.add("-Dot.otdt");
+ switch (this.weavingScheme) {
+ case OTRE:
+ args.add("-javaagent:" + "\""+OTREContainer.getOtreAgentJarPath().toOSString()+'"'); // support blanks in path
+ break;
+ case OTDRE:
+ args.add("-javaagent:" + "\""+OTDREContainer.getOtreAgentJarPath().toOSString()+'"'); // support blanks in path
+ break;
+ }
+ JPLIS_VMARGS.put(this.weavingScheme, args);
}
- return JPLIS_VMARGS;
+ return args;
}
-
+
private String getCallinSteppingVMArg() {
String value = OTDebugPlugin.getDefault().getCallinSteppingConfig();
if (value == null) return null;
diff --git a/plugins/org.eclipse.objectteams.otdt/plugin.xml b/plugins/org.eclipse.objectteams.otdt/plugin.xml
index 262026e..9c8e591 100644
--- a/plugins/org.eclipse.objectteams.otdt/plugin.xml
+++ b/plugins/org.eclipse.objectteams.otdt/plugin.xml
@@ -49,6 +49,10 @@
<classpathContainerInitializer
id="OTRE"
class="org.eclipse.objectteams.otdt.internal.core.ext.OTREContainerInitializer"/>
+ <classpathContainerInitializer
+ class="org.eclipse.objectteams.otdt.internal.core.ext.OTDREContainerInitializer"
+ id="OTDRE">
+ </classpathContainerInitializer>
</extension>
<extension
point="org.eclipse.objectteams.otequinox.aspectBindings">
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTDREContainer.java b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTDREContainer.java
new file mode 100644
index 0000000..490a4ab
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTDREContainer.java
@@ -0,0 +1,150 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2014, GK Software AG, Germany.
+ *
+ * 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://www.eclipse.org/legal/epl-v10.html
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Stephan Herrmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.core.ext;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.objectteams.otdt.internal.core.ext.OTCoreExtMessages;
+import org.eclipse.objectteams.otdt.internal.core.ext.OTVariableInitializer;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * This class serves the "OTRE" classpath container.
+ * It also provides access to resolved paths for all OTRE-related jars.
+ * @since 2.3
+ */
+public class OTDREContainer implements IClasspathContainer
+{
+ /** Name of this classpath container, which hosts the full OTRE. */
+ public static final String CONTAINER_NAME = "OTDRE"; //$NON-NLS-1$
+
+ // these are served from the current plugin:
+ private static IPath OTRE_MIN_JAR_PATH;
+ private static IPath OTRE_AGENT_JAR_PATH;
+ private static IPath OTEQUINOX_AGENT_JAR_PATH;
+
+ public static IPath[] BYTECODE_LIBRARY_PATH; // will be initialized in {@link findBytecodeLib(BundleContext,boolean)}
+
+ // details of this container: name and hosting plugin:
+ static final IPath CONTAINER_PATH = new Path(CONTAINER_NAME);
+ static String OT_RUNTIME_PLUGIN = "org.eclipse.objectteams.otredyn"; //$NON-NLS-1$
+
+ // file names for the above OTRE_X_JAR_PATH constants:
+ private static final String OTRE_MIN_JAR_FILENAME = "otredyn_min.jar"; //$NON-NLS-1$
+ private static final String OTRE_AGENT_JAR_FILENAME = "otredyn_agent.jar"; //$NON-NLS-1$
+ private static final String OTEQUINOX_AGENT_JAR_FILENAME = "otequinoxAgent.jar"; //$NON-NLS-1$
+
+ // data for initializing the ASM_PATH:
+ private static final String[] ASM_BUNDLE_NAMES = { "org.objectweb.asm", "org.objectweb.asm.tree", "org.objectweb.asm.commons" }; //$NON-NLS-1$
+ private static final String ASM_VERSION_RANGE = "[5.0.1,6.0.0)"; //$NON-NLS-1$
+
+ private IClasspathEntry[] _cpEntries;
+
+ /**
+ * Return a an array of classpath entry representing the OTRE.
+ * @return a singleton array.
+ */
+ public IClasspathEntry[] getClasspathEntries()
+ {
+ if (_cpEntries == null)
+ {
+ IPath fullPath = new Path(OTVariableInitializer.getInstallatedPath(OTDTPlugin.getDefault(), OT_RUNTIME_PLUGIN, "bin")); //$NON-NLS-1$
+ _cpEntries = new IClasspathEntry[] {JavaCore.newLibraryEntry(fullPath, fullPath, new Path("/"))}; //$NON-NLS-1$
+ }
+
+ return _cpEntries;
+ }
+
+ /** Answer the text that describes the OTDRE container in the UI. */
+ public String getDescription()
+ {
+ return OTCoreExtMessages.OTDREContainer__Description;
+ }
+
+ /**
+ * Answer the kind of this classpath container, value = {@link IClasspathContainer#K_APPLICATION}.
+ */
+ public int getKind()
+ {
+ // don't mark as K_SYSTEM or K_SYSTEM_DEFAULT, which would prevent jdt.debug from adding this to the runtime classpath.
+ return IClasspathContainer.K_APPLICATION;
+ }
+
+ /**
+ * The name of this classpath container as a path, value = "OTDRE".
+ */
+ public IPath getPath()
+ {
+ return CONTAINER_PATH;
+ }
+
+ /**
+ * Answer the path of the "otredyn_min.jar" archive, which is placed on the bootclasspath when running OT/J programs.
+ * @return resolved path
+ */
+ public static IPath getOtreMinJarPath () {
+ if (OTRE_MIN_JAR_PATH == null)
+ OTRE_MIN_JAR_PATH = OTDTPlugin.getResolvedVariablePath(OTDTPlugin.OTDT_INSTALLDIR, "lib/"+OTRE_MIN_JAR_FILENAME); //$NON-NLS-1$
+ return OTRE_MIN_JAR_PATH;
+ }
+
+ /**
+ * Answer the path of the "otredyn_agent.jar" archive, which is passed as a -javaagent to the JVM.
+ * @return resolved path
+ */
+ public static IPath getOtreAgentJarPath() {
+ if (OTRE_AGENT_JAR_PATH == null)
+ OTRE_AGENT_JAR_PATH = OTDTPlugin.getResolvedVariablePath(OTDTPlugin.OTDT_INSTALLDIR, "lib/"+OTRE_AGENT_JAR_FILENAME); //$NON-NLS-1$
+ return OTRE_AGENT_JAR_PATH;
+ }
+
+ /**
+ * Answer the path of the "otequinoxAgent.jar" archive, which is passed as a -javaagent to the JVM for OT/Equinox debug launches.
+ * @return resolved path
+ */
+ public static IPath getOtequinoxAgentJarPath() {
+ if (OTEQUINOX_AGENT_JAR_PATH == null)
+ OTEQUINOX_AGENT_JAR_PATH = OTDTPlugin.getResolvedVariablePath(OTDTPlugin.OTDT_INSTALLDIR, "lib/"+OTEQUINOX_AGENT_JAR_FILENAME); //$NON-NLS-1$
+ return OTEQUINOX_AGENT_JAR_PATH;
+ }
+
+ /** Fetch the location of the asm bundle into BYTECODE_LIBRARY_PATH. */
+ @SuppressWarnings("deprecation") // class PackageAdmin is "deprectated"
+ static void findBytecodeLib(BundleContext context) throws IOException {
+ ServiceReference<org.osgi.service.packageadmin.PackageAdmin> ref =
+ (ServiceReference<org.osgi.service.packageadmin.PackageAdmin>) context.getServiceReference(org.osgi.service.packageadmin.PackageAdmin.class);
+ if (ref == null)
+ throw new IllegalStateException("Cannot connect to PackageAdmin"); //$NON-NLS-1$
+ org.osgi.service.packageadmin.PackageAdmin packageAdmin = context.getService(ref);
+ BYTECODE_LIBRARY_PATH = new IPath[ASM_BUNDLE_NAMES.length];
+ int i = 0;
+ for (String bundleName : ASM_BUNDLE_NAMES) {
+ for (Bundle bundle : packageAdmin.getBundles(bundleName, ASM_VERSION_RANGE)) {
+ BYTECODE_LIBRARY_PATH[i++] = new Path(FileLocator.toFileURL(bundle.getEntry("/")).getFile()); //$NON-NLS-1$
+ return;
+ }
+ }
+ throw new RuntimeException("bytecode libarary for OTDRE not found"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTDTPlugin.java b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTDTPlugin.java
index 8bb8311..3361f3b 100644
--- a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTDTPlugin.java
+++ b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTDTPlugin.java
@@ -10,7 +10,6 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- * $Id: OTDTPlugin.java 23427 2010-02-03 22:23:59Z stephan $
*
* Please visit http://www.eclipse.org/objectteams for updates and contact.
*
@@ -249,17 +248,9 @@
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
- try {
- // FIXME avoid global config but configure from CompilerOptions where needed
- String weavingProperty = System.getProperty("ot.weaving"); //$NON-NLS-1$
- boolean useDynamicWeaving;
- if (weavingProperty != null) {
- useDynamicWeaving = "dynamic".equals(weavingProperty);
- } else
- useDynamicWeaving = TransformerPlugin.useDynamicWeaving();
- OTREContainer.findBytecodeLib(context, useDynamicWeaving);
- if (useDynamicWeaving)
- OTREContainer.OT_RUNTIME_PLUGIN = "org.eclipse.objectteams.otredyn"; //$NON-NLS-1$
+ try {
+ OTREContainer.findBytecodeLib(context);
+ OTDREContainer.findBytecodeLib(context);
} catch (RuntimeException re) {
this.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, "Cannot initialize BCEL location", re)); //$NON-NLS-1$
}
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTJavaNature.java b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTJavaNature.java
index 18b91ca..6d9fd19 100644
--- a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTJavaNature.java
+++ b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTJavaNature.java
@@ -25,6 +25,7 @@
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.objectteams.otdt.core.OTModelManager;
@@ -131,6 +132,16 @@
return false;
}
+ public static WeavingScheme getWeavingScheme(IJavaProject javaProject) {
+ Object option = javaProject.getOption(JavaCore.COMPILER_OPT_WEAVING_SCHEME, true);
+ if (option instanceof String) {
+ WeavingScheme weavingScheme = WeavingScheme.valueOf((String) option);
+ if (weavingScheme != null)
+ return weavingScheme;
+ }
+ return WeavingScheme.OTRE;
+ }
+
private boolean contains(ICommand[] commands, String builderId) {
for (int i = 0; i < commands.length; i++)
if (commands[i].getBuilderName().equals(builderId))
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTREContainer.java b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTREContainer.java
index 50a2516..8d461ca 100644
--- a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTREContainer.java
+++ b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/OTREContainer.java
@@ -39,7 +39,6 @@
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
/**
* This class serves the "OTRE" classpath container.
@@ -67,13 +66,10 @@
private static final String OTRE_AGENT_JAR_FILENAME = "otre_agent.jar"; //$NON-NLS-1$
private static final String OTEQUINOX_AGENT_JAR_FILENAME = "otequinoxAgent.jar"; //$NON-NLS-1$
- // data for initializing the above BCEL_PATH:
+ // data for initializing the above BYTECODE_LIBRARY_PATH:
private static final String BCEL_BUNDLE_NAME = "org.apache.bcel"; //$NON-NLS-1$
private static final String BCEL_VERSION_RANGE = "[5.2.0,5.3.0)"; //$NON-NLS-1$
- private static final String[] ASM_BUNDLE_NAMES = { "org.objectweb.asm", "org.objectweb.asm.tree", "org.objectweb.asm.commons" }; //$NON-NLS-1$
- private static final String ASM_VERSION_RANGE = "[5.0.1,6.0.0)"; //$NON-NLS-1$
-
private IClasspathEntry[] _cpEntries;
/**
@@ -147,6 +143,7 @@
/**
* Adds the ObjectTeams classes to the given JavaProject's classpath,
* and ensures the Java compliance is >= 1.5
+ * Handles both variants, OTRE and OTDRE.
*/
public static void initializeOTJProject(IProject project) throws CoreException
{
@@ -179,7 +176,8 @@
private static boolean isOTREAlreadyInClasspath(IClasspathEntry[] classpath) {
for (int idx = 0; classpath != null && idx < classpath.length; idx++) {
IClasspathEntry entry = classpath[idx];
- if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER && entry.getPath().equals(OTRE_CONTAINER_PATH))
+ if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER &&
+ (entry.getPath().equals(OTRE_CONTAINER_PATH) || entry.getPath().equals(OTDREContainer.CONTAINER_PATH)))
return true;
}
@@ -196,7 +194,11 @@
System.arraycopy( classpath, 0, newClasspath, 0, classpath.length );
- newClasspath[classpath.length] = JavaCore.newContainerEntry(OTRE_CONTAINER_PATH, false);
+ IPath containerPath = OTRE_CONTAINER_PATH;
+ Object weavingOption = javaPrj.getOption(JavaCore.COMPILER_OPT_WEAVING_SCHEME, true);
+ if (WeavingScheme.OTDRE.toString().equals(weavingOption))
+ containerPath = OTDREContainer.CONTAINER_PATH;
+ newClasspath[classpath.length] = JavaCore.newContainerEntry(containerPath, false);
if (newClasspath[classpath.length] != null)
javaPrj.setRawClasspath( newClasspath, null );
@@ -209,31 +211,21 @@
null) );
}
- /** Fetch the location of the bcel or asm bundle into BCEL_PATH. */
- static void findBytecodeLib(BundleContext context, boolean useDynamicWeaving) throws IOException {
- ServiceReference<PackageAdmin> ref= (ServiceReference<PackageAdmin>) context.getServiceReference(PackageAdmin.class);
+ /** Fetch the location of the bcel bundle into BYTECODE_LIBRARY_PATH. */
+ @SuppressWarnings("deprecation") // class PackageAdmin is "deprecated"
+ static void findBytecodeLib(BundleContext context) throws IOException {
+ ServiceReference<org.osgi.service.packageadmin.PackageAdmin> ref =
+ (ServiceReference<org.osgi.service.packageadmin.PackageAdmin>) context.getServiceReference(org.osgi.service.packageadmin.PackageAdmin.class);
if (ref == null)
throw new IllegalStateException("Cannot connect to PackageAdmin"); //$NON-NLS-1$
- PackageAdmin packageAdmin = context.getService(ref);
- if (useDynamicWeaving) {
- BYTECODE_LIBRARY_PATH = new IPath[ASM_BUNDLE_NAMES.length];
- int i = 0;
- for (String bundleName : ASM_BUNDLE_NAMES) {
- for (Bundle bundle : packageAdmin.getBundles(bundleName, ASM_VERSION_RANGE)) {
- BYTECODE_LIBRARY_PATH[i++] = new Path(FileLocator.toFileURL(bundle.getEntry("/")).getFile()); //$NON-NLS-1$
- break;
- }
- }
+ org.osgi.service.packageadmin.PackageAdmin packageAdmin = context.getService(ref);
+ String bundleName = BCEL_BUNDLE_NAME;
+ String bundleVersionRange = BCEL_VERSION_RANGE;
+ for (Bundle bundle : packageAdmin.getBundles(bundleName, bundleVersionRange)) {
+ BYTECODE_LIBRARY_PATH = new IPath[] { new Path(FileLocator.toFileURL(bundle.getEntry("/")).getFile()) }; //$NON-NLS-1$
return;
- } else {
- String bundleName = BCEL_BUNDLE_NAME;
- String bundleVersionRange = BCEL_VERSION_RANGE;
- for (Bundle bundle : packageAdmin.getBundles(bundleName, bundleVersionRange)) {
- BYTECODE_LIBRARY_PATH = new IPath[] { new Path(FileLocator.toFileURL(bundle.getEntry("/")).getFile()) }; //$NON-NLS-1$
- return;
- }
}
- throw new RuntimeException("bytecode libarary not found, useDynamicWeaving="+useDynamicWeaving); //$NON-NLS-1$
+ throw new RuntimeException("bytecode libarary for OTRE not found"); //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/WeavingScheme.java b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/WeavingScheme.java
new file mode 100644
index 0000000..360448b
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/core/ext/WeavingScheme.java
@@ -0,0 +1,27 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2014, GK Software AG, Germany.
+ *
+ * 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://www.eclipse.org/legal/epl-v10.html
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Stephan Herrmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.core.ext;
+
+/**
+ * Select the target weaving scheme.
+ * @since 2.3
+ */
+public enum WeavingScheme {
+ /** Use the traditional "Object Teams Runtime Environment" based on BCEL. */
+ OTRE,
+ /** Use the newer "Object Teams Dynamic Runtime Environment" based on ASM and supporting runtime weaving. */
+ OTDRE;
+}
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/internal/core/ext/OTCoreExtMessages.java b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/internal/core/ext/OTCoreExtMessages.java
index 94045da..04d386f 100644
--- a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/internal/core/ext/OTCoreExtMessages.java
+++ b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/internal/core/ext/OTCoreExtMessages.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2003, 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2003, 2014 Fraunhofer Gesellschaft, Munich, Germany,
* for its Fraunhofer Institute for Computer Architecture and Software
* Technology (FIRST), Berlin, Germany and Technical University Berlin,
* Germany.
@@ -10,7 +10,6 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- * $Id: OTCoreExtMessages.java 23427 2010-02-03 22:23:59Z stephan $
*
* Please visit http://www.eclipse.org/objectteams for updates and contact.
*
@@ -26,6 +25,7 @@
private static final String BUNDLE_NAME = "org.eclipse.objectteams.otdt.internal.core.ext.OTCoreExtMessages"; //$NON-NLS-1$
public static String OTREContainer__Description;
+ public static String OTDREContainer__Description;
public static String OTREContainer_otre_not_found;
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/internal/core/ext/OTCoreExtMessages.properties b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/internal/core/ext/OTCoreExtMessages.properties
index 1295fb2..6ff5b9e 100644
--- a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/internal/core/ext/OTCoreExtMessages.properties
+++ b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/internal/core/ext/OTCoreExtMessages.properties
@@ -1,3 +1,4 @@
OTREContainer__Description=Object Teams Runtime Environment
+OTDREContainer__Description=Object Teams Dynamic Runtime Environment
OTREContainer_otre_not_found=Cannot setup Object Teams ClassPath -- maybe otre.jar not found?
AbstractMarkable_baseClassHierarchy_progress=base class hierarchy
diff --git a/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/internal/core/ext/OTDREContainerInitializer.java b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/internal/core/ext/OTDREContainerInitializer.java
new file mode 100644
index 0000000..70cd1a5
--- /dev/null
+++ b/plugins/org.eclipse.objectteams.otdt/src/org/eclipse/objectteams/otdt/internal/core/ext/OTDREContainerInitializer.java
@@ -0,0 +1,48 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2014, GK Software AG, Germany.
+ *
+ * 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://www.eclipse.org/legal/epl-v10.html
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Stephan Herrmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.internal.core.ext;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.objectteams.otdt.core.ext.OTDREContainer;
+
+/**
+ * This class creates the OTDREContainer. Installed from plugin.xml as an extension.
+ * @since 2.3
+ */
+public class OTDREContainerInitializer extends ClasspathContainerInitializer
+{
+
+ public OTDREContainerInitializer() {
+ super();
+ }
+
+ public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
+
+ if (containerPath == null || containerPath.isEmpty() || !containerPath.segment(0).equals(OTDREContainer.CONTAINER_NAME))
+ return;
+
+ JavaCore.setClasspathContainer(
+ containerPath,
+ new IJavaProject[] { project },
+ new IClasspathContainer[] { new OTDREContainer() },
+ null);
+ }
+}
diff --git a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/TransformerPlugin.java b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/TransformerPlugin.java
index dca4806..d6b5839 100644
--- a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/TransformerPlugin.java
+++ b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/TransformerPlugin.java
@@ -219,10 +219,6 @@
// TODO Auto-generated method stub
return false;
}
-
- public static boolean useDynamicWeaving() {
- return false;
- }
@Override
public boolean isAdaptedBasePlugin(String baseBundleName) {