package aQute.bnd.build;

import java.io.File;
import java.util.Map;

import aQute.bnd.osgi.Processor;

public class Run extends Project {

	/**
	 * Create a Run that will be stand alone if it contains -standalone. In that
	 * case the given workspace is ignored. Otherwise, the workspace must be a
	 * valid workspace.
	 */
	public static Run createRun(Workspace workspace, File file) throws Exception {
		Processor processor;
		if (workspace != null) {
			Run run = new Run(workspace, file);
			if (run.getProperties()
				.get(STANDALONE) == null) {
				return run;
			}
			// -standalone specified
			processor = run;
		} else {
			processor = new Processor();
			processor.setProperties(file);
		}

		Workspace standaloneWorkspace = Workspace.createStandaloneWorkspace(processor, file.toURI());
		Run run = new Run(standaloneWorkspace, file);
		return run;
	}

	public Run(Workspace workspace, File projectDir, File propertiesFile) throws Exception {
		super(workspace, projectDir, propertiesFile);
	}

	public Run(Workspace workspace, File propertiesFile) throws Exception {
		super(workspace, propertiesFile == null ? null : propertiesFile.getParentFile(), propertiesFile);
	}

	@Override
	public void report(Map<String, Object> table) throws Exception {
		super.report(table, false);
	}

	@Override
	public String getName() {
		return getPropertiesFile().getName();
	}
}

@@ -30,19 +30,187 @@
 ort 
-java.io.Fil
+static java.lang.invoke.MethodType.methodType;%0A%0Aimport java.io.File;%0Aimport java.lang.invoke.MethodHandle;%0Aimport java.lang.invoke.MethodHandles;%0Aimport java.lang.invoke.MethodTyp
 e;%0Ai
@@ -263,16 +263,56 @@
 ocessor;
+%0Aimport aQute.lib.exceptions.Exceptions;
 %0A%0Apublic
@@ -354,212 +354,1364 @@
 %09 * 
-Create a Run that will be stand alone if it contains -standalone. In that%0A%09 * case the given workspace is ignored. Otherwise, the workspace must be a%0A%09 * valid workspace.%0A%09 */%0A%09public static Run createRun
+So far we have not included the resolver code inside bndlib. This means%0A%09 * that anybody inside bndlib cannot rely on the resolver code present.%0A%09 * However, we get more functions that take advantage of this tool. The%0A%09 * following code looks if the resolving counterpart of Run is present in%0A%09 * the classloader. Since this is a 1:1 replacement for this class, we try%0A%09 * to load the resolving Bndrun.%0A%09 */%0A%09private final static MethodHandle createBndrun;%0A%0A%09static %7B%0A%09%09MethodHandles.Lookup lookup = MethodHandles.publicLookup();%0A%09%09MethodType type = methodType(Run.class, Workspace.class, File.class);%0A%09%09MethodHandle handle = null;%0A%09%09try %7B%0A%09%09%09Class%3C?%3E clazz = Run.class.getClassLoader()%0A%09%09%09%09.loadClass(%22biz.aQute.resolve.Bndrun%22);%0A%09%09%09handle = lookup.findStatic(clazz, %22createBndrun%22, type);%0A%09%09%7D catch (Throwable e) %7B%0A%09%09%09handle = null;%0A%09%09%7D%0A%09%09createBndrun = handle;%0A%09%7D%0A%0A%09/**%0A%09 * Create a Run that will be stand alone if it contains -standalone. In that%0A%09 * case the given workspace is ignored. Otherwise, the workspace must be a%0A%09 * valid workspace.%0A%09 */%0A%09public static Run createRun(Workspace workspace, File file) throws Exception %7B%0A%09%09if (createBndrun == null)%0A%09%09%09return createRun0(workspace, file);%0A%0A%09%09try %7B%0A%09%09%09return (Run) createBndrun.invoke(workspace, file);%0A%09%09%7D catch (Throwable e) %7B%0A%09%09%09throw Exceptions.duck(e);%0A%09%09%7D%0A%09%7D%0A%0A%09private static Run createRun0
 (Wor

Make Bndrun instead of Run the default when calling Run.createRun