summaryrefslogtreecommitdiff
path: root/.packages/microsoft.dotnet.arcade.sdk/1.0.0-beta.20113.5/tools/VisualStudio.SetupPackage.vsmanproj
blob: 00f787fa0960e2939664fd05af3ab54aebfb95b1 (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
<?xml version="1.0" encoding="utf-8"?>
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<Project>
  <!--
    Required variables:
      OfficialBuild                   True for official builds.
      ComponentName                   Name of the component (VSIX)
      SetupOutputPath                 Directory to drop Willow manifests to.
      ComponentIntermediateOutputPath Intermediate directory where the component is being built.
      SwixBuildPath                   SwixBuild package path.
      VisualStudioDropName            The name of Visual Studio drop, e.g. 
                                      "Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)"
                                      The manifest will be published with URI
                                      https://vsdrop.corp.microsoft.com/file/v1/$(VisualStudioDropName)
  -->

  <PropertyGroup>
    <ResolveNuGetPackages>false</ResolveNuGetPackages>
    <ImportDirectoryBuildProps>false</ImportDirectoryBuildProps>
    <ImportDirectoryBuildTargets>false</ImportDirectoryBuildTargets>
  </PropertyGroup>

  <Import Project="$(SwixBuildPath)build\MicroBuild.Plugins.*.props" />

  <PropertyGroup>
    <FinalizeManifest>true</FinalizeManifest>
    <FinalizeSkipLayout>true</FinalizeSkipLayout>
    <IsPackage>true</IsPackage>
    <TargetName>$(ComponentName)</TargetName>
    <OutputPath>$(SetupOutputPath)</OutputPath>
    <IntermediateOutputPath>$(ComponentIntermediateOutputPath)</IntermediateOutputPath>

    <!-- Note that the url is expected to end with ';' (%3B) -->
    <ManifestPublishUrl Condition="'$(VisualStudioDropName)' != ''">https://vsdrop.corp.microsoft.com/file/v1/$(VisualStudioDropName)%3B</ManifestPublishUrl>
    <ManifestPublishUrl Condition="'$(VisualStudioDropName)' == ''">http://localhost/non-official-build%3B</ManifestPublishUrl>
  </PropertyGroup>

  <ItemGroup>
    <_PackageStubFiles Include="$(ComponentIntermediateOutputPath)*.stub"/>
    <MergeManifest Include="@(_PackageStubFiles->'$(SetupOutputPath)%(Filename).json')"/>
  </ItemGroup>

  <Import Project="$(SwixBuildPath)build\MicroBuild.Plugins.*.targets" />

  <Target Name="_BuildManifest" DependsOnTargets="_SetManifestBuildVersion;GenerateSetupManifest" />
  
  <!--
    Each stub file contains VSIX version of the respective VSIX file.
    We require that all VSIXes included in a single VS insertion component have the same version.
    This version will be set to ManifestBuildVersion.
  -->
  <Target Name="_SetManifestBuildVersion">

    <ReadLinesFromFile File="%(_PackageStubFiles.Identity)">
      <Output TaskParameter="Lines" ItemName="_StubLine"/>
    </ReadLinesFromFile>

    <ItemGroup>
      <_StubLineSplit Include="@(_StubLine)" 
                      Name="$([MSBuild]::ValueOrDefault('%(_StubLine.Identity)', '').Split('/')[0])" 
                      Version="$([MSBuild]::ValueOrDefault('%(_StubLine.Identity)', '').Split('/')[1])" />
    </ItemGroup>

    <ItemGroup>
      <_VsixVersion Include="%(_StubLineSplit.Version)" Name="%(_StubLineSplit.Name)" />
    </ItemGroup>

    <RemoveDuplicates Inputs="@(_VsixVersion)">
      <Output TaskParameter="Filtered" ItemName="_VsixVersionNoDuplicates"/>
    </RemoveDuplicates>

    <Error Text="Visual Studio component '$(ComponentName)' contains multiple VSIX files with different versions: @(_VsixVersionNoDuplicates->'%(Name) (version %(Identity))', ', ')"
           Condition="@(_VsixVersionNoDuplicates->Count()) != 1"/>

    <PropertyGroup>
      <ManifestBuildVersion>@(_VsixVersionNoDuplicates)</ManifestBuildVersion>
    </PropertyGroup>
  </Target>
</Project>