Skip to content

Commit 77f9608

Browse files
committed
Bundle Source Link packages
1 parent e0390ce commit 77f9608

File tree

13 files changed

+314
-10
lines changed

13 files changed

+314
-10
lines changed
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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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+
Console.WriteLine("Hello World!");
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<RestorePackagesPath Condition=" '$(RestorePackagesPath)' == '' ">$(MSBuildThisFileDirectory)..\..\..\artifacts\.nuget\packages</RestorePackagesPath>
4+
<NoPackageAnalysis>true</NoPackageAnalysis>
5+
<TargetFramework>$(CurrentTargetFramework)</TargetFramework>
6+
<OutputType>Exe</OutputType>
7+
</PropertyGroup>
8+
</Project>

src/Layout/redist/targets/BundledSdks.targets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,13 @@
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+
<!-- Use the same version for all Source Link packages -->
9+
<BundledSdk Include="Microsoft.Build.Tasks.Git" Version="$(MicrosoftSourceLinkGitHubVersion)" />
10+
<BundledSdk Include="Microsoft.SourceLink.Common" Version="$(MicrosoftSourceLinkGitHubVersion)" />
11+
<BundledSdk Include="Microsoft.SourceLink.AzureRepos.Git" Version="$(MicrosoftSourceLinkGitHubVersion)" />
12+
<BundledSdk Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" />
13+
<BundledSdk Include="Microsoft.SourceLink.GitLab" Version="$(MicrosoftSourceLinkGitHubVersion)" />
14+
<BundledSdk Include="Microsoft.SourceLink.Bitbucket.Git" Version="$(MicrosoftSourceLinkGitHubVersion)" />
715
</ItemGroup>
816
</Project>

src/Layout/redist/targets/RestoreDependency.proj

Lines changed: 13 additions & 8 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.
@@ -24,24 +24,29 @@
2424

2525
<Target Name="GetSdkItemsToCopy">
2626
<ItemGroup>
27-
<SdkContent Include="$(DependencyNuPkgPath)/**/*"
28-
Exclude="$(DependencyNuPkgPath)/$(DependencyPackageName).nuspec;
29-
$(DependencyNuPkgPath)/$(DependencyPackageName).$(DependencyPackageVersion).nupkg;
30-
$(DependencyNuPkgPath)/$(DependencyPackageName).$(DependencyPackageVersion).nupkg.sha512" />
27+
<SdkContent Include="$(DependencyNuPkgPath)**\*"
28+
Exclude="$(DependencyNuPkgPath)Icon.png;
29+
$(DependencyNuPkgPath)$(DependencyPackageName).nuspec;
30+
$(DependencyNuPkgPath)$(DependencyPackageName).$(DependencyPackageVersion).nupkg;
31+
$(DependencyNuPkgPath)$(DependencyPackageName).$(DependencyPackageVersion).nupkg.sha512" />
3132
</ItemGroup>
3233
</Target>
3334

3435
<Target Name="EnsureDependencyRestored"
35-
Condition="!Exists('$(DependencyNuPkgPath)/$(DependencyPackageName.ToLower()).nuspec')">
36+
DependsOnTargets="PrepareBundledDependencyProps"
37+
Condition="!Exists('$(DependencyNuPkgPath)$(DependencyPackageName.ToLower()).nuspec')">
38+
39+
<Message Text="Dependency has not been restored yet: '$(DependencyNuPkgPath)$(DependencyPackageName.ToLower()).nuspec'"/>
40+
3641
<MSbuild
37-
Projects="$(MSBuildThisFileDirectory)/sdks/sdks.csproj"
42+
Projects="$(MSBuildThisFileDirectory)sdks\sdks.csproj"
3843
Properties="DependencyPackageName=$(DependencyPackageName);DependencyPackageVersion=$(DependencyPackageVersion)"
3944
Targets="Restore" />
4045
</Target>
4146

4247
<Target Name="PrepareBundledDependencyProps">
4348
<PropertyGroup>
44-
<DependencyNuPkgPath>$(NuGetPackageRoot)/$(DependencyPackageName.ToLower())/$(DependencyPackageVersion.ToLower())</DependencyNuPkgPath>
49+
<DependencyNuPkgPath>$(NuGetPackageRoot)$(DependencyPackageName.ToLower())\$(DependencyPackageVersion.ToLower())\</DependencyNuPkgPath>
4550
</PropertyGroup>
4651
</Target>
4752
</Project>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Copyright (c) .NET Foundation. All rights reserved.
1313

1414
<!-- This file is imported by both cross-targeting and inner builds. Set properties that need to be available to both here. -->
1515

16+
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.SourceLink.targets" />
17+
1618
<PropertyGroup>
1719
<MicrosoftNETBuildTasksDirectoryRoot>$(MSBuildThisFileDirectory)..\tools\</MicrosoftNETBuildTasksDirectoryRoot>
1820
<MicrosoftNETBuildTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">net8.0</MicrosoftNETBuildTasksTFM>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!--
2+
***********************************************************************************************
3+
Microsoft.NET.Sdk.FSharp.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="'$(SuppressImplicitGitSourceLink)' == '' and '$(PkgMicrosoft_SourceLink_Common)' != ''">true</SuppressImplicitGitSourceLink>
21+
</PropertyGroup>
22+
23+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.Build.Tasks.Git\$(_SourceLinkSdkSubDir)\Microsoft.Build.Tasks.Git.props" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
24+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.Common\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.Common.props" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
25+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.GitHub\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.GitHub.props" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
26+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.GitLab\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.GitLab.props" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
27+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.AzureRepos.Git\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.AzureRepos.Git.props" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
28+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.Bitbucket.Git\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.Bitbucket.Git.props" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
29+
30+
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!--
2+
***********************************************************************************************
3+
Microsoft.NET.Sdk.FSharp.targets
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 Condition="'$(SuppressImplicitGitSourceLink)' != 'true'">
16+
<EmbedUntrackedSources Condition="'$(EmbedUntrackedSources)' == ''">true</EmbedUntrackedSources>
17+
</PropertyGroup>
18+
19+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.Build.Tasks.Git\$(_SourceLinkSdkSubDir)\Microsoft.Build.Tasks.Git.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
20+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.Common\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.Common.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
21+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.GitHub\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.GitHub.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
22+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.GitLab\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.GitLab.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
23+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.AzureRepos.Git\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.AzureRepos.Git.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
24+
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.Bitbucket.Git\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.Bitbucket.Git.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
25+
26+
</Project>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ Copyright (c) .NET Foundation. All rights reserved.
157157
<!-- List of supported .NET windows target platform versions -->
158158
<Import Project="Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props" />
159159

160+
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.SourceLink.props" />
161+
160162
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.CSharp.props" Condition="'$(MSBuildProjectExtension)' == '.csproj'" />
161163
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.VisualBasic.props" Condition="'$(MSBuildProjectExtension)' == '.vbproj'" />
162164
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.FSharp.props" Condition="'$(MSBuildProjectExtension)' == '.fsproj'" />

0 commit comments

Comments
 (0)