diff options
Diffstat (limited to 'main/src/addins')
7 files changed, 189 insertions, 2 deletions
diff --git a/main/src/addins/MonoDevelop.AspNetCore/Properties/MonoDevelop.AspNetCore.addin.xml b/main/src/addins/MonoDevelop.AspNetCore/Properties/MonoDevelop.AspNetCore.addin.xml index f7ce13dbca..de087652c5 100644 --- a/main/src/addins/MonoDevelop.AspNetCore/Properties/MonoDevelop.AspNetCore.addin.xml +++ b/main/src/addins/MonoDevelop.AspNetCore/Properties/MonoDevelop.AspNetCore.addin.xml @@ -182,6 +182,19 @@ category="netcore/app/aspnet"
formatExclude="*.min.css|*.min.js|*.map"
defaultParameters="IncludeLaunchSettings=true" />
+ <Template
+ id="Microsoft.Web.Spa.Angular.CSharp"
+ templateId="Microsoft.DotNet.Web.Spa.ProjectTemplates.Angular.CSharp.3.0"
+ _overrideName="Angular"
+ _overrideDescription="A project template for creating an ASP.NET Core application with Angular"
+ path="${DotNetCoreSdk.3.0.Templates.Web.Spa.ProjectTemplates.nupkg}"
+ icon="md-netcore-empty-project"
+ imageId="md-netcore-empty-project"
+ wizard="MonoDevelop.DotNetCore.ProjectTemplateWizard"
+ condition="UseNetCore30=true"
+ category="netcore/app/aspnet"
+ formatExclude="*.min.css|*.min.js|*.map"
+ defaultParameters="IncludeLaunchSettings=true" />
</Condition>
<Condition id="AspNetCoreSdkInstalled" sdkVersion="2.2">
<Template
@@ -286,6 +299,19 @@ category="netcore/app/aspnet"
formatExclude="*.min.css|*.min.js|*.map"
defaultParameters="IncludeLaunchSettings=true" />
+ <Template
+ id="Microsoft.Web.Spa.Angular.CSharp"
+ templateId="Microsoft.DotNet.Web.Spa.ProjectTemplates.Angular.CSharp.2.2"
+ _overrideName="Angular"
+ _overrideDescription="A project template for creating an ASP.NET Core application with Angular"
+ path="${DotNetCoreSdk.2.2.Templates.Web.Spa.ProjectTemplates.nupkg}"
+ icon="md-netcore-empty-project"
+ imageId="md-netcore-empty-project"
+ wizard="MonoDevelop.DotNetCore.ProjectTemplateWizard"
+ condition="UseNetCore22=true"
+ category="netcore/app/aspnet"
+ formatExclude="*.min.css|*.min.js|*.map"
+ defaultParameters="IncludeLaunchSettings=true" />
</Condition>
<Condition id="AspNetCoreSdkInstalled" sdkVersion="2.1">
<Template
@@ -390,6 +416,19 @@ category="netcore/app/aspnet"
formatExclude="*.min.css|*.min.js|*.map"
defaultParameters="IncludeLaunchSettings=true" />
+ <Template
+ id="Microsoft.Web.Spa.Angular.CSharp"
+ templateId="Microsoft.DotNet.Web.Spa.ProjectTemplates.Angular.CSharp.2.1"
+ _overrideName="Angular"
+ _overrideDescription="A project template for creating an ASP.NET Core application with Angular"
+ path="${DotNetCoreSdk.2.1.Templates.Web.Spa.ProjectTemplates.nupkg}"
+ icon="md-netcore-empty-project"
+ imageId="md-netcore-empty-project"
+ wizard="MonoDevelop.DotNetCore.ProjectTemplateWizard"
+ condition="UseNetCore21=true"
+ category="netcore/app/aspnet"
+ formatExclude="*.min.css|*.min.js|*.map"
+ defaultParameters="IncludeLaunchSettings=true" />
</Condition>
<Condition id="AspNetCoreSdkInstalled" sdkVersion="2.0">
<Template
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs index 3d6686111b..eb9ebdb569 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs @@ -67,7 +67,7 @@ namespace MonoDevelop.Debugger void Build () { - checkProjectCodeOnly = new CheckBox (GettextCatalog.GetString ("Debug project code only; do not step into framework code.")); + checkProjectCodeOnly = new CheckBox (GettextCatalog.GetString ("Enable Just My Code")); PackStart (checkProjectCodeOnly); checkStepOverPropertiesAndOperators = new CheckBox (GettextCatalog.GetString ("Step over properties and operators")); PackStart (checkStepOverPropertiesAndOperators); diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateStringTagProvider.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateStringTagProvider.cs index 21f55b3f6d..e3c1a79ef9 100644 --- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateStringTagProvider.cs +++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateStringTagProvider.cs @@ -37,7 +37,7 @@ namespace MonoDevelop.DotNetCore.Templating [Extension] class DotNetCoreProjectTemplateStringTagProvider : IStringTagProvider { - string [] SupportedSDK = { "2.1", "2.2", "3.0" }; + readonly string [] SupportedSDK = { "2.1", "2.2", "3.0" }; public IEnumerable<StringTagDescription> GetTags (Type type) { @@ -58,6 +58,11 @@ namespace MonoDevelop.DotNetCore.Templating ); yield return new StringTagDescription ( + $"DotNetCoreSdk.{SupportedSDK [i]}.Templates.Web.Spa.ProjectTemplates.nupkg", + GettextCatalog.GetString (string.Format (".NET Core SDK {0} Spa Web Project Templates NuGet package path", SupportedSDK [i])) + ); + + yield return new StringTagDescription ( $"DotNetCoreSdk.{SupportedSDK [i]}.Templates.NUnit3.DotNetNew.Template.nupkg", GettextCatalog.GetString (string.Format (".NET Core SDK {0} NUnit Project Templates NuGet package path", SupportedSDK [i])) ); @@ -127,6 +132,7 @@ namespace MonoDevelop.DotNetCore.Templating foreach (var sdk in SupportedSDK) { if (tag.StartsWith ($"DotNetCoreSdk.{sdk}", StringComparison.OrdinalIgnoreCase)) { dotNetCoreSdk = GetDotNetCoreSdkVersion (DotNetCoreVersion.Parse (sdk)); + break; } } diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj index 4ca141ebf2..95d8150c4b 100644 --- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj +++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj @@ -34,6 +34,7 @@ <Compile Include="MonoDevelop.DotNetCore.Tests\DotNetCoreProjectTemplateStringTagProviderTests.cs" /> <Compile Include="MonoDevelop.DotNetCore.Tests\DependencyNodeTests.cs" /> <Compile Include="MonoDevelop.DotNetCore.Tests\DotNetCoreSDKResolverTests.cs" /> + <Compile Include="MonoDevelop.DotNetCore.Tests\TemplateDependencyChecker.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj"> diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateStringTagProviderTests.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateStringTagProviderTests.cs index 3dc63d37e9..a9720ac747 100644 --- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateStringTagProviderTests.cs +++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateStringTagProviderTests.cs @@ -97,6 +97,11 @@ namespace MonoDevelop.DotNetCore.Tests return GetTagValue ($"DotNetCoreSdk.{version}.Templates.Web.ProjectTemplates.nupkg"); } + string GetDotNetCoreSdkSpaWebProjectTemplatesTagValue (string version) + { + return GetTagValue ($"DotNetCoreSdk.{version}.Templates.Web.Spa.ProjectTemplates.nupkg"); + } + void AddProjectTemplateFile (string sdkVersion, params string[] fileNames) { foreach (string fileName in fileNames) { @@ -277,6 +282,26 @@ namespace MonoDevelop.DotNetCore.Tests } [Test] + public void NetCore21Installed_SpaWebProjectTemplates () + { + DotNetCoreSdksInstalled ("2.1.300-preview1-008174"); + AddProjectTemplateFile ( + "2.1.300-preview1-008174", + "microsoft.dotnet.common.projecttemplates.2.1.1.0.1-beta3-20180215-1392068.nupkg", + "microsoft.dotnet.test.projecttemplates.2.1.1.0.1-beta3-20180215-1392068.nupkg", + "microsoft.dotnet.web.spa.projecttemplates.2.1.2.1.0-preview1-final.nupkg"); + string expectedResult = Path.Combine ( + sdkRootPath, + "2.1.300-preview1-008174", + "Templates", + "microsoft.dotnet.web.spa.projecttemplates.2.1.2.1.0-preview1-final.nupkg"); + + string result = GetDotNetCoreSdkSpaWebProjectTemplatesTagValue ("2.1"); + + Assert.AreEqual (expectedResult, result); + } + + [Test] public void NetCore21Installed_MatchingFileWithDifferentExtension_CommonProjectTemplates () { DotNetCoreSdksInstalled ("2.1.300-preview1-008174"); diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateTests.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateTests.cs index 4522ea3c8e..3b5870f5cd 100644 --- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateTests.cs +++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateTests.cs @@ -272,12 +272,18 @@ namespace MonoDevelop.DotNetCore.Tests [TestCase ("Microsoft.Web.WebApi.CSharp", "UseNetCore21=true")] [TestCase ("Microsoft.Web.WebApi.FSharp", "UseNetCore21=true")] [TestCase ("Microsoft.Web.Razor.Library.CSharp", "UseNetCore21=true")] + [TestCase ("Microsoft.Web.Spa.Angular.CSharp", "UseNetCore21=true")] public async Task AspNetCore21 (string templateId, string parameters) { if (!IsDotNetCoreSdk21Installed ()) { Assert.Ignore (".NET Core 2.1 SDK is not installed - required by project template."); } + if (templateId == "Microsoft.Web.Spa.Angular.CSharp" && + !TemplateDependencyChecker.Check(TemplateDependency.Node)) { + Assert.Ignore ("Node is not installed - required by project template"); + } + await CreateFromTemplateAndBuild ("NetCore2x", templateId, parameters); } @@ -289,12 +295,18 @@ namespace MonoDevelop.DotNetCore.Tests [TestCase ("Microsoft.Web.WebApi.CSharp", "UseNetCore22=true")] [TestCase ("Microsoft.Web.WebApi.FSharp", "UseNetCore22=true")] [TestCase ("Microsoft.Web.Razor.Library.CSharp", "UseNetCore22=true")] + [TestCase ("Microsoft.Web.Spa.Angular.CSharp", "UseNetCore22=true")] public async Task AspNetCore22 (string templateId, string parameters) { if (!IsDotNetCoreSdk22Installed ()) { Assert.Ignore (".NET Core 2.2 SDK is not installed - required by project template."); } + if (templateId == "Microsoft.Web.Spa.Angular.CSharp" && + !TemplateDependencyChecker.Check(TemplateDependency.Node)) { + Assert.Ignore("Node is not installed - required by project template"); + } + await CreateFromTemplateAndBuild ("NetCore2x", templateId, parameters); } @@ -307,12 +319,18 @@ namespace MonoDevelop.DotNetCore.Tests [TestCase ("Microsoft.Web.WebApi.CSharp", "UseNetCore30=true")] [TestCase ("Microsoft.Web.WebApi.FSharp", "UseNetCore30=true")] [TestCase ("Microsoft.Web.Razor.Library.CSharp", "UseNetCore30=true")] + [TestCase ("Microsoft.Web.Spa.Angular.CSharp", "UseNetCore30=true")] public async Task AspNetCore30 (string templateId, string parameters) { if (!IsDotNetCoreSdk30Installed ()) { Assert.Ignore (".NET Core 3.0 SDK is not installed - required by project template."); } + if (templateId == "Microsoft.Web.Spa.Angular.CSharp" && + !TemplateDependencyChecker.Check(TemplateDependency.Node)) { + Assert.Ignore("Node is not installed - required by project template"); + } + await CreateFromTemplateAndBuild ("NetCore30", templateId, parameters); } diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/TemplateDependencyChecker.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/TemplateDependencyChecker.cs new file mode 100644 index 0000000000..e4ce0a1963 --- /dev/null +++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/TemplateDependencyChecker.cs @@ -0,0 +1,98 @@ +// +// TemplateDependencyChecker.cs +// +// Author: +// Ian Toal <iantoal@microsoft.com> +// +// Copyright (c) 2019 Microsoft +// +// 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.Diagnostics; + +namespace MonoDevelop.DotNetCore.Tests +{ + [Flags] + public enum TemplateDependency + { + None, + Npm = 1, + Node = 2 + } + + public static class TemplateDependencyChecker + { + static bool isNpmInstalled; + static bool isNodeInstalled; + + static TemplateDependencyChecker () + { + CheckNpmIsInstalled (); + CheckNodeIsInstalled (); + } + + static void CheckNpmIsInstalled () + { + isNpmInstalled = CheckProcessDependency ("npm", "-v"); + } + + static void CheckNodeIsInstalled () + { + isNodeInstalled = CheckProcessDependency ("node", "-v"); + } + + public static bool Check (TemplateDependency dependencies) + { + if ((dependencies & TemplateDependency.Npm) == TemplateDependency.Npm && + !isNpmInstalled) + return false; + + if ((dependencies & TemplateDependency.Node) == TemplateDependency.Node && + !isNodeInstalled) + return false; + + return true; + } + + static bool CheckProcessDependency (string fileName, string arguments) + { + bool processStarted = true; + + try { + using (var process = new Process ()) { + var startInfo = new ProcessStartInfo (fileName, arguments) { + RedirectStandardOutput = true, + UseShellExecute = false + }; + + process.StartInfo = startInfo; + process.Start (); + process.WaitForExit (2000); + processStarted = process.ExitCode == 0; + } + } + catch { + processStarted = false; + } + + return processStarted; + } + } +} |