Repository navigation
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
95 lines (84 loc) · 4.8 KB
/
Copy pathDirectory.Build.targets
File metadata and controls
95 lines (84 loc) · 4.8 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RockWebPath Condition="'$(RockWebPath)' == ''"></RockWebPath>
<CopyToRockWeb Condition="'$(CopyToRockWeb)' == ''">False</CopyToRockWeb>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(UsingMicrosoftNETSdk)' == 'true'">
<LangVersion>12</LangVersion>
</PropertyGroup>
<!--
REVIEW_NETFRAMEWORK and REVIEW_NET are defined in exactly the builds where the SDK defines
NETFRAMEWORK and NET. The REVIEW_ prefix marks code that still needs a look during the
.NET Core conversion (not yet tested, or no .NET Core variant yet).
These live here instead of Directory.Build.props because TargetFramework is not set yet
when the props file runs for single-target projects.
-->
<PropertyGroup Condition="'$(UsingMicrosoftNETSdk)' == 'true'">
<DefineConstants Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">$(DefineConstants);REVIEW_NETFRAMEWORK</DefineConstants>
<DefineConstants Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion.TrimStart(`vV`))', '5.0'))">$(DefineConstants);REVIEW_NET</DefineConstants>
</PropertyGroup>
<Target Name="_AddRockWebArtifactsToCustomOutput" BeforeTargets="CoreCompile" Condition="'$(CopyToRockWeb)' == 'True' and '$(RockWebPath)' != '' and '$(TargetFrameworkIdentifier)' == '.NETFramework'">
<ItemGroup>
<!--
Visual Studio uses this to track when to recompile. If file we will copy to RockWeb
is missing or out of date, it will trigger a recompile.
-->
<UpToDateCheckOutput Include="$(RockWebPath)\Bin\$(TargetName)$(TargetExt)" />
</ItemGroup>
</Target>
<Target Name="_CopyArtifactsToRockWebBin" AfterTargets="AfterBuild" Condition="'$(CopyToRockWeb)' == 'True' and '$(RockWebPath)' != '' and '$(TargetFrameworkIdentifier)' == '.NETFramework'">
<FindUnderPath Path="$(OutDir)" Files="@(FileWrites)"
UpdateToAbsolutePaths="True">
<Output TaskParameter="InPath" ItemName="_SourceFilesToCopyToRockWeb"/>
</FindUnderPath>
<ItemGroup>
<!--
Every item added to _FilesToCopyToRockWeb must be an absolute path. The
task determines where a file lands by stripping the absolute Source path
off of it, so a relative path would be copied to the wrong location.
FindUnderPath already returns absolute paths, but a glob does not, so
those have to be run through %(FullPath) before being added.
-->
<_FilesToCopyToRockWeb Include="%(_SourceFilesToCopyToRockWeb.Identity)" Condition="!@(_SourceFilesToCopyToRockWeb->EndsWith('.dll.config'))" />
<!--
Microsoft.Data.SqlClient.SNI native binaries are copied by the package's
own targets, but those copies do not always flow into @(FileWrites).
Include them explicitly from OutDir so they are mirrored into RockWeb\Bin.
-->
<_SniNativeFilesToCopyToRockWeb Include="$(OutDir)**\Microsoft.Data.SqlClient.SNI.*.dll" />
<_FilesToCopyToRockWeb Include="@(_SniNativeFilesToCopyToRockWeb->'%(FullPath)')" />
</ItemGroup>
<CopyToRockWeb
Source="$(OutDir)"
Destination="$(RockWebPath)\Bin"
Files="@(_FilesToCopyToRockWeb)"
Exclude="$(ExcludeFromRockWebCopy)" />
</Target>
<!--
SQL migration scripts and JSON data files. A project lists them as SqlScript
items. Each file is compressed into obj\sql\ and the compressed copy is
embedded with the logical name "{file name}.gz", so names never depend on
folders. The file itself is never embedded. See specs/261027-sql-migrations-on-net-framework.md.
-->
<ItemGroup>
<!-- Lets Visual Studio's fast up-to-date check see edits to scripts. -->
<UpToDateCheckInput Include="@(SqlScript)" />
</ItemGroup>
<!-- Recompresses only the scripts that changed since the last build. -->
<Target Name="_CompressSqlScripts" Condition="'@(SqlScript)' != ''"
Inputs="@(SqlScript)"
Outputs="@(SqlScript->'$(IntermediateOutputPath)sql\%(Filename)%(Extension).gz')">
<GzipFiles Files="@(SqlScript)" OutputDirectory="$(IntermediateOutputPath)sql" />
</Target>
<!--
Always runs, so the compressed files are embedded even when compression was
skipped, and are recorded in FileWrites so Clean removes them.
-->
<Target Name="_EmbedSqlScripts" BeforeTargets="BeforeBuild" DependsOnTargets="_CompressSqlScripts" Condition="'@(SqlScript)' != ''">
<ItemGroup>
<_CompressedSqlScript Include="@(SqlScript->'$(IntermediateOutputPath)sql\%(Filename)%(Extension).gz')" />
<EmbeddedResource Include="@(_CompressedSqlScript)" LogicalName="%(Filename)%(Extension)" WithCulture="false" Type="Non-Resx" />
<FileWrites Include="@(_CompressedSqlScript)" />
</ItemGroup>
</Target>
</Project>