public void run ( RunConfiguration config ) throws AppEngineException { Preconditions . checkNotNull ( config ) ; Preconditions . checkNotNull ( config . getServices ( ) ) ; Preconditions . checkArgument ( config . getServices ( ) . size ( ) > 0 ) ; List < String > arguments = new ArrayList <> ( ) ; List < String > jvmArguments = new ArrayList <> ( ) ; arguments . addAll ( DevAppServerArgs . get ( "address" , config . getHost ( ) ) ) ; arguments . addAll ( DevAppServerArgs . get ( "port" , config . getPort ( ) ) ) ; if ( Boolean . TRUE . equals ( config . getAutomaticRestart ( ) ) ) { jvmArguments . add ( "-Dappengine.fullscan.seconds=1" ) ; } if ( config . getJvmFlags ( ) != null ) { jvmArguments . addAll ( config . getJvmFlags ( ) ) ; } arguments . addAll ( DevAppServerArgs . get ( "default_gcs_bucket" , config . getDefaultGcsBucketName ( ) ) ) ; arguments . addAll ( DevAppServerArgs . get ( "application" , config . getProjectId ( ) ) ) ; arguments . add ( "--allow_remote_shutdown" ) ; arguments . add ( "--disable_update_check" ) ; List < String > additionalArguments = config . getAdditionalArguments ( ) ; if ( additionalArguments != null ) { arguments . addAll ( additionalArguments ) ; } boolean isSandboxEnforced = isSandboxEnforced ( config . getServices ( ) ) ; if ( ! isSandboxEnforced ) { jvmArguments . add ( "-Duse_jetty9_runtime=true" ) ; jvmArguments . add ( "-D--enable_all_permissions=true" ) ; arguments . add ( "--no_java_agent" ) ; } else { // Add in the appengine agent String appengineAgentJar = sdk . getAppEngineSdkForJavaPath ( ) . resolve ( "agent/appengine-agent.jar" ) . toAbsolutePath ( ) . toString ( ) ; jvmArguments . add ( "-javaagent:" + appengineAgentJar ) ; } for ( Path service : config . getServices ( ) ) { arguments . add ( service . toString ( ) ) ; } Map < String , String > appEngineEnvironment = getAllAppEngineWebXmlEnvironmentVariables ( config . getServices ( ) ) ; if ( ! appEngineEnvironment . isEmpty ( ) ) { log . info ( "Setting appengine-web.xml configured environment variables: " + Joiner . on ( "," ) . withKeyValueSeparator ( "=" ) . join ( appEngineEnvironment ) ) ; } String gaeRuntime = getGaeRuntimeJava ( ! isSandboxEnforced ) ; appEngineEnvironment . putAll ( getLocalAppEngineEnvironmentVariables ( gaeRuntime ) ) ; Map < String , String > configEnvironment = config . getEnvironment ( ) ; if ( configEnvironment != null ) { appEngineEnvironment . putAll ( configEnvironment ) ; } try { Path workingDirectory = null ; if ( config . getServices ( ) . size ( ) == 1 ) { workingDirectory = config . getServices ( ) . get ( 0 ) ; } runner . run ( jvmArguments , arguments , appEngineEnvironment , workingDirectory ) ; } catch ( ProcessHandlerException | IOException ex ) { throw new AppEngineException ( ex ) ; } }
Starts the local development server synchronously or asynchronously .