Skip to content

Commit dd2e7b5

Browse files
authored
Bundle Source Link packages (#31632)
1 parent fb5bb18 commit dd2e7b5

File tree

16 files changed

+466
-17
lines changed

16 files changed

+466
-17
lines changed

eng/Version.Details.xml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,31 @@
274274
<Uri>https://github.com/dotnet/deployment-tools</Uri>
275275
<Sha>9e870996b8bf0b91a791edd1039bfd23bdd01af8</Sha>
276276
</Dependency>
277+
<Dependency Name="Microsoft.Build.Tasks.Git" Version="8.0.0-beta.23210.3">
278+
<Uri>https://github.com/dotnet/sourcelink</Uri>
279+
<Sha>759f344923a0859f3fae83431d0ba1cc62108118</Sha>
280+
<SourceBuild RepoName="sourcelink" ManagedOnly="true" />
281+
</Dependency>
282+
<Dependency Name="Microsoft.SourceLink.Common" Version="8.0.0-beta.23210.3">
283+
<Uri>https://github.com/dotnet/sourcelink</Uri>
284+
<Sha>759f344923a0859f3fae83431d0ba1cc62108118</Sha>
285+
</Dependency>
286+
<Dependency Name="Microsoft.SourceLink.AzureRepos.Git" Version="8.0.0-beta.23210.3">
287+
<Uri>https://github.com/dotnet/sourcelink</Uri>
288+
<Sha>759f344923a0859f3fae83431d0ba1cc62108118</Sha>
289+
</Dependency>
290+
<Dependency Name="Microsoft.SourceLink.GitHub" Version="8.0.0-beta.23210.3">
291+
<Uri>https://github.com/dotnet/sourcelink</Uri>
292+
<Sha>759f344923a0859f3fae83431d0ba1cc62108118</Sha>
293+
</Dependency>
294+
<Dependency Name="Microsoft.SourceLink.GitLab" Version="8.0.0-beta.23210.3">
295+
<Uri>https://github.com/dotnet/sourcelink</Uri>
296+
<Sha>759f344923a0859f3fae83431d0ba1cc62108118</Sha>
297+
</Dependency>
298+
<Dependency Name="Microsoft.SourceLink.BitBucket.Git" Version="8.0.0-beta.23210.3">
299+
<Uri>https://github.com/dotnet/sourcelink</Uri>
300+
<Sha>759f344923a0859f3fae83431d0ba1cc62108118</Sha>
301+
</Dependency>
277302
<!-- Explicit dependency because Microsoft.Deployment.DotNet.Releases has different versioning
278303
than the SB intermediate -->
279304
<Dependency Name="Microsoft.SourceBuild.Intermediate.deployment-tools" Version="8.0.0-preview.6.23206.1">
@@ -288,11 +313,6 @@
288313
<Sha>17d9eee32f20a6af0ebb620254a22f601d159578</Sha>
289314
<SourceBuild RepoName="arcade" ManagedOnly="true" />
290315
</Dependency>
291-
<Dependency Name="Microsoft.SourceLink.GitHub" Version="8.0.0-beta.23210.3" CoherentParentDependency="Microsoft.DotNet.Arcade.Sdk">
292-
<Uri>https://github.com/dotnet/sourcelink</Uri>
293-
<Sha>759f344923a0859f3fae83431d0ba1cc62108118</Sha>
294-
<SourceBuild RepoName="sourcelink" ManagedOnly="true" />
295-
</Dependency>
296316
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="8.0.0-beta.23211.8">
297317
<Uri>https://github.com/dotnet/arcade</Uri>
298318
<Sha>17d9eee32f20a6af0ebb620254a22f601d159578</Sha>

eng/Versions.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@
174174
<!-- Dependencies from https://github.com/dotnet/xliff-tasks -->
175175
<MicrosoftDotNetXliffTasksVersion>1.0.0-beta.23206.1</MicrosoftDotNetXliffTasksVersion>
176176
</PropertyGroup>
177+
<PropertyGroup>
178+
<!-- Dependencies from https://github.com/dotnet/sourcelink -->
179+
<MicrosoftBuildTasksGitVersion>8.0.0-beta.23210.3</MicrosoftBuildTasksGitVersion>
180+
<MicrosoftSourceLinkCommonVersion>8.0.0-beta.23210.3</MicrosoftSourceLinkCommonVersion>
181+
<MicrosoftSourceLinkAzureReposGitVersion>8.0.0-beta.23210.3</MicrosoftSourceLinkAzureReposGitVersion>
182+
<MicrosoftSourceLinkGitHubVersion>8.0.0-beta.23210.3</MicrosoftSourceLinkGitHubVersion>
183+
<MicrosoftSourceLinkGitLabVersion>8.0.0-beta.23210.3</MicrosoftSourceLinkGitLabVersion>
184+
<MicrosoftSourceLinkBitBucketVersion>8.0.0-beta.23210.3</MicrosoftSourceLinkBitBucketVersion>
185+
</PropertyGroup>
177186
<!-- Get .NET Framework reference assemblies from NuGet packages -->
178187
<PropertyGroup>
179188
<UsingToolNetFrameworkReferenceAssemblies>true</UsingToolNetFrameworkReferenceAssemblies>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<Project>
2+
</Project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<Project>
2+
</Project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) .NET Foundation and contributors. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System;
5+
6+
class Program
7+
{
8+
public static void Main()
9+
{
10+
Console.WriteLine("Hello World!");
11+
}
12+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<NoPackageAnalysis>true</NoPackageAnalysis>
4+
<TargetFramework>$(CurrentTargetFramework)</TargetFramework>
5+
<OutputType>Exe</OutputType>
6+
</PropertyGroup>
7+
</Project>

src/Layout/redist/targets/BundledSdks.targets

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,12 @@
44
<BundledSdk Include="Microsoft.NET.Sdk.WindowsDesktop" Version="$(MicrosoftNETSdkWindowsDesktopPackageVersion)" Condition="'$(DotNetBuildFromSource)' != 'true'" />
55
<BundledSdk Include="FSharp.NET.Sdk" Version="1.0.4-bundled-0100" />
66
<BundledSdk Include="Microsoft.Docker.Sdk" Version="1.1.0" />
7+
8+
<BundledSdk Include="Microsoft.Build.Tasks.Git" Version="$(MicrosoftBuildTasksGitVersion)" />
9+
<BundledSdk Include="Microsoft.SourceLink.Common" Version="$(MicrosoftSourceLinkCommonVersion)" />
10+
<BundledSdk Include="Microsoft.SourceLink.AzureRepos.Git" Version="$(MicrosoftSourceLinkAzureReposGitVersion)" />
11+
<BundledSdk Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" />
12+
<BundledSdk Include="Microsoft.SourceLink.GitLab" Version="$(MicrosoftSourceLinkGitLabVersion)" />
13+
<BundledSdk Include="Microsoft.SourceLink.Bitbucket.Git" Version="$(MicrosoftSourceLinkBitBucketVersion)" />
714
</ItemGroup>
815
</Project>
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project ToolsVersion="15.0" DefaultTargets="EnsureDependencyRestored;CopySdkToOutput">
1+
<Project ToolsVersion="15.0" DefaultTargets="PrepareBundledDependencyProps;EnsureDependencyRestored;CopySdkToOutput">
22
<!--
33
44
Note that the CopySdkToOutput target explicitly does NOT have Inputs and Outputs declared.
@@ -10,8 +10,7 @@
1010
-->
1111

1212
<Target Name="CopySdkToOutput"
13-
DependsOnTargets="PrepareBundledDependencyProps;
14-
EnsureDependencyRestored;
13+
DependsOnTargets="EnsureDependencyRestored;
1514
GetSdkItemsToCopy"
1615
Condition="'$(SdkLayoutDirectory)' != ''"
1716
>
@@ -24,24 +23,28 @@
2423

2524
<Target Name="GetSdkItemsToCopy">
2625
<ItemGroup>
27-
<SdkContent Include="$(DependencyNuPkgPath)/**/*"
28-
Exclude="$(DependencyNuPkgPath)/$(DependencyPackageName).nuspec;
29-
$(DependencyNuPkgPath)/$(DependencyPackageName).$(DependencyPackageVersion).nupkg;
30-
$(DependencyNuPkgPath)/$(DependencyPackageName).$(DependencyPackageVersion).nupkg.sha512" />
26+
<SdkContent Include="$(DependencyNuPkgPath)**\*"
27+
Exclude="$(DependencyNuPkgPath)Icon.png;
28+
$(DependencyNuPkgPath)$(DependencyPackageName).nuspec;
29+
$(DependencyNuPkgPath)$(DependencyPackageName).$(DependencyPackageVersion).nupkg;
30+
$(DependencyNuPkgPath)$(DependencyPackageName).$(DependencyPackageVersion).nupkg.sha512" />
3131
</ItemGroup>
3232
</Target>
3333

3434
<Target Name="EnsureDependencyRestored"
35-
Condition="!Exists('$(DependencyNuPkgPath)/$(DependencyPackageName.ToLower()).nuspec')">
35+
Condition="!Exists('$(DependencyNuPkgPath)$(DependencyPackageName.ToLower()).nuspec')">
36+
37+
<Message Text="Dependency has not been restored yet: '$(DependencyNuPkgPath)$(DependencyPackageName.ToLower()).nuspec'"/>
38+
3639
<MSbuild
37-
Projects="$(MSBuildThisFileDirectory)/sdks/sdks.csproj"
40+
Projects="$(MSBuildThisFileDirectory)sdks\sdks.csproj"
3841
Properties="DependencyPackageName=$(DependencyPackageName);DependencyPackageVersion=$(DependencyPackageVersion)"
3942
Targets="Restore" />
4043
</Target>
4144

4245
<Target Name="PrepareBundledDependencyProps">
4346
<PropertyGroup>
44-
<DependencyNuPkgPath>$(NuGetPackageRoot)/$(DependencyPackageName.ToLower())/$(DependencyPackageVersion.ToLower())</DependencyNuPkgPath>
47+
<DependencyNuPkgPath>$(NuGetPackageRoot)$(DependencyPackageName.ToLower())\$(DependencyPackageVersion.ToLower())\</DependencyNuPkgPath>
4548
</PropertyGroup>
4649
</Target>
4750
</Project>

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.CrossTargeting.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Copyright (c) .NET Foundation. All rights reserved.
1212
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1313

1414
<Import Project="Microsoft.NET.Sdk.Common.targets"/>
15+
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.SourceLink.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
1516

1617
<!--
1718
============================================================
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--
2+
***********************************************************************************************
3+
Microsoft.NET.Sdk.SourceLink.props
4+
5+
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6+
created a backup copy. Incorrect changes to this file will make it
7+
impossible to load or build your projects from the command-line or the IDE.
8+
9+
Copyright (c) .NET Foundation. All rights reserved.
10+
***********************************************************************************************
11+
-->
12+
13+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
14+
15+
<PropertyGroup>
16+
<_SourceLinkSdkSubDir>build</_SourceLinkSdkSubDir>
17+
<_SourceLinkSdkSubDir Condition="'$(IsCrossTargetingBuild)' == 'true'">buildMultiTargeting</_SourceLinkSdkSubDir>
18+
19+
<!-- Suppress implicit SourceLink inclusion if any Microsoft.SourceLink package is referenced. -->
20+
<SuppressImplicitGitSourceLink Condition="'$(PkgMicrosoft_SourceLink_Common)' != ''">true</SuppressImplicitGitSourceLink>
21+
</PropertyGroup>
22+
23+
<ImportGroup Condition="'$(SuppressImplicitGitSourceLink)' != 'true'">
24+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.Build.Tasks.Git\$(_SourceLinkSdkSubDir)\Microsoft.Build.Tasks.Git.props"/>
25+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.Common\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.Common.props"/>
26+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.GitHub\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.GitHub.props"/>
27+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.GitLab\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.GitLab.props"/>
28+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.AzureRepos.Git\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.AzureRepos.Git.props"/>
29+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.Bitbucket.Git\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.Bitbucket.Git.props"/>
30+
</ImportGroup>
31+
32+
</Project>

0 commit comments

Comments
 (0)