-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamically Pack MVVM SourceGen project outputs
Previously, static output path to the MVVM SourceGen assembly was used to pack the MVVM project. This leads to error when OutputPath was updated dynamically when testing or in forks. So, here, we'll update the build so that the SourceGen build outputs will be dynamically packed.
- Loading branch information
Showing
3 changed files
with
71 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<Project> | ||
|
||
<!-- We depend on these Common Targets that gathers various Build Outputs of the included project --> | ||
<PropertyGroup> | ||
<_GetBuildOutputsDependsOn>BuiltProjectOutputGroup;DocumentationProjectOutputGroup</_GetBuildOutputsDependsOn> | ||
<_GetBuildOutputsDependsOn Condition="'$(IncludeSymbols)' != 'false'">$(_GetBuildOutputsDependsOn);DebugSymbolsProjectOutputGroup</_GetBuildOutputsDependsOn> | ||
<_GetBuildOutputsDependsOn Condition="'$(IncludeSatelliteAssemblies)' != 'false'">$(_GetBuildOutputsDependsOn);SatelliteDllsProjectOutputGroup</_GetBuildOutputsDependsOn> | ||
</PropertyGroup> | ||
|
||
<!-- Check for 'TargetFramework' input before proceeding. --> | ||
<Target Name="_CheckTargetFrameworkInput" | ||
DependsOnTargets="_CheckForInvalidConfigurationAndPlatform" | ||
Condition="'$(TargetFramework)' == ''"> | ||
<Error Code="NCTDEV01" Text="The 'GetBuildOutputsPerTarget' target is meant to output the build items per 'TargetFramework'. Please call the target with a non-empty 'TargetFramework'."/> | ||
</Target> | ||
|
||
<!-- | ||
Gathers various Build Outputs from included Project per 'TargetFramework'. | ||
This target is called in by the 'GetBuildOutputs' target to combine build outputs from all 'TargetFrameworks'. | ||
--> | ||
<Target Name="GetBuildOutputsPerTarget" | ||
DependsOnTargets="_CheckTargetFrameworkInput;$(_GetBuildOutputsDependsOn)" | ||
Returns="@(BuildOutputPerTarget)"> | ||
<ItemGroup> | ||
<BuildOutputPerTarget Include="@(BuiltProjectOutputGroupOutput);@(DocumentationProjectOutputGroupOutput)"/> | ||
<BuildOutputPerTarget Include="@(DebugSymbolsProjectOutputGroupOutput)" Condition="'$(IncludeSymbols)' != 'false'"/> | ||
<BuildOutputPerTarget Include="@(SatelliteDllsProjectOutputGroupOutput)" Condition="'$(IncludeSatelliteAssemblies)' != 'false'"/> | ||
<BuildOutputPerTarget Update="@(BuildOutputPerTarget)" TargetFramework="$(TargetFramework)"/> | ||
</ItemGroup> | ||
</Target> | ||
|
||
<!-- | ||
Gathers various Build Outputs from this Project across 'TargetFrameworks'. | ||
This target is called in the parent project to pack into a package. | ||
--> | ||
<Target Name="GetBuildOutputs" | ||
DependsOnTargets="_GetTargetFrameworksOutput" | ||
Returns="@(BuildOutput)"> | ||
<MSBuild | ||
Projects="$(MSBuildProjectFullPath)" | ||
Targets="GetBuildOutputsPerTarget" | ||
Properties="TargetFramework=%(_TargetFrameworks.Identity)"> | ||
<Output TaskParameter="TargetOutputs" ItemName="BuildOutput" /> | ||
</MSBuild> | ||
</Target> | ||
|
||
</Project> |