Skip to content
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

Rewrite MSBuild reader to use MSBuild API #1125

Merged

Conversation

kant2002
Copy link
Contributor

@kant2002 kant2002 commented Apr 22, 2018

  • Control usage of new implementation via SPECFLOW_USE_MSBUILDAPI to be able test both implementations side-by-side
  • Update TechTalk.SpecFlow.Generator to net461 to be able use Buildalizer, and propagate changes where required across projects which depends on the TechTalk.SpecFlow.Generator
  • Add tests on the exclude folder
  • Change test a bit to take into account that paths .\filename and filename appear as two items via MSBuild API, and I dont think that duplicate items is desired behavior
  • Implementation of MSBuildApiProjectReader is just old resurrected implementation using MSBuild API with small changes
  • Bump version of generator, tools and tests to net461 as required by Buildalizer

Closes #1029

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added an entry to the changelog

- Control usage of new implementation via SPECFLOW_USE_MSBUILDAPI to be able test both implementations side-by-side
- Update TechTalk.SpecFlow.Generator to net46 to be able use MSBuild API, and propagate changes where required across projects which depends on the TechTalk.SpecFlow.Generator
- Update MSBuild API to 15.6. This change may be not needed, but, I strongly suspect that it will play more nicely with all version of .NET Core up to not yet released .NET Core 2.1
- Add tests on the exclude folder
- Change test a bit to take into account that paths `.\filename` and `filename` appear as two items via MSBuild API, and I dont think that duplicate items is desired behavior
- Implementation of MSBuildApiProjectReader is just old resurrected implementation using MSBuild API with small changes

See SpecFlowOSS#1029
@kant2002 kant2002 force-pushed the kant/rewrite-msbuild-reader branch from cd513fd to c817b4e Compare April 24, 2018 15:17
@@ -128,7 +128,19 @@ private bool IsNewProjectSystem(XDocument xDocument)

public static SpecFlowProject LoadSpecFlowProjectFromMsBuild(string projectFilePath)
{
return new MsBuildProjectReader(new GeneratorConfigurationProvider(new ConfigurationLoader()), new MSBuildRelativePathParser()).ReadSpecFlowProject(projectFilePath);
var configurationProvider = new GeneratorConfigurationProvider(new ConfigurationLoader());
var useMSBuildApi = Environment.GetEnvironmentVariable("SPECFLOW_USE_MSBUILDAPI") == "1";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make the new project reader the default one. Only so do we recognize errors of it.

@SabotageAndi
Copy link
Contributor

Looks good! Thanks for it!

BTW as you are in the topic: For #1033 we need all PackageReferences of the project to find the plugins.
Could you add this in this PR or in an separate?
And when I am thinking about this, I think we don't want to implement this in the XML CsProj parser, so you could delete it completely.

This is justified by fact that supporting it, means reimplementing whole MSBuild logic, which is not reasonable. Also for loading plugins would be needed read PackageReferences from the projects, and this would be problematic implement correctly. Current implementation is also flawled. See SpecFlowOSS#1102, and wellknown fact that Exclude property on the MSBuild items is not supported
@kant2002
Copy link
Contributor Author

@SabotageAndi remove XML based implementation

@SabotageAndi SabotageAndi merged commit 77d555e into SpecFlowOSS:DotNetCore Apr 25, 2018
@kant2002 kant2002 deleted the kant/rewrite-msbuild-reader branch April 25, 2018 07:48
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.

2 participants