Skip to content

Commit

Permalink
Bundle Source Link packages
Browse files Browse the repository at this point in the history
  • Loading branch information
tmat committed Apr 7, 2023
1 parent 5bf500d commit ee262cb
Show file tree
Hide file tree
Showing 15 changed files with 380 additions and 12 deletions.
34 changes: 32 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,36 @@
<Uri>https://github.com/dotnet/deployment-tools</Uri>
<Sha>b60c95e1ce736630d17e16626c59e3dd85ebae2b</Sha>
</Dependency>
<Dependency Name="Microsoft.Build.Tasks.Git" Version="1.2.0-beta-23207-01">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
<SourceBuild RepoName="sourcelink" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceLink.Common" Version="1.2.0-beta-23207-01">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
<SourceBuild RepoName="sourcelink" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceLink.AzureRepos.Git" Version="1.2.0-beta-23207-01">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
<SourceBuild RepoName="sourcelink" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceLink.GitHub" Version="1.2.0-beta-23207-01">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
<SourceBuild RepoName="sourcelink" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceLink.GitLab" Version="1.2.0-beta-23207-01">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
<SourceBuild RepoName="sourcelink" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceLink.BitBucket.Git" Version="1.2.0-beta-23207-01">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
<SourceBuild RepoName="sourcelink" ManagedOnly="true" />
</Dependency>
<!-- Explicit dependency because Microsoft.Deployment.DotNet.Releases has different versioning
than the SB intermediate -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.deployment-tools" Version="8.0.0-preview.1.23159.4">
Expand All @@ -284,9 +314,9 @@
<Sha>290a3ecc0e3dabcdcafff632ccbf28d42db8061b</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceLink.GitHub" Version="1.2.0-beta-23202-01" CoherentParentDependency="Microsoft.DotNet.Arcade.Sdk">
<Dependency Name="Microsoft.SourceLink.GitHub" Version="1.2.0-beta-23207-01" CoherentParentDependency="Microsoft.DotNet.Arcade.Sdk">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>47edfd68f25fc5a9dd399b6e3f8f20a355f82e1a</Sha>
<Sha>31a772fb8b2e3430e91766cdb169fba379f0d013</Sha>
<SourceBuild RepoName="sourcelink" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="8.0.0-beta.23205.4">
Expand Down
9 changes: 9 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@
<!-- Dependencies from https://github.com/dotnet/xliff-tasks -->
<MicrosoftDotNetXliffTasksVersion>1.0.0-beta.23180.1</MicrosoftDotNetXliffTasksVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Dependencies from https://github.com/dotnet/sourcelink -->
<MicrosoftBuildTasksGitVersion>1.2.0-beta-23207-01</MicrosoftBuildTasksGitVersion>
<MicrosoftSourceLinkCommonVersion>1.2.0-beta-23207-01</MicrosoftSourceLinkCommonVersion>
<MicrosoftSourceLinkAzureReposGitVersion>1.2.0-beta-23207-01</MicrosoftSourceLinkAzureReposGitVersion>
<MicrosoftSourceLinkGitHubVersion>1.2.0-beta-23207-01</MicrosoftSourceLinkGitHubVersion>
<MicrosoftSourceLinkGitLabVersion>1.2.0-beta-23207-01</MicrosoftSourceLinkGitLabVersion>
<MicrosoftSourceLinkBitBucketVersion>1.2.0-beta-23207-01</MicrosoftSourceLinkBitBucketVersion>
</PropertyGroup>
<!-- Get .NET Framework reference assemblies from NuGet packages -->
<PropertyGroup>
<UsingToolNetFrameworkReferenceAssemblies>true</UsingToolNetFrameworkReferenceAssemblies>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</Project>
6 changes: 6 additions & 0 deletions src/Assets/TestProjects/SourceLinkTestApp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;

Console.WriteLine("Hello World!");
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RestorePackagesPath Condition=" '$(RestorePackagesPath)' == '' ">$(MSBuildThisFileDirectory)..\..\..\artifacts\.nuget\packages</RestorePackagesPath>
<NoPackageAnalysis>true</NoPackageAnalysis>
<TargetFramework>$(CurrentTargetFramework)</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
</Project>
7 changes: 7 additions & 0 deletions src/Layout/redist/targets/BundledSdks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,12 @@
<BundledSdk Include="Microsoft.NET.Sdk.WindowsDesktop" Version="$(MicrosoftNETSdkWindowsDesktopPackageVersion)" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<BundledSdk Include="FSharp.NET.Sdk" Version="1.0.4-bundled-0100" />
<BundledSdk Include="Microsoft.Docker.Sdk" Version="1.1.0" />

<BundledSdk Include="Microsoft.Build.Tasks.Git" Version="$(MicrosoftBuildTasksGitVersion)" />
<BundledSdk Include="Microsoft.SourceLink.Common" Version="$(MicrosoftSourceLinkCommonVersion)" />
<BundledSdk Include="Microsoft.SourceLink.AzureRepos.Git" Version="$(MicrosoftSourceLinkAzureReposGitVersion)" />
<BundledSdk Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" />
<BundledSdk Include="Microsoft.SourceLink.GitLab" Version="$(MicrosoftSourceLinkGitLabVersion)" />
<BundledSdk Include="Microsoft.SourceLink.Bitbucket.Git" Version="$(MicrosoftSourceLinkBitBucketVersion)" />
</ItemGroup>
</Project>
21 changes: 13 additions & 8 deletions src/Layout/redist/targets/RestoreDependency.proj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project ToolsVersion="15.0" DefaultTargets="EnsureDependencyRestored;CopySdkToOutput">
<Project ToolsVersion="15.0" DefaultTargets="PrepareBundledDependencyProps;EnsureDependencyRestored;CopySdkToOutput">
<!--
Note that the CopySdkToOutput target explicitly does NOT have Inputs and Outputs declared.
Expand All @@ -24,24 +24,29 @@

