Skip to content

Commit

Permalink
chore: add debug launch profile (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
latonz authored Jul 14, 2023
1 parent 3e2a2c8 commit 20fd885
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/docs/contributing/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ Check [here](../configuration/generated-source.mdx) on how to inspect the genera
To debug the Mapperly in unit tests set a breakpoint
in the code of Mappery which you want to debug and run the tests in debug mode.

Since Mapperly runs integrated into the build pipeline,
debugging integration tests and other applications needs some more effort.
If your IDE supports the `DebugRoslynComponent` launch configuration command,
you can just set your breakpoints and debug the preconfigured `integration-tests` profile which will debug Mapperly
in the context of the integration tests.

If your IDE does not support `DebugRoslynComponent`,
debugging the integration tests requires some more effort.
Mapperly uses a compile constant `DEBUG_SOURCE_GENERATOR` to determine whether to attach a debugger.
If it is set, it tries to attach a debugger
(it uses `Debugger.Launch()` on windows, on other operating systems it tries to launch JetBrains Rider)
Expand Down
9 changes: 9 additions & 0 deletions src/Riok.Mapperly/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"integration-tests": {
"commandName": "DebugRoslynComponent",
"targetProject": "../../test/Riok.Mapperly.IntegrationTests/Riok.Mapperly.IntegrationTests.csproj"
}
}
}

0 comments on commit 20fd885

Please sign in to comment.