4
4
using JetBrains . Lifetimes ;
5
5
using JetBrains . ProjectModel ;
6
6
using JetBrains . ProjectModel . Tasks ;
7
+ using JetBrains . ReSharper . Host . Features . BackgroundTasks ;
7
8
using JetBrains . ReSharper . Host . Features . Runtime ;
9
+ using JetBrains . ReSharper . Host . Features . Settings ;
8
10
using JetBrains . ReSharper . Plugins . Unity . ProjectModel ;
11
+ using JetBrains . Rider . Model . Notifications ;
9
12
using JetBrains . Util ;
10
13
11
14
namespace JetBrains . ReSharper . Plugins . Unity . Rider
@@ -14,9 +17,10 @@ namespace JetBrains.ReSharper.Plugins.Unity.Rider
14
17
public class MonoInstallTrigger
15
18
{
16
19
public MonoInstallTrigger ( Lifetime lifetime , ILogger logger , ISolutionLoadTasksScheduler scheduler ,
17
- ISolution solution , UnitySolutionTracker unitySolutionTracker , UnityHost host )
20
+ ISolution solution , UnitySolutionTracker unitySolutionTracker , UnityHost host ,
21
+ NotificationsModel notificationsModel )
18
22
{
19
- if ( PlatformUtil . RuntimePlatform != PlatformUtil . Platform . MacOsX )
23
+ if ( PlatformUtil . RuntimePlatform == PlatformUtil . Platform . Windows )
20
24
return ;
21
25
22
26
scheduler . EnqueueTask ( new SolutionLoadTask ( "Check mono runtime" , SolutionLoadTaskKinds . AfterDone , ( ) =>
@@ -51,10 +55,28 @@ public MonoInstallTrigger(Lifetime lifetime, ILogger logger, ISolutionLoadTasksS
51
55
return false ;
52
56
} ) ;
53
57
54
- if ( ! installedValidMono )
55
- {
58
+ if ( installedValidMono ) return ;
59
+
60
+ if ( PlatformUtil . RuntimePlatform == PlatformUtil . Platform . MacOsX )
56
61
solution . Locks . ExecuteOrQueue ( lifetime , "Show install mono dialog" ,
57
62
( ) => { host . PerformModelAction ( model => model . ShowInstallMonoDialog ( ) ) ; } ) ;
63
+ else if ( PlatformUtil . RuntimePlatform == PlatformUtil . Platform . Linux )
64
+ {
65
+ var notification = new NotificationModel ( "Mono 5.16+ is required." ,
66
+ "<html>Project requires new Mono with MSBuild for new C# language features support.<br>" +
67
+ RiderContextNotificationHelper . MakeOpenSettingsLink (
68
+ WellKnownSettingPages . Environment ,
69
+ "Install the latest Mono" )
70
+ + ".<br>" +
71
+ "If a Mono runtime is available in a non-standard location, please " +
72
+ RiderContextNotificationHelper . MakeOpenSettingsLink (
73
+ WellKnownSettingPages . ToolsetAndBuild ,
74
+ "specify the custom runtime location in settings" )
75
+ + ".</html>"
76
+
77
+ , true ,
78
+ RdNotificationEntryType . WARN ) ;
79
+ notificationsModel . Notification ( notification ) ;
58
80
}
59
81
} ) ;
60
82
} ) ) ;
0 commit comments