diff --git a/DotNetTools.sln b/DotNetTools.sln index d1de4da4d0..653bddd136 100644 --- a/DotNetTools.sln +++ b/DotNetTools.sln @@ -16,16 +16,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F5B382BC-2 EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Watcher.Tools.FunctionalTests", "test\Microsoft.DotNet.Watcher.Tools.FunctionalTests\Microsoft.DotNet.Watcher.Tools.FunctionalTests.xproj", "{16BADE2F-1184-4518-8A70-B68A19D0805B}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestApps", "TestApps", "{2876B12E-5841-4792-85A8-2929AEE11885}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "NoDepsApp", "test\TestApps\NoDepsApp\NoDepsApp.xproj", "{4F0D8A80-221F-4BCB-822E-44A0655F537E}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GlobbingApp", "test\TestApps\GlobbingApp\GlobbingApp.xproj", "{2AB1A28B-2022-49EA-AF77-AC8A875915CC}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AppWithDeps", "test\TestApps\AppWithDeps\AppWithDeps.xproj", "{F7734E61-F510-41E0-AD15-301A64081CD1}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Dependency", "test\TestApps\Dependency\Dependency.xproj", "{2F48041A-F7D1-478F-9C38-D41F0F05E8CA}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.SecretManager.Tools", "src\Microsoft.Extensions.SecretManager.Tools\Microsoft.Extensions.SecretManager.Tools.xproj", "{8730E848-CA0F-4E0A-9A2F-BC22AD0B2C4E}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.SecretManager.Tools.Tests", "test\Microsoft.Extensions.SecretManager.Tools.Tests\Microsoft.Extensions.SecretManager.Tools.Tests.xproj", "{7B331122-83B1-4F08-A119-DC846959844C}" @@ -60,22 +50,6 @@ Global {16BADE2F-1184-4518-8A70-B68A19D0805B}.Debug|Any CPU.Build.0 = Debug|Any CPU {16BADE2F-1184-4518-8A70-B68A19D0805B}.Release|Any CPU.ActiveCfg = Release|Any CPU {16BADE2F-1184-4518-8A70-B68A19D0805B}.Release|Any CPU.Build.0 = Release|Any CPU - {4F0D8A80-221F-4BCB-822E-44A0655F537E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4F0D8A80-221F-4BCB-822E-44A0655F537E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4F0D8A80-221F-4BCB-822E-44A0655F537E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4F0D8A80-221F-4BCB-822E-44A0655F537E}.Release|Any CPU.Build.0 = Release|Any CPU - {2AB1A28B-2022-49EA-AF77-AC8A875915CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2AB1A28B-2022-49EA-AF77-AC8A875915CC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2AB1A28B-2022-49EA-AF77-AC8A875915CC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2AB1A28B-2022-49EA-AF77-AC8A875915CC}.Release|Any CPU.Build.0 = Release|Any CPU - {F7734E61-F510-41E0-AD15-301A64081CD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F7734E61-F510-41E0-AD15-301A64081CD1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F7734E61-F510-41E0-AD15-301A64081CD1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F7734E61-F510-41E0-AD15-301A64081CD1}.Release|Any CPU.Build.0 = Release|Any CPU - {2F48041A-F7D1-478F-9C38-D41F0F05E8CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2F48041A-F7D1-478F-9C38-D41F0F05E8CA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2F48041A-F7D1-478F-9C38-D41F0F05E8CA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2F48041A-F7D1-478F-9C38-D41F0F05E8CA}.Release|Any CPU.Build.0 = Release|Any CPU {8730E848-CA0F-4E0A-9A2F-BC22AD0B2C4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8730E848-CA0F-4E0A-9A2F-BC22AD0B2C4E}.Debug|Any CPU.Build.0 = Debug|Any CPU {8730E848-CA0F-4E0A-9A2F-BC22AD0B2C4E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -119,11 +93,6 @@ Global GlobalSection(NestedProjects) = preSolution {8A8CEABC-AC47-43FF-A5DF-69224F7E1F46} = {66517987-2A5A-4330-B130-207039378FD4} {16BADE2F-1184-4518-8A70-B68A19D0805B} = {F5B382BC-258F-46E1-AC3D-10E5CCD55134} - {2876B12E-5841-4792-85A8-2929AEE11885} = {F5B382BC-258F-46E1-AC3D-10E5CCD55134} - {4F0D8A80-221F-4BCB-822E-44A0655F537E} = {2876B12E-5841-4792-85A8-2929AEE11885} - {2AB1A28B-2022-49EA-AF77-AC8A875915CC} = {2876B12E-5841-4792-85A8-2929AEE11885} - {F7734E61-F510-41E0-AD15-301A64081CD1} = {2876B12E-5841-4792-85A8-2929AEE11885} - {2F48041A-F7D1-478F-9C38-D41F0F05E8CA} = {2876B12E-5841-4792-85A8-2929AEE11885} {8730E848-CA0F-4E0A-9A2F-BC22AD0B2C4E} = {66517987-2A5A-4330-B130-207039378FD4} {7B331122-83B1-4F08-A119-DC846959844C} = {F5B382BC-258F-46E1-AC3D-10E5CCD55134} {8A2E6961-6B12-4A8E-8215-3E7301D52EAC} = {F5B382BC-258F-46E1-AC3D-10E5CCD55134} diff --git a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/AppWithDepsTests.cs b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/AppWithDepsTests.cs index cae3959577..d36674a223 100644 --- a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/AppWithDepsTests.cs +++ b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/AppWithDepsTests.cs @@ -36,18 +36,14 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests private const string AppWithDeps = "AppWithDeps"; private const string Dependency = "Dependency"; - private static readonly string _appWithDepsFolder = Path.Combine(_repositoryRoot, "test", "TestApps", AppWithDeps); - private static readonly string _dependencyFolder = Path.Combine(_repositoryRoot, "test", "TestApps", Dependency); - public AppWithDepsScenario() { StatusFile = Path.Combine(_scenario.TempFolder, "status"); StartedFile = StatusFile + ".started"; - _scenario.AddProject(_appWithDepsFolder); - _scenario.AddProject(_dependencyFolder); + _scenario.AddTestProjectFolder(AppWithDeps); + _scenario.AddTestProjectFolder(Dependency); - _scenario.AddToolToProject(AppWithDeps, DotnetWatch); _scenario.Restore(); AppWithDepsFolder = Path.Combine(_scenario.WorkFolder, AppWithDeps); @@ -59,7 +55,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests // Wait for the process to start using (var wait = new WaitForFileToChange(StatusFile)) { - RunDotNetWatch($"run {StatusFile}", Path.Combine(_scenario.WorkFolder, AppWithDeps)); + RunDotNetWatch(new[] { "run", StatusFile }, Path.Combine(_scenario.WorkFolder, AppWithDeps)); wait.Wait(_defaultTimeout, expectedToChange: true, diff --git a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/GlobbingAppTests.cs b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/GlobbingAppTests.cs index 0512b2fd80..87ae1b6df3 100644 --- a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/GlobbingAppTests.cs +++ b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/GlobbingAppTests.cs @@ -136,7 +136,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests // Add a file that's in a included folder but not matching the globbing pattern private void ChangeNonCompiledFile(bool usePollingWatcher) - { + { using (var scenario = new GlobbingAppScenario()) { scenario.UsePollingWatcher = usePollingWatcher; @@ -184,15 +184,13 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests private class GlobbingAppScenario : DotNetWatchScenario { private const string TestAppName = "GlobbingApp"; - private static readonly string _testAppFolder = Path.Combine(_repositoryRoot, "test", "TestApps", TestAppName); public GlobbingAppScenario() { StatusFile = Path.Combine(_scenario.TempFolder, "status"); StartedFile = StatusFile + ".started"; - _scenario.AddProject(_testAppFolder); - _scenario.AddToolToProject(TestAppName, DotnetWatch); + _scenario.AddTestProjectFolder(TestAppName); _scenario.Restore(); TestAppFolder = Path.Combine(_scenario.WorkFolder, TestAppName); @@ -203,7 +201,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests // Wait for the process to start using (var wait = new WaitForFileToChange(StartedFile)) { - RunDotNetWatch($"run {StatusFile}", Path.Combine(_scenario.WorkFolder, TestAppName)); + RunDotNetWatch(new[] { "run", StatusFile }, Path.Combine(_scenario.WorkFolder, TestAppName)); wait.Wait(_defaultTimeout, expectedToChange: true, diff --git a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/NoDepsAppTests.cs b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/NoDepsAppTests.cs index 1b7109828c..023b57512f 100644 --- a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/NoDepsAppTests.cs +++ b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/NoDepsAppTests.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Threading; @@ -21,7 +22,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests // Wait for the process to start using (var wait = new WaitForFileToChange(scenario.StartedFile)) { - scenario.RunDotNetWatch($"run {scenario.StatusFile} --no-exit"); + scenario.RunDotNetWatch(new[] { "run", scenario.StatusFile, "--no-exit" }); wait.Wait(_defaultTimeout, expectedToChange: true, @@ -60,7 +61,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests // Wait for the process to start using (var wait = new WaitForFileToChange(scenario.StartedFile)) { - scenario.RunDotNetWatch($"run {scenario.StatusFile}"); + scenario.RunDotNetWatch(new[] { "run", scenario.StatusFile }); wait.Wait(_defaultTimeout, expectedToChange: true, @@ -99,15 +100,13 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests private class NoDepsAppScenario : DotNetWatchScenario { private const string TestAppName = "NoDepsApp"; - private static readonly string _testAppFolder = Path.Combine(_repositoryRoot, "test", "TestApps", TestAppName); public NoDepsAppScenario() { StatusFile = Path.Combine(_scenario.TempFolder, "status"); StartedFile = StatusFile + ".started"; - _scenario.AddProject(_testAppFolder); - _scenario.AddToolToProject(TestAppName, DotnetWatch); + _scenario.AddTestProjectFolder(TestAppName); _scenario.Restore(); TestAppFolder = Path.Combine(_scenario.WorkFolder, TestAppName); @@ -117,7 +116,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests public string StartedFile { get; private set; } public string TestAppFolder { get; private set; } - public void RunDotNetWatch(string args) + public void RunDotNetWatch(IEnumerable args) { RunDotNetWatch(args, Path.Combine(_scenario.WorkFolder, TestAppName)); } diff --git a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/Scenario/DotNetWatchScenario.cs b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/Scenario/DotNetWatchScenario.cs index 4af46b1171..bef42282fe 100644 --- a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/Scenario/DotNetWatchScenario.cs +++ b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/Scenario/DotNetWatchScenario.cs @@ -11,25 +11,18 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests { public class DotNetWatchScenario : IDisposable { - protected const string DotnetWatch = "Microsoft.DotNet.Watcher.Tools"; - - protected static readonly string _repositoryRoot = FindRepoRoot(); - protected static readonly string _artifactsFolder = Path.Combine(_repositoryRoot, "artifacts", "build"); - protected ProjectToolScenario _scenario; public DotNetWatchScenario() { _scenario = new ProjectToolScenario(); - Directory.CreateDirectory(_artifactsFolder); - _scenario.AddNugetFeed(DotnetWatch, _artifactsFolder); } public Process WatcherProcess { get; private set; } public bool UsePollingWatcher { get; set; } - protected void RunDotNetWatch(string arguments, string workingFolder) + protected void RunDotNetWatch(IEnumerable arguments, string workingFolder) { IDictionary envVariables = null; if (UsePollingWatcher) @@ -40,7 +33,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests }; } - WatcherProcess = _scenario.ExecuteDotnet("watch " + arguments, workingFolder, envVariables); + WatcherProcess = _scenario.ExecuteDotnetWatch(arguments, workingFolder, envVariables); } public virtual void Dispose() @@ -55,24 +48,5 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests } _scenario.Dispose(); } - - private static string FindRepoRoot() - { - var di = new DirectoryInfo(Directory.GetCurrentDirectory()); - - while (di.Parent != null) - { - var globalJsonFile = Path.Combine(di.FullName, "global.json"); - - if (File.Exists(globalJsonFile)) - { - return di.FullName; - } - - di = di.Parent; - } - - return null; - } } } diff --git a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/Scenario/ProjectToolScenario.cs b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/Scenario/ProjectToolScenario.cs index 48af21836e..41ac05c762 100644 --- a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/Scenario/ProjectToolScenario.cs +++ b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/Scenario/ProjectToolScenario.cs @@ -8,12 +8,18 @@ using System.IO; using System.Threading; using System.Xml.Linq; using Newtonsoft.Json.Linq; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.Extensions.DependencyModel; +using Microsoft.DotNet.ProjectModel; +using System.Reflection; +using System.Linq; namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests { public class ProjectToolScenario : IDisposable { private const string NugetConfigFileName = "NuGet.config"; + private static readonly string TestProjectSourceRoot = Path.Combine(AppContext.BaseDirectory, "TestProjects"); private static readonly object _restoreLock = new object(); @@ -26,57 +32,29 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests CreateTestDirectory(); } - public string TempFolder { get; } = Path.Combine(Path.GetDirectoryName(FindNugetConfig()), "testWorkDir", Guid.NewGuid().ToString()); + public string TempFolder { get; } = Path.Combine(Path.GetDirectoryName(FindNugetConfig()), "testWorkDir", Guid.NewGuid().ToString("N")); public string WorkFolder { get; } - public void AddProject(string projectFolder) + public void AddTestProjectFolder(string projectName) { - var destinationFolder = Path.Combine(WorkFolder, Path.GetFileName(projectFolder)); - Console.WriteLine($"Copying project {projectFolder} to {destinationFolder}"); + var srcFolder = Path.Combine(TestProjectSourceRoot, projectName); + var destinationFolder = Path.Combine(WorkFolder, Path.GetFileName(projectName)); + Console.WriteLine($"Copying project {srcFolder} to {destinationFolder}"); Directory.CreateDirectory(destinationFolder); - foreach (var directory in Directory.GetDirectories(projectFolder, "*", SearchOption.AllDirectories)) + foreach (var directory in Directory.GetDirectories(srcFolder, "*", SearchOption.AllDirectories)) { - Directory.CreateDirectory(directory.Replace(projectFolder, destinationFolder)); + Directory.CreateDirectory(directory.Replace(srcFolder, destinationFolder)); } - foreach (var file in Directory.GetFiles(projectFolder, "*.*", SearchOption.AllDirectories)) + foreach (var file in Directory.GetFiles(srcFolder, "*", SearchOption.AllDirectories)) { - File.Copy(file, file.Replace(projectFolder, destinationFolder), true); + File.Copy(file, file.Replace(srcFolder, destinationFolder), true); } } - public void AddNugetFeed(string feedName, string feed) - { - var tempNugetConfigFile = Path.Combine(WorkFolder, NugetConfigFileName); - - var nugetConfig = XDocument.Load(tempNugetConfigFile); - var packageSource = nugetConfig.Element("configuration").Element("packageSources"); - packageSource.Add(new XElement("add", new XAttribute("key", feedName), new XAttribute("value", feed))); - using (var stream = File.OpenWrite(tempNugetConfigFile)) - { - nugetConfig.Save(stream); - } - } - - public void AddToolToProject(string projectName, string toolName) - { - var projectFile = Path.Combine(WorkFolder, projectName, "project.json"); - Console.WriteLine($"Adding {toolName} to {projectFile}"); - - var projectJson = JObject.Parse(File.ReadAllText(projectFile)); - projectJson.Add("tools", - new JObject( - new JProperty(toolName, - new JObject( - new JProperty("version", "1.0.0-*"), - new JProperty("target", "package"))))); - - File.WriteAllText(projectFile, projectJson.ToString()); - } - public void Restore(string project = null) { if (project == null) @@ -93,8 +71,9 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests // multiple threads - which results in either sharing violation or corrupted json. lock (_restoreLock) { - var restore = ExecuteDotnet($"restore -v Minimal", project); - restore.WaitForExit(); + var restore = Command + .CreateDotNet("restore", new[] { project }) + .Execute(); if (restore.ExitCode != 0) { @@ -114,11 +93,27 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests File.Copy(nugetConfigFilePath, tempNugetConfigFile); } - public Process ExecuteDotnet(string arguments, string workDir, IDictionary environmentVariables = null) + public Process ExecuteDotnetWatch(IEnumerable arguments, string workDir, IDictionary environmentVariables = null) { - Console.WriteLine($"Running dotnet {arguments} in {workDir}"); + // this launches a new .NET Core process using the runtime of the current test app + // and the version of dotnet-watch that this test app is compiled against + var thisAssembly = Path.GetFileNameWithoutExtension(GetType().GetTypeInfo().Assembly.Location); + var args = new List(); + args.Add("exec"); - var psi = new ProcessStartInfo("dotnet", arguments) + args.Add("--depsfile"); + args.Add(Path.Combine(AppContext.BaseDirectory, thisAssembly + FileNameSuffixes.DepsJson)); + + args.Add("--runtimeconfig"); + args.Add(Path.Combine(AppContext.BaseDirectory, thisAssembly + FileNameSuffixes.RuntimeConfigJson)); + + args.Add(Path.Combine(AppContext.BaseDirectory, "dotnet-watch.dll")); + + var argsStr = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(args.Concat(arguments)); + + Console.WriteLine($"Running dotnet {argsStr} in {workDir}"); + + var psi = new ProcessStartInfo(new Muxer().MuxerPath, argsStr) { UseShellExecute = false, WorkingDirectory = workDir, diff --git a/test/TestApps/AppWithDeps/Program.cs b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/AppWithDeps/Program.cs similarity index 100% rename from test/TestApps/AppWithDeps/Program.cs rename to test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/AppWithDeps/Program.cs diff --git a/test/TestApps/AppWithDeps/project.json b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/AppWithDeps/project.json similarity index 100% rename from test/TestApps/AppWithDeps/project.json rename to test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/AppWithDeps/project.json diff --git a/test/TestApps/Dependency/Foo.cs b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/Dependency/Foo.cs similarity index 100% rename from test/TestApps/Dependency/Foo.cs rename to test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/Dependency/Foo.cs diff --git a/test/TestApps/Dependency/project.json b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/Dependency/project.json similarity index 100% rename from test/TestApps/Dependency/project.json rename to test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/Dependency/project.json diff --git a/test/TestApps/GlobbingApp/Program.cs b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/GlobbingApp/Program.cs similarity index 100% rename from test/TestApps/GlobbingApp/Program.cs rename to test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/GlobbingApp/Program.cs diff --git a/test/TestApps/GlobbingApp/exclude/Baz.cs b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/GlobbingApp/exclude/Baz.cs similarity index 100% rename from test/TestApps/GlobbingApp/exclude/Baz.cs rename to test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/GlobbingApp/exclude/Baz.cs diff --git a/test/TestApps/GlobbingApp/include/Foo.cs b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/GlobbingApp/include/Foo.cs similarity index 100% rename from test/TestApps/GlobbingApp/include/Foo.cs rename to test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/GlobbingApp/include/Foo.cs diff --git a/test/TestApps/GlobbingApp/project.json b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/GlobbingApp/project.json similarity index 100% rename from test/TestApps/GlobbingApp/project.json rename to test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/GlobbingApp/project.json diff --git a/test/TestApps/NoDepsApp/Program.cs b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/NoDepsApp/Program.cs similarity index 100% rename from test/TestApps/NoDepsApp/Program.cs rename to test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/NoDepsApp/Program.cs diff --git a/test/TestApps/NoDepsApp/project.json b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/NoDepsApp/project.json similarity index 100% rename from test/TestApps/NoDepsApp/project.json rename to test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/TestProjects/NoDepsApp/project.json diff --git a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/clean-assets.cmd b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/clean-assets.cmd new file mode 100644 index 0000000000..63104d55c6 --- /dev/null +++ b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/clean-assets.cmd @@ -0,0 +1,6 @@ +@ECHO OFF +:again +if not "%1" == "" ( + echo "Deleting %1\TestProjects" + rmdir /s /q %1\TestProjects +) \ No newline at end of file diff --git a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/clean-assets.sh b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/clean-assets.sh new file mode 100755 index 0000000000..1a5e80fb71 --- /dev/null +++ b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/clean-assets.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +if [ -z $1 ]; then + echo "Deleting $1/TestProjects" + rm -rf $1/TestProjects +fi + +exit 0 \ No newline at end of file diff --git a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/project.json b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/project.json index c863adcff4..1dcfb951c9 100644 --- a/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/project.json +++ b/test/Microsoft.DotNet.Watcher.Tools.FunctionalTests/project.json @@ -1,18 +1,22 @@ { "buildOptions": { "warningsAsErrors": true, - "keyFile": "../../tools/Key.snk" + "keyFile": "../../tools/Key.snk", + "copyToOutput": { + "include": "TestProjects/" + }, + "compile": { + "exclude": "TestProjects/" + } }, "dependencies": { "dotnet-test-xunit": "2.2.0-*", "Microsoft.AspNetCore.Testing": "1.1.0-*", "Microsoft.DotNet.Watcher.Tools": "1.0.0-*", - "Microsoft.Extensions.DependencyInjection": "1.1.0-*", "Microsoft.Extensions.Process.Sources": { "type": "build", "version": "1.1.0-*" }, - "Newtonsoft.Json": "9.0.1", "xunit": "2.2.0-*" }, "frameworks": { @@ -25,5 +29,11 @@ } } }, + "scripts": { + "precompile": "clean-assets %compile:OutputDir%" + }, + "publishOptions": { + "include": "TestProjects/" + }, "testRunner": "xunit" } \ No newline at end of file diff --git a/test/TestApps/AppWithDeps/AppWithDeps.xproj b/test/TestApps/AppWithDeps/AppWithDeps.xproj deleted file mode 100644 index 0359495322..0000000000 --- a/test/TestApps/AppWithDeps/AppWithDeps.xproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - f7734e61-f510-41e0-ad15-301a64081cd1 - .\obj - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/test/TestApps/Dependency/Dependency.xproj b/test/TestApps/Dependency/Dependency.xproj deleted file mode 100644 index bab595dfee..0000000000 --- a/test/TestApps/Dependency/Dependency.xproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 2f48041a-f7d1-478f-9c38-d41f0f05e8ca - .\obj - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/test/TestApps/GlobbingApp/GlobbingApp.xproj b/test/TestApps/GlobbingApp/GlobbingApp.xproj deleted file mode 100644 index 6d89d4053b..0000000000 --- a/test/TestApps/GlobbingApp/GlobbingApp.xproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 2ab1a28b-2022-49ea-af77-ac8a875915cc - .\obj - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/test/TestApps/NoDepsApp/NoDepsApp.xproj b/test/TestApps/NoDepsApp/NoDepsApp.xproj deleted file mode 100644 index a85e3bced4..0000000000 --- a/test/TestApps/NoDepsApp/NoDepsApp.xproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 4f0d8a80-221f-4bcb-822e-44a0655f537e - .\obj - .\bin\ - - - 2.0 - - - \ No newline at end of file