@ -218,7 +218,7 @@ namespace Microsoft.Tye.Hosting
application . PopulateEnvironment ( service , ( k , v ) = > environment [ k ] = v ) ;
application . PopulateEnvironment ( service , ( k , v ) = > environment [ k ] = v ) ;
if ( _ options . DebugMode & & ( _ options . DebugAllServices | | _ options . ServicesToDebug ! . Contains ( serviceName , StringComparer . OrdinalIgnoreCase ) ) )
if ( _ options . ShouldDebugService ( serviceName ) )
{
{
environment [ "DOTNET_STARTUP_HOOKS" ] = typeof ( Hosting . Runtime . HostingRuntimeHelpers ) . Assembly . Location ;
environment [ "DOTNET_STARTUP_HOOKS" ] = typeof ( Hosting . Runtime . HostingRuntimeHelpers ) . Assembly . Location ;
}
}
@ -267,7 +267,7 @@ namespace Microsoft.Tye.Hosting
status . StoppingTokenSource = stoppingCts ;
status . StoppingTokenSource = stoppingCts ;
await using var _ = processInfo . StoppedTokenSource . Token . Register ( ( ) = > status . StoppingTokenSource . Cancel ( ) ) ;
await using var _ = processInfo . StoppedTokenSource . Token . Register ( ( ) = > status . StoppingTokenSource . Cancel ( ) ) ;
if ( ! _ options . Watch )
if ( ! _ options . Should WatchService ( serviceName ) )
{
{
service . Replicas [ replica ] = status ;
service . Replicas [ replica ] = status ;
service . ReplicaEvents . OnNext ( new ReplicaEvent ( ReplicaState . Added , status ) ) ;
service . ReplicaEvents . OnNext ( new ReplicaEvent ( ReplicaState . Added , status ) ) ;
@ -327,7 +327,7 @@ namespace Microsoft.Tye.Hosting
WriteReplicaToStore ( pid . ToString ( ) ) ;
WriteReplicaToStore ( pid . ToString ( ) ) ;
if ( _ options . Watch )
if ( _ options . Should WatchService ( serviceName ) )
{
{
// OnStart/OnStop will be called multiple times for watch.
// OnStart/OnStop will be called multiple times for watch.
// Watch will constantly be adding and removing from the list, so only add here for watch.
// Watch will constantly be adding and removing from the list, so only add here for watch.
@ -346,7 +346,7 @@ namespace Microsoft.Tye.Hosting
service . ReplicaEvents . OnNext ( new ReplicaEvent ( ReplicaState . Stopped , status ) ) ;
service . ReplicaEvents . OnNext ( new ReplicaEvent ( ReplicaState . Stopped , status ) ) ;
}
}
if ( ! _ options . Watch )
if ( ! _ options . Should WatchService ( serviceName ) )
{
{
// Only increase backoff when not watching project as watch will wait for file changes before rebuild.
// Only increase backoff when not watching project as watch will wait for file changes before rebuild.
backOff * = 2 ;
backOff * = 2 ;
@ -375,7 +375,7 @@ namespace Microsoft.Tye.Hosting
}
}
} ;
} ;
if ( _ options . Watch & & ( service . Description . RunInfo is ProjectRunInfo runInfo ) )
if ( _ options . Should WatchService ( serviceName ) & & ( service . Description . RunInfo is ProjectRunInfo runInfo ) )
{
{
var projectFile = runInfo . ProjectFile . FullName ;
var projectFile = runInfo . ProjectFile . FullName ;
var fileSetFactory = new MsBuildFileSetFactory ( _l ogger ,
var fileSetFactory = new MsBuildFileSetFactory ( _l ogger ,
@ -387,7 +387,7 @@ namespace Microsoft.Tye.Hosting
await new DotNetWatcher ( _l ogger )
await new DotNetWatcher ( _l ogger )
. WatchAsync ( processInfo , fileSetFactory , replica , status . StoppingTokenSource . Token ) ;
. WatchAsync ( processInfo , fileSetFactory , replica , status . StoppingTokenSource . Token ) ;
}
}
else if ( _ options . Watch & & ( service . Description . RunInfo is AzureFunctionRunInfo azureFunctionRunInfo ) & & ! string . IsNullOrEmpty ( azureFunctionRunInfo . ProjectFile ) )
else if ( _ options . Should WatchService ( serviceName ) & & ( service . Description . RunInfo is AzureFunctionRunInfo azureFunctionRunInfo ) & & ! string . IsNullOrEmpty ( azureFunctionRunInfo . ProjectFile ) )
{
{
var projectFile = azureFunctionRunInfo . ProjectFile ;
var projectFile = azureFunctionRunInfo . ProjectFile ;
var fileSetFactory = new MsBuildFileSetFactory ( _l ogger ,
var fileSetFactory = new MsBuildFileSetFactory ( _l ogger ,
@ -408,7 +408,7 @@ namespace Microsoft.Tye.Hosting
{
{
_l ogger . LogError ( 0 , ex , "Failed to launch process for service {ServiceName}" , replica ) ;
_l ogger . LogError ( 0 , ex , "Failed to launch process for service {ServiceName}" , replica ) ;
if ( ! _ options . Watch )
if ( ! _ options . Should WatchService ( serviceName ) )
{
{
// Only increase backoff when not watching project as watch will wait for file changes before rebuild.
// Only increase backoff when not watching project as watch will wait for file changes before rebuild.
backOff * = 2 ;
backOff * = 2 ;