Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@xamarin.com>2019-09-13 17:22:03 +0300
committerGitHub <noreply@github.com>2019-09-13 17:22:03 +0300
commit7e2f0f8a78cd0e50ee35e880f8bea0b559f1ae2e (patch)
tree49d1513449668f67444ebba6fae699dca67e35da /main/src/addins/MonoDevelop.DotNetCore
parent1f192022eadadc5f21039759ec947b940fd6cc66 (diff)
parentdc5c2147dd71a1674c623c1226d350ba4d63f6a0 (diff)
Merge pull request #8625 from mono/pr-add-netcore-runtime-component
[DotNetCore] Add .NET Core runtime "component"
Diffstat (limited to 'main/src/addins/MonoDevelop.DotNetCore')
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj1
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreRuntimeSystemInformation.cs92
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreSystemInformation.cs27
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/Properties/MonoDevelop.DotNetCore.addin.xml1
4 files changed, 98 insertions, 23 deletions
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj
index d2ca5f1927..bd5b74cc8f 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj
@@ -95,6 +95,7 @@
<Compile Include="MonoDevelop.DotNetCore.NodeBuilders\FrameworkReferenceNode.cs" />
<Compile Include="MonoDevelop.DotNetCore.NodeBuilders\FrameworkReferencesNode.cs" />
<Compile Include="MonoDevelop.DotNetCore.NodeBuilders\FrameworkReferencesNodeBuilder.cs" />
+ <Compile Include="MonoDevelop.DotNetCore\DotNetCoreRuntimeSystemInformation.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\external\mono-addins\Mono.Addins\Mono.Addins.csproj">
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreRuntimeSystemInformation.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreRuntimeSystemInformation.cs
new file mode 100644
index 0000000000..2598af4890
--- /dev/null
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreRuntimeSystemInformation.cs
@@ -0,0 +1,92 @@
+//
+// DotNetCoreRuntimeSystemInformation.cs
+//
+// Author:
+// Rodrigo Moya <rodrigo.moya@xamarin.com>
+//
+// Copyright (c) 2019 Microsoft (http://microsoft.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Linq;
+using System.Text;
+using MonoDevelop.Core;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Updater;
+
+namespace MonoDevelop.DotNetCore
+{
+ /// <summary>
+ /// Used to fetch a 2.2 runtime for Azure functions as
+ /// 3.0 and later currently don't work for this.
+ /// </summary>
+ sealed class DotNetCoreRuntimeSystemInformation : ProductInformationProvider
+ {
+ public override string Title => GettextCatalog.GetString (".NET Core Runtime");
+
+ public override string Description => GetDescription ();
+
+ public override string Version => version?.ToString ();
+
+ public override string ApplicationId => "392e9bd0-7214-4d2f-8b38-420b38e3b20f";
+
+ readonly DotNetCoreVersion version = DotNetCoreRuntime.Versions.FirstOrDefault (v => v.Major == 2 && v.Minor == 2);
+
+ public override UpdateInfo GetUpdateInfo ()
+ {
+ if (version != null) {
+ return new UpdateInfo (ApplicationId, version.Version);
+ }
+
+ if (DotNetCoreRuntime.IsInstalled)
+ // Force the install of the 2.2 runtime
+ return new UpdateInfo (ApplicationId, versionId: 0);
+ // Do not force it on users who never installed any dotnet cli and do not need it.
+ return null;
+ }
+
+ string GetDescription ()
+ {
+ var description = new StringBuilder ();
+
+ description.AppendLine (GettextCatalog.GetString ("Runtime: {0}", GetDotNetRuntimeLocation ()));
+ AppendDotNetCoreRuntimeVersions (description);
+
+ return description.ToString ();
+ }
+
+ static string GetDotNetRuntimeLocation ()
+ {
+ if (DotNetCoreRuntime.IsInstalled)
+ return DotNetCoreRuntime.FileName;
+
+ return DotNetCoreSystemInformation.GetNotInstalledString ();
+ }
+
+ static void AppendDotNetCoreRuntimeVersions (StringBuilder description)
+ {
+ DotNetCoreSystemInformation.AppendVersions (
+ description,
+ DotNetCoreRuntime.Versions,
+ version => GettextCatalog.GetString ("Runtime Version: {0}", version),
+ () => GettextCatalog.GetString ("Runtime Versions:"));
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreSystemInformation.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreSystemInformation.cs
index a20af45479..a43474f9cc 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreSystemInformation.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreSystemInformation.cs
@@ -33,9 +33,9 @@ using MonoDevelop.Ide.Updater;
namespace MonoDevelop.DotNetCore
{
- class DotNetCoreSystemInformation : ProductInformationProvider
+ sealed class DotNetCoreSystemInformation : ProductInformationProvider
{
- public override string Title => GettextCatalog.GetString (".NET Core");
+ public override string Title => GettextCatalog.GetString (".NET Core SDK");
public override string Description => GetDescription ();
@@ -102,8 +102,6 @@ namespace MonoDevelop.DotNetCore
{
var description = new StringBuilder ();
- description.AppendLine (GettextCatalog.GetString ("Runtime: {0}", GetDotNetRuntimeLocation ()));
- AppendDotNetCoreRuntimeVersions (description);
description.AppendLine (GettextCatalog.GetString ("SDK: {0}", GetDotNetSdkLocation ()));
AppendDotNetCoreSdkVersions (description);
description.AppendLine (GettextCatalog.GetString ("MSBuild SDKs: {0}", GetMSBuildSdksLocation ()));
@@ -111,15 +109,7 @@ namespace MonoDevelop.DotNetCore
return description.ToString ();
}
- static string GetDotNetRuntimeLocation ()
- {
- if (DotNetCoreRuntime.IsInstalled)
- return DotNetCoreRuntime.FileName;
-
- return GetNotInstalledString ();
- }
-
- static string GetNotInstalledString ()
+ internal static string GetNotInstalledString ()
{
return GettextCatalog.GetString ("Not installed");
}
@@ -143,15 +133,6 @@ namespace MonoDevelop.DotNetCore
return GetNotInstalledString ();
}
- static void AppendDotNetCoreRuntimeVersions (StringBuilder description)
- {
- AppendVersions (
- description,
- DotNetCoreRuntime.Versions,
- version => GettextCatalog.GetString ("Runtime Version: {0}", version),
- () => GettextCatalog.GetString ("Runtime Versions:"));
- }
-
static void AppendDotNetCoreSdkVersions (StringBuilder description)
{
AppendVersions (
@@ -161,7 +142,7 @@ namespace MonoDevelop.DotNetCore
() => GettextCatalog.GetString ("SDK Versions:"));
}
- static void AppendVersions (
+ internal static void AppendVersions (
StringBuilder description,
DotNetCoreVersion[] versions,
Func<DotNetCoreVersion, string> getSingleVersionString,
diff --git a/main/src/addins/MonoDevelop.DotNetCore/Properties/MonoDevelop.DotNetCore.addin.xml b/main/src/addins/MonoDevelop.DotNetCore/Properties/MonoDevelop.DotNetCore.addin.xml
index 46c9c0aa18..ca1ccdb0d6 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/Properties/MonoDevelop.DotNetCore.addin.xml
+++ b/main/src/addins/MonoDevelop.DotNetCore/Properties/MonoDevelop.DotNetCore.addin.xml
@@ -1265,6 +1265,7 @@
<Extension path="/MonoDevelop/Core/SystemInformation">
<Class class="MonoDevelop.DotNetCore.DotNetCoreSystemInformation" />
+ <Class class="MonoDevelop.DotNetCore.DotNetCoreRuntimeSystemInformation" />
</Extension>
<Extension path="/MonoDevelop/Ide/TemplateImages">