-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DYN-5944 Removed NDesk.Options Library #14106
Changes from 13 commits
cb3e0ea
0f9174d
4bb7b70
d0b8b8d
91fafcd
2fb22c2
61b2630
f1e6aec
7cdc64c
e855f59
324bb3e
fc1a09f
2e0af94
33a1310
de6659d
4e5216a
fc78c58
c819987
8e44108
ad9c4ef
2cf6b72
bda2f98
3d73767
4d6b5cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,72 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<ImportGroup Label="PropertySheets"> | ||
<Import Project="$(SolutionDir)Config\CS_SDK.props" /> | ||
</ImportGroup> | ||
<PropertyGroup> | ||
<ProjectGuid>{0893F745-CB1A-427A-8E87-CA927273039A}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>Md2Html</RootNamespace> | ||
<AssemblyName>Md2Html</AssemblyName> | ||
<SharedOutputPath>$(OutputPath)\Md2Html\</SharedOutputPath> | ||
<OutputPath>bin\AnyCPU\$(Configuration)\</OutputPath> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="HtmlSanitizer"> | ||
<Version>5.0.372</Version> | ||
</PackageReference> | ||
<PackageReference Include="ILMerge"> | ||
<Version>3.0.41</Version> | ||
</PackageReference> | ||
<PackageReference Include="Markdig"> | ||
<Version>0.22.0</Version> | ||
</PackageReference> | ||
<PackageReference Include="NDesk.Options"> | ||
<Version>0.2.1</Version> | ||
</PackageReference> | ||
</ItemGroup> | ||
<Target Name="AfterBuildOps" AfterTargets="Build"> | ||
<Exec Condition=" '$([MSBuild]::IsOSPlatform(`Windows`))' == 'True'" | ||
Command="if not exist $(SharedOutputPath) mkdir $(SharedOutputPath)"/> | ||
<!-- the ILMergePath property points to the location of ILMerge.exe console application --> | ||
<Exec Condition=" '$([MSBuild]::IsOSPlatform(`Windows`))' == 'True'" | ||
Command="$(ILMergeConsolePath) $(OutputPath)Md2Html.exe ^ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<ImportGroup Label="PropertySheets"> | ||
<Import Project="$(SolutionDir)Config\CS_SDK.props" /> | ||
</ImportGroup> | ||
<PropertyGroup> | ||
<ProjectGuid>{0893F745-CB1A-427A-8E87-CA927273039A}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>Md2Html</RootNamespace> | ||
<AssemblyName>Md2Html</AssemblyName> | ||
<SharedOutputPath>$(OutputPath)\Md2Html\</SharedOutputPath> | ||
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' "> | ||
<PublishSingleFile>true</PublishSingleFile> | ||
<SelfContained>false</SelfContained> | ||
</PropertyGroup> | ||
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' "> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
JimmySanchezGlobant marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="AngleSharp" Version="0.14.0" /> | ||
<PackageReference Include="AngleSharp.Css" Version="0.14.2" /> | ||
<PackageReference Include="CommandLineParser"> | ||
<Version>2.8.0</Version> | ||
</PackageReference> | ||
<PackageReference Include="HtmlSanitizer"> | ||
<Version>5.0.372</Version> | ||
</PackageReference> | ||
<PackageReference Include="ILMerge" Condition=" '$(TargetFramework)' == 'net48'"> | ||
<Version>3.0.41</Version> | ||
</PackageReference> | ||
<PackageReference Include="Markdig"> | ||
<Version>0.22.0</Version> | ||
</PackageReference> | ||
<PackageReference Include="System.Buffers" Version="4.5.1" /> | ||
<PackageReference Include="System.Memory" Version="4.5.5" /> | ||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" /> | ||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need direct references to these? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all these references need to be bundled in a single executable. From what I can tell, these dependencies were needed for net48 (when using ilmerge). I assume they are still needed on net6 (I did not check though) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I see. These are actually transitive dependencies from one of the other packageRefs. |
||
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" /> | ||
</ItemGroup> | ||
<Target Name="Publish net6" Condition=" '$(TargetFramework)' == 'net6.0' And '$([MSBuild]::IsOSPlatform(`Windows`))' == 'True' " AfterTargets="Build"> | ||
<CallTarget Targets="Publish" /> | ||
<Exec Command="if not exist $(SharedOutputPath) mkdir $(SharedOutputPath)"/> | ||
<Copy SourceFiles="$(OutputPath)win10-x64\publish\Md2Html.exe" DestinationFolder="$(SharedOutputPath)" /> | ||
</Target> | ||
<Target Name="AfterBuildOps" AfterTargets="Build" Condition=" '$(TargetFramework)' == 'net48' And '$([MSBuild]::IsOSPlatform(`Windows`))' == 'True'"> | ||
<Exec Command="if not exist $(SharedOutputPath) mkdir $(SharedOutputPath)"/> | ||
<!-- the ILMergePath property points to the location of ILMerge.exe console application --> | ||
<Exec Command="$(ILMergeConsolePath) $(OutputPath)Md2Html.exe ^ | ||
/allowDup ^ | ||
/lib:$(OutputPath) ^ | ||
/out:$(SharedOutputPath)Md2Html.exe ^ | ||
AngleSharp.Css.dll ^ | ||
AngleSharp.dll ^ | ||
HtmlSanitizer.dll ^ | ||
Markdig.dll ^ | ||
NDesk.Options.dll ^ | ||
CommandLine.dll ^ | ||
System.Buffers.dll ^ | ||
System.Memory.dll ^ | ||
System.Numerics.Vectors.dll ^ | ||
System.Runtime.CompilerServices.Unsafe.dll ^ | ||
System.Text.Encoding.CodePages.dll " /> | ||
<Exec Condition=" '!$([MSBuild]::IsOSPlatform(`Windows`))' == 'True' " | ||
Command="mkdir -p $(SharedOutputPath)"/> | ||
<Exec Condition=" '!$([MSBuild]::IsOSPlatform(`Windows`))' == 'True' " | ||
Command="cp $(OutputPath)*.* $(SharedOutputPath)"/> | ||
</Target> | ||
<Copy SourceFiles="$(OutputPath)Md2Html.exe" DestinationFolder="$(SharedOutputPath)" /> | ||
</Target> | ||
</Project> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need this to run on net48 too. Please verify if the new way works for net48. If not you will have to bring back the old way with (ilmerge) under the net48 condition.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pinzart90 As I told you before, this was built it correctly on .NET 4.8 and also I built it on .NET 6, and there wasn't any error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JimmySanchezGlobant please see the comment above from the bin diff job - the exe is not being produced: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JimmySanchezGlobant the new flags do not work for net48 target.
But this should be added only under net6 target somehow. Also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pinzart90 The old way with ILMerge is failing, when I build the project it's returning the error code (missing file), so, it's not clear to me how this can solve this issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ILMerge should only work under net48. If you try to build from master it still works right ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pinzart90 Yes, it's working well under . Net 4.8 from the master branch, it's weird, yesterday I did exactly the same test and it was failing on the ILMerge command, so, I don't know what to do to solve this, to be honest, I'm still very confused. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
using System; | ||
using System; | ||
using System.IO; | ||
using NDesk.Options; | ||
using CommandLine; | ||
using CommandLine.Text; | ||
|
||
namespace Md2Html | ||
{ | ||
internal class CMDLineOptions | ||
{ | ||
[Option('h', "help", Required = false, HelpText = "Show help and exit")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pinzart90 ... two thoughts - I don't see that this PR updates any of the tests. I think that ndesk options and command line parser require setting flags differently... ie Have you tried running the docs browser tests locally? Perhaps the markdown converter tool is never shutting down causing some kind of deadlock in the test runner etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mjkkirschner good catch, the md2html tests do seem to hang locally. Hopefully it is the same cause on the build machine |
||
public bool ShowHelp { get; set; } | ||
} | ||
|
||
static class Program | ||
{ | ||
static void Main(string[] args) | ||
|
@@ -82,15 +89,19 @@ static string GetData() | |
static bool CheckForHelp(string[] args) | ||
{ | ||
bool help = false; | ||
var options = new OptionSet() | ||
{ | ||
{@"h|?|help", @"Show help and exit", v => help = v != null }, | ||
}; | ||
var parser = new Parser(options => { | ||
options.IgnoreUnknownArguments = true; options.HelpWriter = Console.Out; | ||
options.CaseSensitive = false; | ||
}); | ||
var results = parser.ParseArguments<CMDLineOptions>(args); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. guess it's also possible that this is somehow messing with Console.Out or modifying the input argument list so it never makes its way to the rest of the Main function? |
||
|
||
help = results.MapResult((cmdArgs) => { | ||
return cmdArgs.ShowHelp; | ||
}, errs => false); | ||
|
||
options.Parse(args); | ||
if (help) | ||
{ | ||
options.WriteOptionDescriptions(Console.Out); | ||
Console.WriteLine(HelpText.AutoBuild(results, null, null).ToString()); | ||
DisplayHelp(); | ||
} | ||
|
||
|
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.
@pinzart90 looks like a missing
EndProject
tag maybe messing up the build somehow?