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

Improve solution analysis #2928

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open

Improve solution analysis #2928

wants to merge 51 commits into from

Conversation

dupdob
Copy link
Member

@dupdob dupdob commented Apr 30, 2024

Improve solution analysis

Purpose

Improve the project discovery and analysis phase and improve the design of associated classes. Fixes relevant issues along the way

Changes

Project discovery and Solution mode (main changes)

  • Alignement The general processing is now identical for both modes. The difference is in how individual projects are discovered:
    • in solution mode, Stryker works with every project of the solution
    • in project discovery mode, Stryker recursively discovers project, starting with the provide test project(s) and add any project dependencies
      Note that other strategies are easy to implement, such as full recursive discovery: testing all projects are referenced (incl. transitively) by a set of test projects.

Project Analysis

  • Configuration: the user can now specify the desired (project/solution configuration (e.g Release) instead of Stryker peeking the default one.
  • Multi-target: Stryker respects exact inter project dependencies, including target framework version and target platform
  • Filtering: SourceProject option works for solution mode too
  • Platform: Stryker uses the target platform settings (if specified) when running tests.
  • Resiliency: Stryker retries project analysis when Buildalyzer failed to detect dependency. Stryker considers an analysis as failed if it did not report any source files or any dependencies, disregarding the BuildAlyzer status. MsBuild may report a build as failed if some secondary target fails, on the other hand, BuildAlyzer will report a success while it failed to capture any dependencies.
  • Logging: Stryker provides MsBuild log for both project and solution mode (with -dev—mode modifier) as well as analysis result details.
  • Content files: Stryker perform a post build scan of dependencies to identify content files from nugget packages such as ‘MimeTypes’. This is a workaround until BuildAlyzer is able to detect them

CLI

  • -configuration : new option that allows to specify which configuration to build (Debug, Release…). This should be a solution configuration in ‘solution’ mode.

Misc

  • compilation phase: compilation stops (and fails) immediately if Stryker is unable to identify any (new) mutation causing errors. Previously it recompiled the same code until the max attempts is reached
  • initial build: log first build attempt when it fails (Trace level), use dotnet msbuild instead of msbuild.exe on non windows platform
  • initial build: ensure quotes are applied for space containing path in every situation

Main changes in design

  • Merged ProjectFileReader class with InputFileSolver as responsibilities were blurry between them.
  • Added several tests for not yet covered cases

Github issues

fix #2930, fix #2748, fix #2693, fix #2587
related: #2886, #2393, #2077, #2938

dupdob added 27 commits March 1, 2024 10:57
…alysis

# Conflicts:
#	src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs
#	src/Stryker.Core/Stryker.Core/Initialisation/ProjectFileReader.cs
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@dupdob dupdob force-pushed the improve_solution_analysis branch from 6ed1f80 to 7beb37c Compare May 1, 2024 08:42
@dupdob dupdob force-pushed the improve_solution_analysis branch from 3abfdef to 3db6dec Compare May 20, 2024 09:57
@dupdob dupdob force-pushed the improve_solution_analysis branch from 3db6dec to 3be5105 Compare May 20, 2024 11:43
@dupdob dupdob marked this pull request as ready for review May 20, 2024 16:51
@dupdob dupdob force-pushed the improve_solution_analysis branch 2 times, most recently from f5f9c1e to 1d3ae30 Compare May 21, 2024 13:18
@dupdob dupdob force-pushed the improve_solution_analysis branch 4 times, most recently from 78b342d to d441739 Compare May 21, 2024 14:56
@dupdob dupdob force-pushed the improve_solution_analysis branch from d441739 to 599fffa Compare May 21, 2024 15:49
…alysis

# Conflicts:
#	src/Stryker.Core/Stryker.Core/Initialisation/Buildalyzer/IAnalyzerResultExtensions.cs
#	src/Stryker.Core/Stryker.Core/Initialisation/CsharpProjectComponentsBuilder.cs
#	src/Stryker.Core/Stryker.Core/Initialisation/InitialBuildProcess.cs
#	src/Stryker.Core/Stryker.Core/Initialisation/InitialisationProcess.cs
#	src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs
#	src/Stryker.Core/Stryker.Core/Initialisation/ProjectFileReader.cs
#	src/Stryker.Core/Stryker.Core/TestRunners/VsTest/VsTestContextInformation.cs
#	src/Stryker.Core/Stryker.Core/TestRunners/VsTest/VsTestRunner.cs
@dupdob dupdob marked this pull request as draft May 24, 2024 12:34
@dupdob
Copy link
Member Author

dupdob commented May 24, 2024

revert to draft to deal with merge of PR #2929

@dupdob dupdob marked this pull request as ready for review May 24, 2024 15:30
@dupdob dupdob force-pushed the improve_solution_analysis branch from 10a1ee3 to 74cfffc Compare May 25, 2024 14:24
Copy link

sonarcloud bot commented May 25, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment