This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
/
build.proj
74 lines (58 loc) · 3.84 KB
/
build.proj
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
<?xml version="1.0" encoding="utf-8"?>
<!--
# Targets
/t:Build
Builds assemblies.
/t:Clean
Removes temporary build outputs.
/t:Test
Runs tests
-->
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)repo.props" />
<PropertyGroup>
<!-- Flags -->
<SkipHelp Condition ="'$(SkipHelp)' != 'true'">false</SkipHelp>
<!-- Folders -->
<TestOutputDirectory>$(RepoArtifacts)TestResults</TestOutputDirectory>
<StaticAnalysisOutputDirectory>$(RepoArtifacts)StaticAnalysisResults</StaticAnalysisOutputDirectory>
<!-- General -->
<Configuration Condition="'$(Configuration)' != 'Release'">Debug</Configuration>
<!-- PowerShell -->
<PowerShellCoreCommandPrefix>pwsh -NonInteractive -NoLogo -NoProfile -Command</PowerShellCoreCommandPrefix>
</PropertyGroup>
<Target Name="Build">
<!-- Build the project -->
<Exec Command="dotnet build Partner-Center-PowerShell.sln -c $(Configuration)" />
<!-- Delete PowerShell runtime files -->
<PropertyGroup>
<RuntimeDllsIncludeList>Microsoft.Powershell.*.dll,System*.dll,Microsoft.VisualBasic.dll,Microsoft.CSharp.dll,Microsoft.CodeAnalysis.dll,Microsoft.CodeAnalysis.CSharp.dll</RuntimeDllsIncludeList>
<RuntimeDllsExcludeList>System.Security.Cryptography.ProtectedData.dll,System.Configuration.ConfigurationManager.dll,System.Runtime.CompilerServices.Unsafe.dll,System.IO.FileSystem.AccessControl.dll,System.Buffers.dll,System.Text.Encodings.Web.dll,System.CodeDom.dll</RuntimeDllsExcludeList>
</PropertyGroup>
<Exec Command="$(PowerShellCoreCommandPrefix) "Get-ChildItem -Path $(RepoArtifacts)/$(Configuration) -Recurse -Include $(RuntimeDllsIncludeList) -Exclude $(RuntimeDllsExcludeList) | Remove-Item -Recurse -Force"" />
<Exec Command="$(PowerShellCoreCommandPrefix) "Get-ChildItem -Path $(RepoArtifacts)/$(Configuration) -Recurse -Include 'runtimes' | Remove-Item -Recurse -Force"" />
</Target>
<Target Name="Clean">
<Message Importance="high" Text="Cleaning Cmdlets..." />
<!-- Clean out the NuGet cache -->
<Exec Command="dotnet nuget locals global-packages --clear" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" />
<!-- Remove Package, Publish, bin, obj, and TestResults directories -->
<Exec Command="$(PowerShellCoreCommandPrefix) "Remove-Item -Path $(RepoArtifacts) -Recurse -Force -ErrorAction Ignore"" IgnoreExitCode="true" />
<Exec Command="$(PowerShellCoreCommandPrefix) "Get-ChildItem -Path $(MSBuildThisFileDirectory) -Recurse -Include 'bin','obj','TestResults' | Remove-Item -Recurse -Force -ErrorAction Ignore"" IgnoreExitCode="true" />
</Target>
<Target Name="GenerateHelp" Condition="'$(SkipHelp)' == 'false'">
<Message Importance="high" Text="Running help generation..." />
<MakeDir Directories="$(StaticAnalysisOutputDirectory)" />
<Exec Command="$(PowerShellCoreCommandPrefix) "Set-Variable -Name ProgressPreference -Value 'SilentlyContinue';. $(RepoTools)/GenerateHelp.ps1 -ValidateMarkdownHelp -GenerateMamlHelp -BuildConfig $(Configuration)"" />
</Target>
<Target Name="Full" DependsOnTargets="Clean;Build;GenerateHelp;ValidateModule;Test" />
<Target Name="Test">
<Message Importance="high" Text="Running unit tests..." />
<MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" />
<Exec Command="dotnet test Partner-Center-PowerShell.sln --configuration $(Configuration) --logger trx --results-directory "$(TestOutputDirectory)"" />
</Target>
<Target Name="ValidateModule">
<Message Importance="high" Text="Validating the module definition..." />
<Exec Command="$(PowerShellCoreCommandPrefix) "Test-ModuleManifest $(RepoArtifacts)$(Configuration)/PartnerCenter.psd1"" />
</Target>
</Project>