-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathMicrosoft.DotNet.HotReload.Utils.Generator.BuildTool.targets.in
71 lines (59 loc) · 4.91 KB
/
Microsoft.DotNet.HotReload.Utils.Generator.BuildTool.targets.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<PropertyGroup>
<!-- If DotNetTool is undefined, we default to assuming 'dotnet' is on the path -->
<DotNetTool Condition="'$(DotNetTool)' == ''">dotnet</DotNetTool>
<_HotReloadDeltaGeneratorTFM Condition="'$(_HotReloadDeltaGeneratorTFM)' == ''">${NetToolCurrent}</_HotReloadDeltaGeneratorTFM>
<_HotReloadDeltaGeneratorPath Condition="'$(_HotReloadDeltaGeneratorPath)' == ''">$(MSBuildThisFileDirectory)..\tools\$(_HotReloadDeltaGeneratorTFM)\Microsoft.DotNet.HotReload.Utils.Generator.BuildTool.dll</_HotReloadDeltaGeneratorPath>
<_HotReloadDeltaGeneratorCommand>"$(DotNetTool)" "$(_HotReloadDeltaGeneratorPath)"</_HotReloadDeltaGeneratorCommand>
<_HotReloadDeltaGeneratorTasksPath Condition="'$(_HotReloadDeltaGeneratorTasksPath)' == ''">$(MSBuildThisFileDirectory)..\tools\$(_HotReloadDeltaGeneratorTFM)\Microsoft.DotNet.HotReload.Utils.Generator.Tasks.dll</_HotReloadDeltaGeneratorTasksPath>
</PropertyGroup>
<PropertyGroup>
<_HotReloadDeltaGeneratorDeltaScript Condition="'$(DeltaScript)' != ''">$([System.IO.Path]::Combine($(MSBuildProjectDirectory), '$(DeltaScript)'))</_HotReloadDeltaGeneratorDeltaScript>
<_HotReloadDeltaGeneratorShouldRun Condition="'$(_HotReloadDeltaGeneratorShouldRun)' == '' and Exists('$(_HotReloadDeltaGeneratorDeltaScript)')">true</_HotReloadDeltaGeneratorShouldRun>
<_HotReloadDeltaGeneratorShouldRun Condition="'$(_HotReloadDeltaGeneratorShouldRun)' == ''">false</_HotReloadDeltaGeneratorShouldRun>
</PropertyGroup>
<UsingTask TaskName="HotReloadDeltaGeneratorComputeScriptOutputs" AssemblyFile="$(_HotReloadDeltaGeneratorTasksPath)" />
<!-- Doesn't actually run the delta geneator, but just analyzes the script and figures out what output items it would produce.
Used for computing incremental inputs/outputs of HotReloadDeltaGeneratorGenerateDeltas, and for ContentForDeltaFileOutputNames
-->
<Target Name="HotReloadDeltaGeneratorComputeScriptInputsOutputs" Condition="$(_HotReloadDeltaGeneratorShouldRun)">
<HotReloadDeltaGeneratorComputeScriptOutputs BaseAssemblyName="$(TargetPath)" DeltaScript="$(DeltaScript)">
<Output TaskParameter="DeltaOutputs" ItemName="_HotReloadDeltaGeneratorOutputs" />
<Output TaskParameter="DeltaSources" ItemName="_HotReloadDeltaGeneratorInputs" />
</HotReloadDeltaGeneratorComputeScriptOutputs>
</Target>
<!-- Invoke hotreload-delta-gen to apply the DeltaScript to the output assembly to
create the .dmeta, .dil and .dpdb files on the OutputPath -->
<!-- Have to be careful about AfterTargets. If we happen to go after a design-time target, we could get into an infinite loop. -->
<Target Name="HotReloadDeltaGeneratorGenerateDeltas"
AfterTargets="Build"
DependsOnTargets="HotReloadDeltaGeneratorComputeScriptInputsOutputs"
Condition="$(_HotReloadDeltaGeneratorShouldRun)"
Inputs="$(TargetPath); @(_HotReloadDeltaGeneratorInputs)"
Outputs="@(_HotReloadDeltaGeneratorOutputs)"
>
<PropertyGroup>
<_HotReloadDeltaGeneratorArgs>"-msbuild:$(MSBuildProjectFullPath)"</_HotReloadDeltaGeneratorArgs>
<_HotReloadDeltaGeneratorArgs>$(_HotReloadDeltaGeneratorArgs) "-script:$(_HotReloadDeltaGeneratorDeltaScript)"</_HotReloadDeltaGeneratorArgs>
<!-- This is a little bit delicate: we're invoking a design-time msbuild here, and we need it to come back with the same OutputPath as the current
run of msbuild. If there are other properties that affect where the baseline assembly ends up, we need to pass those here too.
-->
<_HotReloadDeltaGeneratorArgs Condition="'$(Configuration)' != ''">$(_HotReloadDeltaGeneratorArgs) -p:Configuration=$(Configuration)</_HotReloadDeltaGeneratorArgs>
<_HotReloadDeltaGeneratorArgs Condition="'$(RuntimeIdentifier)' != ''">$(_HotReloadDeltaGeneratorArgs) -p:RuntimeIdentifier=$(RuntimeIdentifier)</_HotReloadDeltaGeneratorArgs>
<!-- escape hatch for any extra arguments. If this changes what delta artifacts are produced, the HotReloadDeltaGeneratorComputeScriptOutputs target would need to be overridden -->
<_HotReloadDeltaGeneratorArgs Condition="'$(HotReloadDeltaGeneratorExtraArgs)' != ''">$(_HotReloadDeltaGeneratorArgs) $(HotReloadDeltaGeneratorExtraArgs)</_HotReloadDeltaGeneratorArgs>
</PropertyGroup>
<Exec Command="$(_HotReloadDeltaGeneratorCommand) $(_HotReloadDeltaGeneratorArgs)" />
</Target>
<Target Name="HotReloadDeltaGeneratorContentForOutputs"
BeforeTargets="AssignTargetPaths"
DependsOnTargets="HotReloadDeltaGeneratorComputeScriptInputsOutputs"
Condition="$(_HotReloadDeltaGeneratorShouldRun) and '$(DesignTimeBuild)' != 'true'">
<ItemGroup>
<Content Include="@(_HotReloadDeltaGeneratorOutputs)">
<CopyToOutputDirectory>always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Target>
</Project>