-
Notifications
You must be signed in to change notification settings - Fork 160
Make it core-clr compatible and unix-friendly #329
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
Conversation
|
@BernieWhite @it-praktyk can you take a look? |
BernieWhite
left a comment
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.
@vors Nice work.
| <AssemblyName>Markdown.MAML</AssemblyName> | ||
| <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
| <FileAlignment>512</FileAlignment> | ||
| <TargetFramework>netstandard1.6</TargetFramework> |
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.
Shouldn't we be targeting both net452 and netstandard1.6? We still need this to work on PowerShell 5.1 right?
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.
It seems to work as is: AppVeyor CI runs full PowerShell 5.1
But I would not claim that I understand dotnet taxonomy. If it breaks on older versions of PS, we can revisit this.
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.
Fairly sure this is because the framework is installed. I'll confirm on a fresh machine.
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.
Looks like you are right, got that on a fresh server 2016 machine. Good catch!
Import-Module : Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
At line:1 char:1
+ Import-Module C:\Users\localadmin\Downloads\platyPS-0.7.6.1064\Markdo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
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.
So is there a way to build 1 assembly that will work on ps 5.1 and 6.0?
Or two assemblies hack is the only way?
cc @daxian-dbw
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.
I guess one way would be to build only net451 version and ship it (because it works just fine on pwsh for some reason), and for local development on non-windows platform build netstandart1.6
but that doesn't feel too good
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.
Two assemblies for sure, can't see that as a hack though. It is how every other cross plat module is built afaik
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.
well, you can use the currently published modules from the gallery (built for 4.5) just fine on pwsh. At least I haven't seen problems so far and problems are usually showing up very early when it cannot resolve System.Runtime and friends. Also a bunch of dlls, like makdig are working ok on both, when consumer thru import-module (it's also built for full). So we can still build for full and publish it as the one package.
It just that you cannot do that from a non-windows platform because full doesn't exist there.
|
|
||
| public int MaxSyntaxWidth { get; private set; } | ||
|
|
||
| private const string NewLine = "\r\n"; |
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.
Nice. We should probably do this generically. There is lot of separate references to \r\n
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.
Yeah, I just didn't want to introduce dependencies between classes to reference 2 well-known chars and creating a common helper seems like an overkill too.
| namespace Markdown.MAML.Renderer | ||
| { | ||
| static class RenderCleaner | ||
| static public class RenderCleaner |
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.
What is the reason for making it public? We should minimise exposure to classes that don't need to be called outside the assembly. As we add extensibility we want to minimise people taking a dependency on a class that is for internal use.
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.
Agree. I used line normalization from this class in tests. What would be a better way?
src/platyPS/platyPS.psd1
Outdated
|
|
||
| # Assemblies that must be loaded prior to importing this module | ||
| RequiredAssemblies = @('Markdown.MAML.dll','YamlDotNet.dll') | ||
| RequiredAssemblies = @('Markdown.MAML.dll','YamlDotNet.NetStandard.dll') |
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.
Same comment as above. Needs to run on PS 5.1 unless we are explicitly dropping support for it.
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.
AFAIK net451 implements NetStandard and 5.1 compatible. CI run proves that.
| elseif (Test-Path -PathType Container $_) | ||
| { | ||
| $MarkdownFiles += Get-ChildItem $_ -Filter $filter | WHERE {$_.BaseName -notlike $aboutFilePrefixPattern} | ||
| $MarkdownFiles += Get-ChildItem $_ -Filter $filter | Where-Object {$_.BaseName -notlike $aboutFilePrefixPattern} |
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.
Nice. Completely agree with expanding out aliases. Make it easier to understand for more people.
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.
VS Code makes it no-brainer with automatic alias expansion refactoring.
I seen a bunch of folders like -ErrorAction in repo root, but hopefully fixed all mkdir calls.
|
Sorry, rebased on master and then realized that it will make the review harder, apologies for that. I employed the same technique as @lzybkr in PSReadLine: build for But for a local development, |
Fix #205