Skip to content

Conversation

@vors
Copy link
Collaborator

@vors vors commented Dec 22, 2017

  • Fix appveyor and build.ps1
  • Fix all tests to be line-end agnostic
  • Replace powershell aliases by full names for cross-plat compatability
  • Remove old .nuget folder
  • Switch build.psd1 to dotnet cli
  • Make C# part CoreCLR-friendly
  • Update csproj files
  • update docs
  • add unix CI build

Fix #205

@vors
Copy link
Collaborator Author

vors commented Dec 22, 2017

@BernieWhite @it-praktyk can you take a look?

Copy link
Contributor

@BernieWhite BernieWhite left a 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>
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Contributor

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

Copy link
Contributor

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

Copy link
Collaborator Author

@vors vors Dec 23, 2017

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";
Copy link
Contributor

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

Copy link
Collaborator Author

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
Copy link
Contributor

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.

Copy link
Collaborator Author

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?


# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @('Markdown.MAML.dll','YamlDotNet.dll')
RequiredAssemblies = @('Markdown.MAML.dll','YamlDotNet.NetStandard.dll')
Copy link
Contributor

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.

Copy link
Collaborator Author

@vors vors Dec 22, 2017

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}
Copy link
Contributor

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.

Copy link
Collaborator Author

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.

@vors
Copy link
Collaborator Author

vors commented Dec 24, 2017

Sorry, rebased on master and then realized that it will make the review harder, apologies for that.
@BernieWhite thank you so much for catching the TargetFramework problem! It was very close to breaking everybody on a new release. So glad you took a look. 👍

I employed the same technique as @lzybkr in PSReadLine: build for net4xx which is core-clr compatible in the pwsh context, because of netstandart2.0 (or not sure really why).
So currently we still need to publish only appveyor produced builds, they will work with the same dlls on all platforms.

But for a local development, build.ps1 will now use netstandart1.6 for a local build. Also, Travis CI will ensure there are no regressions in this case.
Overall that seems like a nicer alternative then shipping multiply dlls. The only downside is really inability to produce a package from a non-windows machine.

@vors vors merged commit 6746f01 into master Dec 24, 2017
@vors vors deleted the unix3 branch December 24, 2017 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants