aboutsummaryrefslogtreecommitdiff
path: root/src/Directory.Build.targets
blob: 4adf903cd028c8ba3466d8a431d63d5145fda10d (plain)
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
96
97
98
99
100
101
102
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->

<Project>
  <PropertyGroup>
    <SigningToolExe>$(ToolsFolder)\sign.exe</SigningToolExe>
    <SigningCommand>code azure-key-vault</SigningCommand>
    <SigningConfiguration>--description "WiX Toolset" --description-url "https://wixtoolset.org/" --file-list "$(MSBuildThisFileDirectory)signing-empty-file-list.txt"  --azure-key-vault-url $(SigningKeyVaultUri) --azure-key-vault-tenant-id $(SigningTenantId) --azure-key-vault-client-id $(SigningClientId) --azure-key-vault-client-secret $(SigningClientSecret) --azure-key-vault-certificate $(SigningCertName) --timestamp-url "http://timestamp.digicert.com"</SigningConfiguration>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(IsWixTestSupportProject)'=='true' ">
    <IsTestProject>false</IsTestProject>
  </PropertyGroup>

  <ItemGroup Condition=" '$(IsWixTestSupportProject)'=='true' ">
    <ProjectCapability Remove="TestContainer" />
  </ItemGroup>

  <!-- If the git information wasn't imported yet, import the cached git information. -->
  <Import Project="$(RootBuildFolder)SomeVerInfo.props" Condition=" '$(SomeVerInfoImported)'!='true' " />
  <Import Project="internal/SetBuildNumber/SomeVerInfo.targets" />

  <PropertyGroup>
    <RepositoryUrl Condition=" '$(RepositoryUrl)'=='' ">https://github.com/wixtoolset/wix</RepositoryUrl>
    <RepositoryType Condition=" '$(RepositoryType)'=='' ">git</RepositoryType>
    <RepositoryCommit Condition=" '$(RepositoryCommit)'=='' ">$(SomeVerInfoSha)</RepositoryCommit>
    <PublishRepositoryUrl>true</PublishRepositoryUrl>

    <ProjectUrl Condition=" '$(ProjectUrl)'=='' and '$(RepositoryUrl)'!='' ">$(RepositoryUrl)</ProjectUrl>
  </PropertyGroup>

  <PropertyGroup>
    <GenerateNuspecDependsOn>
      $(GenerateNuspecDependsOn);
      __SetNuspecProperties
    </GenerateNuspecDependsOn>
  </PropertyGroup>

  <Target Name="__SetNuspecProperties"
          Condition=" Exists('$(MSBuildProjectName).nuspec') ">
    <PropertyGroup>
      <NuspecFile Condition=" '$(NuspecFile)'=='' ">$(MSBuildProjectName).nuspec</NuspecFile>
      <PackageId Condition=" '$(PackageId)'=='' ">$(MSBuildProjectName)</PackageId>
      <Title Condition=" '$(Title)'=='' ">$(Description)</Title>
      <NuspecBasePath Condition=" '$(NuspecBasePath)'=='' ">$(OutputPath)</NuspecBasePath>
      <NuspecProperties>$(NuspecProperties);Id=$(PackageId);Version=$(PackageVersion);MajorVersion=$(SomeVerInfoMajor);NextMajorVersion=$(SomeVerInfoNextMajor);Authors=$(Authors);Configuration=$(Configuration)</NuspecProperties>
      <NuspecProperties>$(NuspecProperties);Copyright=$(Copyright);Description=$(Description);Title=$(Title)</NuspecProperties>
      <NuspecProperties>$(NuspecProperties);RepositoryType=$(RepositoryType);RepositoryCommit=$(RepositoryCommit);RepositoryUrl=$(RepositoryUrl)</NuspecProperties>
      <NuspecProperties>$(NuspecProperties);ProjectUrl=$(ProjectUrl);ProjectFolder=$(MSBuildProjectDirectory)</NuspecProperties>
    </PropertyGroup>
  </Target>

  <Target Name="PackNative" DependsOnTargets="__SetNuspecProperties"
          Condition=" Exists('$(MSBuildProjectName).nuspec') ">

    <Exec Command='nuget pack $(NuspecFile) -OutputDirectory "$(PackageOutputPath.Trim(&quot;\&quot;))" -BasePath $(NuspecBasePath) -Properties "$(NuspecProperties)"'
          WorkingDirectory="$(MSBuildProjectDirectory)" />

    <ItemGroup>
      <NuGetPackOutput Include="$(PackageOutputPath)\$(PackageId).$(PackageVersion).nupkg" />
    </ItemGroup>
  </Target>

  <Target Name="SignOutput" AfterTargets="AfterBuild"
          Condition=" '$(SigningCertName)'!='' and '$(SignOutput)'!='false' and
                      ('$(MSBuildProjectExtension)'=='.csproj' or ('$(MSBuildProjectExtension)'=='.vcxproj' and '$(ConfigurationType)'!='StaticLibrary'))">

    <Message Importance="high" Text="Signing file: $(TargetPath)" />

    <Exec Command='"$(SigningToolExe)" $(SigningCommand) $(SigningConfiguration) $(TargetPath)'
          WorkingDirectory="$(MSBuildProjectDirectory)" EchoOff="true" />
  </Target>

  <Target Name="SignNupkg" AfterTargets="Pack;PackNative"
          Condition=" '$(SigningCertName)'!='' and '@(NuGetPackOutput)'!='' and '$(SignNupkg)'!='false' ">
    <ItemGroup>
      <SigningNupkgs Include="@(NuGetPackOutput)" Condition=" '%(Extension)'=='.nupkg' " />
    </ItemGroup>

    <Message Importance="high" Text="Signing nupkg: @(SigningNupkgs->&apos;%(Identity)&apos;)" />

    <Exec Command='"$(SigningToolExe)" $(SigningCommand) $(SigningConfiguration) "@(SigningNupkgs->&apos;%(Identity)&apos;)"'
          WorkingDirectory="$(MSBuildProjectDirectory)" EchoOff="true" />
  </Target>

  <Target Name="SignBundleEngine" Condition=" '$(SigningCertName)'!='' and '$(SignOutput)'!='false' ">
    <Message Importance="high" Text="Signing bundle engine: @(SignBundleEngine->&apos;%(Identity)&apos;)" />

    <Exec Command='"$(SigningToolExe)" $(SigningCommand) $(SigningConfiguration) "@(SignBundleEngine->&apos;%(Identity)&apos;)"'
          WorkingDirectory="$(MSBuildProjectDirectory)" EchoOff="true" />
  </Target>

  <Target Name="SignBundle" Condition=" '$(SigningCertName)'!='' and '$(SignOutput)'!='false' ">
    <Message Importance="high" Text="Signing bundle: @(SignBundle->&apos;%(Identity)&apos;)" />

    <Exec Command='"$(SigningToolExe)" $(SigningCommand) $(SigningConfiguration) "@(SignBundle->&apos;%(Identity)&apos;)"'
          WorkingDirectory="$(MSBuildProjectDirectory)" EchoOff="true" />
  </Target>

  <Import Project="Directory$(MSBuildProjectExtension).targets" Condition=" Exists('Directory$(MSBuildProjectExtension).targets') " />
  <Import Project="Custom.Build.targets" Condition=" Exists('Custom.Build.targets') " />
</Project>