Skip to content

Commit 0647320

Browse files
committed
Enable Source Link in design-time build (#1144)
1 parent 65d527d commit 0647320

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

gitc

Whitespace-only changes.

src/SourceLink.Common/build/Microsoft.SourceLink.Common.props

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77

88
<PropertyGroup>
99
<!--
10-
Do not query source control manager for any information when building in the IDE or for Live Unit Testing.
11-
Features that need this information will be disabled if false.
10+
Used to suppress querying source control and features that use the information (e.g. git commit SHA).
1211
-->
13-
<EnableSourceControlManagerQueries Condition="'$(EnableSourceControlManagerQueries)' == '' and '$(DesignTimeBuild)' != 'true' and '$(BuildingForLiveUnitTesting)' != 'true'">true</EnableSourceControlManagerQueries>
14-
12+
<EnableSourceControlManagerQueries Condition="'$(EnableSourceControlManagerQueries)' == ''">true</EnableSourceControlManagerQueries>
13+
1514
<!--
1615
Do not generate SourceLink when building in the IDE or for Live Unit Testing.
1716
-->
1817
<EnableSourceLink Condition="'$(EnableSourceLink)' == '' and '$(DesignTimeBuild)' != 'true' and '$(BuildingForLiveUnitTesting)' != 'true'">true</EnableSourceLink>
19-
</PropertyGroup>
18+
</PropertyGroup>
2019
</Project>

src/SourceLink.Common/build/Microsoft.SourceLink.Common.targets

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414
Triggers SetEmbeddedFilesFromSourceControlManagerUntrackedFiles target defined by a source control package Microsoft.Build.Tasks.{Git|Tfvc|...}.
1515
Assumes that all targets that generate source files and add them to Compile items run before BeforeCompile target.
1616
This is a convention established by common targets.
17+
18+
Disabled for design-time build since calculating untracked files is non-trivial operation
19+
and embedding them only affects the content of the generated PDB, which has no impact on design-time build.
1720
-->
1821
<Target Name="_SetEmbeddedFilesFromSourceControlManagerUntrackedFiles"
1922
DependsOnTargets="BeforeCompile;SetEmbeddedFilesFromSourceControlManagerUntrackedFiles"
2023
BeforeTargets="CoreCompile"
21-
Condition="'$(EmbedUntrackedSources)' == 'true' and '$(EmbedAllSources)' != 'true' and '$(DebugType)' != 'none' and '$(EnableSourceControlManagerQueries)' == 'true'" />
24+
Condition="'$(EmbedUntrackedSources)' == 'true' and '$(EmbedAllSources)' != 'true' and '$(DebugType)' != 'none' and '$(EnableSourceControlManagerQueries)' == 'true' and '$(DesignTimeBuild)' != 'true'" />
2225

2326
<!--
2427
If defined populates MappedPath metadata of SourceRoot items.

src/SourceLink.Git.IntegrationTests/TargetTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ public void DefaultValuesForEnableProperties_DesignTimeBuild()
9090
expectedResults: new[]
9191
{
9292
NuGetPackageFolders,
93-
"",
93+
ProjectSourceRoot,
94+
"true",
9495
"",
9596
""
9697
},
@@ -125,7 +126,8 @@ public void DefaultValuesForEnableProperties_BuildingForLiveUnitTesting()
125126
expectedResults: new[]
126127
{
127128
NuGetPackageFolders,
128-
"",
129+
ProjectSourceRoot,
130+
"true",
129131
"",
130132
""
131133
},

0 commit comments

Comments
 (0)