-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start! I see it's a WiP so much of the commentary is likely already planned to be addressed. Key points:
- I think we can simplify the predicates approach
- I don't see why we have another parser. We're not saving much [5%, maybe] on LoC and yet we're paying for YAP(tm) [Yet another parser].
- Need more test coverage
</PropertyGroup> | ||
|
||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -24,6 +24,7 @@ | |||
using Microsoft.DotNet.Tools.Test; | |||
using Microsoft.DotNet.Tools.VSTest; | |||
using NuGet.Frameworks; | |||
using Microsoft.DotNet.Tools.Add; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -45,6 +46,7 @@ public class Program | |||
["run"] = RunCommand.Run, | |||
["test"] = TestCommand.Run, | |||
["vstest"] = VSTestCommand.Run, | |||
["add"] = AddCommand.Run, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
FullName = ".NET Add Project to Project (p2p) reference Command", | ||
Description = "Command to add project to project (p2p) reference" | ||
}; | ||
app.HelpOption("-h|--help"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
app.HelpOption("-h|--help"); | ||
|
||
CommandArgument projectArgument = app.Argument("<PROJECT>", | ||
"The MSBuild project file to modify. If a project file is not specified," + |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
new AddP2PCommand() | ||
.WithWorkingDirectory(testRoot) | ||
.Execute($"{Lib2Path} -r {Lib4Path} -f net451") | ||
.Should().Pass(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
new AddP2PCommand() | ||
.WithWorkingDirectory(testRoot) | ||
.Execute($"{Lib2Path} -r {Lib4Path} -f netcoreapp1.0") | ||
.Should().Pass(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
string lib2FullPath = Path.Combine(testRoot, Lib2Path); | ||
CountOccurrances(File.ReadAllText(lib2FullPath), "Lib4.csproj").Should().Be(2); | ||
|
||
new RestoreCommand() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
return ret; | ||
} | ||
} | ||
} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
#endif | ||
} | ||
} | ||
} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Any updates on this one? |
<ItemGroup> | ||
<Compile Include="**\*.cs" /> | ||
<EmbeddedResource Include="**\*.resx" /> | ||
<PackageReference Include="Microsoft.NET.Sdk"> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
<ItemGroup> | ||
<Compile Include="**\*.cs" /> | ||
<EmbeddedResource Include="**\*.resx" /> | ||
<PackageReference Include="Microsoft.NET.Sdk"> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,8 @@ | |||
using System; | |||
|
|||
namespace SomeNS |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
<ItemGroup> | ||
<Compile Include="**\*.cs" /> | ||
<EmbeddedResource Include="**\*.resx" /> | ||
<PackageReference Include="Microsoft.NET.Sdk"> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
<ItemGroup> | ||
<Compile Include="**\*.cs" /> | ||
<EmbeddedResource Include="**\*.resx" /> | ||
<PackageReference Include="Microsoft.NET.Sdk"> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,20 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,20 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,22 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,25 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,14 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,22 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
<ItemGroup> | ||
<Compile Include="**\*.cs" /> | ||
<EmbeddedResource Include="**\*.resx" /> | ||
<PackageReference Include="Microsoft.NET.Sdk"> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,25 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,25 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,26 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,26 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,31 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
<ItemGroup Condition="'$(TargetFramework)' == 'net451'"> | ||
<!-- This is intentionally empty - do not remove --> | ||
</ItemGroup> | ||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' "> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' "> | ||
<DefineConstants>$(DefineConstants);NETCOREAPP1_0</DefineConstants> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(TargetFramework)' == 'net451' "> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,28 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -0,0 +1,31 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -27,14 +27,18 @@ public static bool IsEquivalentTo(this ProjectItemElement item, ProjectItemEleme | |||
// Different includes | |||
if (item.IntersectIncludes(otherItem).Count() != item.Includes().Count()) | |||
{ | |||
#if !DISABLE_TRACE |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
return false; | ||
} | ||
|
||
// Different Excludes | ||
if (item.IntersectExcludes(otherItem).Count() != item.Excludes().Count()) | ||
{ | ||
#if !DISABLE_TRACE |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
if (files.Length > 1) | ||
{ | ||
throw new GracefulException("Found more than one MSBuild project in the current directory. Please specify which one to use."); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
} | ||
|
||
[Fact] | ||
|
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@dotnet-bot Test this please |
added a lot of changes, need to be reviewed again
Seems like I got some non-windows issues, I'll investigate this |
|
||
namespace Microsoft.DotNet.Tools | ||
{ | ||
internal static class Strings |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
{ | ||
internal static class Strings | ||
{ | ||
// Arguments parsing |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
CommandOptionType.NoValue); | ||
|
||
app.OnExecute(() => { | ||
if (string.IsNullOrEmpty(projectArgument.Value)) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
} | ||
|
||
// There is ProjectRootElement.TryOpen but it does not work as expected | ||
// I.e. it returns null for some valid projects |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
public AddP2PCommand() | ||
: base("dotnet") | ||
{ | ||
|
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
namespace Microsoft.DotNet.Cli.Add.P2P.Tests | ||
{ | ||
internal static class Extensions |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
return root.ItemGroups.Count((ig) => string.IsNullOrEmpty(ig.Condition)); | ||
} | ||
|
||
public static IEnumerable<ProjectElement> ItemsWithIncludeAndConditionContaining(this ProjectRootElement root, string itemType, string includePattern, string patternInCondition) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
}); | ||
} | ||
|
||
public static int NumberOfProjectReferencesWithIncludeAndConditionContaining(this ProjectRootElement root, string includePattern, string patternInCondition) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
return root.ItemsWithIncludeAndConditionContaining("ProjectReference", includePattern, patternInCondition).Count(); | ||
} | ||
|
||
public static IEnumerable<ProjectElement> ItemsWithIncludeContaining(this ProjectRootElement root, string itemType, string includePattern) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
…, fix long lines, remove empty line
@srivatsn @MattGertz please approve |
Your wish is my command... :-) |
https://github.com/dotnet/cli/issues/4521