mirror of
https://github.com/sbt/sbt.git
synced 2026-09-02 02:57:21 +02:00
Add in the ability to launch non xsbti.AppMain classes.
* Deprecate old mainClass method on appProvider * Create entryPoint method which represnets class used to launch instead. * Create PlainApplication to wrap static `main` methods. Can return either Int, Exit or Unit. * Detect supported 'plain' classes via reflection. * Add new unit tests appropriate to the feature.
This commit is contained in:
committed by
Mark Harrah
parent
53b4edd79f
commit
b0f6f94839
@@ -8,13 +8,27 @@ public interface AppProvider
|
||||
public ScalaProvider scalaProvider();
|
||||
/** The ID of the application that will be created by 'newMain' or 'mainClass'.*/
|
||||
public ApplicationID id();
|
||||
|
||||
public ClassLoader loader();
|
||||
/** Loads the class for the entry point for the application given by 'id'. This method will return the same class
|
||||
* every invocation. That is, the ClassLoader is not recreated each call.*/
|
||||
/** The classloader used to load this application. */
|
||||
public ClassLoader loader();
|
||||
/** Loads the class for the entry point for the application given by 'id'.
|
||||
* This method will return the same class every invocation.
|
||||
* That is, the ClassLoader is not recreated each call.
|
||||
* @deprecated("use entryPoint instead")
|
||||
*
|
||||
* Note: This will throw an exception if the launched application does not extend AppMain.
|
||||
*/
|
||||
@Deprecated
|
||||
public Class<? extends AppMain> mainClass();
|
||||
/** Loads the class for the entry point for the application given by 'id'.
|
||||
* This method will return the same class every invocation.
|
||||
* That is, the ClassLoader is not recreated each call.
|
||||
*/
|
||||
public Class<?> entryPoint();
|
||||
/** Creates a new instance of the entry point of the application given by 'id'.
|
||||
* It is guaranteed that newMain().getClass() == mainClass()*/
|
||||
* It is NOT guaranteed that newMain().getClass() == mainClass().
|
||||
* The sbt launcher can wrap generic static main methods. In this case, there will be a wrapper class,
|
||||
* and you must use the `entryPoint` method.
|
||||
*/
|
||||
public AppMain newMain();
|
||||
|
||||
/** The classpath from which the main class is loaded, excluding Scala jars.*/
|
||||
|
||||
Reference in New Issue
Block a user