<Target Name="GetSdkItemsToCopy">
<ItemGroup>
<SdkContent Include="$(DependencyNuPkgPath)/**/*"
Exclude="$(DependencyNuPkgPath)/$(DependencyPackageName).nuspec;
$(DependencyNuPkgPath)/$(DependencyPackageName).$(DependencyPackageVersion).nupkg;
$(DependencyNuPkgPath)/$(DependencyPackageName).$(DependencyPackageVersion).nupkg.sha512" />
<SdkContent Include="$(DependencyNuPkgPath)**\*"
Exclude="$(DependencyNuPkgPath)Icon.png;
$(DependencyNuPkgPath)$(DependencyPackageName).nuspec;
$(DependencyNuPkgPath)$(DependencyPackageName).$(DependencyPackageVersion).nupkg;
$(DependencyNuPkgPath)$(DependencyPackageName).$(DependencyPackageVersion).nupkg.sha512" />
</ItemGroup>
</Target>

<Target Name="EnsureDependencyRestored"
Condition="!Exists('$(DependencyNuPkgPath)/$(DependencyPackageName.ToLower()).nuspec')">
DependsOnTargets="PrepareBundledDependencyProps"
Condition="!Exists('$(DependencyNuPkgPath)$(DependencyPackageName.ToLower()).nuspec')">

<Message Text="Dependency has not been restored yet: '$(DependencyNuPkgPath)$(DependencyPackageName.ToLower()).nuspec'"/>

<MSbuild
Projects="$(MSBuildThisFileDirectory)/sdks/sdks.csproj"
Projects="$(MSBuildThisFileDirectory)sdks\sdks.csproj"
Properties="DependencyPackageName=$(DependencyPackageName);DependencyPackageVersion=$(DependencyPackageVersion)"
Targets="Restore" />
</Target>

<Target Name="PrepareBundledDependencyProps">
<PropertyGroup>
<DependencyNuPkgPath>$(NuGetPackageRoot)/$(DependencyPackageName.ToLower())/$(DependencyPackageVersion.ToLower())</DependencyNuPkgPath>
<DependencyNuPkgPath>$(NuGetPackageRoot)$(DependencyPackageName.ToLower())\$(DependencyPackageVersion.ToLower())\</DependencyNuPkgPath>
</PropertyGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Copyright (c) .NET Foundation. All rights reserved.

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

<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.SourceLink.targets" />

<PropertyGroup>
<MicrosoftNETBuildTasksDirectoryRoot>$(MSBuildThisFileDirectory)..\tools\</MicrosoftNETBuildTasksDirectoryRoot>
<MicrosoftNETBuildTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">net8.0</MicrosoftNETBuildTasksTFM>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!--
***********************************************************************************************
Microsoft.NET.Sdk.FSharp.props
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<_SourceLinkSdkSubDir>build</_SourceLinkSdkSubDir>
<_SourceLinkSdkSubDir Condition="'$(IsCrossTargetingBuild)' == 'true'">buildMultiTargeting</_SourceLinkSdkSubDir>

<!-- Suppress implicit SourceLink inclusion if any Microsoft.SourceLink package is referenced. -->
<SuppressImplicitGitSourceLink Condition="'$(SuppressImplicitGitSourceLink)' == '' and '$(PkgMicrosoft_SourceLink_Common)' != ''">true</SuppressImplicitGitSourceLink>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.Build.Tasks.Git\$(_SourceLinkSdkSubDir)\Microsoft.Build.Tasks.Git.props" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.Common\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.Common.props" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.GitHub\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.GitHub.props" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.GitLab\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.GitLab.props" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.AzureRepos.Git\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.AzureRepos.Git.props" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.Bitbucket.Git\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.Bitbucket.Git.props" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!--
***********************************************************************************************
Microsoft.NET.Sdk.FSharp.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup Condition="'$(SuppressImplicitGitSourceLink)' != 'true'">
<EmbedUntrackedSources Condition="'$(EmbedUntrackedSources)' == ''">true</EmbedUntrackedSources>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.Build.Tasks.Git\$(_SourceLinkSdkSubDir)\Microsoft.Build.Tasks.Git.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.Common\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.Common.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.GitHub\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.GitHub.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.GitLab\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.GitLab.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.AzureRepos.Git\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.AzureRepos.Git.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)..\..\Microsoft.SourceLink.Bitbucket.Git\$(_SourceLinkSdkSubDir)\Microsoft.SourceLink.Bitbucket.Git.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<!-- List of supported .NET windows target platform versions -->
<Import Project="Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props" />

<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.SourceLink.props" />

<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.CSharp.props" Condition="'$(MSBuildProjectExtension)' == '.csproj'" />
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.VisualBasic.props" Condition="'$(MSBuildProjectExtension)' == '.vbproj'" />
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.FSharp.props" Condition="'$(MSBuildProjectExtension)' == '.fsproj'" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<OutDirName>Tests\$(MSBuildProjectName)</OutDirName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
Expand Down
Loading

0 comments on commit ee262cb

Please sign in to comment.