public abstract class DevModeBase extends Object implements DoneCallback
Modifier and Type | Class and Description |
---|---|
protected static class |
DevModeBase.ArgHandlerCodeServerPort
Handles the -codeServerPort command line flag.
|
protected static class |
DevModeBase.ArgHandlerLogDir
Handles the -logdir command line option.
|
protected static class |
DevModeBase.ArgHandlerNoServerFlag
Runs a convenient embedded web server.
|
protected static class |
DevModeBase.ArgHandlerPort
Handles the -port command line flag.
|
protected static class |
DevModeBase.ArgHandlerRemoteUI
Handles the -remoteUI command line flag.
|
protected static class |
DevModeBase.ArgProcessor
The base dev mode argument processor.
|
protected static interface |
DevModeBase.HostedModeBaseOptions
Base options for dev mode.
|
protected static class |
DevModeBase.HostedModeBaseOptionsImpl
Concrete class to implement all hosted mode base options.
|
protected static interface |
DevModeBase.OptionCodeServerPort
Controls what port the code server listens on.
|
protected static interface |
DevModeBase.OptionLogDir
Controls whether and where to log data to file.
|
protected static interface |
DevModeBase.OptionNoServer
Controls whether to run a server or not.
|
protected static interface |
DevModeBase.OptionPort
Controls what port to use.
|
protected static interface |
DevModeBase.OptionRemoteUI
Controls the UI that should be used to display the dev mode server's data.
|
protected static interface |
DevModeBase.OptionStartupURLs
Controls the startup URLs.
|
class |
DevModeBase.UiBrowserWidgetHostImpl
Implementation of BrowserWidgetHost that supports the abstract UI
interface.
|
Modifier and Type | Field and Description |
---|---|
protected TreeLogger.Type |
baseLogLevelForUI |
protected BrowserWidgetHost |
browserHost |
protected CompilerContext |
compilerContext |
protected CompilerContext.Builder |
compilerContextBuilder |
protected String |
connectAddress |
protected boolean |
isHttps |
protected DevModeBase.HostedModeBaseOptions |
options |
protected DevModeUI |
ui |
Constructor and Description |
---|
DevModeBase() |
Modifier and Type | Method and Description |
---|---|
void |
addStartupURL(String url) |
protected long |
checkForUpdatesInterval()
Derived classes can override to lengthen ping delay.
|
protected abstract DevModeBase.HostedModeBaseOptions |
createOptions() |
protected ShellModuleSpaceHost |
doCreateShellModuleSpaceHost(TreeLogger logger,
CompilationState compilationState,
ModuleDef moduleDef)
Creates an instance of ShellModuleSpaceHost (or a derived class) using the
specified constituent parts.
|
protected abstract void |
doShutDownServer() |
protected boolean |
doSlowStartup()
Perform any slower startup tasks, such as loading modules.
|
protected abstract boolean |
doStartup() |
protected boolean |
doStartup(File persistentCacheDir)
Perform any startup tasks, including initializing the UI (if any) and the
logger, updates checker, and the development mode code server.
|
protected abstract int |
doStartUpServer() |
protected abstract void |
ensureCodeServerListener() |
TreeLogger.Type |
getBaseLogLevelForUI()
Gets the base log level recommended by the UI for INFO-level messages.
|
protected String |
getHost() |
int |
getPort() |
TreeLogger |
getTopLogger() |
protected void |
inferStartupUrls()
Add any plausible HTML files which might be used as startup URLs.
|
protected boolean |
isHeadless()
By default we will open the application window.
|
protected StandardLinkerContext |
link(TreeLogger logger,
ModuleDef module)
Perform an initial hosted mode link, without overwriting newer or
unmodified files in the output folder.
|
protected ModuleDef |
loadModule(TreeLogger logger,
String moduleName,
boolean refresh)
Load a module.
|
protected abstract URL |
makeStartupUrl(String url) |
static String |
normalizeURL(String unknownUrlText,
boolean isHttps,
int port,
String host) |
void |
onDone()
Callback for the UI to indicate it is done.
|
protected abstract void |
produceOutput(TreeLogger logger,
StandardLinkerContext linkerStack,
ArtifactSet artifacts,
ModuleDef module,
boolean isRelink) |
protected static String |
randomString()
Produce a random string that has low probability of collisions.
|
void |
run()
Sets up all the major aspects of running the shell graphically, including
creating the main window and optionally starting an embedded web server.
|
protected void |
setDone() |
protected void |
setHeadless(boolean headlessMode) |
void |
setPort(int port) |
void |
setRunTomcat(boolean run) |
protected void |
shutDown() |
protected boolean |
startUp() |
protected abstract void |
warnAboutNoStartupUrls()
Log a warning explaining that no startup URLs were specified and no
plausible startup URLs were found.
|
protected TreeLogger.Type baseLogLevelForUI
protected String connectAddress
protected boolean isHttps
protected final DevModeBase.HostedModeBaseOptions options
protected final CompilerContext.Builder compilerContextBuilder
protected CompilerContext compilerContext
protected DevModeUI ui
protected BrowserWidgetHost browserHost
public static String normalizeURL(String unknownUrlText, boolean isHttps, int port, String host)
protected static String randomString()
In this case, we use 16 characters, each drawn from a pool of 94, so the number of possible values is 94^16, leading to an expected number of values used before a collision occurs as sqrt(pi/2) * 94^8 (treated the same as a birthday attack), or a little under 10^16.
This algorithm is also implemented in hosted.html, though it is not technically important that they match.
public final void addStartupURL(String url)
public TreeLogger.Type getBaseLogLevelForUI()
createUI()
has been called. Please
do not depend on this method, as it is subject to change.public final int getPort()
public TreeLogger getTopLogger()
public void onDone()
onDone
in interface DoneCallback
public final void run()
public final void setPort(int port)
public final void setRunTomcat(boolean run)
protected long checkForUpdatesInterval()
protected abstract DevModeBase.HostedModeBaseOptions createOptions()
protected final ShellModuleSpaceHost doCreateShellModuleSpaceHost(TreeLogger logger, CompilationState compilationState, ModuleDef moduleDef) throws UnableToCompleteException
logger
- TreeLogger to usecompilationState
- moduleDef
- UnableToCompleteException
protected abstract void doShutDownServer()
protected boolean doSlowStartup()
doStartup()
so that the UI can be updated as soon as possible
and the web server can be started earlier.protected abstract boolean doStartup()
protected boolean doStartup(File persistentCacheDir)
Subclasses that override this method should be careful what facilities are used before the super implementation is called.
protected abstract int doStartUpServer()
protected abstract void ensureCodeServerListener()
protected String getHost()
protected void inferStartupUrls()
options.addStartupUrl(url)
.protected final boolean isHeadless()
protected final StandardLinkerContext link(TreeLogger logger, ModuleDef module) throws UnableToCompleteException
logger
- the logger to usemodule
- the module to linkUnableToCompleteException
protected ModuleDef loadModule(TreeLogger logger, String moduleName, boolean refresh) throws UnableToCompleteException
logger
- TreeLogger to usemoduleName
- name of the module to loadrefresh
- if true
, refresh the module from diskUnableToCompleteException
protected abstract URL makeStartupUrl(String url) throws UnableToCompleteException
UnableToCompleteException
protected abstract void produceOutput(TreeLogger logger, StandardLinkerContext linkerStack, ArtifactSet artifacts, ModuleDef module, boolean isRelink) throws UnableToCompleteException
UnableToCompleteException
protected final void setDone()
protected final void setHeadless(boolean headlessMode)
protected final void shutDown()
protected final boolean startUp()
protected abstract void warnAboutNoStartupUrls()
Copyright © 2018. All rights reserved.