Initial checkin of source-build tarball build infrastructure (#10961)

* Initial checkin of source-build tarball build infra

* Add a couple more comments

* Update eng/SourceBuild.Version.Details.xml based on PR review

Co-authored-by: Chris Rummel <crummel@microsoft.com>

* Updates based on PR review comments

Co-authored-by: Chris Rummel <crummel@microsoft.com>
This commit is contained in:
Dan Seefeldt 2021-06-24 16:36:04 -05:00 committed by GitHub
parent ce003df97b
commit 832010fdf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
132 changed files with 12977 additions and 1 deletions

View file

@ -4,3 +4,4 @@
# Snaps
/src/snaps/ @rbhanda
/src/sourceBuild/ @dotnet/source-build-internal

View file

@ -1,8 +1,12 @@
<Project>
<ItemGroup>
<ItemGroup Condition=" '$(ArcadeBuildTarball)' != 'true' ">
<ProjectToBuild Include="$(RepoRoot)Microsoft.DotNet.Cli.sln" />
<ProjectToBuild Condition="'$(OS)' == 'Windows_NT' And ('$(Architecture)' == 'x86' Or '$(Architecture)' == 'x64' Or '$(Architecture)' == 'arm64')"
Include="$(RepoRoot)eng\version.csproj;
$(RepoRoot)eng\native.proj" />
</ItemGroup>
<ItemGroup Condition=" '$(ArcadeBuildTarball)' == 'true' " >
<ProjectToBuild Include="$(RepoRoot)src/SourceBuild/Arcade/src/SourceBuild.Tasks.csproj" BuildInParallel="false" />
<ProjectToBuild Include="$(RepoRoot)src/SourceBuild/tarball/BuildSourceBuildTarball.proj" BuildInParallel="false" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.6.21321.1" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/mono/linker</Uri>
<Sha>f2588193553431636b9853b0f87209fa395a72c5</Sha>
<SourceBuild RepoName="linker" ManagedOnly="true" />
<RepoName>linker</RepoName>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.21319.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>a3377cccde8639089f99107e2ba5df2c8cbe6394</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="5.0.0-alpha.1.20473.1">
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
<Sha>def2e2c6dc5064319250e2868a041a3dc07f9579</Sha>
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-21309-01" CoherentParentDependency="Microsoft.DotNet.Arcade.Sdk">
<Uri>https://github.com/dotnet/sourcelink</Uri>
<Sha>4b584dbc392bb1aad49c2eb1ab84d8b489b6dccc</Sha>
<SourceBuild RepoName="sourcelink" ManagedOnly="true" />
</Dependency>
</ToolsetDependencies>
</Dependencies>

View file

@ -151,6 +151,15 @@
<DotnetDebToolVersion>2.0.0</DotnetDebToolVersion>
<MicrosoftNETTestSdkVersion>17.0.0-preview-20210518-01</MicrosoftNETTestSdkVersion>
</PropertyGroup>
<!-- dependencies for source-build tarball -->
<PropertyGroup>
<!-- These two MicrosoftBuild versions are required to build tarball tasks
These tasks will eventually move to Arcade and then these can be
removed. See https://github.com/dotnet/source-build/issues/2295 -->
<MicrosoftBuildFrameworkVersion>15.7.179</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildUtilitiesCoreVersion>15.7.179</MicrosoftBuildUtilitiesCoreVersion>
<PrivateSourceBuiltArtifactsPackageVersion>0.1.0-6.0.100-bootstrap.3</PrivateSourceBuiltArtifactsPackageVersion>
</PropertyGroup>
<!-- Workload manifest package versions -->
<PropertyGroup>
<MauiWorkloadManifestVersion>6.0.100-ci.main.806</MauiWorkloadManifestVersion>

View file

@ -0,0 +1 @@
The source and targets in the `src/SourceBuild/Arcade` directory are intended to move into the Arcade repo at some point. They are added here for ease of development while developing the tarball generation process. See https://github.com/dotnet/source-build/issues/2295

View file

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net5.0</TargetFrameworks>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<RunAnalyzers>false</RunAnalyzers>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="*.cs" />
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkVersion)" PrivateAssets="All" ExcludeAssets="Runtime" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCoreVersion)" Publish="false" ExcludeAssets="runtime" />
<PackageReference Include="NuGet.Packaging" Version="5.8.0" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,135 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace Microsoft.DotNet.SourceBuild.Tasks
{
/// <summary>
/// Reads entries in a Version.Details.xml file to find intermediate nupkg dependencies. For
/// each dependency with a "SourceBuild" element, adds an item to the "Dependencies" output.
/// </summary>
public class Tarball_ReadSourceBuildIntermediateNupkgDependencies : Task
{
[Required]
public string VersionDetailsXmlFile { get; set; }
[Required]
public string SourceBuildIntermediateNupkgPrefix { get; set; }
/// <summary>
/// The intermediate nupkg RID to use if any RID-specific intermediate nupkgs are required.
/// If this parameter isn't specified, RID-specific intermediate nupkgs can't be used and
/// this task fails.
/// </summary>
public string SourceBuildIntermediateNupkgRid { get; set; }
/// <summary>
/// %(Identity): NuGet package ID.
/// %(Name): The Name of the dependency from Version.Details.xml.
/// %(ExactVersion): NuGet package version. This can be used to look up the restored package
/// contents in a package cache.
/// %(Version): NuGet package version, wrapped in "[version]" syntax for exact match.
/// %(Uri): The URI for the repo.
/// %(Sha): The commit Sha for the dependency.
/// %(SourceBuildRepoName): The repo name to use in source-build.
/// </summary>
[Output]
public ITaskItem[] Dependencies { get; set; }
public override bool Execute()
{
XElement root = XElement.Load(VersionDetailsXmlFile, LoadOptions.PreserveWhitespace);
XName CreateQualifiedName(string plainName)
{
return root.GetDefaultNamespace().GetName(plainName);
}
Dependencies = root
.Elements()
.Elements(CreateQualifiedName("Dependency"))
.Select(d =>
{
XElement sourceBuildElement = d.Element(CreateQualifiedName("SourceBuild"));
if (sourceBuildElement == null)
{
// Ignore element: doesn't represent a source-build dependency.
return null;
}
string repoName = sourceBuildElement.Attribute("RepoName")?.Value;
if (string.IsNullOrEmpty(repoName))
{
Log.LogError($"Dependency SourceBuild RepoName null or empty in '{VersionDetailsXmlFile}' element {d}");
return null;
}
string dependencyName = d.Attribute("Name")?.Value ?? string.Empty;
if (string.IsNullOrEmpty(dependencyName))
{
// Log name missing as FYI, but this is not an error case for source-build.
Log.LogMessage($"Dependency Name null or empty in '{VersionDetailsXmlFile}' element {d}");
}
string dependencyVersion = d.Attribute("Version")?.Value;
string uri = d.Element(CreateQualifiedName("Uri"))?.Value;
string sha = d.Element(CreateQualifiedName("Sha"))?.Value;
string sourceBuildRepoName = sourceBuildElement.Attribute("RepoName")?.Value;
if (string.IsNullOrEmpty(dependencyVersion))
{
// We need a version to bring down an intermediate nupkg. Fail.
Log.LogError($"Dependency Version null or empty in '{VersionDetailsXmlFile}' element {d}");
return null;
}
string identity = SourceBuildIntermediateNupkgPrefix + repoName;
bool.TryParse(
sourceBuildElement.Attribute("ManagedOnly")?.Value,
out bool managedOnly);
// If RID-specific, add the RID to the end of the identity.
if (!managedOnly)
{
if (string.IsNullOrEmpty(SourceBuildIntermediateNupkgRid))
{
Log.LogError(
$"Parameter {nameof(SourceBuildIntermediateNupkgRid)} was " +
"not specified, indicating this project depends only on managed " +
"inputs. However, source-build element is not ManagedOnly: " +
sourceBuildElement);
return null;
}
identity += "." + SourceBuildIntermediateNupkgRid;
}
return new TaskItem(
identity,
new Dictionary<string, string>
{
["Name"] = dependencyName,
["Version"] = $"[{dependencyVersion}]",
["ExactVersion"] = dependencyVersion,
["Uri"] = uri,
["Sha"] = sha,
["SourceBuildRepoName"] = sourceBuildRepoName
});
})
.Where(d => d != null)
.ToArray();
return !Log.HasLoggedErrors;
}
}
}

View file

@ -0,0 +1,204 @@
// 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.
using Microsoft.Build.Framework;
using Microsoft.Build.Tasks;
using Microsoft.Build.Utilities;
using NuGet.Versioning;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
namespace Microsoft.DotNet.SourceBuild.Tasks
{
/// <summary>
/// Writes a props file to the given directory for each dependency specified
/// plus adds or updates an existing props file with all dependencies. The
/// intention is for the props file to be included by a source-build build
/// to get metadata about each dependent repo.
/// </summary>
public class Tarball_WriteSourceRepoProperties : Task
{
/// <summary>
/// The directory to write the props files to.
/// </summary>
[Required]
public string SourceBuildMetadataDir { get; set; }
/// <summary>
/// Dependencies to include in the props files.
///
/// %(Identity): NuGet package ID.
/// %(Name): The Name of the dependency from Version.Details.xml.
/// %(ExactVersion): NuGet package version. This can be used to look up the restored package
/// contents in a package cache.
/// %(Version): NuGet package version, wrapped in "[version]" syntax for exact match.
/// %(Uri): The URI for the repo.
/// %(Sha): The commit Sha for the dependency.
/// %(SourceBuildRepoName): The repo name to use in source-build.
/// </summary>
/// <value></value>
[Required]
public ITaskItem[] Dependencies { get; set; }
public override bool Execute()
{
var allRepoProps = new Dictionary<string, string>();
foreach (var dependency in Dependencies.Select(dep =>
new {
Name = dep.GetMetadata("Name"),
Version = dep.GetMetadata("ExactVersion"),
Sha = dep.GetMetadata("Sha"),
Uri = dep.GetMetadata("Uri")
}))
{
string repoName = GetDefaultRepoNameFromUrl(dependency.Uri);
string safeRepoName = repoName.Replace("-", "");
string propsPath = Path.Combine(SourceBuildMetadataDir, $"{repoName}.props");
DerivedVersion derivedVersion = GetVersionInfo(dependency.Version, "0");
var repoProps = new Dictionary<string, string>
{
["GitCommitHash"] = dependency.Sha,
["OfficialBuildId"] = derivedVersion.OfficialBuildId,
["OutputPackageVersion"] = dependency.Version,
["PreReleaseVersionLabel"] = derivedVersion.PreReleaseVersionLabel,
["IsStable"] = string.IsNullOrWhiteSpace(derivedVersion.PreReleaseVersionLabel) ? "true" : "false",
};
WritePropsFile(propsPath, repoProps);
allRepoProps[$"{safeRepoName}GitCommitHash"] = dependency.Sha;
allRepoProps[$"{safeRepoName}OutputPackageVersion"] = dependency.Version;
}
string allRepoPropsPath = Path.Combine(SourceBuildMetadataDir, "AllRepoVersions.props");
Log.LogMessage(MessageImportance.Normal, $"[{DateTimeOffset.Now}] Writing all repo versions to {allRepoPropsPath}");
UpdatePropsFile(allRepoPropsPath, allRepoProps);
return !Log.HasLoggedErrors;
}
/// <summary>
/// Reverse a version in the Arcade style (https://github.com/dotnet/arcade/blob/fb92b14d8cd07cf44f8f7eefa8ac58d7ffd05f3f/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.BeforeCommonTargets.targets#L18)
/// back to an OfficialBuildId + ReleaseLabel which we can then supply to get the same resulting version number.
/// </summary>
/// <param name="version">The complete version, e.g. 1.0.0-beta1-19720.5</param>
/// <param name="commitCount">The current commit count of the repo. This is used for some repos that do not use the standard versioning scheme.</param>
/// <returns></returns>
private static DerivedVersion GetVersionInfo(string version, string commitCount)
{
var nugetVersion = new NuGetVersion(version);
if (!string.IsNullOrWhiteSpace(nugetVersion.Release))
{
var releaseParts = nugetVersion.Release.Split('-', '.');
if (releaseParts.Length == 2)
{
if (releaseParts[1].TrimStart('0') == commitCount)
{
// core-sdk does this - OfficialBuildId is only used for their fake package and not in anything shipped
return new DerivedVersion { OfficialBuildId = DateTime.Now.ToString("yyyyMMdd.1"), PreReleaseVersionLabel = releaseParts[0] };
}
else
{
// NuGet does this - arbitrary build IDs
return new DerivedVersion { OfficialBuildId = releaseParts[1], PreReleaseVersionLabel = releaseParts[0] };
}
}
else if (releaseParts.Length == 3)
{
// VSTest uses full dates for the first part of their preview build numbers
if (DateTime.TryParseExact(releaseParts[1], "yyyyMMdd", new CultureInfo("en-US"), DateTimeStyles.AssumeLocal, out DateTime fullDate))
{
return new DerivedVersion { OfficialBuildId = $"{releaseParts[1]}.{releaseParts[2]}", PreReleaseVersionLabel = releaseParts[0] };
}
else if (int.TryParse(releaseParts[1], out int datePart) && int.TryParse(releaseParts[2], out int buildPart))
{
if (datePart > 1 && datePart < 8 && buildPart > 1000 && buildPart < 10000)
{
return new DerivedVersion { OfficialBuildId = releaseParts[2], PreReleaseVersionLabel = $"{releaseParts[0]}.{releaseParts[1]}" };
}
else
{
return new DerivedVersion { OfficialBuildId = $"20{((datePart / 1000))}{((datePart % 1000) / 50):D2}{(datePart % 50):D2}.{buildPart}", PreReleaseVersionLabel = releaseParts[0] };
}
}
}
else if (releaseParts.Length == 4)
{
// new preview version style, e.g. 5.0.0-preview.7.20365.12
if (int.TryParse(releaseParts[2], out int datePart) && int.TryParse(releaseParts[3], out int buildPart))
{
return new DerivedVersion { OfficialBuildId = $"20{((datePart / 1000))}{((datePart % 1000) / 50):D2}{(datePart % 50):D2}.{buildPart}", PreReleaseVersionLabel = $"{releaseParts[0]}.{releaseParts[1]}" };
}
}
}
else
{
// finalized version number (x.y.z) - probably not our code
// VSTest, Application Insights, Newtonsoft.Json do this
return new DerivedVersion { OfficialBuildId = DateTime.Now.ToString("yyyyMMdd.1"), PreReleaseVersionLabel = string.Empty };
}
throw new FormatException($"Can't derive a build ID from version {version} (commit count {commitCount}, release {string.Join(";", nugetVersion.Release.Split('-', '.'))})");
}
private static string GetDefaultRepoNameFromUrl(string repoUrl)
{
if (repoUrl.EndsWith(".git"))
{
repoUrl = repoUrl.Substring(0, repoUrl.Length - ".git".Length);
}
return repoUrl.Substring(repoUrl.LastIndexOf("/") + 1);
}
private static void UpdatePropsFile(string filePath, Dictionary<string, string> properties)
{
if (!File.Exists(filePath))
{
WritePropsFile(filePath, properties);
}
else
{
var content = new StringBuilder();
foreach (var line in File.ReadAllLines(filePath))
{
content.AppendLine(line);
if (line.Contains("<PropertyGroup>"))
{
foreach (var propName in properties.Keys.OrderBy(k => k))
{
content.AppendLine($" <{propName}>{properties[propName]}</{propName}>");
}
}
}
File.WriteAllText(filePath, content.ToString());
}
}
private static void WritePropsFile(string filePath, Dictionary<string, string> properties)
{
var content = new StringBuilder();
content.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
content.AppendLine("<Project>");
content.AppendLine(" <PropertyGroup>");
foreach (var propName in properties.Keys.OrderBy(k => k))
{
content.AppendLine($" <{propName}>{properties[propName]}</{propName}>");
}
content.AppendLine(" </PropertyGroup>");
content.AppendLine("</Project>");
File.WriteAllText(filePath, content.ToString());
}
private class DerivedVersion
{
internal string OfficialBuildId { get; set; }
internal string PreReleaseVersionLabel { get; set; }
}
}
}

View file

@ -0,0 +1,7 @@
<?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. -->
<Project>
<PropertyGroup>
<SourceBuildTasksAssembly>$(RepoRoot)\artifacts\bin\SourceBuild.Tasks\$(Configuration)\net5.0\SourceBuild.Tasks.dll</SourceBuildTasksAssembly>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,179 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project Sdk="Microsoft.DotNet.Arcade.Sdk">
<Import Project="./BuildTasks.props" />
<Import Project="../tools/SourceBuild/SourceBuildArcadeTools.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<UsingTask TaskName="Microsoft.DotNet.SourceBuild.Tasks.Tarball_ReadSourceBuildIntermediateNupkgDependencies" AssemblyFile="$(SourceBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.DotNet.SourceBuild.Tasks.Tarball_WriteSourceRepoProperties" AssemblyFile="$(SourceBuildTasksAssembly)" />
<Target Name="CreateSourceTarball"
DependsOnTargets="
CreateTarballDir;
SetupSelfGithubInfo;
CloneRepoAndDependentsRecursive;
CopyTarballContent;
">
<Message Text="Tarball successfully created: $(TarballRootDir)" Importance="High" />
</Target>
<PropertyGroup>
<TarballDir>$(RepoRoot)artifacts/tarball/</TarballDir>
<TarballRootDir>$([MSBuild]::EnsureTrailingSlash('$(TarballDir)'))</TarballRootDir>
<TarballSourceDir>$(TarballRootDir)src/</TarballSourceDir>
<TarballGitInfoDir>$(TarballRootDir)git-info/</TarballGitInfoDir>
<CloneVerbosity>quiet</CloneVerbosity> <!-- Support quiet and full -->
</PropertyGroup>
<Target Name="CreateTarballDir" >
<RemoveDir Directories='$(TarballRootDir)' Condition=" EXISTS('$(TarballRootDir)') " />
<Error Text="Tarball directory not specified. Pass /p:TarballDir=[new dir name] to specify a tarball directory." Condition=" '$(TarballDir)' == '' " />
<Error Text="Tarball directory already exists: $(TarballRootDir)" Condition=" '$(TarballRootDir)' != '' AND EXISTS('$(TarballRootDir)') " />
<MakeDir Directories="$(TarballRootDir)" Condition=" '$(TarballRootDir)' != '' " />
<MakeDir Directories="$(TarballSourceDir)" Condition=" '$(TarballSourceDir)' != '' " />
<MakeDir Directories="$(TarballGitInfoDir)" Condition=" '$(TarballGitInfoDir)' != '' " />
</Target>
<Target Name="SetupSelfGithubInfo" Condition=" '$(IsRootRepo)' != 'true' ">
<Exec
Command="cd $(RepoRoot);git config --get remote.origin.url"
ConsoleToMSBuild="true"
WorkingDirectory="$(RepoRoot)">
<Output TaskParameter="ConsoleOutput" ItemName="RootRepoUri" />
</Exec>
<Exec
Command="cd $(RepoRoot);git rev-parse HEAD"
ConsoleToMSBuild="true"
WorkingDirectory="$(RepoRoot)">
<Output TaskParameter="ConsoleOutput" ItemName="RootRepoCommitSha" />
</Exec>
<!-- This is hardcoding version for the root repo (installer), since there
isn't a Version.Details.xml file to read it from.
See https://github.com/dotnet/source-build/issues/2250 -->
<ItemGroup>
<SourceBuildRepos Include="$(GitHubRepositoryName)">
<Name>$(GitHubRepositoryName)</Name>
<Version>1.0.0</Version>
<ExactVersion>1.0.0</ExactVersion>
<Sha>@(RootRepoCommitSha)</Sha>
<Uri>@(RootRepoUri)</Uri>
<SourceBuildRepoName>$(GitHubRepositoryName)</SourceBuildRepoName>
</SourceBuildRepos>
</ItemGroup>
<Tarball_WriteSourceRepoProperties
SourceBuildMetadataDir="$(TarballGitInfoDir)"
Dependencies="@(SourceBuildRepos)" />
<PropertyGroup>
<SourceBuildRepoName>%(SourceBuildRepos.SourceBuildRepoName)</SourceBuildRepoName>
<RepoUri>%(SourceBuildRepos.Uri)</RepoUri>
<RepoSha>%(SourceBuildRepos.Sha)</RepoSha>
</PropertyGroup>
<!-- Remove root repo from SourceBuildRepos so it doesn't try to clone twice -->
<ItemGroup>
<SourceBuildRepos Remove="@(SourceBuildRepos)" />
</ItemGroup>
</Target>
<Target Name="CloneRepoAndDependentsRecursive"
DependsOnTargets="GetSourceBuildIntermediateNupkgNameConvention">
<Message Text="--> Start Cloning Repo $(SourceBuildRepoName)" Importance="High" />
<PropertyGroup>
<SourceDir>$(SourceBuildRepoName).$(RepoSha)/</SourceDir>
<TarballRepoSourceDir>$(TarballSourceDir)$(SourceDir)</TarballRepoSourceDir>
<TarballRepoSourceEngDir>$(TarballSourceDir)$(SourceDir)eng/</TarballRepoSourceEngDir>
<TarballVersionDetailsFile>$(TarballRepoSourceEngDir)Version.Details.xml</TarballVersionDetailsFile>
<CloneParam Condition=" '$(CloneVerbosity)' == 'quiet' ">-q</CloneParam>
</PropertyGroup>
<Exec
Command="git clone $(CloneParam) $(RepoUri) $(SourceDir)"
WorkingDirectory="$(TarballSourceDir)" />
<Exec
Command="git checkout $(CloneParam) $(RepoSha)"
WorkingDirectory="$(TarballRepoSourceDir)" />
<Exec
Command="git submodule update --init --recursive"
WorkingDirectory="$(TarballRepoSourceDir)" />
<Message Text="--> Done Cloning Repo $(SourceBuildRepoName)" Importance="High" />
<!-- Override to use a temporary SourceBuild specific Version.Details.xml file in installer for Preview 6
See https://github.com/dotnet/source-build/issues/2266 -->
<Copy
Condition=" '$(SourceBuildRepoName)' == 'installer' "
SourceFiles="$(RepoRoot)eng/SourceBuild.Version.Details.xml"
DestinationFiles="$(TarballRepoSourceDir)/eng/Version.Details.xml" />
<Tarball_ReadSourceBuildIntermediateNupkgDependencies
VersionDetailsXmlFile="$([MSBuild]::NormalizePath($(TarballVersionDetailsFile)))"
SourceBuildIntermediateNupkgPrefix="$(SourceBuildIntermediateNupkgPrefix)"
SourceBuildIntermediateNupkgRid="$(SourceBuildIntermediateNupkgRid)">
<Output TaskParameter="Dependencies" ItemName="SourceBuildRepos" />
</Tarball_ReadSourceBuildIntermediateNupkgDependencies>
<!-- Remove repo if it has already be cloned at any sha. This results in
The commit sha for the cloned repo in the tarball being the one that
was first encountered. -->
<ItemGroup>
<SourceBuildRepos Remove="@(SourceBuildRepos)" Condition=" EXISTS('$(TarballGitInfoDir)%(SourceBuildRepoName).props')" />
</ItemGroup>
<Tarball_WriteSourceRepoProperties
SourceBuildMetadataDir="$(TarballGitInfoDir)"
Dependencies="@(SourceBuildRepos)" />
<Message Text="--> Dependencies for $(TarballVersionDetailsFile):" Importance="High" />
<Message Text="--> [@(SourceBuildRepos)]" Importance="High" />
<MSBuild Projects="$(MSBuildProjectFile)"
Condition=" '@(SourceBuildRepos)' != '' "
Targets="CloneRepoAndDependentsRecursive"
Properties="SourceBuildRepoName=%(SourceBuildRepos.SourceBuildRepoName);RepoSha=%(SourceBuildRepos.Sha);RepoUri=%(SourceBuildRepos.Uri)" />
</Target>
<Target Name="CopyTarballContent">
<ItemGroup>
<TarballContent Include="$(RepoRoot)src/SourceBuild/tarball/content/**/*" />
<EngCommonContent Include="$(RepoRoot)eng/common/**/*" />
</ItemGroup>
<Copy
SourceFiles="@(TarballContent)"
DestinationFiles="@(TarballContent->'$(TarballRootDir)%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy
SourceFiles="@(EngCommonContent)"
DestinationFiles="@(EngCommonContent->'$(TarballRootDir)eng/common/%(RecursiveDir)%(Filename)%(Extension)')" />
<PropertyGroup>
<ExternalTarballsDir>$(TarballRootDir)packages/archive/</ExternalTarballsDir>
<SourceBuiltArtifactsTarballName>Private.SourceBuilt.Artifacts</SourceBuiltArtifactsTarballName>
<SourceBuiltArtifactsTarballUrl>https://dotnetcli.azureedge.net/source-built-artifacts/assets/</SourceBuiltArtifactsTarballUrl>
<ArchiveArtifactsTextFileName>archiveArtifacts.txt</ArchiveArtifactsTextFileName>
<ArchiveArtifactsTextFile>$(ExternalTarballsDir)$(ArchiveArtifactsTextFileName)</ArchiveArtifactsTextFile>
</PropertyGroup>
<MakeDir Directories="$(ExternalTarballsDir)" />
<ItemGroup>
<ArtifactUrls Include="$(SourceBuiltArtifactsTarballUrl)$(SourceBuiltArtifactsTarballName).$(PrivateSourceBuiltArtifactsPackageVersion).tar.gz" />
</ItemGroup>
<WriteLinesToFile
File="$(ArchiveArtifactsTextFile)"
Lines="@(ArtifactUrls)"
Overwrite="true" />
<MakeDir Directories="$(TarballRootDir)packages/prebuilt" />
</Target>
</Project>

View file

@ -0,0 +1,6 @@
<Project>
<Import Project="../Arcade/tools/SourceBuildArcadeTarball.targets" />
<Target Name="Build" DependsOnTargets="CreateSourceTarball" />
</Project>

View file

@ -0,0 +1,268 @@
<Project>
<PropertyGroup>
<ImportNetSdkFromRepoToolset>false</ImportNetSdkFromRepoToolset>
<_SuppressSdkImports>true</_SuppressSdkImports>
<Configuration Condition="$(Configuration) == ''">Release</Configuration>
</PropertyGroup>
<Import Condition="'$(SkipArcadeSdkImport)' != 'true'" Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<PropertyGroup>
<!-- Fake, for SDK. -->
<TargetFramework>netstandard2.0</TargetFramework>
<!-- We have no projects targeting multiple frameworks, so don't include in output path. -->
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup>
<Platform Condition="'$(Platform)' == 'AnyCPU'"></Platform>
<BuildArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</BuildArchitecture>
<Platform Condition="'$(Platform)' == '' AND '$(BuildArchitecture)' == 'arm64'">$(BuildArchitecture)</Platform>
<Platform Condition="'$(Platform)' == ''">x64</Platform>
<UseStableVersions Condition="'$(UseStableVersions)' == ''">true</UseStableVersions>
<!-- new supported portable/nonportable options. These control whether to build portable runtime
or portable SDK. The PortableBuild flag is only set in runtime-portable.proj and should
no longer be passed in. -->
<BuildPortableRuntime Condition="'$(BuildPortableRuntime)' == ''">false</BuildPortableRuntime>
<BuildPortableSdk Condition="'$(BuildPortableSdk)' == ''">false</BuildPortableSdk>
<UseSystemLibraries Condition="'$(UseSystemLibraries)' == '' AND '$(PortableRuntime)' != 'true'">true</UseSystemLibraries>
<UseSystemLibraries Condition="'$(UseSystemLibraries)' == ''">false</UseSystemLibraries>
</PropertyGroup>
<!-- This repo's projects are entirely infrastructure and do not ship. -->
<PropertyGroup>
<IsShipping>false</IsShipping>
</PropertyGroup>
<PropertyGroup>
<ProjectDir>$(MSBuildThisFileDirectory)</ProjectDir>
<TargetsDir>$(ProjectDir)targets/</TargetsDir>
<KeysDir>$(ProjectDir)keys/</KeysDir>
<DotNetCliToolDir Condition="'$(DotNetCliToolDir)' == '' and '$(CustomDotNetSdkDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(CustomDotNetSdkDir)'))</DotNetCliToolDir>
<DotNetCliToolDir Condition="'$(DotNetCliToolDir)' == '' and '$(DOTNET_INSTALL_DIR)' != ''">$([MSBuild]::NormalizeDirectory('$(DOTNET_INSTALL_DIR)'))</DotNetCliToolDir>
<DotNetCliToolDir Condition="'$(DotNetCliToolDir)' == ''">$(ProjectDir).dotnet/</DotNetCliToolDir>
<DotnetToolCommand>$(DotNetCliToolDir)dotnet</DotnetToolCommand>
<PatchesDir>$(ProjectDir)patches/</PatchesDir>
<PackagesDir Condition="'$(NuGetPackageRoot)' != ''">$(NuGetPackageRoot)</PackagesDir>
<PackagesDir Condition="'$(PackagesDir)' == ''">$(ProjectDir)packages/restored/</PackagesDir>
<ArcadeBootstrapPackageDir>$(PackagesDir)ArcadeBootstrapPackage/</ArcadeBootstrapPackageDir>
<!-- if we're not currently building, Visual Studio will still set this -->
<SDK_VERSION Condition="'$(SDK_VERSION)' == ''">$(NETCoreSdkVersion)</SDK_VERSION>
<DotNetSdkDir>$(DotNetCliToolDir)sdk/$(SDK_VERSION)/</DotNetSdkDir>
<DotNetSdkResolversDir>$(DotNetSdkDir)SdkResolvers/</DotNetSdkResolversDir>
<SdkReferenceDir>$(DotNetCliToolDir)sdk/$(SDK_VERSION)/</SdkReferenceDir>
</PropertyGroup>
<!--
'.proj' has no DefaultLanguageSourceExtension, causing **/* to be collected
in Compile items! Avoid this by disabling the default items.
-->
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.proj'">
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<PropertyGroup>
<LogVerbosity Condition="'$(LogVerbosity)'==''">minimal</LogVerbosity>
</PropertyGroup>
<PropertyGroup>
<BuildInParallel Condition="'$(BuildInParallel)'==''">false</BuildInParallel>
</PropertyGroup>
<PropertyGroup>
<ShellExtension Condition="'$(OS)' == 'Windows_NT'">.cmd</ShellExtension>
<ShellExtension Condition="'$(OS)' != 'Windows_NT'">.sh</ShellExtension>
<TarBallExtension Condition="'$(OS)' == 'Windows_NT'">.zip</TarBallExtension>
<TarBallExtension Condition="'$(OS)' != 'Windows_NT'">.tar.gz</TarBallExtension>
</PropertyGroup>
<PropertyGroup>
<SubmoduleDirectory Condition="'$(SubmoduleDirectory)' == ''">$(ProjectDir)src/</SubmoduleDirectory>
<GitModulesPath>$(ProjectDir).gitmodules</GitModulesPath>
<ProdConFeedPath>$(ProjectDir)ProdConFeed.txt</ProdConFeedPath>
</PropertyGroup>
<PropertyGroup>
<!-- Init basic Arcade props, if the project importing this file doesn't use Arcade. -->
<ArtifactsDir Condition="'$(ArtifactsDir)' == ''">$(ProjectDir)artifacts/</ArtifactsDir>
<RepositoryEngineeringDir Condition="'$(RepositoryEngineeringDir)' == ''">$(ProjectDir)eng/</RepositoryEngineeringDir>
</PropertyGroup>
<PropertyGroup>
<BaseOutputPath>$(ArtifactsDir)</BaseOutputPath>
<ClonedSubmoduleDirectory Condition="'$(ClonedSubmoduleDirectory)' == ''">$(BaseOutputPath)src/</ClonedSubmoduleDirectory>
<ClonedSubmoduleGitRootDirectory Condition="'$(ClonedSubmoduleGitRootDirectory)' == ''">$(ProjectDir).git/modules/src/</ClonedSubmoduleGitRootDirectory>
<ToolsDir>$(ProjectDir)Tools/</ToolsDir>
<ToolPackageExtractDir>$(ToolsDir)source-built/</ToolPackageExtractDir>
<ToolsLocalDir>$(ProjectDir)tools-local/</ToolsLocalDir>
<TaskDirectory>$(ToolsLocalDir)tasks/</TaskDirectory>
<XPlatTasksBinDir>$(TaskDirectory)Microsoft.DotNet.SourceBuild.Tasks.XPlat/bin/$(Configuration)/</XPlatTasksBinDir>
<XPlatSourceBuildTasksAssembly>$(XPlatTasksBinDir)Microsoft.DotNet.SourceBuild.Tasks.XPlat.dll</XPlatSourceBuildTasksAssembly>
<LeakDetectionTasksBinDir>$(TaskDirectory)Microsoft.DotNet.SourceBuild.Tasks.LeakDetection/</LeakDetectionTasksBinDir>
<LeakDetectionTasksAssembly>$(LeakDetectionTasksBinDir)Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.dll</LeakDetectionTasksAssembly>
<BaseIntermediatePath>$(BaseOutputPath)obj/</BaseIntermediatePath>
<OutputPath>$(BaseOutputPath)$(Platform)/$(Configuration)/</OutputPath>
<IntermediatePath>$(BaseIntermediatePath)$(Platform)/$(Configuration)/</IntermediatePath>
<LocalBlobStorageRoot>$(IntermediatePath)blobs/</LocalBlobStorageRoot>
<LocalNuGetPackagesRoot>$(IntermediatePath)nuget-packages/</LocalNuGetPackagesRoot>
<SourceBuiltBlobFeedDir>$(IntermediatePath)blob-feed/</SourceBuiltBlobFeedDir>
<SourceBuiltPackagesPath>$(SourceBuiltBlobFeedDir)packages/</SourceBuiltPackagesPath>
<SourceBuiltAssetsDir>$(SourceBuiltBlobFeedDir)assets/</SourceBuiltAssetsDir>
<PrebuiltPackagesPath>$(ProjectDir)packages/prebuilt/</PrebuiltPackagesPath>
<PreviouslyRestoredPackagesPath>$(ProjectDir)packages/previouslyRestored/</PreviouslyRestoredPackagesPath>
<PrebuiltSourceBuiltPackagesPath>$(ProjectDir)packages/source-built/</PrebuiltSourceBuiltPackagesPath>
<PrebuiltSourceBuiltPackagesPath Condition="'$(CustomPrebuiltSourceBuiltPackagesPath)' != ''">$(CustomPrebuiltSourceBuiltPackagesPath)/</PrebuiltSourceBuiltPackagesPath>
<SourceBuiltTarBallPath>$(OutputPath)</SourceBuiltTarBallPath>
<SourceBuiltToolsetDir>$(LocalBlobStorageRoot)Sdk/</SourceBuiltToolsetDir>
<SourceBuiltRuntimeDir>$(LocalBlobStorageRoot)Runtime/</SourceBuiltRuntimeDir>
<SourceBuiltAspNetCoreRuntime>$(LocalBlobStorageRoot)aspnetcore/Runtime/</SourceBuiltAspNetCoreRuntime>
<RestoreSourcePropsPath>$(IntermediatePath)RestoreSources.props</RestoreSourcePropsPath>
<PackageVersionPropsPath>$(IntermediatePath)PackageVersions.props</PackageVersionPropsPath>
<GennedPackageVersionPropsPath Condition="'$(OfflineBuild)' == 'true'">$(IntermediatePath)GennedPackageVersions.props</GennedPackageVersionPropsPath>
<GennedPackageVersionPropsPath Condition="'$(OfflineBuild)' != 'true'">$(IntermediatePath)PackageVersions.props</GennedPackageVersionPropsPath>
<LoggingDir>$(BaseOutputPath)logs/</LoggingDir>
<MSBuildDebugPathTargetDir>$(BaseOutputPath)msbuild-debug/</MSBuildDebugPathTargetDir>
<RoslynDebugPathTargetDir>$(BaseOutputPath)roslyn-debug/</RoslynDebugPathTargetDir>
<AspNetRazorBuildServerLogDir>$(BaseOutputPath)aspnet-debug</AspNetRazorBuildServerLogDir>
<AspNetRazorBuildServerLogFile>$(AspNetRazorBuildServerLogDir)razor-build-server.log</AspNetRazorBuildServerLogFile>
<!-- Dir where git info is generated during online builds. -->
<GitInfoOutputDir>$(BaseOutputPath)git-info/</GitInfoOutputDir>
<!-- Dir where git info is placed inside the tarball. -->
<GitInfoOfflineDir>$(ProjectDir)git-info/</GitInfoOfflineDir>
<OutputGitInfoPropsFile>$(GitInfoOutputDir)$(RepositoryName).props</OutputGitInfoPropsFile>
<ProductionAllRepoPropsFile>$(GitInfoOutputDir)AllRepoVersions.props</ProductionAllRepoPropsFile>
<OfflineGitInfoPropsFile>$(GitInfoOfflineDir)$(RepositoryName).props</OfflineGitInfoPropsFile>
<OfflineAllRepoPropsFile>$(GitInfoOfflineDir)AllRepoVersions.props</OfflineAllRepoPropsFile>
<PackageReportDir>$(BaseOutputPath)prebuilt-report/</PackageReportDir>
<PackageReportDataFile>$(PackageReportDir)prebuilt-usage.xml</PackageReportDataFile>
<PoisonUsageReportFile>$(PackageReportDir)poison-usage.xml</PoisonUsageReportFile>
<PoisonReportDataFile>$(PackageReportDir)poison-catalog.xml</PoisonReportDataFile>
<PoisonMarkerFile>.prebuilt.xml</PoisonMarkerFile>
<SourceBuiltPoisonReportDataFile>$(PackageReportDir)poison-source-built-catalog.xml</SourceBuiltPoisonReportDataFile>
<SourceBuiltPoisonMarkerFile>.source-built.xml</SourceBuiltPoisonMarkerFile>
<ProjectAssetsJsonArchiveFile>$(PackageReportDir)all-project-assets-json-files.zip</ProjectAssetsJsonArchiveFile>
<ProdConManifestFile>$(PackageReportDir)prodcon-build.xml</ProdConManifestFile>
<PoisonedReportFile>$(PackageReportDir)poisoned.txt</PoisonedReportFile>
<ConflictingPackageReportDir>$(BaseOutputPath)conflict-report/</ConflictingPackageReportDir>
<OfflinePrebuiltBurndownDataFile>$(PackageReportDir)PrebuiltBurndownData-offline.csv</OfflinePrebuiltBurndownDataFile>
<OnlinePrebuiltBurndownDataFile>$(PackageReportDir)PrebuiltBurndownData-online.csv</OnlinePrebuiltBurndownDataFile>
<ReferencePackagesBaseDir>$(IntermediatePath)reference-packages/</ReferencePackagesBaseDir>
<TextOnlyPackageBaseDir>$(IntermediatePath)text-only-packages/</TextOnlyPackageBaseDir>
<ExternalTarballsDir>$(IntermediatePath)external-tarballs/</ExternalTarballsDir>
<!--
Change ReferencePackagesBaseDir & ExternalTarballsDir conditionally in offline build.
See corresponding change in build-source-tarball.sh to copy reference-packages & external-tarballs
from source-build bin dir to tarball packages/reference dir & packages/archive.
-->
<ExternalTarballsDir Condition="'$(OfflineBuild)' == 'true'">$(ProjectDir)packages/archive/</ExternalTarballsDir>
<ReferencePackagesBaseDir Condition="'$(OfflineBuild)' == 'true'">$(ProjectDir)packages/reference/</ReferencePackagesBaseDir>
<TextOnlyPackageBaseDir Condition="'$(OfflineBuild)' == 'true'">$(ProjectDir)packages/text-only/</TextOnlyPackageBaseDir>
<ReferencePackagesDir>$(ReferencePackagesBaseDir)packages/</ReferencePackagesDir>
<SourceBuiltArtifactsTarballName>Private.SourceBuilt.Artifacts</SourceBuiltArtifactsTarballName>
<SourceBuiltArtifactsTarballUrl>https://dotnetcli.azureedge.net/source-built-artifacts/assets/</SourceBuiltArtifactsTarballUrl>
<ArchiveArtifactsTextFileName>archiveArtifacts.txt</ArchiveArtifactsTextFileName>
<ArchiveArtifactsTextFile>$(ExternalTarballsDir)$(ArchiveArtifactsTextFileName)</ArchiveArtifactsTextFile>
<BaselineDataFile>$(ToolsLocalDir)prebuilt-baseline-</BaselineDataFile>
<OfflineBaselineDataFile>$(BaselineDataFile)offline.xml</OfflineBaselineDataFile>
<OnlineBaselineDataFile>$(BaselineDataFile)online.xml</OnlineBaselineDataFile>
<BaselineDataFile Condition="'$(OfflineBuild)' == 'true'">$(OfflineBaselineDataFile)</BaselineDataFile>
<BaselineDataFile Condition="'$(OfflineBuild)' != 'true'">$(OnlineBaselineDataFile)</BaselineDataFile>
<!--Exclude tests that are failing for test enabled projects like - corefx -->
<TestExclusionsDir>$(ProjectDir)test/exclusions/</TestExclusionsDir>
</PropertyGroup>
<!-- Import Build tools common props file where repo-independent properties are found -->
<Import Project="$(ToolsDir)Build.Common.props" Condition="Exists('$(ToolsDir)Build.Common.props')" />
<PropertyGroup>
<ArmEnvironmentVariables Condition="'$(ArmEnvironmentVariables)' == ''">ROOTFS_DIR=$(BaseIntermediatePath)crossrootfs/arm</ArmEnvironmentVariables>
<ArmEnvironmentVariables Condition="'$(Platform)' == 'armel'">ROOTFS_DIR=$(BaseIntermediatePath)crossrootfs/armel</ArmEnvironmentVariables>
</PropertyGroup>
<PropertyGroup>
<TargetRid Condition="'$(TargetRid)' == ''">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</TargetRid>
<TargetOS Condition="'$(TargetOS)' == '' AND $([MSBuild]::IsOSPlatform('WINDOWS'))">Windows_NT</TargetOS>
<TargetOS Condition="'$(TargetOS)' == '' AND $([MSBuild]::IsOSPlatform('OSX'))">OSX</TargetOS>
<TargetOS Condition="'$(TargetOS)' == '' AND $([MSBuild]::IsOSPlatform('LINUX'))">Linux</TargetOS>
<TargetOS Condition="'$(TargetOS)' == '' AND $([MSBuild]::IsOSPlatform('FREEBSD'))">FreeBSD</TargetOS>
</PropertyGroup>
<PropertyGroup Condition="'$(PortableBuild)' == 'true'">
<TargetRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-$(Platform)</TargetRid>
<TargetRid Condition="'$(TargetOS)' == 'OSX'">osx-$(Platform)</TargetRid>
<TargetRid Condition="'$(TargetOS)' == 'Linux'">linux-$(Platform)</TargetRid>
<TargetRid Condition="'$(TargetOS)' == 'Windows_NT'">win-$(Platform)</TargetRid>
</PropertyGroup>
<PropertyGroup>
<!-- known-good (repos/known-good.proj) conditionally includes submodules based on the platform,
so this will not always correspond to the same repos - see that file for details.
We need an "empty" project after the last real project in order for prebuilt detection
to work, so we always build known-good. -->
<RootRepo>known-good</RootRepo>
<RootRepoTests>known-good-tests</RootRepoTests>
</PropertyGroup>
<!--
Semaphore path for incremental builds
-->
<PropertyGroup>
<CompletedSemaphorePath>$(BaseIntermediatePath)semaphores/</CompletedSemaphorePath>
</PropertyGroup>
<!-- CLI internal version is statically set by us to a version that will never show up in the wild.
This ensures we will never restore a public version instead of our source-built version. We
invlude the version number because it is used both by CLI.proj and the core-sdk build and they
have to be synced up. ExtraPackageVersionPropsPackageInfo doesn't work in cli.proj because
toolset is between CLI and core-sdk, and the extra package version info is lost. -->
<PropertyGroup>
<CliInternalReleaseTag>source</CliInternalReleaseTag>
<CliInternalBuildVersion>30000001-1</CliInternalBuildVersion>
</PropertyGroup>
<ItemGroup>
<ExtraPackageVersionPropsPackageInfo Include="DotnetCliInternalVersion" Version="3.0.100-$(CliInternalReleaseTag)-$(CliInternalBuildVersion)" />
</ItemGroup>
<Import Project="$(ProductionAllRepoPropsFile)" Condition="Exists('$(ProductionAllRepoPropsFile)')" />
<Import Project="$(OfflineAllRepoPropsFile)" Condition="Exists('$(OfflineAllRepoPropsFile)')" />
<!-- Additional psuedo-versions that some repos depend on -->
<ItemGroup>
<!-- we don't produce the Windows version of this package but that's the one core-sdk keys off of for the ASP.NET version -->
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftAspNetCoreAppRuntimewinx64PackageVersion" Version="$(aspnetcoreOutputPackageVersion)" />
<!-- same thing here for CLI -->
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppRuntimewinx64Version" Version="$(coresetupOutputPackageVersion)" />
<!-- same thing here for toolset -->
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppRuntimewinx64PackageVersion" Version="%24(MicrosoftNETCoreDotNetAppHostPackageVersion)" />
<!-- same thing here for core-sdk -->
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppRuntimePackageVersion" Version="%24(MicrosoftNETCoreDotNetAppHostPackageVersion)" />
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppRuntimeVersion" Version="%24(MicrosoftNETCoreDotNetAppHostPackageVersion)" />
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppHostPackageVersion" Version="%24(MicrosoftNETCoreDotNetAppHostPackageVersion)" />
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftAspNetCoreAppRuntimePackageVersion" Version="%24(MicrosoftAspNetCoreAppRuntimeLinux$(Platform)PackageVersion)" />
<!-- core-sdk uses this property for ASP.NET blob directory -->
<ExtraPackageVersionPropsPackageInfo Include="VSRedistCommonAspNetCoreTargetingPackx6430PackageVersion" Version="$(aspnetcoreOutputPackageVersion)" />
<!-- OSX needs the OSX version instead of Linux. We don't have a lot of flexibility in how we output these properties so we're relying on the previous one being blank if the Linux version of the package is missing. -->
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftAspNetCoreAppRuntimePackageVersion" Version="%24(MicrosoftAspNetCoreAppRuntimeOsxX64PackageVersion)" DoNotOverwrite="true" />
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftAspNetCoreAppRuntimePackageVersion" Version="%24(MicrosoftAspNetCoreAppRuntimewinx64PackageVersion)" DoNotOverwrite="true" />
<!-- Used by sdk to determine msbuild version for fsharp -->
<ExtraPackageVersionPropsPackageInfo Include="FSharpBuildVersion" Version="%24(MicrosoftBuildPackageVersion)" />
<!-- Used by roslyn-analyzsers to determine rsolyn version -->
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftCodeAnalysisForShippedApisVersion" Version="%24(MicrosoftCodeAnalysisVersion)" />
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion" Version="%24(MicrosoftCodeAnalysisVersion)" />
<!-- property used by Arcade to determine what version of SourceLink to use -->
<!-- if MicrosoftSourceLinkCommonPackageVersion is non-empty, then we've already built SourceLink, regardless of whether
this is the production or offline build, so we should use that version. -->
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftSourceLinkVersion" Version="%24(MicrosoftSourceLinkCommonPackageVersion)" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,63 @@
<Project>
<Target Name="RemoveUninteresingToolingPackageReferences"
BeforeTargets="CollectPackageReferences">
<!-- The source-build infra doesn't need sourcelink. Avoid this prebuilt. -->
<ItemGroup>
<PackageReference Remove="Microsoft.SourceLink.GitHub" />
<PackageReference Remove="Microsoft.SourceLink.Vsts.Git" />
<PackageReference Remove="Microsoft.SourceLink.AzureRepos.Git" />
</ItemGroup>
</Target>
<Target Name="AcquireDarc"
Condition="
'$(OfflineBuild)' != 'true' and
'$(SkipAcquireDarc)' != 'true'"
Inputs="$(MSBuildThisFileDirectory)tools-local\acquire-darc\acquire-darc.proj"
Outputs="$(CompletedSemaphorePath)AcquireDarc.complete">
<MSBuild
Projects="$(MSBuildThisFileDirectory)tools-local\acquire-darc\acquire-darc.proj"
Targets="AcquireDarcCore" />
<WriteLinesToFile File="$(CompletedSemaphorePath)AcquireDarc.complete" Overwrite="true" />
</Target>
<Target Name="GetCommonDarcCloneCommand" DependsOnTargets="AcquireDarc">
<PropertyGroup>
<IgnoredRepos>$(IgnoredRepos);https://dev.azure.com/dnceng/internal/_git/dotnet-optimization</IgnoredRepos>
<IgnoredRepos>$(IgnoredRepos);https://dev.azure.com/devdiv/DevDiv/_git/DotNet-Trusted</IgnoredRepos>
<IgnoredRepos>$(IgnoredRepos);https://devdiv.visualstudio.com/DevDiv/_git/DotNet-Trusted</IgnoredRepos>
<IgnoredRepos>$(IgnoredRepos);https://dnceng@dev.azure.com/dnceng/internal/_git/dotnet-optimization</IgnoredRepos>
<IgnoredRepos>$(IgnoredRepos);https://dev.azure.com/dnceng/internal/_git/dotnet-core-setup</IgnoredRepos>
<IgnoredRepos>$(IgnoredRepos);https://github.com/dotnet/source-build-reference-packages</IgnoredRepos>
<DarcCloneReposFolder Condition="'$(DarcCloneReposFolder)' == ''">$(ClonedSubmoduleDirectory)</DarcCloneReposFolder>
<DarcCloneArguments>$(DarcCloneArguments) --git-dir-folder $(ClonedSubmoduleGitRootDirectory)</DarcCloneArguments>
<DarcCloneArguments>$(DarcCloneArguments) --include-toolset</DarcCloneArguments>
<DarcCloneArguments>$(DarcCloneArguments) --ignore-repos "$(IgnoredRepos)"</DarcCloneArguments>
<DarcCloneArguments>$(DarcCloneArguments) --debug</DarcCloneArguments>
<!-- required so Darc doesn't throw an error for missing auth -->
<AzDoPat Condition="'$(AzDoPat)' == ''">bogus</AzDoPat>
<DarcCloneArguments>$(DarcCloneArguments) --azdev-pat $(AzDoPat)</DarcCloneArguments>
<DarcCloneArguments>$(DarcCloneArguments) --github-pat bogus</DarcCloneArguments>
<!-- depth 0 should be sufficient for us since we explictly declare all our dependencies -->
<DarcCloneArguments>$(DarcCloneArguments) --depth 0</DarcCloneArguments>
<DarcCloneCommand>$(DotNetCliToolDir)dotnet $(DarcDll) clone $(DarcCloneArguments)</DarcCloneCommand>
</PropertyGroup>
</Target>
<Import Condition="'$(SkipArcadeSdkImport)' != 'true'" Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Target Name="GetProdConBlobFeedUrl">
<PropertyGroup>
<ProdConBlobFeedUrl>$([System.IO.File]::ReadAllText('$(ProdConFeedPath)').Trim())</ProdConBlobFeedUrl>
<ProdConBlobFeedUrl Condition="'$(ProdConBlobFeedUrlPrefix)' != ''">$(ProdConBlobFeedUrl.Replace('https://dotnetfeed.blob.core.windows.net/', '$(ProdConBlobFeedUrlPrefix)'))</ProdConBlobFeedUrl>
</PropertyGroup>
</Target>
</Project>

View file

@ -0,0 +1,197 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<UsingTask AssemblyFile="$(LeakDetectionTasksAssembly)" TaskName="CheckForPoison" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteUsageBurndownData" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceTextInFile" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="DownloadFileSB" />
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Target Name="Build" DependsOnTargets="PrepareOutput;InitBuild">
<Message Text="Build Environment: $(Platform) $(Configuration) $(TargetOS) $(TargetRid)" />
<MSBuild Projects="repos\$(RootRepo).proj" Targets="Build" BuildInParallel="$(BuildInParallel)" StopOnFirstFailure="true" />
</Target>
<Target Name="RunTests" DependsOnTargets="PrepareOutput;InitBuild">
<Message Text="Build Environment: $(Platform) $(Configuration) $(TargetOS) $(TargetRid)" />
<MSBuild Projects="repos\$(RootRepoTests).proj" Targets="Build" Properties="PrepForTests=true;SkipEnsurePackagesCreated=true" BuildInParallel="$(BuildInParallel)" StopOnFirstFailure="true" />
<MSBuild Projects="repos\$(RootRepoTests).proj" Targets="Build" Properties="RunTests=true;SkipEnsurePackagesCreated=true" BuildInParallel="$(BuildInParallel)" StopOnFirstFailure="true" />
</Target>
<Target Name="CreateRootRepoFile" AfterTargets="PrepareOutput">
<WriteLinesToFile Lines="$(RootRepo)" File="$(BaseIntermediatePath)rootrepo.txt" Overwrite="True" />
</Target>
<Target Name="PrepareOutput">
<MakeDir Directories="$(OutputPath)" />
<MakeDir Directories="$(LoggingDir)" />
<MakeDir Directories="$(GitInfoOutputDir)" />
<MakeDir Directories="$(IntermediatePath)" />
<MakeDir Directories="$(SourceBuiltBlobFeedDir)" />
<MakeDir Directories="$(SourceBuiltPackagesPath)" />
<MakeDir Directories="$(SourceBuiltAssetsDir)" />
<MakeDir Directories="$(LocalBlobStorageRoot)" />
<MakeDir Directories="$(MSBuildDebugPathTargetDir)" />
<MakeDir Directories="$(RoslynDebugPathTargetDir)" />
<MakeDir Directories="$(AspNetRazorBuildServerLogDir)" />
</Target>
<Target Name="InitBuild">
<MSBuild Projects="tools-local/init-build.proj" />
</Target>
<Target Name="Clean">
<RemoveDir Directories="$(BaseOutputPath)" />
</Target>
<Target Name="OutputArchiveArtifactsTextFile"
AfterTargets="Build"
Condition="'$(OfflineBuild)' != 'true' and '$(OS)' != 'Windows_NT'" >
<ItemGroup>
<ArtifactUrls Include="$(ReferencePackagesTarballUrl)$(ReferencePackagesTarballName).$(PrivateSourceBuildReferencePackagesPackageVersion).tar.gz" />
<ArtifactUrls Include="$(SourceBuiltArtifactsTarballUrl)$(SourceBuiltArtifactsTarballName).$(PrivateSourceBuiltArtifactsPackageVersion).tar.gz" />
</ItemGroup>
<WriteLinesToFile
File="$(ArchiveArtifactsTextFile)"
Lines="@(ArtifactUrls)"
Overwrite="true" />
</Target>
<Target Name="DownloadSourceBuildReferencePackages"
AfterTargets="Build"
Condition="'$(OfflineBuild)' != 'true' and '$(OS)' != 'Windows_NT' and '$(SkipDownloadingReferencePackages)' != 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)DownloadSourceBuildReferencePackages.complete" >
<PropertyGroup Condition="'$(DownloadSourceBuildReferencePackagesTimeoutSeconds)' == ''">
<DownloadSourceBuildReferencePackagesTimeoutSeconds>N/A</DownloadSourceBuildReferencePackagesTimeoutSeconds>
</PropertyGroup>
<DownloadFileSB
SourceUrl="$(ReferencePackagesTarballUrl)$(ReferencePackagesTarballName).$(PrivateSourceBuildReferencePackagesPackageVersion).tar.gz"
DestinationFolder="$(ExternalTarballsDir)"
TimeoutSeconds="$(DownloadSourceBuildReferencePackagesTimeoutSeconds)" />
<WriteLinesToFile File="$(CompletedSemaphorePath)DownloadSourceBuildReferencePackages.complete" Overwrite="true" />
</Target>
<Target Name="DownloadSourceBuiltArtifacts"
AfterTargets="Build"
Condition="
'$(OfflineBuild)' != 'true' and
'$(OS)' != 'Windows_NT' and
'$(SkipDownloadingPreviouslySourceBuiltPackages)' != 'true' and
'$(PrivateSourceBuiltArtifactsPackageVersion)' != ''"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)DownloadSourceBuiltArtifacts.complete" >
<PropertyGroup Condition="'$(DownloadSourceBuiltArtifactsTimeoutSeconds)' == ''">
<DownloadSourceBuiltArtifactsTimeoutSeconds>N/A</DownloadSourceBuiltArtifactsTimeoutSeconds>
</PropertyGroup>
<DownloadFileSB
SourceUrl="$(SourceBuiltArtifactsTarballUrl)$(SourceBuiltArtifactsTarballName).$(PrivateSourceBuiltArtifactsPackageVersion).tar.gz"
DestinationFolder="$(ExternalTarballsDir)"
TimeoutSeconds="$(DownloadSourceBuiltArtifactsTimeoutSeconds)" />
<WriteLinesToFile File="$(CompletedSemaphorePath)DownloadSourceBuiltArtifacts.complete" Overwrite="true" />
</Target>
<!-- After building, generate a prebuilt usage report. -->
<Target Name="ReportPrebuiltUsage"
AfterTargets="Build"
Condition="'$(SkipReportPrebuiltUsage)' != 'true'">
<MSBuild Projects="repos\$(RootRepo).proj" Targets="WritePrebuiltUsageData;ReportPrebuiltUsage" />
</Target>
<!--
Dev scenario: rewrite a prebuilt-report. This makes it easy to add data to an existing
prebuilt report without performing another full build. This doesn't reevalutate which packages
are prebuilts or search the projects: it uses the existing usage.xml file to generate report
XMLs based on the info put in artifacts/.
-->
<Target Name="RewritePrebuiltUsageReport">
<MSBuild Projects="repos\$(RootRepo).proj" Targets="ReportPrebuiltUsage" />
</Target>
<Target Name="ReportPoisonUsage"
AfterTargets="Build"
Condition="'$(EnablePoison)' == 'true' and '$(OfflineBuild)' == 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)ReportPoisonUsage.complete" >
<ItemGroup>
<FinalCliTarball Include="$(SourceBuiltTarBallPath)**/*$(TarBallExtension)" />
</ItemGroup>
<CheckForPoison FilesToCheck="@(FinalCliTarball)"
HashCatalogFilePath="$(PoisonReportDataFile)"
MarkerFileName="$(PoisonMarkerFile)"
PoisonReportOutputFilePath="$(PoisonUsageReportFile)" />
<WriteLinesToFile File="$(CompletedSemaphorePath)ReportPoisonUsage.complete" Overwrite="true" />
</Target>
<Target Name="GeneratePrebuiltBurndownData"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)GeneratePrebuiltBurndownData.complete" >
<WriteUsageBurndownData RootDirectory="$(ProjectDir)"
PrebuiltBaselineFile="$(OnlineBaselineDataFile)"
OutputFilePath="$(OnlinePrebuiltBurndownDataFile)" />
<WriteUsageBurndownData RootDirectory="$(ProjectDir)"
PrebuiltBaselineFile="$(OfflineBaselineDataFile)"
OutputFilePath="$(OfflinePrebuiltBurndownDataFile)" />
<WriteLinesToFile File="$(CompletedSemaphorePath)GeneratePrebuiltBurndownData.complete" Overwrite="true" />
</Target>
<Target Name="RunSmokeTest" DependsOnTargets="GetProdConBlobFeedUrl">
<PropertyGroup>
<SmokeTestCommand>./smoke-test.sh</SmokeTestCommand>
<SmokeTestCommand>$(SmokeTestCommand) --minimal</SmokeTestCommand>
<SmokeTestCommand>$(SmokeTestCommand) --projectOutput</SmokeTestCommand>
<SmokeTestCommand>$(SmokeTestCommand) --configuration $(Configuration)</SmokeTestCommand>
<SmokeTestCommand>$(SmokeTestCommand) --archiveRestoredPackages</SmokeTestCommand>
<!-- Dev certs don't work on this platform. -->
<SmokeTestCommand Condition="'$(TargetOS)' == 'OSX'">$(SmokeTestCommand) --excludeWebHttpsTests</SmokeTestCommand>
</PropertyGroup>
<!--
Pass prodConBlobFeedUrl via EnvironmentVariables because it has '//' in it, which is
translated into '/' if it's passed in the Command arg.
This is also a problem when passing CLI feeds: https://github.com/dotnet/source-build/issues/561
-->
<Exec Command="$(SmokeTestCommand)"
EnvironmentVariables="
targetRid=$(TargetRid);
prodConBlobFeedUrl=$(ProdConBlobFeedUrl)" />
</Target>
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="UploadToAzure" />
<Target Name="PublishPrebuiltReportData">
<Error Text="RelativeBlobPath must be set to a non-empty string." Condition="'$(RelativeBlobPath)' == ''" />
<Error Text="ContainerName must be set to a non-empty string." Condition="'$(ContainerName)' == ''" />
<Error Text="AzureAccountName must be set to a non-empty string." Condition="'$(AzureAccountName)' == ''" />
<Error Text="AzureAccessToken must be set to a non-empty string." Condition="'$(AzureAccessToken)' == ''" />
<ItemGroup>
<ItemsToPublish Include="$(PackageReportDir)*.xml" />
<ItemsToPublish Include="$(PackageReportDir)*.csv" />
<ItemsToPublish>
<RelativeBlobPath>$(RelativeBlobPath)/%(Filename)%(Extension)</RelativeBlobPath>
</ItemsToPublish>
</ItemGroup>
<Message Text="Uploading files to '$(AzureAccountName)' blob storage at $(ContainerName)/$(RelativeBlobPath)" />
<UploadToAzure AccountName="$(AzureAccountName)"
AccountKey="$(AzureAccessToken)"
ContainerName="$(ContainerName)"
Items="@(ItemsToPublish)"
Overwrite="true" />
</Target>
</Project>

View file

@ -0,0 +1,162 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
usage() {
echo "usage: $0 [options]"
echo "options:"
echo " --with-ref-packages <dir> use the specified directory of reference packages"
echo " --with-packages <dir> use the specified directory of previously-built packages"
echo " --with-sdk <dir> use the SDK in the specified directory for bootstrapping"
echo "use -- to send the remaining arguments to MSBuild"
echo ""
}
SCRIPT_ROOT="$(cd -P "$( dirname "$0" )" && pwd)"
MSBUILD_ARGUMENTS=("/p:OfflineBuild=true" "/flp:v=detailed")
CUSTOM_REF_PACKAGES_DIR=''
CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR=''
alternateTarget=false
CUSTOM_SDK_DIR=''
while :; do
if [ $# -le 0 ]; then
break
fi
lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
--run-smoke-test)
alternateTarget=true
MSBUILD_ARGUMENTS+=( "/t:RunSmokeTest" )
;;
--with-packages)
CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR="$(cd -P "$2" && pwd)"
if [ ! -d "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" ]; then
echo "Custom prviously built packages directory '$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR' does not exist"
exit 1
fi
MSBUILD_ARGUMENTS+=( "/p:CustomPrebuiltSourceBuiltPackagesPath=$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" )
shift
;;
--with-sdk)
CUSTOM_SDK_DIR="$(cd -P "$2" && pwd)"
if [ ! -d "$CUSTOM_SDK_DIR" ]; then
echo "Custom SDK directory '$CUSTOM_SDK_DIR' does not exist"
exit 1
fi
if [ ! -x "$CUSTOM_SDK_DIR/dotnet" ]; then
echo "Custom SDK '$CUSTOM_SDK_DIR/dotnet' does not exist or is not executable"
exit 1
fi
shift
;;
--)
shift
echo "Detected '--': passing remaining parameters '$@' as build.sh arguments."
break
;;
-?|-h|--help)
usage
exit 0
;;
*)
echo "Unrecognized argument '$1'"
usage
exit 1
;;
esac
shift
done
if [ -f "$SCRIPT_ROOT/packages/archive/archiveArtifacts.txt" ]; then
ARCHIVE_ERROR=0
if [ ! -d "$SCRIPT_ROOT/.dotnet" ] && [ "$CUSTOM_SDK_DIR" == "" ]; then
echo "ERROR: SDK not found at $SCRIPT_ROOT/.dotnet"
ARCHIVE_ERROR=1
fi
if [ ! -f $SCRIPT_ROOT/packages/archive/Private.SourceBuilt.Artifacts*.tar.gz ] && [ "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR" == "" ]; then
echo "ERROR: Private.SourceBuilt.Artifacts artifact not found at $SCRIPT_ROOT/packages/archive/ - Either run prep.sh or pass --with-packages parameter"
ARCHIVE_ERROR=1
fi
if [ $ARCHIVE_ERROR == 1 ]; then
echo ""
echo " Errors detected in tarball. To prep the tarball, run prep.sh while online to install an SDK"
echo " and Private.SourceBuilt.Artifacts tarball. After prepping the tarball, the tarball can be"
echo " built offline. As an alternative to prepping the tarball, these assets can be provided using"
echo " the --with-sdk and --with-packages parameters"
exit 1
fi
fi
if [ -d "$CUSTOM_SDK_DIR" ]; then
export SDK_VERSION=`"$CUSTOM_SDK_DIR/dotnet" --version`
export CLI_ROOT="$CUSTOM_SDK_DIR"
export _InitializeDotNetCli="$CLI_ROOT/dotnet"
export CustomDotNetSdkDir="$CLI_ROOT"
echo "Using custom bootstrap SDK from '$CLI_ROOT', version '$SDK_VERSION'"
else
sdkLine=`grep -m 1 'dotnet' "$SCRIPT_ROOT/global.json"`
sdkPattern="\"dotnet\" *: *\"(.*)\""
if [[ $sdkLine =~ $sdkPattern ]]; then
export SDK_VERSION=${BASH_REMATCH[1]}
export CLI_ROOT="$SCRIPT_ROOT/.dotnet"
fi
fi
packageVersionsPath=''
restoredPackagesDir="$SCRIPT_ROOT/packages/restored"
if [ -d "$SCRIPT_ROOT/packages/archive" ]; then
sourceBuiltArchive=`find $SCRIPT_ROOT/packages/archive -maxdepth 1 -name 'Private.SourceBuilt.Artifacts*.tar.gz'`
if [ -f "$sourceBuiltArchive" ]; then
tar -xzf "$sourceBuiltArchive" -C /tmp PackageVersions.props
packageVersionsPath=/tmp/PackageVersions.props
fi
else
if [ -f "$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR/PackageVersions.props" ]; then
packageVersionsPath="$CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR/PackageVersions.props"
fi
fi
if [ ! -f "$packageVersionsPath" ]; then
echo "Cannot find PackagesVersions.props. Debugging info:"
echo " Attempted archive path: $SCRIPT_ROOT/packages/archive"
echo " Attempted custom PVP path: $CUSTOM_PREVIOUSLY_BUILT_PACKAGES_DIR/PackageVersions.props"
exit 1
fi
arcadeSdkLine=`grep -m 1 'MicrosoftDotNetArcadeSdkVersion' "$packageVersionsPath"`
versionPattern="<MicrosoftDotNetArcadeSdkVersion>(.*)</MicrosoftDotNetArcadeSdkVersion>"
if [[ $arcadeSdkLine =~ $versionPattern ]]; then
export ARCADE_BOOTSTRAP_VERSION=${BASH_REMATCH[1]}
# Ensure that by default, the bootstrap version of the Arcade SDK is used. Source-build infra
# projects use bootstrap Arcade SDK, and would fail to find it in the tarball build. The repo
# projects overwrite this so that they use the source-built Arcade SDK instad.
export SOURCE_BUILT_SDK_ID_ARCADE=Microsoft.DotNet.Arcade.Sdk
export SOURCE_BUILT_SDK_VERSION_ARCADE=$ARCADE_BOOTSTRAP_VERSION
export SOURCE_BUILT_SDK_DIR_ARCADE=$restoredPackagesDir/ArcadeBootstrapPackage/microsoft.dotnet.arcade.sdk/$ARCADE_BOOTSTRAP_VERSION
fi
sourceLinkLine=`grep -m 1 'MicrosoftSourceLinkCommonVersion' "$packageVersionsPath"`
versionPattern="<MicrosoftSourceLinkCommonVersion>(.*)</MicrosoftSourceLinkCommonVersion>"
if [[ $sourceLinkLine =~ $versionPattern ]]; then
export SOURCE_LINK_BOOTSTRAP_VERSION=${BASH_REMATCH[1]}
fi
echo "Found bootstrap SDK $SDK_VERSION, bootstrap Arcade $ARCADE_BOOTSTRAP_VERSION, bootstrap SourceLink $SOURCE_LINK_BOOTSTRAP_VERSION"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export NUGET_PACKAGES=$restoredPackagesDir/
if [ "$alternateTarget" == "true" ]; then
"$CLI_ROOT/dotnet" $CLI_ROOT/sdk/$SDK_VERSION/MSBuild.dll "$SCRIPT_ROOT/build.proj" /bl:source-build-test.binlog /clp:v=m ${MSBUILD_ARGUMENTS[@]} "$@"
else
LogDateStamp=$(date +"%m%d%H%M%S")
$CLI_ROOT/dotnet $CLI_ROOT/sdk/$SDK_VERSION/MSBuild.dll /bl:$SCRIPT_ROOT/artifacts/log/Debug/BuildXPlatTasks_$LogDateStamp.binlog $SCRIPT_ROOT/tools-local/init-build.proj /t:PrepareOfflineLocalTools ${MSBUILD_ARGUMENTS[@]} "$@"
$CLI_ROOT/dotnet $CLI_ROOT/sdk/$SDK_VERSION/MSBuild.dll /bl:$SCRIPT_ROOT/artifacts/log/Debug/Build_$LogDateStamp.binlog $SCRIPT_ROOT/build.proj ${MSBUILD_ARGUMENTS[@]} "$@"
fi

View file

@ -0,0 +1,17 @@
<Project>
<ItemGroup Condition="'$(SkipProductionBuild)' != 'true'">
<ProjectToBuild Include="$(RepoRoot)build.proj" />
</ItemGroup>
<!-- Prevent Arcade from trying to find something to build, if we want to build nothing. -->
<ItemGroup Condition="'@(ProjectToBuild)' == ''">
<ProjectToBuild Include="$(MSBuildThisFileDirectory)No.proj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)))" />
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets, $(MSBuildThisFileDirectory)))" />
<Import Project="$(MSBuildThisFileDirectory)SourceBuild.Tarball.targets" />
</Project>

View file

@ -0,0 +1,9 @@
<!--
This project intentionally does nothing. It is a stub used to avoid building while preventing
Arcade from searching the repo root to find something to do.
-->
<Project>
<Target Name="Build" />
</Project>

View file

@ -0,0 +1,11 @@
<Project>
<Target Name="AllowWorkInProgressPrebuilts"
BeforeTargets="ForbidPrebuilts">
<ItemGroup>
<!-- Example: $(TarballPrebuiltPackageDir)microsoft.dotnet.web.itemtemplates.5.0.2.nupkg -->
<AllowedPrebuiltPackageFile />
</ItemGroup>
</Target>
</Project>

View file

@ -0,0 +1,63 @@
<Project>
<!--
Below are some destructive cleanup steps that we optionally perform during tarball creation.
These are used in CI to avoid filling up disk space, when we have weak build agents. These steps
are not generally suitable for dev scenarios because they delete intermediate data that might
have taken quite a while to download or create, and Git data that may be in-progress work.
-->
<!--
We need to keep artifacts/src/<repo>/.git around for sourcelink metadata but we can delete just
about everything else, Darc will pull it from the copy in .git/modules. This list of extensions
is everything over 6MB or so.
-->
<Target Name="DestructiveIntermediateCleanLargeFilesFromClonedSource"
BeforeTargets="AddTarballSource">
<ItemGroup>
<LargeSrcFileExtension Include="
.dll;
.exe;
.pdb;
.mdb;
.zip;
.so;
.o;
.a;
.tar.gz;
.vb;
.il;
.xlf;
.cpp;
.txt;
.map;
.md;
.fs;
.h;
.c;
.js;
.json;
.ildump;
.resx;
.xml;
.css;
.nupkg" />
<LargeSrcFiles Include="$(ClonedSubmoduleDirectory)*%(LargeSrcFileExtension.Identity)" />
</ItemGroup>
<Message Importance="High" Text="Removing large and unnecessary source files from $(ClonedSubmoduleDirectory)" />
<Delete Files="@(LargeSrcFiles)" />
</Target>
<Target Name="DestructiveIntermediateCleanTarballSource"
AfterTargets="AddTarballSource">
<!-- Now we don't need .git/modules/src anymore. -->
<RemoveDir Directories="$(ClonedSubmoduleGitRootDirectory)" />
<!-- we don't build CoreCLR tests right now and they have a lot of them - ~380MB -->
<Exec Command="rm -rf '$(TarballSourceDir)coreclr.'*'/tests'" />
</Target>
</Project>

View file

@ -0,0 +1,136 @@
<Project>
<!--
Remove a list of packages that end up in the tarball's prebuilts folder but are not actually
needed. This is typically because part of the build are turned off for DotNetBuildOffline but
not DotNetBuildFromSource.
-->
<Target Name="RemoveTarballKnownExtraPrebuilts"
DependsOnTargets="GetTarballDirProps">
<ItemGroup>
<KnownExtraPrebuiltFile Include="
$(TarballPrebuiltPackageDir)microbuild.core.0.2.0.nupkg;
$(TarballPrebuiltPackageDir)microbuild.core.sentinel.1.0.0.nupkg;
$(TarballPrebuiltPackageDir)microsoft.bcl.asyncinterfaces.1.1.1.nupkg;
$(TarballPrebuiltPackageDir)microsoft.bcl.asyncinterfaces.5.0.0-rc.1.20451.14.nupkg;
$(TarballPrebuiltPackageDir)microsoft.build.framework.15.3.409.nupkg;
$(TarballPrebuiltPackageDir)microsoft.build.framework.15.4.8.nupkg;
$(TarballPrebuiltPackageDir)microsoft.build.tasks.core.15.3.409.nupkg;
$(TarballPrebuiltPackageDir)microsoft.build.utilities.core.15.3.409.nupkg;
$(TarballPrebuiltPackageDir)microsoft.build.utilities.core.15.4.8.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.analyzers.2.6.1.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.analyzers.2.9.6.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.analyzers.3.0.0.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.bannedapianalyzers.3.3.0.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.common.2.9.0.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.common.3.4.0.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.common.3.8.0.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.csharp.2.9.0.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.csharp.3.4.0.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.csharp.3.8.0.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.csharp.codestyle.3.8.0-2.20414.4.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.csharp.codestyle.3.8.0.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.visualbasic.codestyle.3.8.0-2.20414.4.nupkg;
$(TarballPrebuiltPackageDir)microsoft.codeanalysis.visualbasic.codestyle.3.8.0.nupkg;
$(TarballPrebuiltPackageDir)microsoft.dotnet.arcade.sdk.5.0.0-beta.20426.4.nupkg;
$(TarballPrebuiltPackageDir)microsoft.dotnet.signtool.5.0.0-beta.20426.4.nupkg;
$(TarballPrebuiltPackageDir)microsoft.extensions.dependencymodel.3.1.6.nupkg;
$(TarballPrebuiltPackageDir)microsoft.extensions.dependencyinjection.5.0.0.nupkg;
$(TarballPrebuiltPackageDir)microsoft.netcore.app.host.linux-x64.3.1.7.nupkg;
$(TarballPrebuiltPackageDir)microsoft.symboluploader.build.task.1.1.141804.nupkg;
$(TarballPrebuiltPackageDir)netstandard.library.1.6.0.nupkg;
$(TarballPrebuiltPackageDir)nuget.commands.5.6.0-preview.2.6489.nupkg;
$(TarballPrebuiltPackageDir)nuget.common.5.6.0-preview.2.6489.nupkg;
$(TarballPrebuiltPackageDir)nuget.configuration.5.6.0-preview.2.6489.nupkg;
$(TarballPrebuiltPackageDir)nuget.credentials.5.6.0-preview.2.6489.nupkg;
$(TarballPrebuiltPackageDir)nuget.dependencyresolver.core.5.6.0-preview.2.6489.nupkg;
$(TarballPrebuiltPackageDir)nuget.frameworks.5.6.0-preview.2.6489.nupkg;
$(TarballPrebuiltPackageDir)nuget.librarymodel.5.6.0-preview.2.6489.nupkg;
$(TarballPrebuiltPackageDir)nuget.packaging.5.6.0-preview.2.6489.nupkg;
$(TarballPrebuiltPackageDir)nuget.projectmodel.5.6.0-preview.2.6489.nupkg;
$(TarballPrebuiltPackageDir)nuget.protocol.5.6.0-preview.2.6489.nupkg;
$(TarballPrebuiltPackageDir)nuget.versioning.5.6.0-preview.2.6489.nupkg;
$(TarballPrebuiltPackageDir)runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg;
$(TarballPrebuiltPackageDir)runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg;
$(TarballPrebuiltPackageDir)runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg;
$(TarballPrebuiltPackageDir)runtime.native.system.4.0.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.native.system.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.native.system.data.sqlclient.sni.4.7.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.native.system.io.compression.4.1.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.native.system.io.compression.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.native.system.net.http.4.0.1.nupkg;
$(TarballPrebuiltPackageDir)runtime.native.system.net.http.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.native.system.net.security.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.native.system.security.cryptography.4.0.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.native.system.security.cryptography.apple.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.native.system.security.cryptography.openssl.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.native.system.security.cryptography.openssl.4.3.2.nupkg;
$(TarballPrebuiltPackageDir)runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg;
$(TarballPrebuiltPackageDir)runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg;
$(TarballPrebuiltPackageDir)runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg;
$(TarballPrebuiltPackageDir)runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg;
$(TarballPrebuiltPackageDir)runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg;
$(TarballPrebuiltPackageDir)runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg;
$(TarballPrebuiltPackageDir)runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg;
$(TarballPrebuiltPackageDir)runtime.win-arm64.runtime.native.system.data.sqlclient.sni.4.4.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.win-x64.runtime.native.system.data.sqlclient.sni.4.4.0.nupkg;
$(TarballPrebuiltPackageDir)runtime.win-x86.runtime.native.system.data.sqlclient.sni.4.4.0.nupkg;
$(TarballPrebuiltPackageDir)sn.1.0.0.nupkg;
$(TarballPrebuiltPackageDir)system.collections.immutable.5.0.0-preview.8.20407.11.nupkg;
$(TarballPrebuiltPackageDir)system.composition.1.0.31.nupkg;
$(TarballPrebuiltPackageDir)system.composition.attributedmodel.1.0.31.nupkg;
$(TarballPrebuiltPackageDir)system.composition.convention.1.0.31.nupkg;
$(TarballPrebuiltPackageDir)system.composition.hosting.1.0.31.nupkg;
$(TarballPrebuiltPackageDir)system.composition.runtime.1.0.31.nupkg;
$(TarballPrebuiltPackageDir)system.composition.typedparts.1.0.31.nupkg;
$(TarballPrebuiltPackageDir)system.io.pipelines.5.0.0.nupkg;
$(TarballPrebuiltPackageDir)system.reflection.metadata.5.0.0-preview.8.20407.11.nupkg;
$(TarballPrebuiltPackageDir)system.runtime.compilerservices.unsafe.5.0.0-rc.1.20451.14.nupkg;
$(TarballPrebuiltPackageDir)system.security.cryptography.pkcs.5.0.0.nupkg;
$(TarballPrebuiltPackageDir)system.text.encodings.web.4.7.1.nupkg;
$(TarballPrebuiltPackageDir)system.text.encodings.web.5.0.0-rc.1.20451.14.nupkg;
$(TarballPrebuiltPackageDir)system.text.json.4.7.2.nupkg;
$(TarballPrebuiltPackageDir)system.text.json.5.0.0-rc.1.20451.14.nupkg;
$(TarballPrebuiltPackageDir)system.text.json.5.0.0.nupkg;
$(TarballPrebuiltPackageDir)system.valuetuple.4.3.0.nupkg;
$(TarballPrebuiltPackageDir)system.xml.xpath.xmldocument.4.0.1.nupkg;
$(TarballPrebuiltPackageDir)vswhere.2.6.7.nupkg;
$(TarballPrebuiltPackageDir)xlifftasks.1.0.0-beta.20420.1.nupkg;
" />
<!--
Remove source-link packages to throw away tooling that Arcade imports unconditionally in the
production build.
-->
<KnownExtraPrebuiltFile Include="
$(TarballPrebuiltPackageDir)microsoft.build.tasks.git.1.0.0-beta2-*.nupkg;
$(TarballPrebuiltPackageDir)microsoft.sourcelink.common.1.0.0-beta2-*.nupkg;
$(TarballPrebuiltPackageDir)microsoft.sourcelink.github.1.0.0-beta2-*.nupkg;
$(TarballPrebuiltPackageDir)microsoft.sourcelink.vsts.git.1.0.0-beta2-*.nupkg;
" />
<!--
Remove packages that show up when dotnet/sdk restores Microsoft.Build/15.7.179 in net472
configuration. These are not present in the source-build-reference-packages version of
Microsoft.Build/15.7.179, so we know it's safe to ignore. In the production build, we aren't
using SBRP yet, so we need to remove them here.
-->
<KnownExtraPrebuiltFile Include="
$(TarballPrebuiltPackageDir)microsoft.visualstudio.setup.configuration.interop.1.16.30.nupkg;
$(TarballPrebuiltPackageDir)system.threading.tasks.dataflow.4.5.24.nupkg;
" />
</ItemGroup>
<Delete Files="@(KnownExtraPrebuiltFile)" />
</Target>
</Project>

View file

@ -0,0 +1,99 @@
<Project>
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceTextInFile" />
<!--
Find text-only nupkgs and decompose them into text files to include in the tarball as source
code. This simplifies maintenance by removing the need to put a new version of these files in
dotnet/source-build-reference-packages for potentially every single servicing release.
'dotnet new' template packages are a prominent example of text-only packages that change often.
-->
<Target Name="AddAllUnpackedTextOnlyPackageSource"
DependsOnTargets="GetTarballDirProps"
BeforeTargets="AddTarballPackages">
<PropertyGroup>
<TarballUnpackedTextOnlyPackageSourceDir>$([MSBuild]::NormalizeDirectory('$(TarballRootDir)', 'packages', 'text-only'))</TarballUnpackedTextOnlyPackageSourceDir>
</PropertyGroup>
<!--
Find .nupkg files in package cache in order to locate the extraction directory, then filter
which files are copied to the tarball to exclude the nupkg itself and unnecessary metadata.
-->
<ItemGroup>
<TextOnlyPrebuiltNupkgFile Include="
$(ProjectDir)packages\restored\**\microsoft.dotnet.web.itemtemplates.2.1.*.nupkg;
$(ProjectDir)packages\restored\**\microsoft.dotnet.web.projecttemplates.2.1.2.1.*.nupkg;
$(ProjectDir)packages\restored\**\microsoft.dotnet.web.spa.projecttemplates.2.1.2.1.*.nupkg;
$(ProjectDir)packages\restored\**\microsoft.dotnet.common.itemtemplates.3.1.*.nupkg;
$(ProjectDir)packages\restored\**\microsoft.dotnet.web.itemtemplates.3.1.*.nupkg;
$(ProjectDir)packages\restored\**\microsoft.dotnet.web.projecttemplates.3.1.3.1.*.nupkg;
$(ProjectDir)packages\restored\**\microsoft.dotnet.web.spa.projecttemplates.3.1.3.1.*.nupkg;
$(ProjectDir)packages\restored\**\microsoft.dotnet.web.itemtemplates.5.0.*.nupkg;
$(ProjectDir)packages\restored\**\microsoft.dotnet.web.projecttemplates.5.0.5.0.*.nupkg;
$(ProjectDir)packages\restored\**\microsoft.dotnet.web.spa.projecttemplates.5.0.5.0.*.nupkg;
" />
<!-- Make prebuilt nupkg copy logic ignore these text-only nupkgs. -->
<RefOnlyPackageFilename Include="@(TextOnlyPrebuiltNupkgFile->'%(Filename)')" />
<TextOnlyPrebuiltNupkgProject
Include="$(MSBuildProjectFullPath)"
Properties="
TextOnlyPackageRootDir=%(TextOnlyPrebuiltNupkgFile.RootDir)%(TextOnlyPrebuiltNupkgFile.Directory)" />
</ItemGroup>
<MSBuild
Projects="@(TextOnlyPrebuiltNupkgProject)"
Targets="AddUnpackedTextOnlyPackageSource">
<Output TaskParameter="TargetOutputs" ItemName="TarballCopyFile" />
</MSBuild>
</Target>
<Target Name="AddUnpackedTextOnlyPackageSource"
DependsOnTargets="GetTarballDirProps"
Returns="@(TarballCopyFile)">
<PropertyGroup>
<PackageVersionDirFile>$([System.IO.Path]::GetDirectoryName('$(TextOnlyPackageRootDir)'))</PackageVersionDirFile>
<PackageIdDirFile>$([System.IO.Path]::GetDirectoryName('$(PackageVersionDirFile)'))</PackageIdDirFile>
<PackageVersion>$([System.IO.Path]::GetFileName('$(PackageVersionDirFile)'))</PackageVersion>
<PackageId>$([System.IO.Path]::GetFileName('$(PackageIdDirFile)'))</PackageId>
<PackageIntermediateDir>$([MSBuild]::NormalizeDirectory('$(TextOnlyPackageBaseDir)', '$(PackageId)', '$(PackageVersion)'))</PackageIntermediateDir>
</PropertyGroup>
<MakeDir Directories="$(PackageIntermediateDir)" />
<ItemGroup>
<NuspecFile Include="$(TextOnlyPackageRootDir)*.nuspec" />
<PackableNuspecFile Include="@(NuspecFile->'$(PackageIntermediateDir)%(Filename)%(Extension)')" />
</ItemGroup>
<Error Condition="@(NuspecFile->Count()) != 1" Text="Expected exactly one nuspec file in $(TextOnlyPackageRootDir)" />
<Copy SourceFiles="@(NuspecFile)" DestinationFiles="@(PackableNuspecFile)" />
<ReplaceTextInFile
InputFile="@(PackableNuspecFile)"
OldText="&lt;/package&gt;"
NewText="&lt;files&gt;&lt;file src=&quot;.\**\*&quot;/&gt;&lt;/files&gt;&lt;/package&gt;" />
<ItemGroup>
<TextOnlyPackageContentFile
Include="
$(TextOnlyPackageRootDir)**;
$(PackageIntermediateDir)**"
Exclude="
@(NuspecFile);
$(TextOnlyPackageRootDir)**\.nupkg.metadata;
$(TextOnlyPackageRootDir)**\.signature.p7s;
$(TextOnlyPackageRootDir)**\*.nupkg;
$(TextOnlyPackageRootDir)**\*.nupkg.sha512" />
<TarballCopyFile
Include="@(TextOnlyPackageContentFile)"
RelativeDestination="packages\text-only\$(PackageId)\$(PackageVersion)\%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
</Target>
</Project>

View file

@ -0,0 +1,386 @@
<Project>
<Target Name="PackSourceBuildTarball"
Condition="'$(PackSourceBuildTarball)' == 'true'"
DependsOnTargets="
GetTarballDirProps;
AddTarballSource;
AddTarballSourcelinkMetadata;
AddTarballTools;
AddTarballPackages;
AddTarballExternalTarballs;
AddTarballCommitInfo;
AddTarballLeakDetection;
CopyTarballFiles;
RemoveTarballKnownExtraPrebuilts;
ForbidPrebuilts;
"
AfterTargets="Execute" />
<Import Project="SourceBuild.Tarball.KnownExtraPrebuilts.targets" />
<Import Project="SourceBuild.Tarball.AllowedPrebuilts.targets" />
<Import Project="SourceBuild.Tarball.TextOnlyPrebuilts.targets" />
<Import
Project="SourceBuild.Tarball.DestructiveCleanup.targets"
Condition="'$(DestructiveIntermediateClean)' == 'true'"/>
<Target Name="GetTarballDirProps">
<PropertyGroup>
<TarballRootDir>$([MSBuild]::NormalizeDirectory('$(TarballRoot)'))</TarballRootDir>
<TarballSourceDir>$([MSBuild]::NormalizeDirectory('$(TarballRootDir)', 'src'))</TarballSourceDir>
<TarballPrebuiltPackageDir>$([MSBuild]::NormalizeDirectory('$(TarballRootDir)', 'packages', 'prebuilt'))</TarballPrebuiltPackageDir>
</PropertyGroup>
</Target>
<Target Name="AddTarballSource"
DependsOnTargets="
GetTarballDirProps;
GetCommonDarcCloneCommand"
Condition="'$(SkipAddTarballSource)' != 'true'">
<!--
Use Git to put sources in the tarball. This ensure it's fresh, without having to clean and
reset the working dir. This helps preserve diagnostic information if the tarball build doesn't
work.
-->
<Exec
Command="git --work-tree=&quot;$(TarballRootDir)&quot; checkout HEAD -- src"
WorkingDirectory="$(ProjectDir)" />
<!--
Now re-uberclone into the tarball src directory. Since we reuse the .gitdirs, this shouldn't
hit the network at all.
-->
<Exec
Command="$(DarcCloneCommand) --repos-folder $(TarballSourceDir)"
WorkingDirectory="$(ProjectDir)" />
<Message Importance="High" Text="Darc clone into tarball complete." />
<ItemGroup>
<TarballSrcBinaryExtension Include="
.dll;
.Dll;
.exe;
.pdb;
.mdb;
.zip;
.nupkg" />
<TarballSrcBinaryToRemove Include="$(TarballSourceDir)**\*%(TarballSrcBinaryExtension.Identity)" />
<!-- Runtime coreclr and installer parts have empty placeholder PDB files. Keep them. -->
<TarballSrcBinaryToRemove Remove="
$(TarballSourceDir)runtime*\src\coreclr\src\.nuget\**\*%(TarballSrcBinaryExtension.Identity);
$(TarballSourceDir)runtime*\src\installer\pkg\**\*%(TarballSrcBinaryExtension.Identity)" />
</ItemGroup>
<Delete Files="@(TarballSrcBinaryToRemove)" />
<ItemGroup>
<MasterRepositoryDirToRemove
Include="$([System.IO.Directory]::GetDirectories('$(TarballSourceDir)'))" />
<!-- Keep known source dirs and non-master repo dirs. -->
<MasterRepositoryDirToRemove Remove="$(TarballSourceDir)reference-assemblies" />
<MasterRepositoryDirToRemove Remove="$(TarballSourceDir)netcorecli-fsc" />
<MasterRepositoryDirToRemove Remove="$(TarballSourceDir)package-source-build" />
<MasterRepositoryDirToRemove
Remove="@(MasterRepositoryDirToRemove)"
Condition="
$([System.Text.RegularExpressions.Regex]::IsMatch(
'%(Identity)',
'\.[A-Fa-f0-9]{40}$'))" />
</ItemGroup>
<RemoveDir Directories="@(MasterRepositoryDirToRemove)" />
</Target>
<Target Name="AddTarballSourcelinkMetadata">
<ItemGroup>
<ArtifactsGitDir Include="$(ClonedSubmoduleDirectory)**\.git\**\*" />
</ItemGroup>
<Copy
SourceFiles="@(ArtifactsGitDir)"
DestinationFiles="@(ArtifactsGitDir -> '$(TarballSourceDir)%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="AddTarballTools">
<ItemGroup>
<TarballRootToolFile
Include="
$(ProjectDir)*.proj;
$(ProjectDir)*.props;
$(ProjectDir)*.targets;
$(ProjectDir)global.json;
$(ProjectDir)DarcVersion.txt;
$(ProjectDir)ProdConFeed.txt;
$(ProjectDir)smoke-test*;
$(ProjectDir)eng\**;
$(ProjectDir)keys\**;
$(ProjectDir)patches\**;
$(ProjectDir)scripts\**;
$(ProjectDir)repos\**;
$(ProjectDir)tools-local\**;
"
Exclude="
$(ProjectDir)tools-local\arcade-services\**;
$(ProjectDir)tools-local\tasks\*\bin\**;
$(ProjectDir)tools-local\tasks\*\obj\**;
" />
<TarballRootToolFile
Include="$(DotNetCliToolDir)**"
Exclude="
$(DotNetCliToolDir)shared\2.1.0\**;
$(DotNetCliToolDir)tools\**;
"
Condition=" '$(CustomDotNetSdkDir)' == '' AND '$(PackBaseTarball)' != 'true' "/>
<TarballCopyFile
Include="@(TarballRootToolFile)"
RelativeDestination="$([MSBuild]::MakeRelative('$(ProjectDir)', '%(Identity)'))" />
<TarballGitInfoFile Include="$(ProjectDir)artifacts\git-info\**" />
<TarballCopyFile
Include="@(TarballGitInfoFile)"
RelativeDestination="git-info\%(RecursiveDir)%(Filename)%(Extension)" />
<TarballBootstrappingToolFile Include="$(ProjectDir)support\tarball\tool-bootstrapping/**;" />
<TarballCopyFile
Include="@(TarballBootstrappingToolFile)"
RelativeDestination="tool-bootstrapping\%(RecursiveDir)%(Filename)%(Extension)" />
<TarballCopyFile
Include="$(ProjectDir)support/tarball/build.sh"
RelativeDestination="build.sh" />
<TarballCopyFile
Condition=" '$(PackBaseTarball)' == 'true' "
Include="$(ProjectDir)support/tarball/prep.sh"
RelativeDestination="prep.sh" />
<!--
When building an internal build, the main smoke-test nuget config has authenticated sources
in it to generate a full set of smoke-test-prereqs. This isn't necessary in the tarball
because we have those smoke-test-prereqs, but we hit authentication errors nonetheless. Copy
a trimmed down nuget.config in this case.
TODO: Automatically trim down the main nuget.config.
-->
<TarballCopyFile
Condition="Exists('$(ProjectDir)support\tarball\smoke-testNuGet.Config')"
Include="$(ProjectDir)support\tarball\smoke-testNuGet.Config"
RelativeDestination="smoke-testNuGet.Config" />
<!-- Setup package version props to include both source-built and running PackageVersions.props -->
<TarballCopyFile
Include="$(ProjectDir)support\tarball\PackageVersions.props"
RelativeRoot="artifacts/obj/$(Platform)/Release/" />
</ItemGroup>
</Target>
<Target Name="AddTarballPackages">
<!-- Find reference-packages to exclude from tarball prebuilts...-->
<ItemGroup Condition="'$(CustomRefPackagesDir)' != ''">
<SourceBuildReferencePackageFile Include="$(CustomRefPackagesDir)**\*.nupkg" />
</ItemGroup>
<Exec
Command="tar -tf $(ExternalTarballsDir)Private.SourceBuild.ReferencePackages.*.tar.gz | tr '[:upper:]' '[:lower:]'"
ConsoleToMsBuild="true"
StandardOutputImportance="low"
Condition="'$(CustomRefPackagesDir)' == ''">
<Output TaskParameter="ConsoleOutput" ItemName="SourceBuildReferencePackageFile" />
</Exec>
<ItemGroup>
<SourceBuildReferencePackageFilename Include="@(SourceBuildReferencePackageFile -> '%(Filename)')" />
</ItemGroup>
<!-- Find previously source-built packages to exclude from tarball prebuilts... -->
<ItemGroup Condition="'$(CustomPreviouslySourceBuiltPackagesDir)' != ''">
<PreviouslySourceBuiltPackageFile Include="$(CustomPreviouslySourceBuiltPackagesDir)**\*.nupkg" />
</ItemGroup>
<ItemGroup>
<!-- Use a downloaded previously source built artifacts tar.gz if specified. -->
<PrivateSourceBuiltArtifactsTarGzFile
Condition="'$(PrivateSourceBuiltArtifactsPackageVersion)' != ''"
Include="$(ExternalTarballsDir)Private.SourceBuilt.Artifacts.*.tar.gz" />
<!-- If not using previously source built artifacts tar.gz, use Production build output. -->
<PrivateSourceBuiltArtifactsTarGzFile
Condition="'$(PrivateSourceBuiltArtifactsPackageVersion)' == ''"
Include="$(OutputPath)$(SourceBuiltArtifactsTarballName).*.tar.gz" />
</ItemGroup>
<Error
Text="Expected one PrivateSourceBuiltArtifactsTarGzFile item, got @(PrivateSourceBuiltArtifactsTarGzFile->Count())"
Condition="@(PrivateSourceBuiltArtifactsTarGzFile->Count()) != 1" />
<Exec
Command="tar -tf @(PrivateSourceBuiltArtifactsTarGzFile) | tr '[:upper:]' '[:lower:]'"
ConsoleToMsBuild="true"
StandardOutputImportance="low"
Condition="'$(CustomPreviouslySourceBuiltPackagesDir)' == ''">
<Output TaskParameter="ConsoleOutput" ItemName="PreviouslySourceBuiltPackageFile" />
</Exec>
<ItemGroup>
<PreviouslySourceBuiltPackageFilename Include="@(PreviouslySourceBuiltPackageFile -> '%(Filename)')" />
</ItemGroup>
<ItemGroup>
<!-- Find source-built packages to exclude from tarball prebuilts... -->
<SourceBuiltPackageFile Include="$(SourceBuiltPackagesPath)**\*.nupkg" />
<SourceBuiltPackageFilename Include="@(SourceBuiltPackageFile -> '%(Filename)')" />
<!-- Find prebuilts and smoke-test prebuilts to copy (with exclusions). -->
<PrebuiltPackageFile
Include="
$(ProjectDir)packages\restored\**\*.nupkg;
$(LocalNuGetPackagesRoot)**\*.nupkg;
" />
<PrebuiltPackageFile
RelativeDestination="packages\prebuilt\%(Filename)%(Extension)" />
<SmokeTestPackageFile
Include="$(ProjectDir)testing-smoke\smoke-test-packages\**\*.nupkg"
RelativeRoot="packages\smoke-test-packages\" />
<!--
Set up filename-based items, in order to filter out some packages that aren't necessary as
prebuilts, or are generated/acquired another way.
-->
<IncludedPrebuiltPackageCandidate Include="@(PrebuiltPackageFile)" />
<!--
For internal builds, all smoke-test packages should be kept. For external builds, they can
be restored during smoke-test execution from public sources, so can be pruned.
-->
<IncludedPrebuiltPackageFile Include="@(SmokeTestPackageFile)" Condition="'$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)' != ''" />
<IncludedPrebuiltPackageCandidate Include="@(SmokeTestPackageFile)" Condition="'$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)' == ''" />
<IncludedPrebuiltPackageFilename
Include="@(IncludedPrebuiltPackageCandidate -> '%(Filename)')"
OriginalIdentity="%(Identity)" />
<IncludedPrebuiltPackageFilename Remove="
@(SourceBuiltPackageFilename);
@(SourceBuildReferencePackageFilename);
@(PreviouslySourceBuiltPackageFilename);
@(RefOnlyPackageFilename);
" />
<IncludedPrebuiltPackageFile
Include="@(IncludedPrebuiltPackageFilename -> '%(OriginalIdentity)')" />
<!-- Add prebuilt packages to tarball. -->
<TarballCopyFile Include="@(IncludedPrebuiltPackageFile)" />
</ItemGroup>
</Target>
<Target Name="AddTarballExternalTarballs"
DependsOnTargets="AddTarballPackages">
<ItemGroup>
<ExternalTarballFile
Condition=" '$(PackBaseTarball)' != 'true' "
Include="$(ExternalTarballsDir)*.tar.gz"
RelativeRoot="packages\archive\" />
<!-- If not using previously source built artifacts tar.gz, use Production build output. -->
<ExternalTarballFile
Condition=" '$(PrivateSourceBuiltArtifactsPackageVersion)' == '' AND '$(PackBaseTarball)' != 'true' "
Include="@(PrivateSourceBuiltArtifactsTarGzFile)"
RelativeRoot="packages\archive\" />
<ExternalTarballFile
Condition=" '$(PackBaseTarball)' == 'true' "
Include="$(ArchiveArtifactsTextFile)"
RelativeRoot="packages\archive\" />
<TarballCopyFile Include="@(ExternalTarballFile);" />
</ItemGroup>
</Target>
<!--
Record commits for the source-build repo and all submodules, to aid in reproducibility...
-->
<Target Name="AddTarballCommitInfo"
Condition="'$(SkipAddTarballCommitInfo)' != 'true'">
<PropertyGroup>
<SourceBuildInfoFile>$(TarballRootDir)source-build-info.txt</SourceBuildInfoFile>
</PropertyGroup>
<Exec
Command="(
echo 'source-build:';
echo ' '%24(git rev-parse HEAD)' . ('%24(git describe --always HEAD)')';
echo ''
echo 'submodules:'
echo %24(git submodule status --recursive)
) > $(SourceBuildInfoFile)"
WorkingDirectory="$(ProjectDir)"
StandardOutputImportance="low" />
</Target>
<Target Name="AddTarballLeakDetection"
Condition="'$(IncludeLeakDetection)' == 'true'"
DependsOnTargets="CopyTarballFiles">
<PropertyGroup>
<LeakDetectionProjectFile>$(ProjectDir)tools-local\tasks\Microsoft.DotNet.SourceBuild.Tasks.LeakDetection\Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.csproj</LeakDetectionProjectFile>
</PropertyGroup>
<MSBuild
Projects="$(LeakDetectionProjectFile)"
Targets="Restore"
Properties="
RestoreSources=$(SourceBuiltPackagesPath)%3B$(TarballRootDir)packages/prebuilt%3bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public%40Local/nuget/v3/index.json;
DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)"/>
<MSBuild
Projects="$(LeakDetectionProjectFile)"
Targets="Publish"
Properties="
OutputPath=$(TarballRootDir)tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection/;
DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)"/>
</Target>
<Target Name="CopyTarballFiles">
<ItemGroup>
<TarballCopyFile
Condition="
'%(TarballCopyFile.RelativeDestination)' == '' and
'%(TarballCopyFile.RelativeRoot)' != ''"
RelativeDestination="%(TarballCopyFile.RelativeRoot)%(TarballCopyFile.RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<Copy
SourceFiles="@(TarballCopyFile)"
DestinationFiles="@(TarballCopyFile -> '$(TarballRootDir)%(RelativeDestination)')" />
</Target>
<!-- Check for any remaining prebuilts... -->
<Target Name="ForbidPrebuilts"
Condition="'$(SkipPrebuiltEnforcement)' != 'true'">
<ItemGroup>
<!--
'Exclude' is an escape hatch for prebuilts, but none are allowed as of writing this target.
If necessary, define a target in a separate targets file (to avoid clutter) that sets up the
exclusion items and runs with BeforeTargets="ForbidPrebuilts".
-->
<ForbiddenPrebuiltPackageFile
Include="$(TarballPrebuiltPackageDir)**\*.nupkg"
Exclude="@(AllowedPrebuiltPackageFile)" />
</ItemGroup>
<PropertyGroup Condition="'@(ForbiddenPrebuiltPackageFile)' != ''">
<PrebuiltErrorText>Detected forbidden prebuilts. They must be removed, or explicitly allowed (see target for details):</PrebuiltErrorText>
<PrebuiltErrorText>$(PrebuiltErrorText)%0A@(ForbiddenPrebuiltPackageFile -> '%(Identity)', '%0A')</PrebuiltErrorText>
</PropertyGroup>
<Error Text="$(PrebuiltErrorText)" Condition="'$(PrebuiltErrorText)' != ''" />
</Target>
</Project>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- SDK/Runtime Version Information -->
<PropertyGroup>
<MajorVersion>6</MajorVersion>
<MinorVersion>0</MinorVersion>
<RuntimePatchVersion>0-preview.6</RuntimePatchVersion>
<SdkPatchVersion>100-preview.6</SdkPatchVersion>
<RuntimeProductVersion>$(MajorVersion).$(MinorVersion).$(RuntimePatchVersion)</RuntimeProductVersion>
<AspNetCoreProductVersion>$(MajorVersion).$(MinorVersion).$(RuntimePatchVersion)</AspNetCoreProductVersion>
<SdkProductVersion>$(MajorVersion).$(MinorVersion).$(SdkPatchVersion)</SdkProductVersion>
</PropertyGroup>
<!-- Repo Version Information -->
<PropertyGroup>
<VersionPrefix>0.1.0</VersionPrefix>
<PreReleaseVersionLabel>alpha.1</PreReleaseVersionLabel>
</PropertyGroup>
<!-- Humanizer expects us to tell the version it's building -->
<PropertyGroup>
<HumanizerCorePackageVersion>2.2.0</HumanizerCorePackageVersion>
</PropertyGroup>
<!-- Production Dependencies -->
<PropertyGroup>
<PrivateSourceBuiltArtifactsPackageVersion>0.1.0-6.0.100-bootstrap.3</PrivateSourceBuiltArtifactsPackageVersion>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,41 @@
#!/usr/bin/env bash
# This script installs the NuGet Credential Provider. It is intended for use on CI machines only.
# Originally copied from https://github.com/dotnet/core-setup/blob/aa28510afc9b986c6837db6784d816fe4a66c7d0/eng/install-nuget-credprovider.sh
set -e
# Install curl if necessary. Dependency exists inside downloaded script.
if command -v curl > /dev/null; then
echo "curl found."
else
echo "curl not found, trying to install..."
(
set +e
set -x
apt update && apt install -y curl
apk update && apk upgrade && apk add curl
exit 0
)
fi
# Install. Ported from https://gist.github.com/shubham90/ad85f2546a72caa20d57bce03ec3890f
install_credprovider() {
# Download the provider and install.
cred_provider_url='https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh'
curl "$cred_provider_url" -s -S -L | bash
# Environment variable to enable session token cache. More on this here: https://github.com/Microsoft/artifacts-credprovider#help
export NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED=true
}
install_credprovider
# Additional setup to try to avoid flakiness: https://github.com/dotnet/arcade/issues/3932
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
export NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20
export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20

View file

@ -0,0 +1,12 @@
{
"tools": {
"dotnet": "6.0.100-preview.5.21225.11"
},
"msbuild-sdks": {
"Microsoft.Build.CentralPackageVersions": "2.0.1",
"Microsoft.Build.Traversal": "2.0.2",
"Microsoft.NET.Sdk.IL": "3.0.0-preview-27107-01",
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21304.1",
"Yarn.MSBuild": "1.15.2"
}
}

Binary file not shown.

View file

@ -0,0 +1,13 @@
This directory contains the public key portion of keys used by different
projects so we can public sign (also known as OSS signing) assemblies that need
to be signed to have the correct strong name.
These are used for projects which full sign their assemblies and don't have keys
checked in.
To extract a key, take an existing built binary for a project (e.g. download a
nupkg from NuGet.org and then unpack one of the assemblies from it) and use `sn`:
```
sn -e <path-to-binary> <path-to-snk-to-write>
```

View file

@ -0,0 +1,76 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
SCRIPT_ROOT="$(cd -P "$( dirname "$0" )" && pwd)"
usage() {
echo "usage: $0"
echo ""
echo " Prepares a tarball to be built by downloading Private.SourceBuilt.Artifacts.*.tar.gz and"
echo " installing the version of dotnet referenced in global.json"
echo ""
}
positional_args=()
while :; do
if [ $# -le 0 ]; then
break
fi
lowerI="$(echo "$1" | awk '{print tolower($0)}')"
case $lowerI in
"-?"|-h|--help)
usage
exit 0
;;
*)
positional_args+=("$1")
;;
esac
shift
done
# Check for the archive text file which describes the location of the archive files to download
if [ ! -f $SCRIPT_ROOT/packages/archive/archiveArtifacts.txt ]; then
echo " ERROR: $SCRIPT_ROOT/packages/archive/archiveArtifacts.txt does not exist. Cannot determine which archives to download. Exiting..."
exit -1
fi
downloadArtifacts=true
installDotnet=true
# Check to make sure curl exists to download the archive files
if ! command -v curl &> /dev/null
then
echo " ERROR: curl not found. Exiting..."
exit -1
fi
# Check if Private.SourceBuilt artifacts archive exists
if [ -f $SCRIPT_ROOT/packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz ]; then
echo " Private.SourceBuilt.Artifacts.*.tar.gz exists...it will not be downloaded"
downloadArtifacts=false
fi
# Check if dotnet is installed
if [ -d $SCRIPT_ROOT/.dotnet ]; then
echo " ./.dotnet SDK directory exists...it will not be installed"
installDotnet=false;
fi
# Read the archive text file to get the archives to download and download them
while read -r line; do
if [[ $line == *"Private.SourceBuilt.Artifacts"* ]]; then
if [ "$downloadArtifacts" == "true" ]; then
echo " Downloading source-built artifacts..."
(cd $SCRIPT_ROOT/packages/archive/ && curl -O $line)
fi
fi
done < $SCRIPT_ROOT/packages/archive/archiveArtifacts.txt
# Check for the version of dotnet to install
if [ "$installDotnet" == "true" ]; then
echo " Installing dotnet..."
(source ./eng/common/tools.sh && InitializeDotNetCli true)
fi

View file

@ -0,0 +1,148 @@
<Project>
<PropertyGroup>
<RepositoryName Condition="'$(RepositoryName)' == ''">$(MSBuildProjectName)</RepositoryName>
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)..))" />
<Import Project="$(OutputGitInfoPropsFile)" Condition="Exists('$(OutputGitInfoPropsFile)')" />
<Import Project="$(OfflineGitInfoPropsFile)" Condition="Exists('$(OfflineGitInfoPropsFile)')" />
<PropertyGroup>
<SourceDirectory Condition="'$(SourceDirectory)' == ''">$(RepositoryName)</SourceDirectory>
<ProjectDirectory Condition="'$(ProjectDirectory)' == '' and '$(OfflineBuild)' != 'true'">$(ClonedSubmoduleDirectory)$(SourceDirectory).$(GitCommitHash)/</ProjectDirectory>
<ProjectDirectory Condition="'$(ProjectDirectory)' == '' and '$(OfflineBuild)' == 'true'">$(SubmoduleDirectory)$(SourceDirectory).$(GitCommitHash)/</ProjectDirectory>
<MinimalConsoleLogOutput Condition="'$(MinimalConsoleLogOutput)' == ''">true</MinimalConsoleLogOutput>
<RepoConsoleLogFile>$(LoggingDir)$(RepositoryName).log</RepoConsoleLogFile>
<RedirectRepoOutputToLog Condition="'$(MinimalConsoleLogOutput)' == 'true'">&gt;&gt; $(RepoConsoleLogFile) 2&gt;&amp;1</RedirectRepoOutputToLog>
<IsStable Condition="'$(UseStableVersions)' == 'true'">true</IsStable>
<!--
Repo specific semaphore path for incremental build
-->
<RepoCompletedSemaphorePath>$(CompletedSemaphorePath)$(RepositoryName)/</RepoCompletedSemaphorePath>
</PropertyGroup>
<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
<FlagParameterPrefix>-</FlagParameterPrefix>
<ArcadeFalseBoolBuildArg>0</ArcadeFalseBoolBuildArg>
</PropertyGroup>
<PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
<FlagParameterPrefix>--</FlagParameterPrefix>
<ArcadeFalseBoolBuildArg>false</ArcadeFalseBoolBuildArg>
</PropertyGroup>
<PropertyGroup>
<GitCommitDateNoDashes>$(GitCommitDate.Replace('-', ''))</GitCommitDateNoDashes>
</PropertyGroup>
<!-- A human-readable description of what's building and why. -->
<PropertyGroup>
<ProjectBuildReason>'$(RepositoryName)'</ProjectBuildReason>
<ProjectBuildReason Condition="'$(OfflineBuild)' != 'true' AND '$(ArchiveDownloadedPackages)' == 'true'">$(ProjectBuildReason) to produce tarball</ProjectBuildReason>
<ProjectBuildReason Condition="'$(OfflineBuild)' == 'true'">$(ProjectBuildReason) in tarball</ProjectBuildReason>
</PropertyGroup>
<ItemGroup>
<EnvironmentVariables Include="DotNetBuildFromSource=true" />
<EnvironmentVariables Include="DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)" />
<EnvironmentVariables Include="DotNetRestorePackagesPath=$(PackagesDir)" />
<EnvironmentVariables Include="DotNetBuildOffline=true" Condition="'$(OfflineBuild)' == 'true'" />
<!-- Ensure the SDK (Core-SDK/Installer) doesn't add an online source. -->
<EnvironmentVariables Include="AddDotnetfeedProjectSource=false" Condition="'$(OfflineBuild)' == 'true'" />
<!-- Arcade tools.sh picks up DotNetCoreSdkDir, but we can pass DOTNET_INSTALL_DIR directly. -->
<EnvironmentVariables Include="DOTNET_INSTALL_DIR=$(DotNetCliToolDir)" />
<EnvironmentVariables Include="DOTNET_PATH=$(DotNetCliToolDir)" />
<EnvironmentVariables Include="DOTNET_HOST_PATH=$(DotNetCliToolDir)dotnet" />
<!-- _InitializeDotNetCli is used by websdk and templating to decide whether to init the SDK -->
<EnvironmentVariables Include="_InitializeDotNetCli=$(DotNetCliToolDir)" />
<EnvironmentVariables Include="_DotNetInstallDir=$(DotNetCliToolDir)" />
<EnvironmentVariables Include="_InitializeToolset=$(ProjectDir)Tools/source-built/Microsoft.DotNet.Arcade.Sdk/tools/Build.proj" Condition="'$(UseBootstrapArcade)' != 'true'" />
<EnvironmentVariables Include="_OverrideArcadeInitializeBuildToolFramework=net5.0" />
<!--
With ProdCon v2, stabilization options are checked in, unlike ProdCon v1. These should be
deprecated but are left in to avoid potentially regressing edge-case versioning.
-->
<EnvironmentVariables Include="StabilizePackageVersion=$(IsStable)" Condition="'$(IsStable)' != '' and '$(IsToolingProject)' != 'true'" />
<EnvironmentVariables Include="PB_IsStable=$(IsStable)" Condition="'$(IsStable)' != '' and '$(IsToolingProject)' != 'true'" />
<EnvironmentVariables Include="IsStableBuild=$(IsStable)" Condition="'$(IsStable)' != '' and '$(IsToolingProject)' != 'true'" />
<EnvironmentVariables Include="DotNetFinalVersionKind=release" Condition="'$(IsStable)' == 'true' and '$(IsToolingProject)' != 'true'" />
<EnvironmentVariables Include="DropSuffix=true" Condition="'$(IsStable)' == 'true' and '$(IsToolingProject)' != 'true'" />
<EnvironmentVariables Include="DotNetUseShippingVersions=true" />
<EnvironmentVariables Include="PreReleaseVersionLabel=$(PreReleaseVersionLabel)" />
<EnvironmentVariables Include="PackageVersionStamp=$(PreReleaseVersionLabel)" />
<EnvironmentVariables Include="PB_VersionStamp=$(PreReleaseVersionLabel)" />
<!-- We pass '-ci', but also apply ci mode via env var for edge cases. (E.g. misbehaving inner builds.) -->
<EnvironmentVariables Include="ContinuousIntegrationBuild=true" />
<!-- Turn off node reuse for source build because repos use conflicting versions
of compilers which cause assembly load errors.
See https://github.com/dotnet/source-build/issues/541 -->
<EnvironmentVariables Include="MSBUILDDISABLENODEREUSE=1" />
<!--
Apply official build versioning to match Microsoft build. These are based on build date, so
need to be parsed from Maestro++ auto-update and passed through.
-->
<EnvironmentVariables Include="OfficialBuildId=$(OfficialBuildId)" />
<EnvironmentVariables Include="BUILD_BUILDNUMBER=$(OfficialBuildId)" />
<!-- Give build access to commit info without necessarily requiring git queries. -->
<EnvironmentVariables Include="GitCommitCount=$(GitCommitCount)" />
<EnvironmentVariables Include="GitCommitHash=$(GitCommitHash)" Condition="'$(GitCommitHash)' != ''" />
<EnvironmentVariables Include="GitInfoCommitHash=$(GitCommitHash)" Condition="'$(GitCommitHash)' != ''" />
<EnvironmentVariables Include="SourceRevisionId=$(GitCommitHash)" Condition="'$(GitCommitHash)' != ''" />
<EnvironmentVariables Include="RepositoryCommit=$(GitCommitHash)" Condition="'$(GitCommitHash)' != ''" />
<EnvironmentVariables Include="COMMIT_SHA=$(GitCommitHash)" Condition="'$(GitCommitHash)' != ''" />
<EnvironmentVariables Include="GIT_COMMIT=$(GitCommitHash)" Condition="'$(GitCommitHash)' != ''" />
<EnvironmentVariables Include="RepositoryType=Git" />
<EnvironmentVariables Include="DeterministicSourcePaths=true" Condition="'$(DeterministicBuildOptOut)' != 'true'" />
<EnvironmentVariables Include="DeterministicSourcePaths=false" Condition="'$(DeterministicBuildOptOut)' == 'true'" />
<EnvironmentVariables Include="SourceRoot=$(ProjectDirectory)" />
</ItemGroup>
<ItemGroup Condition="'$(EnableExtraDebugging)' == 'true'">
<!-- If MSBuild exits early, make sure debug output like 'MSBuild_*.failure.txt' ends up in a place we can see it. -->
<EnvironmentVariables Include="MSBUILDDEBUGPATH=$(MSBuildDebugPathTargetDir)" />
<EnvironmentVariables Include="MSBUILDDEBUGCOMM=1" />
<EnvironmentVariables Include="MSBUILDDEBUGSCHEDULER=1" />
<EnvironmentVariables Include="MSBUILDDEBUGFORCECACHING=1" />
<EnvironmentVariables Include="MSBUILDDEBUG=1" />
<EnvironmentVariables Include="MSBUILDDEBUGEVALUATION=1" />
<EnvironmentVariables Include="MSBUILDTARGETOUTPUTLOGGING=1" />
<EnvironmentVariables Include="MSBUILDLOGTASKINPUTS=1" />
<EnvironmentVariables Include="MSBUILDEMITSOLUTION=1" />
<EnvironmentVariables Include="MSBUILDLOGVERBOSERARSEARCHRESULTS=1" />
<!-- Output Roslyn logs to allow debugging compiler errors -->
<EnvironmentVariables Include="RoslynCommandLineLogFile=$(RoslynDebugPathTargetDir)" />
<!--ASP.NET dev server request logs -->
<EnvironmentVariables Include="RAZORBUILDSERVER_LOG=$(AspNetRazorBuildServerLogFile)" />
</ItemGroup>
<PropertyGroup>
<ArcadeBootstrapDir Condition="'$(OfflineBuild)' != 'true'">$(PackagesDir)</ArcadeBootstrapDir>
<ArcadeBootstrapDir Condition="'$(OfflineBuild)' == 'true'">$(ArcadeBootstrapPackageDir)</ArcadeBootstrapDir>
<ArcadeBootstrapVersion>$(ARCADE_BOOTSTRAP_VERSION)</ArcadeBootstrapVersion>
</PropertyGroup>
<ItemGroup>
<ArcadeSdkOverride Include="Microsoft.DotNet.Arcade.Sdk" Group="ARCADE" Version="$(arcadeOutputPackageVersion)"/>
<ArcadeBootstrapSdkOverride Include="Microsoft.DotNet.Arcade.Sdk" Group="ARCADE" Version="$(ArcadeBootstrapVersion)" Location="$(ArcadeBootstrapDir)microsoft.dotnet.arcade.sdk/$(ArcadeBootstrapVersion)" />
<ArcadePackagingOverride Include="Microsoft.DotNet.Build.Tasks.Packaging" Group="ARCADE_PACKAGING" Version="$(arcadeOutputPackageVersion)"/>
<ArcadeTargetFrameworkSdkOverride Include="Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk" Group="ARCADE_TGT_FX_SDK" Version="$(arcadeOutputPackageVersion)"/>
<ILSdkOverride Include="Microsoft.NET.Sdk.IL" Group="IL" />
<MsBuildTraversalSdkOverride Include="Microsoft.Build.Traversal" Group="MSBUILD_TRAVERSAL" Version="2.0.2"/>
</ItemGroup>
</Project>

View file

@ -0,0 +1,756 @@
<Project InitialTargets="SetNuGetPackagesEnvironment">
<ItemGroup Condition="'$(OfflineBuild)' == 'true'">
<EnvironmentVariables Include="LatestCommit=$(GitCommitHash)" />
<EnvironmentVariables Include="OfficialBuildId=$(OfficialBuildId)" />
</ItemGroup>
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="AddSourceToNuGetConfig" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="GetSourceBuiltNupkgCacheConflicts" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReadNuGetPackageInfos" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="RemoveInternetSourcesFromNuGetConfig" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceFeedsInNuGetConfig" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="UpdateJson" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ValidateUsageAgainstBaseline" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteBuildOutputProps" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WritePackageUsageData" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteRestoreSourceProps" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteRestoreSourceAndVersionProps" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteUsageReports" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteVersionsFile" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ZipFileExtractToDirectory" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceTextInFile" />
<!--
Central property to define that a repo doesn't implement any of the Repo API. If a repo adds an
implementation of a specific part of the Repo API, replace RepoApiImplemented in the repo's
props file with the properties below. When more API surface area is added, remove the
corresponding lines from the repo's props file. Once the entire API is implemented, the props
file is clean.
-->
<PropertyGroup>
<RepoApiImplemented Condition="'$(RepoApiImplemented)' == ''">true</RepoApiImplemented>
<EngCommonToolsShFile Condition="Exists('$(ProjectDirectory)/eng/common/tools.sh')">$(ProjectDirectory)/eng/common/tools.sh</EngCommonToolsShFile>
<EngCommonBuildShFile Condition="Exists('$(ProjectDirectory)/eng/common/build.sh')">$(ProjectDirectory)/eng/common/build.sh</EngCommonBuildShFile>
</PropertyGroup>
<PropertyGroup>
<DependencyVersionInputRepoApiImplemented Condition="'$(DependencyVersionInputRepoApiImplemented)' == ''">$(RepoApiImplemented)</DependencyVersionInputRepoApiImplemented>
<SourceOverrideRepoApiImplemented Condition="'$(SourceOverrideRepoApiImplemented)' == ''">$(RepoApiImplemented)</SourceOverrideRepoApiImplemented>
<OutputPlacementRepoApiImplemented Condition="'$(OutputPlacementRepoApiImplemented)' == ''">$(RepoApiImplemented)</OutputPlacementRepoApiImplemented>
</PropertyGroup>
<PropertyGroup Condition="'$(SourceOverrideRepoApiImplemented)' != 'true'">
<NuGetConfigFile Condition="'$(NuGetConfigFile)' == '' and Exists('$(ProjectDirectory)NuGet.config')">$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<NuGetConfigFile Condition="'$(NuGetConfigFile)' == '' and Exists('$(ProjectDirectory)NuGet.Config')">$(ProjectDirectory)NuGet.Config</NuGetConfigFile>
<NuGetConfigFile Condition="'$(NuGetConfigFile)' == '' and Exists('$(ProjectDirectory)src\NuGet.config')">$(ProjectDirectory)src\NuGet.config</NuGetConfigFile>
<NuGetConfigFile Condition="'$(NuGetConfigFile)' == '' and Exists('$(ProjectDirectory)src\NuGet.Config')">$(ProjectDirectory)src\NuGet.Config</NuGetConfigFile>
</PropertyGroup>
<!-- Dependency version input arguments -->
<PropertyGroup Condition="'$(DependencyVersionInputRepoApiImplemented)' == 'true'">
<RepoApiArgs>$(RepoApiArgs) /p:DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)</RepoApiArgs>
</PropertyGroup>
<!-- Source override arguments -->
<PropertyGroup Condition="'$(SourceOverrideRepoApiImplemented)' == 'true'">
<RepoApiArgs>$(RepoApiArgs) /p:DotNetRestoreSourcePropsPath=$(RestoreSourcePropsPath)</RepoApiArgs>
<RepoApiArgs Condition="'$(OfflineBuild)' == 'true'">$(RepoApiArgs) /p:DotNetBuildOffline=true</RepoApiArgs>
</PropertyGroup>
<!-- Output placement arguments -->
<PropertyGroup Condition="'$(OutputPlacementRepoApiImplemented)' == 'true'">
<RepoApiArgs>$(RepoApiArgs) /p:DotNetOutputBlobFeedDir=$(SourceBuiltBlobFeedDir)</RepoApiArgs>
</PropertyGroup>
<Target Name="BuildRepoReferences" Condition="'@(RepositoryReference)' != '' and '$(SkipRepoReferences)' != 'true'">
<Message Importance="High" Text="Building dependencies [@(RepositoryReference)] needed by '$(RepositoryName)'." />
<ItemGroup>
<_DependentProject Include="@(RepositoryReference -> '%(Identity).proj')" />
</ItemGroup>
<MSBuild Projects="@(_DependentProject)" Targets="Build" BuildInParallel="$(BuildInParallel)" StopOnFirstFailure="true" />
</Target>
<ItemGroup Condition="Exists('$(PatchesDir)$(RepositoryName)')" >
<PatchesToApply Include="$(PatchesDir)$(RepositoryName)/*.patch" />
</ItemGroup>
<Target Name="ApplyPatches"
Condition="'@(PatchesToApply)' != '' and '$(SkipPatches)' != 'true'"
Inputs="@(PatchesToApply)"
Outputs="$(RepoCompletedSemaphorePath)ApplyPatches.complete" >
<PropertyGroup>
<PatchCommand>git --work-tree=$(ProjectDirectory) apply --ignore-whitespace --whitespace=nowarn</PatchCommand>
</PropertyGroup>
<Exec Command="$(PatchCommand) %(PatchesToApply.Identity)"
WorkingDirectory="$(ProjectDirectory)"
Condition="'@(PatchesToApply)' != ''" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)ApplyPatches.complete" Overwrite="true" />
</Target>
<!--
Update root repo with trailing slash until https://github.com/dotnet/arcade/pull/7498 gets figured out
in arcade an propegated to all repos
-->
<Target Name="UpdateBuildRepoRoot"
BeforeTargets="Build"
Condition="'$(EngCommonBuildShFile)' != ''"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)UpdateBuildRepoRoot.complete" >
<ReplaceTextInFile InputFile="$(EngCommonBuildShFile)"
OldText="/p:RepoRoot=&quot;$repo_root&quot;"
NewText="/p:RepoRoot=&quot;$repo_root/&quot;" />
</Target>
<Target Name="UpdateBuildToolFramework"
BeforeTargets="Build"
Condition="'$(EngCommonToolsShFile)' != ''"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)UpdateBuildToolFramework.complete" >
<!-- Use a relative find in NewText to avoid regex matches with parent directories.
See https://github.com/dotnet/source-build/issues/1914 for details. -->
<PropertyGroup>
<ArcadeSdkReplacementText>
logger_path=&quot;%24toolset_dir&quot;/%24%28cd &quot;$toolset_dir&quot; &amp;&amp; find . -name Microsoft.DotNet.Arcade.Sdk.dll \( -regex &apos;.*netcoreapp2.1.*&apos; -or -regex &apos;.*net5.0.*&apos; \) )
</ArcadeSdkReplacementText>
<ArcadeLoggingReplacementText>
logger_path=&quot;%24toolset_dir&quot;/%24%28cd &quot;$toolset_dir&quot; &amp;&amp; find . -name Microsoft.DotNet.ArcadeLogging.dll \( -regex &apos;.*netcoreapp2.1.*&apos; -or -regex &apos;.*net5.0.*&apos; \) )
</ArcadeLoggingReplacementText>
<LoggerPathReplacementText>
$(ArcadeLoggingReplacementText)
if [[ ! -f $logger_path ]]; then
$(ArcadeSdkReplacementText)
fi
</LoggerPathReplacementText>
</PropertyGroup>
<!-- Arcade has added a new ArcadeLogging library (see: https://github.com/dotnet/arcade/pull/6739)
This adds additional scenarios when modifying tools.sh to search for the logger_path. Source-build
builds arcade after the change, so the logger is no longer found in Microsoft.DotNet.Arcade.Sdk,
rather, it has moved to Microsoft.DotNet.ArcadeLogging.
The scenarios are:
1. Repo has old tools.sh - replace with new search for logger_path from updated tools.sh which looks for ArcadeLogging first,
but make the source-build search changes to find the right dll. -->
<ReplaceTextInFile InputFile="$(EngCommonToolsShFile)"
OldText="local logger_path=&quot;$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll&quot;"
NewText="$(LoggerPathReplacementText)" />
<!-- 2. Repo has updated tools.sh, replace 2 logger_path statements with source-build search equivalents to find the right dll -->
<ReplaceTextInFile InputFile="$(EngCommonToolsShFile)"
OldText="local logger_path=&quot;$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.ArcadeLogging.dll&quot;"
NewText="$(ArcadeLoggingReplacementText)" />
<ReplaceTextInFile InputFile="$(EngCommonToolsShFile)"
OldText="logger_path=&quot;$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll&quot;"
NewText="$(ArcadeSdkReplacementText)" />
<!-- 3. Repo has 3rd generation of tools.sh. In this case, we set an override for _InitializeBuildToolFramework -->
<ReplaceTextInFile InputFile="$(EngCommonToolsShFile)"
OldText="_InitializeBuildToolFramework=&quot;netcoreapp3.1&quot;"
NewText="_InitializeBuildToolFramework=&quot;%24{_OverrideArcadeInitializeBuildToolFramework-netcoreapp3.1}&quot;" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)UpdateBuildToolFramework.complete" Overwrite="true" />
</Target>
<Target Name="UpdateNuGetConfig"
BeforeTargets="Build"
Condition="'$(NuGetConfigFile)' != '' OR '@(NuGetConfigFiles)' != ''"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)UpdateNuGetConfig.complete">
<!-- Update the detected or manually specified NuGetConfigFile, but also allow multiple. -->
<ItemGroup>
<NuGetConfigFiles Include="$(NuGetConfigFile)" />
</ItemGroup>
<!-- TODO: Don't remove these sources now. Need a switch for building to check prebuilts.
Currently, tarball build allows online restore sources.
See https://github.com/dotnet/source-build/issues/2255 -->
<!-- RemoveInternetSourcesFromNuGetConfig
NuGetConfigFile="%(NuGetConfigFiles.Identity)"
OfflineBuild="$(OfflineBuild)"
KeepFeedPrefixes="@(KeepFeedPrefixes)" /-->
<AddSourceToNuGetConfig NuGetConfigFile="%(NuGetConfigFiles.Identity)"
SourceName="prebuilt"
SourcePath="$(PrebuiltPackagesPath)"
Condition="'$(OfflineBuild)' == 'true'" />
<AddSourceToNuGetConfig NuGetConfigFile="%(NuGetConfigFiles.Identity)"
SourceName="previously-source-built"
SourcePath="$(PrebuiltSourceBuiltPackagesPath)"
Condition="'$(OfflineBuild)' == 'true'" />
<AddSourceToNuGetConfig NuGetConfigFile="%(NuGetConfigFiles.Identity)"
SourceName="reference-packages"
SourcePath="$(ReferencePackagesDir)"
Condition="'$(OfflineBuild)' == 'true'" />
<AddSourceToNuGetConfig NuGetConfigFile="%(NuGetConfigFiles.Identity)"
SourceName="source-built"
SourcePath="$(SourceBuiltPackagesPath)" />
<AddSourceToNuGetConfig NuGetConfigFile="%(NuGetConfigFiles.Identity)"
SourceName="ExtraSources"
SourcePath="$(ExtraRestoreSourcePath)"
Condition="'$(ExtraRestoreSourcePath)' != ''" />
<!--
The internal transport feed is dynamically added by Arcade by a script called directly in the
official pipeline, so in some cases we need to do the same here.
-->
<AddSourceToNuGetConfig
Condition="
'$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)' != '' and
'$(SetUpInternalTransportFeed)' == 'true'"
NuGetConfigFile="%(NuGetConfigFiles.Identity)"
SourceName="dotnet5-internal-transport"
SourcePath="https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v3/index.json" />
<!-- Update NuGet.Config files that have deprecated myget feeds -->
<ItemGroup>
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/nuget-build/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://www.myget.org/F/nugetbuild/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/nuget-build/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"
NewFeed="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/vstest/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/mstestv2/auth/1e768268-8c95-4e7e-9fd2-0eb1b1b69b18/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/roslyn/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/roslyn-master-nightly/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/symreader-converter/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/interactive-window/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/mstestv2/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/vsunittesting/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/msbuild/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
<LegacyFeedMapping
Include="https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json"
NewFeed="https://pkgs.dev.azure.com/dnceng/public/_packaging/myget-legacy/nuget/v3/index.json" />
</ItemGroup>
<ReplaceFeedsInNugetConfig InputFile="%(NuGetConfigFiles.Identity)"
FeedMapping="@(LegacyFeedMapping)" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)UpdateNuGetConfig.complete" Overwrite="true" />
</Target>
<Target Name="UpdateGlobalJsonVersions"
BeforeTargets="Build"
Condition="'$(GlobalJsonFile)' != ''"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)UpdateGlobalJsonVersions.complete">
<ItemGroup>
<_PossibleCliVersionJsonPath Include="sdk.version" />
<_PossibleCliVersionJsonPath Include="tools.dotnet" />
</ItemGroup>
<UpdateJson JsonFilePath="$(GlobalJsonFile)"
PathToAttribute="%(_PossibleCliVersionJsonPath.Identity)"
NewAttributeValue="$(SDK_VERSION)"
SkipUpdateIfMissingKey="true" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)UpdateGlobalJsonVersions.complete" Overwrite="true" />
</Target>
<Target Name="CreateBuildOutputProps"
BeforeTargets="Build"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)CreateBuildOutputProps.complete">
<PropertyGroup>
<_PackageVersionPropsBackupPath>$(PackageVersionPropsPath).pre.$(RepositoryName).xml</_PackageVersionPropsBackupPath>
</PropertyGroup>
<ItemGroup>
<PreviouslySourceBuiltPackages Include="$(SourceBuiltPackagesPath)*.nupkg"
Exclude="$(SourceBuiltPackagesPath)*.symbols.nupkg" />
<_AdditionalAssetDirs Include="$(SourceBuiltToolsetDir)" Condition="Exists('$(SourceBuiltToolsetDir)')" />
</ItemGroup>
<WriteBuildOutputProps NuGetPackages="@(PreviouslySourceBuiltPackages)"
ExtraProperties="@(ExtraPackageVersionPropsPackageInfo)"
AdditionalAssetDirs="@(_AdditionalAssetDirs)"
OutputPath="$(GennedPackageVersionPropsPath)" />
<WriteBuildOutputProps NuGetPackages="@(PreviouslySourceBuiltPackages)"
IncludeCreationTimeProperty="true"
OutputPath="$(_PackageVersionPropsBackupPath)" />
<Message Importance="High" Text="$(RepositoryName) using package version properties saved at $(_PackageVersionPropsBackupPath) " />
<ReadNuGetPackageInfos PackagePaths="@(PreviouslySourceBuiltPackages)">
<Output TaskParameter="PackageInfoItems" ItemName="_PreviouslySourceBuiltPackageInfos" />
</ReadNuGetPackageInfos>
<ItemGroup>
<_KnownOriginPackagePaths Include="$(PrebuiltSourceBuiltPackagesPath)*.nupkg" />
<_KnownOriginPackagePaths Include="$(PrebuiltPackagesPath)*.nupkg" />
<_KnownOriginPackagePaths Include="$(ReferencePackagesDir)*.nupkg" />
</ItemGroup>
<GetSourceBuiltNupkgCacheConflicts SourceBuiltPackageInfos="@(_PreviouslySourceBuiltPackageInfos)"
PackageCacheDir="$(PackagesDir)"
KnownOriginPackagePaths="@(_KnownOriginPackagePaths)">
<Output TaskParameter="ConflictingPackageInfos" ItemName="ConflictingPackageInfos" />
</GetSourceBuiltNupkgCacheConflicts>
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)CreateBuildOutputProps.complete" Overwrite="true" />
</Target>
<Target Name="CheckSourceBuiltNupkgConflictUsages"
DependsOnTargets="GetAllProjectDirectories"
AfterTargets="CreateBuildOutputProps"
Condition="'@(ConflictingPackageInfos)' != ''"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)CheckSourceBuiltNupkgConflictUsages.complete">
<PropertyGroup>
<_ReportDir>$(ConflictingPackageReportDir)before-$(RepositoryName)/</_ReportDir>
<_ReportDataFile>$(_ReportDir)usage.xml</_ReportDataFile>
<_ProjectAssetsJsonArchiveFile>$(_ReportDir)all-project-assets-json-files.zip</_ProjectAssetsJsonArchiveFile>
</PropertyGroup>
<WritePackageUsageData NuGetPackageInfos="@(ConflictingPackageInfos)"
RootDir="$(ProjectDir)"
DataFile="$(_ReportDataFile)"
ProjectAssetsJsonArchiveFile="$(_ProjectAssetsJsonArchiveFile)" />
<WriteUsageReports DataFile="$(_ReportDataFile)"
OutputDirectory="$(_ReportDir)" />
<Warning Text="Detected packages in the cache that should be source-built, but contents don't match. See $(_ReportDir) for usage details:" />
<Warning Text="%(ConflictingPackageInfos.PackageId)/%(ConflictingPackageInfos.PackageVersion) : %(ConflictingPackageInfos.WarningMessage)" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)CheckSourceBuiltNupkgConflictUsages.complete" Overwrite="true" />
</Target>
<Target Name="CreateCombinedRestoreSourceAndVersionProps"
BeforeTargets="Build"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)CreateCombinedRestoreSourceAndVersionProps.complete">
<ItemGroup>
<_DotNetRestoreSources Include="$(ExtraRestoreSourcePath)" Condition="'$(ExtraRestoreSourcePath)' != ''"/>
<_DotNetRestoreSources Include="$(SourceBuiltPackagesPath)" />
<_DotNetRestoreSources Include="$(ReferencePackagesDir)" Condition="'$(OfflineBuild)' == 'true'"/>
<_DotNetRestoreSources Include="$(PrebuiltPackagesPath)" Condition="'$(OfflineBuild)' == 'true'"/>
<_DotNetRestoreSources Include="$(PrebuiltSourceBuiltPackagesPath)" Condition="'$(OfflineBuild)' == 'true'"/>
<PreviouslySourceBuiltPackages Include="$(SourceBuiltPackagesPath)*.nupkg"
Exclude="$(SourceBuiltPackagesPath)*.symbols.nupkg" />
<_AdditionalAssetDirs Include="$(SourceBuiltToolsetDir)" Condition="Exists('$(SourceBuiltToolsetDir)')" />
</ItemGroup>
<WriteRestoreSourceAndVersionProps NuGetPackages="@(PreviouslySourceBuiltPackages)"
ExtraProperties="@(ExtraPackageVersionPropsPackageInfo)"
AdditionalAssetDirs="@(_AdditionalAssetDirs)"
RestoreSources="@(_DotNetRestoreSources)"
OutputPath="$(RestoreSourcePropsPath)" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)CreateCombinedRestoreSourceAndVersionProps.complete" Overwrite="true" />
</Target>
<!--
Generate blank directory build files above the repos, so they won't
automatically find the source-build directory build files ("escaping" their
directories and causing differences vs. ordinary build).
-->
<Target Name="PreventDirectoryBuildPropsTargetsEscape"
BeforeTargets="Build"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)PreventDirectoryBuildPropsTargetsEscape.complete">
<ItemGroup>
<DirectoryBuildFilename Include="Directory.Build.targets" />
<DirectoryBuildFilename Include="Directory.Build.props" />
</ItemGroup>
<WriteLinesToFile
Lines="&lt;Project /&gt;"
File="$([MSBuild]::NormalizePath('$(ClonedSubmoduleDirectory)', '%(DirectoryBuildFilename.Identity)'))"
Overwrite="True" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)PreventDirectoryBuildPropsTargetsEscape.complete" Overwrite="true" />
</Target>
<Target Name="Build"
DependsOnTargets="BuildRepoReferences"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)Build.complete">
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Building $(ProjectBuildReason)" />
<Message Importance="High" Text="Running command:" />
<Message Importance="High" Text=" $(BuildCommand) $(RepoApiArgs)" Condition="'$(BuildCommand)' != ''" />
<Message Importance="High" Text=" Using custom build target" Condition="'$(BuildCommand)' == ''" />
<Message Importance="High" Text=" Log: $(RepoConsoleLogFile)" />
<Message Importance="High" Text=" With Environment Variables:" />
<Message Importance="High" Text=" %(EnvironmentVariables.Identity)" />
<CallTarget Targets="RepoBuild" />
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Building $(ProjectBuildReason)...done" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)Build.complete" Overwrite="true" />
<OnError ExecuteTargets="ReportRepoError" />
</Target>
<Target Name="RepoBuild">
<ItemGroup>
<EnvironmentVariables Condition="'$(NUGET_PACKAGES)'!=''" Include="NUGET_PACKAGES=$(NUGET_PACKAGES)" />
</ItemGroup>
<PropertyGroup>
<FullCommand Condition="'$(LogVerbosityOptOut)' != 'true'">$(BuildCommand) /v:$(LogVerbosity) $(RepoApiArgs) $(RedirectRepoOutputToLog)</FullCommand>
<FullCommand Condition="'$(LogVerbosityOptOut)' == 'true'">$(BuildCommand) $(RepoApiArgs) $(RedirectRepoOutputToLog)</FullCommand>
</PropertyGroup>
<Exec Command="$(FullCommand)"
WorkingDirectory="$(ProjectDirectory)"
EnvironmentVariables="@(EnvironmentVariables)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
<Target Name="ReportRepoError">
<Message Importance="High" Text="$([System.IO.File]::ReadAllText('$(RepoConsoleLogFile)'))" Condition="Exists('$(RepoConsoleLogFile)')" />
<Message Importance="High" Text="'$(RepositoryName)' failed during build." />
<Message Importance="High" Text="See '$(RepoConsoleLogFile)' for more information." Condition="Exists('$(RepoConsoleLogFile)')" />
</Target>
<Target Name="Package" AfterTargets="Build"
Condition="'$(BuildPackagesCommand)' != ''"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)Package.complete">
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Packaging $(ProjectBuildReason)" />
<Message Importance="High" Text="Running command:" />
<Message Importance="High" Text=" $(BuildPackagesCommand)" />
<Message Importance="High" Text=" Log: $(RepoConsoleLogFile)" />
<Message Importance="High" Text=" With Environment Variables:" />
<Message Importance="High" Text=" %(EnvironmentVariables.Identity)" />
<Exec Command="$(BuildPackagesCommand) /v:$(LogVerbosity) $(RedirectRepoOutputToLog)"
WorkingDirectory="$(ProjectDirectory)"
EnvironmentVariables="@(EnvironmentVariables)"
IgnoreStandardErrorWarningFormat="true" />
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Packaging $(ProjectBuildReason)...done" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)Package.complete" Overwrite="true" />
<OnError ExecuteTargets="ReportRepoError" />
</Target>
<Target Name="GatherBuiltPackages">
<ItemGroup>
<!-- Filter out packages for WriteVersions -->
<_BuiltPackages Condition="'$(PackagesOutput)' != ''" Include="$(PackagesOutput)/*.nupkg" Exclude="$(PackagesOutput)/*.symbols.nupkg"/>
<_BuiltPackages Condition="'@(PackagesOutputList)' != ''" Include="%(PackagesOutputList.Identity)/*.nupkg" Exclude="%(PackagesOutputList.Identity)/*.symbols.nupkg"/>
</ItemGroup>
</Target>
<Target Name="ExtractIntermediatePackages"
AfterTargets="Package">
<ItemGroup>
<_BuiltIntermediatePackages Condition="'$(PackagesOutput)' != ''" Include="$(PackagesOutput)/Microsoft.SourceBuild.Intermediate.*.nupkg" Exclude="$(PackagesOutput)/*.symbols.nupkg"/>
<_BuiltIntermediatePackages Condition="'@(PackagesOutputList)' != ''" Include="%(PackagesOutputList.Identity)/Microsoft.SourceBuild.Intermediate.*.nupkg" Exclude="%(PackagesOutputList.Identity)/*.symbols.nupkg"/>
</ItemGroup>
<PropertyGroup Condition="'@(_BuiltIntermediatePackages)' != ''">
<_DestinationPath>$(SourceBuiltPackagesPath)</_DestinationPath>
<!-- SBRP packages unpack into the Reference packages directory instead of into blob-feed packages -->
<_DestinationPath Condition="$([System.String]::Copy(%(_BuiltIntermediatePackages.Identity)).Contains('source-build-reference-packages'))">$(ReferencePackagesDir)</_DestinationPath>
</PropertyGroup>
<ZipFileExtractToDirectory Condition="'@(_BuiltIntermediatePackages)' != ''"
SourceArchive="%(_BuiltIntermediatePackages.Identity)"
DestinationDirectory="$(SourceBuiltPackagesPath)extractArtifacts/"
OverwriteDestination="true" />
<ItemGroup>
<SourceBuiltNupkgFiles Include="$(SourceBuiltPackagesPath)extractArtifacts/**/*.nupkg" />
</ItemGroup>
<Copy
Condition="'@(SourceBuiltNupkgFiles)' != ''"
SourceFiles="@(SourceBuiltNupkgFiles)"
DestinationFiles="@(SourceBuiltNupkgFiles -> '$(_DestinationPath)%(Filename)%(Extension)')" />
<RemoveDir
Condition="Exists('$(SourceBuiltPackagesPath)extractArtifacts/')"
Directories="$(SourceBuiltPackagesPath)extractArtifacts/" />
</Target>
<Target Name="CopyPackage"
AfterTargets="Package"
Condition="'$(OutputPlacementRepoApiImplemented)' != 'true' AND ('$(PackagesOutput)' != '' OR '@(PackagesOutputList)' != '')"
DependsOnTargets="GatherBuiltPackages"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)CopyPackage.complete">
<Copy SourceFiles="@(_BuiltPackages)"
DestinationFolder="$(SourceBuiltPackagesPath)"
Condition="'@(_BuiltPackages)'!=''" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)CopyPackage.complete" Overwrite="true" />
</Target>
<Target Name="RemoveBuiltPackagesFromCache"
AfterTargets="Package"
Condition="'@(_BuiltPackages)'!=''"
DependsOnTargets="GatherBuiltPackages"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)RemoveBuiltPackagesFromCache.complete">
<ItemGroup>
<!-- Excluding Arcade here will keep it in the cache, because that's where we're running from.
Subsequent projects will get Arcade from Tools/source-built. -->
<PackagePaths Include="@(_BuiltPackages)" Exclude="$(PackagesOutput)/Microsoft.DotNet.Arcade.Sdk.*.nupkg" />
</ItemGroup>
<ReadNuGetPackageInfos PackagePaths="@(PackagePaths)">
<Output TaskParameter="PackageInfoItems" ItemName="_BuiltPackageInfos" />
</ReadNuGetPackageInfos>
<!-- Copy built nupkgs from nuget packages cache directory to the previouslyRestored directory
and then delete all expanded files and the nupkg from the package cache so the next time
the package is used, it will reload the source-built version -->
<ItemGroup>
<_FilesToCopy Include="$(PackagesDir)$([System.String]::copy('%(_BuiltPackageInfos.PackageId)').ToLower())/%(_BuiltPackageInfos.PackageVersion)/**/*.nupkg" />
<_FilesToDelete Include="$(PackagesDir)$([System.String]::copy('%(_BuiltPackageInfos.PackageId)').ToLower())/%(_BuiltPackageInfos.PackageVersion)/**/*.*" />
</ItemGroup>
<Copy SourceFiles="@(_FilesToCopy)" DestinationFolder="$(PreviouslyRestoredPackagesPath)$(RepositoryName)/" />
<Delete Files="@(_FilesToDelete)" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)RemoveBuiltPackagesFromCache.complete" Overwrite="true" />
</Target>
<Target Name="ExtractToolPackage"
DependsOnTargets="GatherBuiltPackages"
AfterTargets="Build"
Condition="'@(BuiltSdkPackageOverride)' != ''"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)ExtractToolPackage.complete">
<ItemGroup>
<_ToolPackage
Condition="'%(BuiltSdkPackageOverride.Version)' == ''"
Include="$(SourceBuiltPackagesPath)%(BuiltSdkPackageOverride.Identity)*.nupkg"
Exclude="$(SourceBuiltPackagesPath)%(BuiltSdkPackageOverride.Identity)*.symbols.nupkg"
Id="%(BuiltSdkPackageOverride.Identity)" />
<_ToolPackage
Condition="'%(BuiltSdkPackageOverride.Version)' != ''"
Include="$(SourceBuiltPackagesPath)%(BuiltSdkPackageOverride.Identity).%(BuiltSdkPackageOverride.Version).nupkg"
Exclude="$(SourceBuiltPackagesPath)%(BuiltSdkPackageOverride.Identity).%(BuiltSdkPackageOverride.Version).symbols.nupkg"
Id="%(BuiltSdkPackageOverride.Identity)" />
</ItemGroup>
<ZipFileExtractToDirectory SourceArchive="%(_ToolPackage.Identity)"
DestinationDirectory="$(ToolPackageExtractDir)%(_ToolPackage.Id)\"
OverwriteDestination="true" />
<ItemGroup>
<ExtractedToolFiles Include="$(ToolPackageExtractDir)%(_ToolPackage.Id)/**/*netcore*/*.dll" />
</ItemGroup>
<Copy SourceFiles="@(ExtractedToolFiles)" DestinationFolder="$(ToolPackageExtractDir)/" />
<!-- TODO: When unpacking using ZipFileExtractToDirectory, this executable file has the wrong
permissions. See https://github.com/dotnet/source-build/issues/2259 -->
<Exec Command="chmod 755 git-clone-to-dir.sh"
Condition=" '%(_ToolPackage.Id)' == 'Microsoft.DotNet.Arcade.Sdk' "
WorkingDirectory="$(ToolPackageExtractDir)%(_ToolPackage.Id)/tools/SourceBuild/" />
<ReplaceTextInFile
Condition=" '%(_ToolPackage.Id)' == 'Microsoft.DotNet.Arcade.Sdk' "
InputFile="$(ToolPackageExtractDir)%(_ToolPackage.Id)/tools/SourceBuild/SourceBuildArcadeTools.targets"
OldText="%3CReadSourceBuildIntermediateNupkgDependencies"
NewText="%3CReadSourceBuildIntermediateNupkgDependencies Condition=&quot;'%24%28DotNetBuildOffline%29' != 'true'&quot;" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)ExtractToolPackage.complete" Overwrite="true" />
</Target>
<Target Name="EnsurePackagesCreated"
AfterTargets="CopyPackage"
Condition="'$(SkipEnsurePackagesCreated)' != 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)EnsurePackagesCreated.complete">
<ItemGroup>
<JustSourceBuiltPackages
Include="$(SourceBuiltPackagesPath)*.nupkg"
Exclude="
$(SourceBuiltPackagesPath)*.symbols.nupkg;
@(PreviouslySourceBuiltPackages)" />
</ItemGroup>
<ItemGroup>
<_PackagesNotCreatedReason Include="^ There may have been a silent failure in the submodule build. To confirm, check the build log file for undetected errors that may have prevented package creation: $(RepoConsoleLogFile)" />
<_PackagesNotCreatedReason Include="^ This error might be a false positive if $(RepositoryName) intentionally builds no nuget packages. If so, set the SkipEnsurePackagesCreated property to true in $(MSBuildProjectFullPath)" />
<_PackagesNotCreatedReason Include="^ The 'bin' directory might be dirty from a previous build and the package files already existed. If so, perform a clean build, or check which packages were already in 'bin' by opening $(_PackageVersionPropsBackupPath)" />
<_PackagesNotCreatedReason Include="^ The packages may have been written to an unexpected directory. For example, some repos used bin/ and changed to artifacts/ to match Arcade. Check PackagesOutput in $(MSBuildProjectFullPath) (currently '$(PackagesOutput)')" />
</ItemGroup>
<Error Condition="'@(JustSourceBuiltPackages)' == ''"
Text="$(RepositoryName) produced no new source-built package identities. Known possible causes:%0A@(_PackagesNotCreatedReason, '%0A')" />
<ReadNuGetPackageInfos PackagePaths="@(JustSourceBuiltPackages)">
<Output TaskParameter="PackageInfoItems" ItemName="_JustSourceBuiltPackageInfos" />
</ReadNuGetPackageInfos>
<Message Importance="High" Text="New NuGet package(s) after building $(RepositoryName):" />
<Message Importance="High" Text=" -> %(_JustSourceBuiltPackageInfos.PackageId) %(_JustSourceBuiltPackageInfos.PackageVersion)" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)EnsurePackagesCreated.complete" Overwrite="true" />
</Target>
<Target Name="Clean" Condition="'$(CleanCommand)' != ''" >
<Exec Command="$(CleanCommand) /v:$(LogVerbosity) $(RedirectRepoOutputToLog)"
WorkingDirectory="$(ProjectDirectory)"
EnvironmentVariables="@(EnvironmentVariables)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
<Target Name="SetNuGetPackagesEnvironment" Condition="'$(ArchiveDownloadedPackages)' == 'true'">
<PropertyGroup>
<LocalNuGetPackagesRootForRepository>$(LocalNuGetPackagesRoot)$(RepositoryName)/</LocalNuGetPackagesRootForRepository>
</PropertyGroup>
<MakeDir Directories="$(LocalNuGetPackagesRootForRepository)" />
<ItemGroup>
<EnvironmentVariables Include="NUGET_PACKAGES=$(LocalNuGetPackagesRootForRepository)" />
</ItemGroup>
</Target>
<Target Name="SetSourceBuiltSdkOverrides"
BeforeTargets="Build"
Condition="'@(UseSourceBuiltSdkOverride)' != ''">
<ItemGroup>
<EnvironmentVariables Include="SOURCE_BUILT_SDK_ID_%(UseSourceBuiltSdkOverride.Group)=%(UseSourceBuiltSdkOverride.Identity)" />
<EnvironmentVariables Include="SOURCE_BUILT_SDK_VERSION_%(UseSourceBuiltSdkOverride.Group)=%(UseSourceBuiltSdkOverride.Version)" />
<EnvironmentVariables Condition="'%(UseSourceBuiltSdkOverride.Location)' != ''" Include="SOURCE_BUILT_SDK_DIR_%(UseSourceBuiltSdkOverride.Group)=%(UseSourceBuiltSdkOverride.Location)/" />
<EnvironmentVariables Condition="'%(UseSourceBuiltSdkOverride.Location)' == ''" Include="SOURCE_BUILT_SDK_DIR_%(UseSourceBuiltSdkOverride.Group)=$(ToolPackageExtractDir)%(UseSourceBuiltSdkOverride.Identity)/" />
</ItemGroup>
</Target>
<Target Name="WritePrebuiltUsageData"
DependsOnTargets="GetAllProjectDirectories"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)WritePrebuiltUsageData.complete">
<!-- Save the PVP snapshot of each build step to be evaluated while building the report. -->
<ItemGroup>
<PackageVersionPropsSnapshotFiles Include="$(IntermediatePath)PackageVersions.props.pre.*.xml" />
</ItemGroup>
<Copy SourceFiles="@(PackageVersionPropsSnapshotFiles)" DestinationFolder="$(PackageReportDir)snapshots/" />
<ItemGroup>
<AllRestoredPackageFiles Include="$(LocalNuGetPackagesRoot)**/*.nupkg" />
<AllRestoredPackageFiles Include="$(PackagesDir)**/*.nupkg" />
<!-- Only contains packages when building a tarball. -->
<TarballPrebuiltPackageFiles Include="$(PrebuiltPackagesPath)*.nupkg" />
<SourceBuiltPackageFiles Include="$(SourceBuiltBlobFeedDir)**/*.nupkg" />
<SourceBuiltPackageFiles Include="$(PrebuiltSourceBuiltPackagesPath)*.nupkg" />
<ReferencePackageFiles Condition="'$(OfflineBuild)' == 'true'" Include="$(ReferencePackagesDir)**/*.nupkg" />
<!-- Check all RIDs from all restored Microsoft.NETCore.Platforms packages. -->
<PlatformsRuntimeJsonFiles Include="$(LocalNuGetPackagesRoot)*/microsoft.netcore.platforms/*/runtime.json" />
<PlatformsRuntimeJsonFiles Include="$(PackagesDir)microsoft.netcore.platforms/*/runtime.json" />
<!-- Add some other potential top-level project directories for a more specific report. -->
<ProjectDirectories Include="$(ToolsDir);$(TaskDirectory);$(BaseIntermediatePath)" />
<!-- Finally, scan entire source-build, in case project.assets.json ends up in an unexpected place. -->
<ProjectDirectories Include="$(ProjectDir)" />
</ItemGroup>
<ItemGroup>
<!-- This file is a resource tracked by Git, not generated by restore. Ignore false positive. -->
<IgnoredProjectAssetsJsonFiles Include="$(ClonedSubmoduleDirectory)nuget.client*/test/NuGet.Core.Tests/NuGet.Build.Tasks.Pack.Test/compiler/resources/project.assets.json" Condition="'$(OfflineBuild)' != 'true'" />
<IgnoredProjectAssetsJsonFiles Include="$(SubmoduleDirectory)nuget.client*/test/NuGet.Core.Tests/NuGet.Build.Tasks.Pack.Test/compiler/resources/project.assets.json" Condition="'$(OfflineBuild)' == 'true'" />
</ItemGroup>
<WritePackageUsageData
RestoredPackageFiles="@(AllRestoredPackageFiles)"
TarballPrebuiltPackageFiles="@(TarballPrebuiltPackageFiles)"
SourceBuiltPackageFiles="@(SourceBuiltPackageFiles)"
ReferencePackageFiles="@(ReferencePackageFiles)"
PlatformsRuntimeJsonFiles="@(PlatformsRuntimeJsonFiles)"
TargetRid="$(TargetRid)"
ProjectDirectories="@(ProjectDirectories)"
RootDir="$(ProjectDir)"
IgnoredProjectAssetsJsonFiles="@(IgnoredProjectAssetsJsonFiles)"
DataFile="$(PackageReportDataFile)"
ProjectAssetsJsonArchiveFile="$(ProjectAssetsJsonArchiveFile)" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)WritePrebuiltUsageData.complete" Overwrite="true" />
</Target>
<Target Name="GetAllProjectDirectories">
<ItemGroup>
<AllRepoProjects Include="$(ProjectDir)repos\*.proj" />
</ItemGroup>
<Message Importance="High" Text="Finding project directories..." />
<MSBuild Projects="@(AllRepoProjects)"
Targets="GetProjectDirectory">
<Output TaskParameter="TargetOutputs" ItemName="ProjectDirectories" />
</MSBuild>
</Target>
<Target Name="ReportPrebuiltUsage"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)ReportPrebuiltUsage.complete">
<PropertyGroup>
<FailOnPrebuiltBaselineError Condition="'$(FailOnPrebuiltBaselineError)' == ''">false</FailOnPrebuiltBaselineError>
</PropertyGroup>
<ItemGroup>
<PackageVersionPropsSavedSnapshotFiles Include="$(PackageReportDir)snapshots/PackageVersions.props.pre.*.xml" />
</ItemGroup>
<WriteUsageReports DataFile="$(PackageReportDataFile)"
PackageVersionPropsSnapshots="@(PackageVersionPropsSavedSnapshotFiles)"
ProdConBuildManifestFile="$(ProdConManifestFile)"
PoisonedReportFile="$(PoisonedReportFile)"
OutputDirectory="$(PackageReportDir)" />
<PropertyGroup Condition="'$(ContinueOnPrebuiltBaselineError)' == ''">
<ContinueOnPrebuiltBaselineError>false</ContinueOnPrebuiltBaselineError>
<ContinueOnPrebuiltBaselineError Condition="'$(FailOnPrebuiltBaselineError)' != 'true'">true</ContinueOnPrebuiltBaselineError>
</PropertyGroup>
<ValidateUsageAgainstBaseline
DataFile="$(PackageReportDataFile)"
BaselineDataFile="$(BaselineDataFile)"
OutputBaselineFile="$(PackageReportDir)generated-new-baseline.xml"
OutputReportFile="$(PackageReportDir)baseline-comparison.xml"
AllowTestProjectUsage="$(AllowTestProjectUsage)"
ContinueOnError="$(ContinueOnPrebuiltBaselineError)" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)ReportPrebuiltUsage.complete" Overwrite="true" />
</Target>
<Target Name="GetProjectDirectory" Outputs="$(ProjectDirectory)" />
<Target Name="GetOfficialBuildId" Outputs="$(OfficialBuildId)" />
<Target Name="GetRepositoryReferences" Outputs="@(RepositoryReference)" />
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets, $(MSBuildThisFileDirectory)..))" />
</Project>

View file

@ -0,0 +1,44 @@
<Project>
<PropertyGroup>
<SourceDirectory>ApplicationInsights-dotnet</SourceDirectory>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<PackagesOutput>$(ProjectDirectory)/bin/$(Configuration)</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
</PropertyGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Target Name="RepoBuild">
<PropertyGroup>
<BuildCommandArgs>$(ProjectDirectory)/Microsoft.ApplicationInsights.csproj</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:Configuration=$(Configuration)</BuildCommandArgs>
<!-- Re-assign EnlistmentRoot property so output directories end up under src/application-insights -->
<BuildCommandArgs>$(BuildCommandArgs) /p:EnlistmentRoot=$(ProjectDirectory)/src</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:RelativeOutputPathBase=</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /v:$(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(RedirectRepoOutputToLog)</BuildCommandArgs>
</PropertyGroup>
<Exec Command="$(DotnetToolCommand) restore /bl:restore.binlog $(BuildCommandArgs) "
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="$(DotnetToolCommand) build /bl:build.binlog $(BuildCommandArgs)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="$(DotnetToolCommand) pack /bl:pack.binlog $(BuildCommandArgs)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
</Project>

View file

@ -0,0 +1,78 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<!-- 'restore' and 'build' switches automatically passed by build.sh/ps1. -->
<BuildCommandArgs />
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)pack</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)nodereuse $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<BuildCommandArgs>$(BuildCommandArgs) -v $(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -bl</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -ci</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)warnAsError $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:ArcadeBuildFromSource=true</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:CopyWipIntoInnerSourceBuildRepo=true</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)\build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<!-- NuGet SDK resolver only checks nuget.config files. https://github.com/Microsoft/msbuild/issues/2914 -->
<NuGetConfigFile>$(ProjectDirectory)/NuGet.config</NuGetConfigFile>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<DependencyVersionInputRepoApiImplemented>true</DependencyVersionInputRepoApiImplemented>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/NonShipping/</PackagesOutput>
<!-- we need to use a prebuilt Arcade to build Arcade -->
<UseBootstrapArcade>true</UseBootstrapArcade>
<IsToolingProject>true</IsToolingProject>
</PropertyGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeBootstrapSdkOverride)" />
<BuiltSdkPackageOverride Include="@(ArcadeSdkOverride)" />
<BuiltSdkPackageOverride Include="@(ArcadeCoreFxTestingOverride)" />
<BuiltSdkPackageOverride Include="@(ArcadePackagingOverride)" />
<BuiltSdkPackageOverride Include="@(ArcadeTargetFrameworkSdkOverride)" />
</ItemGroup>
<ItemGroup>
<EnvironmentVariables Include="UsingToolMicrosoftNetCompilers=false" />
<EnvironmentVariables Include="useInstalledDotNetCli=false" />
</ItemGroup>
<ItemGroup>
<RepositoryReference Include="sourcelink" />
</ItemGroup>
<!-- TODO: Temporarily skip this target for now until source-build NuGet packaging is built
and packaged into source-built artifacts for 6.0.
See https://github.com/dotnet/source-build/issues/2285 -->
<Target Name="UsePreviouslySourceBuiltNuGet"
Condition="'$(OfflineBuild)' == 'true' AND 'true' == 'false' "
BeforeTargets="RepoBuild">
<ItemGroup>
<PreviouslySourceBuiltNuGetPackageFile Include="$(PrebuiltSourceBuiltPackagesPath)NuGet.Packaging.*.nupkg" />
</ItemGroup>
<Error
Text="Unable to find any previously source built NuGet.Packaging version to use in Arcade SDK tooling."
Condition="'@(PreviouslySourceBuiltNuGetPackageFile)' == ''" />
<ReadNuGetPackageInfos PackagePaths="@(PreviouslySourceBuiltNuGetPackageFile)">
<Output TaskParameter="PackageInfoItems" ItemName="PreviouslySourceBuiltNuGetPackageInfo" />
</ReadNuGetPackageInfos>
<PropertyGroup>
<PreviouslySourceBuiltNuGetVersion>%(PreviouslySourceBuiltNuGetPackageInfo.PackageVersion)</PreviouslySourceBuiltNuGetVersion>
<BuildCommand>$(BuildCommand) /p:NuGetVersion=$(PreviouslySourceBuiltNuGetVersion)</BuildCommand>
</PropertyGroup>
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,33 @@
<Project>
<PropertyGroup>
<SourceDirectory>xdt</SourceDirectory>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<BuildCommandArgs/>
<BuildCommandArgs>$(BuildCommandArgs) --configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --binaryLog</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -ci</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)nodereuse $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<NuGetConfigFile>$(ProjectDirectory)/NuGet.config</NuGetConfigFile>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/NonShipping/</PackagesOutput>
</PropertyGroup>
<ItemGroup>
<RepositoryReference Include="arcade" />
</ItemGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,93 @@
<Project>
<PropertyGroup>
<SourceDirectory>aspnetcore</SourceDirectory>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-x64</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'OSX'">osx-x64</OverrideTargetRid>
<BuildCommandArgs>$(BuildCommandArgs) --restore --build --pack</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --ci</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -bl</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /v:$(LogVerbosity)</BuildCommandArgs>
<!-- The arch flag (defaults to x64) overrides any value of TargetArchitecture that we might set -->
<BuildCommandArgs>$(BuildCommandArgs) --arch $(Platform)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:BuildNodeJs=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:SourceBuildRuntimeIdentifier=$(OverrideTargetRid)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:UseAppHost=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltAspNetCoreRuntime)</BuildCommandArgs>
<!-- Update to 1.0.0 version of reference assemblies which are built in SBRP instead of the preview.2 version
included by Arcade -->
<BuildCommandArgs>$(BuildCommandArgs) /p:MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.0</BuildCommandArgs>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<BuildCommand>$(ProjectDirectory)build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<ShippingPackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/</ShippingPackagesOutput>
<NonShippingPackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/NonShipping/</NonShippingPackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<DependencyVersionInputRepoApiImplemented>true</DependencyVersionInputRepoApiImplemented>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<EnvironmentRestoreSources>$(SourceBuiltPackagesPath)</EnvironmentRestoreSources>
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' == 'true'">$(EnvironmentRestoreSources)%3B$(ReferencePackagesDir)%3B$(PrebuiltPackagesPath)</EnvironmentRestoreSources>
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public%40Local/nuget/v3/index.json</EnvironmentRestoreSources>
</PropertyGroup>
<ItemGroup>
<RepositoryReference Include="arcade" />
<RepositoryReference Include="cssparser" />
<RepositoryReference Include="runtime" />
<RepositoryReference Include="msbuild" />
<RepositoryReference Include="roslyn" />
<RepositoryReference Include="roslyn-analyzers" />
</ItemGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<ItemGroup>
<EnvironmentVariables Include="RestoreSources=$(EnvironmentRestoreSources)" />
<EnvironmentVariables Include="DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)" />
</ItemGroup>
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceRegexInFiles" />
<Target Name="FixAspNetCoreVersion"
AfterTargets="ApplyPatches">
<ItemGroup>
<MinifiedJavascriptFile Include="$(ProjectDirectory)**\blazor.server.js" />
</ItemGroup>
<!--
Patch the version embedded in minified js files. Because they are
minified files, git patch doesn't work too well and produces unreadable
binary patches.
-->
<ReplaceRegexInFiles
InputFiles="@(MinifiedJavascriptFile)"
OldTextRegex=",l=&quot;5\.0\.\d+&quot;}]\);"
NewText=",l=&quot;$(AspNetCoreProductVersion)&quot;}]);" />
</Target>
<Target Name="SetOutputList" AfterTargets="Package" BeforeTargets="GatherBuiltPackages">
<ItemGroup>
<PackagesOutputList Include="$(ShippingPackagesOutput)" />
<PackagesOutputList Include="$(NonShippingPackagesOutput)" />
</ItemGroup>
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,41 @@
<Project>
<PropertyGroup>
<SourceDirectory>CliCommandLineParser</SourceDirectory>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<!-- In Windows -restore is already passed by default by build.cmd to build.ps1 -->
<BuildCommandArgs>$(FlagParameterPrefix)pack $(FlagParameterPrefix)configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --projects $(ProjectDirectory)CommandLine.sln</BuildCommandArgs>
<BuildCommandArgs Condition="'$(OS)' != 'Windows_NT'">$(BuildCommandArgs) $(FlagParameterPrefix)restore</BuildCommandArgs>
<!-- CliCommandLineParser takes -v instead of /v -->
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<BuildCommandArgs>$(BuildCommandArgs) -v $(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -bl</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -ci</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<DependencyVersionInputRepoApiImplemented>false</DependencyVersionInputRepoApiImplemented>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/NonShipping/</PackagesOutput>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
<NuGetConfigFile>$(ProjectDirectory)/NuGet.config</NuGetConfigFile>
</PropertyGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<ItemGroup>
<RepositoryReference Include="arcade" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,30 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<BuildCommandArgs>--restore --build --pack</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --binaryLog</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -ci</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)nodereuse $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:Projects=$(ProjectDirectory)source-build.slnf</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/</PackagesOutput>
</PropertyGroup>
<ItemGroup>
<RepositoryReference Include="arcade" />
</ItemGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,24 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<RepositoryOrganization>aspnet</RepositoryOrganization>
<RepositoryBranch>servicing/1.0.x</RepositoryBranch>
<PackagesOutput>$(ProjectDirectory)artifacts/build/</PackagesOutput>
<BuildArguments>/p:Configuration=$(Configuration)</BuildArguments>
<BuildCommand>$(ProjectDirectory)/build$(ShellExtension) -NoTest $(BuildArguments)</BuildCommand>
<CleanCommand>$(ProjectDirectory)/clean$(ShellExtension) $(BuildArguments)</CleanCommand>
<RepoApiImplemented>false</RepoApiImplemented>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
</PropertyGroup>
<ItemGroup>
<EnvironmentVariables Include="DOTNET_TOOL_DIR=$(DotNetCliToolDir)" />
</ItemGroup>
<ItemGroup>
<RepositoryReference Include="newtonsoft-json" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,37 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<PackagesOutput>$(ProjectDirectory)/src/Microsoft.Css.Parser/bin/$(Configuration)/</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
</PropertyGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Target Name="RepoBuild">
<PropertyGroup>
<BuildCommandArgs>$(ProjectDirectory)/src/Microsoft.Css.Parser/Microsoft.Css.Parser.csproj</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:Configuration=$(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /v:$(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(RedirectRepoOutputToLog)</BuildCommandArgs>
</PropertyGroup>
<Exec Command="$(DotnetToolCommand) restore /bl:restore.binlog $(BuildCommandArgs) "
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="$(DotnetToolCommand) build /bl:build.binlog $(BuildCommandArgs)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="$(DotnetToolCommand) pack /bl:pack.binlog $(BuildCommandArgs)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
</Project>

View file

@ -0,0 +1,43 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<PackagesOutput>$(ProjectDirectory)/artifacts/packages/$(Configuration)/Shipping</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
</PropertyGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Target Name="RepoBuild">
<PropertyGroup>
<BuildCommandArgs>$(ProjectDirectory)/src/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:Configuration=$(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /v:$(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(RedirectRepoOutputToLog)</BuildCommandArgs>
</PropertyGroup>
<Exec Command="$(DotnetToolCommand) restore /bl:restore.binlog $(BuildCommandArgs) "
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="$(DotnetToolCommand) build /bl:build.binlog $(BuildCommandArgs)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="$(DotnetToolCommand) pack /bl:pack.binlog $(BuildCommandArgs)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
</Project>

View file

@ -0,0 +1,39 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<BuildCommandArgs>--restore --build --pack --publish</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --binaryLog</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --ci</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:FSharpSourceBuild=true</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DotNetBuildFromSource=true</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:TreatWarningsAsErrors=false</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/</PackagesOutput>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<NuGetConfigFile>$(ProjectDirectory)/NuGet.config</NuGetConfigFile>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
</PropertyGroup>
<ItemGroup>
<RepositoryReference Include="arcade" />
<RepositoryReference Include="msbuild" />
<RepositoryReference Include="newtonsoft-json901" />
<RepositoryReference Include="newtonsoft-json" />
<RepositoryReference Include="xliff-tasks" />
</ItemGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<ItemGroup>
<EnvironmentVariables Include="DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)" />
<EnvironmentVariables Include="DOTNET_TOOL_DIR=$(DotNetCliToolDir)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,48 @@
<Project>
<PropertyGroup>
<SourceDirectory>Humanizer</SourceDirectory>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<PackagesOutput>$(ProjectDirectory)/src/Humanizer/bin/$(Configuration)</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
<NuGetConfigFile>$(ProjectDirectory)/src/NuGet.config</NuGetConfigFile>
</PropertyGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<ItemGroup>
<!-- Humanizer needs SourceLink.Create.CommandLine which is not produced from sourcelink repo
<RepositoryReference Include="sourcelink" />
-->
</ItemGroup>
<Target Name="RepoBuild">
<PropertyGroup>
<BuildCommandArgs>$(ProjectDirectory)src/Humanizer/Humanizer.csproj</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:Configuration=$(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /v:$(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(RedirectRepoOutputToLog)</BuildCommandArgs>
</PropertyGroup>
<Exec Command="$(DotnetToolCommand) restore /bl:restore.binlog $(BuildCommandArgs) "
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="$(DotnetToolCommand) build /bl:build.binlog $(BuildCommandArgs)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="$(DotnetToolCommand) pack $(ProjectDirectory)src/Humanizer/Humanizer.csproj /p:NuspecFile=$(ProjectDirectory)NuSpecs/Humanizer.Core.nuspec /p:NuspecBasePath=$(ProjectDirectory)src/ /p:NuspecProperties=Version=$(HumanizerCorePackageVersion) /p:Configuration=$(Configuration)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
</Project>

View file

@ -0,0 +1,135 @@
<Project>
<PropertyGroup>
<SourceDirectory>installer</SourceDirectory>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'OSX'">osx-x64</OverrideTargetRid>
<OSNameOverride>$(OverrideTargetRid.Substring(0, $(OverrideTargetRid.IndexOf("-"))))</OSNameOverride>
<RuntimeArg>--runtime-id $(OverrideTargetRid)</RuntimeArg>
<RuntimeArg Condition="'$(TargetOS)' == 'Linux'">--runtime-id $(TargetRid)</RuntimeArg>
<BuildCommandArgs>--restore --build --pack --ci --binaryLog</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(RuntimeArg)</BuildCommandArgs>
<!--
Setting NETCoreAppMaximumVersion to a high version so that the sdk doesn't complain if we're restoring/publishing for a higher version than the sdk.
See https://github.com/dotnet/sdk/issues/1512#issuecomment-377082883
-->
<BuildCommandArgs>$(BuildCommandArgs) /p:NETCoreAppMaximumVersion=99.9</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:OSName=$(OSNameOverride)</BuildCommandArgs>
<BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:Rid=$(TargetRid)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DOTNET_INSTALL_DIR=$(DotNetCliToolDir)</BuildCommandArgs>
<BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:AspNetCoreSharedFxInstallerRid=linux-$(Platform)</BuildCommandArgs>
<!-- core-sdk always wants to build portable on OSX and FreeBSD -->
<BuildCommandArgs Condition="'$(TargetOS)' == 'FreeBSD'">$(BuildCommandArgs) /p:CoreSetupRid=freebsd-x64 /p:PortableBuild=true</BuildCommandArgs>
<BuildCommandArgs Condition="'$(TargetOS)' == 'OSX'">$(BuildCommandArgs) /p:CoreSetupRid=osx-x64</BuildCommandArgs>
<BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:CoreSetupRid=$(TargetRid)</BuildCommandArgs>
<!-- Consume the source-built Core-Setup. This line must be removed to source-build CLI without source-building Core-Setup first. -->
<BuildCommandArgs>$(BuildCommandArgs) /p:CoreSetupBlobRootUrl=file:%2F%2F$(LocalBlobStorageRoot)</BuildCommandArgs>
<!-- location to pick up the toolset binaries from. This must be removed to source-build core-sdk without building toolset first -->
<BuildCommandArgs>$(BuildCommandArgs) /p:DotnetToolsetBlobRootUrl=file:%2F%2F$(LocalBlobStorageRoot)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:SkipBuildingInstallers=true</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:IncludeNuGetPackageArchive=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:IncludeAdditionalSharedFrameworks=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:UsePortableLinuxSharedFramework=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:IncludeSharedFrameworksForBackwardsCompatibilityTests=false</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)/build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<PackageOutputRid Condition="'$(TargetOS)' == 'Windows_NT'">win-x64</PackageOutputRid>
<PackageOutputRid Condition="'$(TargetOS)' == 'OSX'">osx-x64</PackageOutputRid>
<PackageOutputRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-x64</PackageOutputRid>
<PackageOutputRid Condition="'$(PackageOutputRid)' == ''">$(TargetRid)</PackageOutputRid>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/</PackagesOutput>
<TarBallOutput>$(PackagesOutput)</TarBallOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<SourceOverrideRepoApiImplemented>true</SourceOverrideRepoApiImplemented>
<DependencyVersionInputRepoApiImplemented>true</DependencyVersionInputRepoApiImplemented>
<EnvironmentExternalRestoreSources>$(SourceBuiltPackagesPath)</EnvironmentExternalRestoreSources>
<EnvironmentExternalRestoreSources Condition="'$(OfflineBuild)' == 'true'">$(EnvironmentExternalRestoreSources)%3B$(ReferencePackagesDir)%3B$(PrebuiltPackagesPath)</EnvironmentExternalRestoreSources>
<!-- This project builds zips, not NuGet packages. -->
<SkipEnsurePackagesCreated>true</SkipEnsurePackagesCreated>
<NuGetConfigFile>$(ProjectDirectory)/NuGet.config</NuGetConfigFile>
<!-- This repo uses text-only template packages from the internal transport feed. -->
<SetUpInternalTransportFeed>true</SetUpInternalTransportFeed>
</PropertyGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<ItemGroup>
<RepositoryReference Include="application-insights" />
<RepositoryReference Include="arcade" />
<RepositoryReference Include="aspnetcore" />
<RepositoryReference Include="clicommandlineparser" />
<RepositoryReference Include="fsharp" />
<RepositoryReference Include="msbuild" />
<RepositoryReference Include="netcorecli-fsc" />
<RepositoryReference Include="newtonsoft-json" />
<RepositoryReference Include="newtonsoft-json901" />
<RepositoryReference Include="nuget-client" />
<RepositoryReference Include="roslyn" />
<RepositoryReference Include="runtime" />
<RepositoryReference Include="sdk" />
<RepositoryReference Include="templating" />
<RepositoryReference Include="test-templates" />
<RepositoryReference Include="vstest" />
<RepositoryReference Include="xliff-tasks" />
</ItemGroup>
<!--
If we have authentication, keep the templating internal feed (if one exists) to acquire the
text-only prebuilt. The source-build repo as a whole should depend on the same internal feed as
this repo does, so authentication should already be set up in the global endpoints json.
-->
<ItemGroup Condition="'$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)' != ''">
<KeepFeedPrefixes Include="darc-int-dotnet-aspnetcore-" />
</ItemGroup>
<ItemGroup>
<EnvironmentVariables Include="CLIBUILD_SKIP_TESTS=true" />
<!-- Pass multiple restore sources as environment: avoid the shell seeing ';' in an Exec. -->
<EnvironmentVariables Include="ExternalRestoreSources=$(EnvironmentExternalRestoreSources)" />
<!-- Disable bundled tools until we can figure out:
Unable to find package dotnet-dev-certs.
Unable to find package dotnet-ef.
Unable to find package dotnet-sql-cache.
Unable to find package dotnet-user-secrets.
Unable to find package dotnet-watch. -->
<EnvironmentVariables Include="CLIBUILD_SKIP_BUNDLEDDOTNETTOOLS=true" />
</ItemGroup>
<Target Name="CopyTarBall"
AfterTargets="CopyPackage"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)CopyTarBall.complete">
<ItemGroup>
<CliTarBalls Include="$(TarBallOutput)*$(TarBallExtension)" />
</ItemGroup>
<Copy SourceFiles="@(CliTarBalls)"
DestinationFolder="$(SourceBuiltTarBallPath)"
Condition="'@(CliTarBalls)'!=''" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)CopyTarBall.complete" Overwrite="true" />
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,37 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<RepoApiImplemented>false</RepoApiImplemented>
<SkipEnsurePackagesCreated>true</SkipEnsurePackagesCreated>
</PropertyGroup>
<!-- This project file includes only repos that are enabled for building and running tests in source-build. -->
<!-- Windows and ARM builds don't support all repos, keep them separate for future conditioning. -->
<Choose>
<When Condition="'$(OS)' == 'Windows_NT'">
<ItemGroup>
<RepositoryReference Include="runtime" />
</ItemGroup>
</When>
<When Condition="$(Platform.Contains('arm'))">
<ItemGroup>
<RepositoryReference Include="runtime" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<!-- List of repos currently enabled. -->
<RepositoryReference Include="runtime" />
</ItemGroup>
</Otherwise>
</Choose>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Target Name="RepoBuild">
</Target>
</Project>

View file

@ -0,0 +1,43 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<RepoApiImplemented>false</RepoApiImplemented>
<SkipEnsurePackagesCreated>true</SkipEnsurePackagesCreated>
</PropertyGroup>
<!-- This project file serves a couple of purpose.
- We conditionally include repos based on what works on different platforms/configurations.
- We need an "empty" build after the last real repo for prebuilt detection to work - this is that file.
- If we have a repo that is not in core-sdk's dependency tree, we can still build it by including it here. -->
<!-- Windows and ARM builds currently only work through core-setup -->
<Choose>
<When Condition="'$(OS)' == 'Windows_NT'">
<ItemGroup>
<RepositoryReference Include="runtime" />
</ItemGroup>
</When>
<When Condition="$(Platform.Contains('arm')) AND '$(BuildArchitecture)' != 'arm64'">
<ItemGroup>
<RepositoryReference Include="runtime" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<!-- Toolsets -->
<RepositoryReference Include="source-build-reference-packages" />
<RepositoryReference Include="sourcelink" />
<RepositoryReference Include="arcade" />
<RepositoryReference Include="linker" />
</ItemGroup>
</Otherwise>
</Choose>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Target Name="RepoBuild">
</Target>
</Project>

View file

@ -0,0 +1,81 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<!-- Package version is pinned to what CoreFX expects because CoreFX doesn't take an override property. -->
<ILLinkTasksPackageId>Microsoft.NET.ILLink.Tasks</ILLinkTasksPackageId>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)ci</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)restore</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)build</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)pack</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)publish</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -bl</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:ArcadeBuildFromSource=true</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:CopyWipIntoInnerSourceBuildRepo=true</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)\build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/NonShipping/</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<NuGetConfigFile>$(ProjectDirectory)/NuGet.config</NuGetConfigFile>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
</PropertyGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<!-- Extract this package into packages dir, because repos assume it's restored as a tool. -->
<!-- TODO: Determine if this is still required. See https://github.com/dotnet/source-build/issues/2291 -->
<!-- <Target Name="ExtractLinkerPackageToCache"
AfterTargets="Package"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)ExtractLinkerPackageToCache.complete">
<PropertyGroup>
<ILLinkTasksPackageFile>$(PackagesOutput)/$(ILLinkTasksPackageId).$(OutputPackageVersion).nupkg</ILLinkTasksPackageFile>
<ILLinkTasksPackageIdToLower>$(ILLinkTasksPackageId.ToLowerInvariant())</ILLinkTasksPackageIdToLower>
</PropertyGroup>
<Message Importance="high" Text="Extracting $(ILLinkTasksPackageFile) to package cache..." />
<ZipFileExtractToDirectory SourceArchive="$(ILLinkTasksPackageFile)"
DestinationDirectory="$(PackagesDir)$(ILLinkTasksPackageIdToLower)/$(OutputPackageVersion)/"
OverwriteDestination="true" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)ExtractLinkerPackageToCache.complete" Overwrite="true" />
</Target> -->
<!-- Replace file includes in nuspec as recommended in the linker repo's ./corebuild/README.md -->
<Target Name="ReplaceNuspecDllIncludeLines" BeforeTargets="Build" Condition="'$(TargetOS)' != 'Windows_NT'">
<PropertyGroup>
<LinkerTasksNuspecFile>$(ProjectDirectory)src/ILLink.Tasks/ILLink.Tasks.nuspec</LinkerTasksNuspecFile>
<NuspecFileContents>
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>$id$</id>
<version>$version$</version>
<authors>$authors$</authors>
<description>$description$</description>
</metadata>
<files>
<file src="ILLink.Tasks.targets" target="build" />
<file src="ILLink.CrossGen.targets" target="build" />
<file src="netcoreapp2.0/**/*.dll" target="tools/netcoreapp2.0" />
</files>
</package>
]]>
</NuspecFileContents>
</PropertyGroup>
<WriteLinesToFile File="$(LinkerTasksNuspecFile)"
Lines="$(NuspecFileContents)"
Overwrite="true" />
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,105 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<ShippingPackagesOutput>$(ProjectDirectory)/artifacts/packages/$(Configuration)/Shipping</ShippingPackagesOutput>
<NonShippingPackagesOutput>$(ProjectDirectory)/artifacts/packages/$(Configuration)/NonShipping</NonShippingPackagesOutput>
<OutputVersionArgs>$(OutputVersionArgs) /p:DisableNerdbankVersioning=true</OutputVersionArgs>
<BuildCommandArgs>--build --publish --pack</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DotNetBuildFromSource=true</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DotNetCoreSdkDir=$(DotNetCliToolDir)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --projects $(ProjectDirectory)MSBuild.SourceBuild.slnf</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)nodereuse $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(OutputVersionArgs)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)</BuildCommandArgs>
<!-- all repos that build with arcade currently have a warning about including RestoreSources twice -->
<BuildCommandArgs>$(BuildCommandArgs) --warnAsError false</BuildCommandArgs>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<BuildCommandArgs>$(BuildCommandArgs) -v $(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -bl</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -ci</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<!-- NuGet SDK resolver only checks nuget.config files. https://github.com/Microsoft/msbuild/issues/2914 -->
<NuGetConfigFile>$(ProjectDirectory)/NuGet.config</NuGetConfigFile>
<SourceOverrideRepoApiImplemented>true</SourceOverrideRepoApiImplemented>
<RepoApiImplemented>false</RepoApiImplemented>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<EnvironmentRestoreSources>$(SourceBuiltPackagesPath)</EnvironmentRestoreSources>
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' == 'true'">$(EnvironmentRestoreSources)%3B$(ReferencePackagesDir)%3B$(PrebuiltPackagesPath)</EnvironmentRestoreSources>
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public%40Local/nuget/v3/index.json</EnvironmentRestoreSources>
</PropertyGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
<UseSourceBuiltSdkOverride Include="@(CentralVersionsSdkOverride)" />
</ItemGroup>
<ItemGroup>
<RepositoryReference Include="arcade" />
<RepositoryReference Include="runtime" />
<RepositoryReference Include="roslyn" />
</ItemGroup>
<ItemGroup>
<EnvironmentVariables Include="RestoreSources=$(EnvironmentRestoreSources)" />
</ItemGroup>
<Target Name="SetOutputList" AfterTargets="Package" BeforeTargets="GatherBuiltPackages">
<ItemGroup>
<PackagesOutputList Include="$(ShippingPackagesOutput)" />
<PackagesOutputList Include="$(NonShippingPackagesOutput)" />
</ItemGroup>
</Target>
<!--
Begin workaround: https://github.com/dotnet/source-build/issues/933
The CentralPackageVersions SDK isn't actually source-built. We get it as a text-only prebuilt,
but the NuGet resolver seems flaky so we're using our resolver instead. We only have access to
the nupkg ahead of time when building a tarball, so only enable this workaround then.
-->
<ItemGroup Condition="'$(OfflineBuild)' == 'true'">
<CentralPackageVersionsSdkOverride Include="Microsoft.Build.CentralPackageVersions" Group="CENTRAL_PACKAGE_VERSIONS" />
<UseSourceBuiltSdkOverride Include="@(CentralPackageVersionsSdkOverride)" />
</ItemGroup>
<Target Name="ExtractCentralPackageVersionsSdkPackage"
BeforeTargets="SetSourceBuiltSdkOverrides"
Condition="'$(OfflineBuild)' == 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)ExtractCentralPackageVersionsSdkPackage.complete">
<ItemGroup>
<_CentralVersionsToolPackage
Include="$(ReferencePackagesDir)%(CentralPackageVersionsSdkOverride.Identity)*.nupkg"
Id="%(CentralPackageVersionsSdkOverride.Identity)" />
</ItemGroup>
<PropertyGroup>
<CentralVersionsSdkDir>$(ToolPackageExtractDir)%(_CentralVersionsToolPackage.Id)/</CentralVersionsSdkDir>
</PropertyGroup>
<Message Importance="High" Text="Setting up SDK package for UseSourceBuiltSdkOverride: %(_CentralVersionsToolPackage.Filename)" />
<ZipFileExtractToDirectory
SourceArchive="@(_CentralVersionsToolPackage)"
DestinationDirectory="$(CentralVersionsSdkDir)"
OverwriteDestination="true" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)ExtractCentralPackageVersionsSdkPackage.complete" Overwrite="true" />
</Target>
<!--
End workaround: https://github.com/dotnet/source-build/issues/933
-->
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,20 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<OutputArgs>/bl /v:$(LogVerbosity) /p:OutputPath=$(OutputPath)$(RepositoryName)/ /p:BaseIntermediateOutputPath=$(IntermediatePath)$(RepositoryName)</OutputArgs>
<BuildCommand>$(DotnetToolCommand) pack -c $(Configuration) --output $(SourceBuiltPackagesPath) --no-build FSharp.NET.Sdk.csproj /p:NuspecFile=FSharp.NET.Sdk.nuspec $(OutputArgs) $(RedirectRepoOutputToLog)</BuildCommand>
<PackagesOutput>$(SourceBuiltPackagesPath)</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<ProjectDirectory>$(SubmoduleDirectory)$(RepositoryName)/</ProjectDirectory>
</PropertyGroup>
<Target Name="RepoRestore" BeforeTargets="Build" DependsOnTargets="UpdateNuGetConfig">
<Exec Command="$(DotnetToolCommand) restore FSharp.NET.Sdk.csproj $(OutputArgs) /v:$(LogVerbosity) $(RedirectRepoOutputToLog)"
WorkingDirectory="$(ProjectDirectory)"
EnvironmentVariables="@(EnvironmentVariables)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,39 @@
<Project>
<PropertyGroup>
<SourceDirectory>Newtonsoft.Json</SourceDirectory>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<!--The Library Frameworks was added to environment variables so as to override the frameworks in newtonsoft csproj-->
<!--The semicolons were added with encoding so as to avoid conflicts in MSBuild shell-->
<ItemGroup>
<EnvironmentVariables Include="LibraryFrameworks=netstandard1.0%3Bnetstandard1.3%3Bnetstandard2.0" />
<!--This is a fake repo reference to slightly tweak build ordering so that arcade builds before newtonsoft. Although this tweak is temporary. dtd 06/19/2019-->
<RepositoryReference Include="arcade" />
</ItemGroup>
<PropertyGroup>
<NuGetConfigFile>$(ProjectDirectory)/Src/NuGet.Config</NuGetConfigFile>
<NewtonsoftJsonKeyFilePath>$(KeysDir)Newtonsoft.Json.snk</NewtonsoftJsonKeyFilePath>
<NewtonsoftJsonDirectory>$(ProjectDirectory)/Src/Newtonsoft.Json/</NewtonsoftJsonDirectory>
<NewtonsoftJsonProjectPath>$(NewtonsoftJsonDirectory)Newtonsoft.Json.csproj</NewtonsoftJsonProjectPath>
<DotnetToolCommandArguments>"/p:DotnetOnly=true" "/p:Configuration=$(Configuration)" "/p:AssemblyOriginatorKeyFile=$(NewtonsoftJsonKeyFilePath)" "/p:SignAssembly=true" "/p:PublicSign=true" "/p:TreatWarningsAsErrors=false" "/p:AdditionalConstants=SIGNED"</DotnetToolCommandArguments>
<BuildCommand>$(DotnetToolCommand) build $(NewtonsoftJsonProjectPath) /bl:build.binlog $(DotnetToolCommandArguments)</BuildCommand>
<BuildPackagesCommand>$(DotnetToolCommand) pack $(NewtonsoftJsonProjectPath) /bl:pack.binlog $(DotnetToolCommandArguments)</BuildPackagesCommand>
<CleanCommand>$(DotnetToolCommand) clean $(NewtonsoftJsonProjectPath) $(DotnetToolCommandArguments)</CleanCommand>
<PackagesOutput>$(NewtonsoftJsonDirectory)bin/$(Configuration)/</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
</PropertyGroup>
<Target Name="RepoRestore" BeforeTargets="Build" DependsOnTargets="UpdateNuGetConfig">
<Exec Command="$(DotnetToolCommand) restore $(NewtonsoftJsonProjectPath) $(DotnetToolCommandArguments) /v:$(LogVerbosity) /bl:restore.binlog $(RedirectRepoOutputToLog)"
WorkingDirectory="$(ProjectDirectory)"
EnvironmentVariables="@(EnvironmentVariables)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,31 @@
<Project>
<PropertyGroup>
<SourceDirectory>Newtonsoft.Json</SourceDirectory>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<NuGetConfigFile>$(ProjectDirectory)/Src/NuGet.Config</NuGetConfigFile>
<NewtonsoftJsonKeyFilePath>$(KeysDir)Newtonsoft.Json.snk</NewtonsoftJsonKeyFilePath>
<NewtonsoftJsonDirectory>$(ProjectDirectory)/Src/Newtonsoft.Json/</NewtonsoftJsonDirectory>
<NewtonsoftJsonProjectPath>$(NewtonsoftJsonDirectory)Newtonsoft.Json.Dotnet.csproj</NewtonsoftJsonProjectPath>
<DotnetToolCommandArguments>"/p:DotnetOnly=true" "/p:Configuration=$(Configuration)" "/p:AssemblyOriginatorKeyFile=$(NewtonsoftJsonKeyFilePath)" "/p:SignAssembly=true" "/p:PublicSign=true" "/p:TreatWarningsAsErrors=false" "/p:AdditionalConstants=SIGNED"</DotnetToolCommandArguments>
<BuildCommand>$(DotnetToolCommand) build $(NewtonsoftJsonProjectPath) $(DotnetToolCommandArguments)</BuildCommand>
<BuildPackagesCommand>$(DotnetToolCommand) pack $(NewtonsoftJsonProjectPath) $(DotnetToolCommandArguments)</BuildPackagesCommand>
<CleanCommand>$(DotnetToolCommand) clean $(NewtonsoftJsonProjectPath) $(DotnetToolCommandArguments)</CleanCommand>
<PackagesOutput>$(NewtonsoftJsonDirectory)bin/$(Configuration)/</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
</PropertyGroup>
<Target Name="RepoRestore" BeforeTargets="Build" DependsOnTargets="UpdateNuGetConfig">
<Exec Command="$(DotnetToolCommand) restore $(NewtonsoftJsonProjectPath) $(DotnetToolCommandArguments) /v:$(LogVerbosity) $(RedirectRepoOutputToLog)"
WorkingDirectory="$(ProjectDirectory)"
EnvironmentVariables="@(EnvironmentVariables)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,68 @@
<Project>
<PropertyGroup>
<SourceDirectory>nuget.client</SourceDirectory>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<PackagesOutput>$(ProjectDirectory)artifacts/nupkgs/</PackagesOutput>
<NuGetCoreSourceDirectory>$(ProjectDirectory)src/NuGet.Core/</NuGetCoreSourceDirectory>
<ToolsDirectory>$(ProjectDirectory)cli/</ToolsDirectory>
<NuGetKeyFilePath>$(KeysDir)NuGet.Client.snk</NuGetKeyFilePath>
<RepoApiImplemented>false</RepoApiImplemented>
<DependencyVersionInputRepoApiImplemented>true</DependencyVersionInputRepoApiImplemented>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
</PropertyGroup>
<ItemGroup>
<EnvironmentVariables Include="MS_PFX_PATH=$(NuGetKeyFilePath)" />
<EnvironmentVariables Include="NUGET_PFX_PATH=$(NuGetKeyFilePath)" />
<RepositoryReference Include="common" />
<RepositoryReference Include="newtonsoft-json" />
<RepositoryReference Include="msbuild" />
<RepositoryReference Include="aspnet-xdt" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Target Name="RepoBuild">
<PropertyGroup>
<BuildCommandBase>$(DotnetToolCommand) msbuild $(ProjectDirectory)/build/build.proj</BuildCommandBase>
<BuildCommandBase>$(BuildCommandBase) /p:VisualStudioVerion=15.0</BuildCommandBase>
<BuildCommandBase>$(BuildCommandBase) /p:Configuration=$(Configuration)</BuildCommandBase>
<BuildCommandBase>$(BuildCommandBase) /p:BuildRTM=false</BuildCommandBase>
<BuildCommandBase>$(BuildCommandBase) /p:BuildNumber=$(OfficialBuildId)</BuildCommandBase>
<BuildCommandBase>$(BuildCommandBase) /v:$(LogVerbosity)</BuildCommandBase>
<BuildCommandBase>$(BuildCommandBase) /p:TreatWarningsAsErrors=false</BuildCommandBase>
<BuildCommandBase>$(BuildCommandBase) /p:DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)</BuildCommandBase>
</PropertyGroup>
<Exec Command="$(BuildCommandBase) /t:RestoreXPLAT /bl:restore.binlog $(RedirectRepoOutputToLog)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="$(BuildCommandBase) /t:BuildXPLAT /bl:build.binlog $(RedirectRepoOutputToLog)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
<PropertyGroup>
<PackCommand>$(BuildCommandBase) /t:PackXPlat</PackCommand>
<PackCommand>$(PackCommand) /p:PackageOutputPath=$(PackagesOutput)</PackCommand>
<PackCommand>$(PackCommand) /p:NoPackageAnalysis=true</PackCommand>
<PackCommand>$(PackCommand) /flp:v=detailed</PackCommand>
<PackCommand>$(PackCommand) /v:$(LogVerbosity)</PackCommand>
<PackCommand>$(PackCommand) /bl:pack.binlog</PackCommand>
<PackCommand>$(PackCommand) $(RedirectRepoOutputToLog)</PackCommand>
</PropertyGroup>
<Exec Command="$(PackCommand)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
</Project>

View file

@ -0,0 +1,38 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<RepoApiImplemented>false</RepoApiImplemented>
<ProjectDirectory>$(SubmoduleDirectory)$(RepositoryName)/</ProjectDirectory>
<SkipEnsurePackagesCreated>true</SkipEnsurePackagesCreated>
<IncludedPackageVersionPropsFile Condition="'$(OfflineBuild)' != 'true'">$(PackageVersionPropsPath)</IncludedPackageVersionPropsFile>
<IncludedPackageVersionPropsFile Condition="'$(OfflineBuild)' == 'true'">$(GennedPackageVersionPropsPath)</IncludedPackageVersionPropsFile>
</PropertyGroup>
<ItemGroup>
<RepositoryReference Include="arcade" />
<RepositoryReference Include="sdk" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Target Name="RepoBuild">
<!-- Copy PVP to packages dir in order to package them together -->
<Copy SourceFiles="$(IncludedPackageVersionPropsFile)" DestinationFiles="$(SourceBuiltPackagesPath)PackageVersions.props" />
<!-- Copy coreclr tools to packages dir to include it in the source-built tarball as well -->
<ItemGroup>
<CoreClrToolsFiles Include="$(ToolPackageExtractDir)coreclr-tools/*" />
</ItemGroup>
<Copy SourceFiles="@(CoreClrToolsFiles)" DestinationFolder="$(SourceBuiltPackagesPath)coreclr-tools" />
<PropertyGroup>
<SourceBuiltTarballName>$(OutputPath)$(SourceBuiltArtifactsTarballName).$(VersionPrefix)-$(VersionSuffix).tar.gz</SourceBuiltTarballName>
</PropertyGroup>
<Exec Command="tar --numeric-owner -czf $(SourceBuiltTarballName) *.nupkg *.props coreclr-tools/*" WorkingDirectory="$(SourceBuiltPackagesPath)" />
<Message Importance="High" Text="Packaged source-built artifacts to $(SourceBuiltTarballName)" />
</Target>
</Project>

View file

@ -0,0 +1,38 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<BuildCommandArgs>--restore --build --pack</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -v $(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -bl</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -warnaserror false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:TreatWarningsAsErrors=false</BuildCommandArgs>
<!-- Versioning args. -->
<BuildCommandArgs>$(BuildCommandArgs) /p:OfficialBuild=true</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DotNetBuildFromSource=true</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:GitHubRepositoryName=roslyn-analyzers</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:RepositoryUrl=git://github.com/dotnet/roslyn-analyzers</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<DependencyVersionInputRepoApiImplemented>true</DependencyVersionInputRepoApiImplemented>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
</PropertyGroup>
<ItemGroup>
<RepositoryReference Include="runtime" />
<RepositoryReference Include="roslyn" />
</ItemGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,78 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceTextInFiles" />
<PropertyGroup>
<BuildCommandArgs>--restore --build --pack</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -v $(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -bl</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:TreatWarningsAsErrors=false</BuildCommandArgs>
<!-- Versioning args. -->
<BuildCommandArgs>$(BuildCommandArgs) /p:OfficialBuild=true</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:ApplyPartialNgenOptimization=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:EnablePartialNgenOptimization=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PublishWindowsPdb=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DotNetBuildFromSource=true</BuildCommandArgs>
<!-- UsingToolMicrosoftNetCompilers=false introduces a prebuilt so we'll have to turn back on after our bootstrap SDK has native integer support -->
<!-- issue: https://github.com/dotnet/source-build/issues/1719 -->
<BuildCommandArgs>$(BuildCommandArgs) /p:UsingToolMicrosoftNetCompilers=false</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
</PropertyGroup>
<ItemGroup>
<PackProjects Include="$(ProjectDirectory)src/NuGet/Microsoft.NETCore.Compilers/Microsoft.NETCore.Compilers.Package.csproj" />
<PackProjects Include="$(ProjectDirectory)src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj" />
<PackProjects Include="$(ProjectDirectory)src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj" />
<PackProjects Include="$(ProjectDirectory)src/Workspaces/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.Workspaces.csproj" />
</ItemGroup>
<ItemGroup>
<RepositoryReference Include="arcade" />
<RepositoryReference Include="command-line-api" />
<RepositoryReference Include="humanizer" />
<RepositoryReference Include="xliff-tasks" />
</ItemGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<!--
Some internal utility APIs implemented by dotnet/roslyn have the same name
as types that were officially added to .NET in 5.0. That means that when we
target 'net5.0', they are sometimes ambiguous. The .NET 5.0 and Roslyn
versions of these types are not compatible, so we need to keep using the
internal implementation. This target renames the internal Roslyn types to
make them unambiguous to the compiler.
-->
<Target Name="MangleInternalApiNamesOverlappingWithNet50"
BeforeTargets="Build">
<ItemGroup>
<RoslynSourceFile Include="$(ProjectDirectory)**\*.cs" />
<RoslynSourceFile Include="$(ProjectDirectory)**\*.vb" />
</ItemGroup>
<!-- Stick 'Roslyn' in the middle of the new text for some idempotence. -->
<ReplaceTextInFiles
InputFiles="@(RoslynSourceFile)"
OldText="IReadOnlySet"
NewText="IRoslynReadOnlySet" />
<ReplaceTextInFiles
InputFiles="@(RoslynSourceFile)"
OldText="ReferenceEqualityComparer"
NewText="ReferenceEqualityRoslynComparer" />
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,56 @@
<Project>
<PropertyGroup>
<SourceDirectory>runtime</SourceDirectory>
<PortableBuild>true</PortableBuild>
<UseSystemLibunwind>false</UseSystemLibunwind>
</PropertyGroup>
<Import Project="runtime.common.props"/>
<!-- Repository References -->
<ItemGroup>
<RepositoryReference Include="arcade" />
<RepositoryReference Include="linker" />
<RepositoryReference Include="newtonsoft-json" />
<RepositoryReference Include="newtonsoft-json901" />
<RepositoryReference Include="roslyn" />
</ItemGroup>
<!-- Additional Targets -->
<Target Name="CleanupRepoForNonPortableBuild" AfterTargets="RemoveBuiltPackagesFromCache">
<!-- Make a copy of the portable build logs & project.assets.json files-->
<PropertyGroup>
<PortableLogDir>$(ProjectDirectory)artifacts/portableLog</PortableLogDir>
<PortableObjDir>$(ProjectDirectory)artifacts/portableObj</PortableObjDir>
</PropertyGroup>
<ItemGroup>
<LogFilesToCopy Include="$(ProjectDirectory)artifacts/log/**/*" />
<ObjFilesToCopy Include="$(ProjectDirectory)artifacts/obj/**/project.assets.json" />
</ItemGroup>
<MakeDir Directories="$(PortableLogDir)" Condition="Exists('$(ProjectDirectory)artifacts')"/>
<MakeDir Directories="$(PortableObjDir)" Condition="Exists('$(ProjectDirectory)artifacts')"/>
<Copy SourceFiles="@(LogFilesToCopy)" DestinationFolder="$(PortableLogDir)/%(RecursiveDir)" Condition="Exists('$(PortableLogDir)')" />
<Copy SourceFiles="@(ObjFilesToCopy)" DestinationFolder="$(PortableObjDir)/%(RecursiveDir)" Condition="Exists('$(PortableObjDir)')" />
<!-- Cleanup everything else -->
<ItemGroup>
<DirsToDelete Include="$([System.IO.Directory]::GetDirectories(&quot;$(ProjectDirectory)artifacts/&quot;))" Condition="Exists('$(ProjectDirectory)artifacts')" />
<DirsToDelete Include="$(ProjectDirectory)bin" Condition="Exists('$(ProjectDirectory)bin')" />
<DirsToDelete Remove="$(PortableLogDir)" />
<DirsToDelete Remove="$(PortableObjDir)" />
</ItemGroup>
<RemoveDir Directories="@(DirsToDelete)" />
</Target>
<Import Project="runtime.common.targets" />
<Target Name="GatherBuiltPackages" BeforeTargets="CopyPackage">
<ItemGroup>
<_BuiltPackages Include="$(ShippingPackagesOutput)/*linux*nupkg" Exclude="$(ShippingPackagesOutput)/*.symbols.nupkg" />
<_BuiltPackages Include="$(NonShippingPackagesOutput)/*linux*nupkg" Exclude="$(NonShippingPackagesOutput)/*.symbols.nupkg" />
</ItemGroup>
</Target>
</Project>

View file

@ -0,0 +1,143 @@
<Project>
<PropertyGroup>
<SourceDirectory>runtime</SourceDirectory>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<!--- Portable / TargetRid Overrides-->
<PropertyGroup>
<!-- OSX installer build always uses the portable RID, so override it -->
<OverridePortableBuild>$(PortableBuild)</OverridePortableBuild>
<OverridePortableBuild Condition="'$(TargetOS)' == 'OSX' OR '$(TargetOS)' == 'Windows_NT' OR '$(TargetOS)' == 'FreeBSD'">true</OverridePortableBuild>
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'OSX'">osx-x64</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-x64</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'Windows_NT'">win-x64</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'Linux' and ('$(PortableBuild)' == 'true' or '$(BuildingPortableRuntime)' == 'true')">linux-$(Platform)</OverrideTargetRid>
<UseSystemLibunwind Condition="'$(UseSystemLibunwind)' == '' AND '$(OS)' == 'Windows_NT'">false</UseSystemLibunwind>
<UseSystemLibunwind Condition="'$(UseSystemLibunwind)' == '' AND '$(TargetOS)' == 'OSX'">false</UseSystemLibunwind>
<UseSystemLibunwind Condition="'$(UseSystemLibunwind)' == ''">$(UseSystemLibraries)</UseSystemLibunwind>
</PropertyGroup>
<!-- Build arguments -->
<PropertyGroup>
<!-- common arguments -->
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<!-- coreclr -->
<CoreClrBuildArguments Condition="'$(UseSystemLibunwind)' == 'true'">$(CoreClrBuildArguments) -cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE</CoreClrBuildArguments>
<CoreClrBuildArguments Condition="$(Platform.Contains('arm')) AND '$(BuildArchitecture)' != 'arm64' ">$(CoreClrBuildArguments) skipnuget cross -skiprestore cmakeargs -DFEATURE_GDBJIT=TRUE</CoreClrBuildArguments>
<CoreClrBuildArguments Condition="'$(TargetOS)' == 'FreeBSD'">$(CoreClrBuildArguments) -clang6.0 /p:PortableBuild=true</CoreClrBuildArguments>
<!-- Portable builds only apply to Linux - Mac and Windows are both always portable.
Additionally, Linux builds are portable by default and only have a switch to turn it off -->
<CoreClrBuildArguments Condition="'$(TargetOS)' == 'Linux' and '$(PortableBuild)' == 'false'">$(CoreClrBuildArguments) /p:PortableBuild=false</CoreClrBuildArguments>
<CoreClrBuildArguments>$(CoreClrBuildArguments) /p:PackagesDir=$(PackagesDir)</CoreClrBuildArguments>
<CoreClrBuildArguments>$(CoreClrBuildArguments) /p:ContinuousIntegrationBuild=true</CoreClrBuildArguments>
<CoreClrBuildArguments>$(CoreClrBuildArguments) /p:PackageRid=$(OverrideTargetRid)</CoreClrBuildArguments>
<!-- PGO is disabled for now because the profiler only runs on Windows: https://github.com/dotnet/source-build/issues/247 -->
<CoreClrBuildArguments>$(CoreClrBuildArguments) /p:NoPgoOptimize=true</CoreClrBuildArguments>
<CoreClrBuildArguments>$(CoreClrBuildArguments) /p:KeepNativeSymbols=true</CoreClrBuildArguments>
<CoreClrBuildArguments Condition="'$(TargetOS)' != 'OSX'">$(CoreClrBuildArguments) /p:RuntimeOS=$(OverrideTargetRid.Substring(0, $(OverrideTargetRid.IndexOf("-"))))</CoreClrBuildArguments>
<CoreClrBuildArguments Condition="'$(TargetOS)' == 'OSX'">$(CoreClrBuildArguments) /p:RuntimeOS=$(OverrideTargetRid)</CoreClrBuildArguments>
<!-- libraries -->
<LibrariesBuildArguments Condition="'$(RunTests)' != 'true' AND '$(PrepForTests)' != 'true'">$(LibrariesBuildArguments) $(FlagParameterPrefix)restore $(FlagParameterPrefix)build $(FlagParameterPrefix)pack /p:SkipTests=true</LibrariesBuildArguments>
<LibrariesBuildArguments Condition="'$(PrepForTests)' == 'true'">$(LibrariesBuildArguments) $(FlagParameterPrefix)restore $(FlagParameterPrefix)build /p:IncludeTestUtils=true</LibrariesBuildArguments>
<LibrariesBuildArguments Condition="'$(RunTests)' == 'true'">$(LibrariesBuildArguments) $(FlagParameterPrefix)restore $(FlagParameterPrefix)buildtests $(FlagParameterPrefix)test /p:IncludeTestUtils=true</LibrariesBuildArguments>
<LibrariesBuildArguments Condition="'$(RunTests)' == 'true' AND '$(DotNetRunningInDocker)' == '1' AND '$(TargetOS)' == 'Linux'">$(LibrariesBuildArguments) /p:TestRspFile=$(TestExclusionsDir)corefx/linux.docker.rsp</LibrariesBuildArguments>
<LibrariesBuildArguments>$(LibrariesBuildArguments) /p:ConfigurationGroup=$(Configuration)</LibrariesBuildArguments>
<LibrariesBuildArguments>$(LibrariesBuildArguments) /p:PackageRid=$(OverrideTargetRid)</LibrariesBuildArguments>
<!-- CoreFX parses this argument for a OS "family", i.e. rhel.7 to rhel. OSX doesn't have the extra identifier so we need to include the
"-x64" so CoreFX can find a character to break on (digits, hyphen, period). -->
<LibrariesBuildArguments Condition="'$(TargetOS)' != 'OSX'">$(LibrariesBuildArguments) /p:RuntimeOS=$(OverrideTargetRid.Substring(0, $(OverrideTargetRid.IndexOf("-"))))</LibrariesBuildArguments>
<LibrariesBuildArguments Condition="'$(TargetOS)' == 'OSX'">$(LibrariesBuildArguments) /p:RuntimeOS=$(OverrideTargetRid)</LibrariesBuildArguments>
<LibrariesBuildArguments>$(LibrariesBuildArguments) /p:PortableBuild=$(OverridePortableBuild)</LibrariesBuildArguments>
<LibrariesBuildArguments>$(LibrariesBuildArguments) /p:BuildAllPackages=true</LibrariesBuildArguments>
<LibrariesBuildArguments>$(LibrariesBuildArguments) /p:BuildAllOOBPackages=true</LibrariesBuildArguments>
<LibrariesBuildArguments>$(LibrariesBuildArguments) /p:KeepNativeSymbols=true</LibrariesBuildArguments>
<LibrariesBuildArguments>$(LibrariesBuildArguments) /p:BuiltSdkPackageOverride=""</LibrariesBuildArguments> <!-- Clear PackageOverride for Libraries - it only applies to coreclr -->
<LibrariesBuildArguments Condition="'$(OfflineBuild)' == 'true'">$(LibrariesBuildArguments) /p:MicrosoftNETCoreDotNetHostPackageVersion=$(DOTNET_HOST_BOOTSTRAP_VERSION)</LibrariesBuildArguments>
<LibrariesBuildArguments Condition="'$(OfflineBuild)' == 'true'">$(LibrariesBuildArguments) /p:MicrosoftNETCoreDotNetHostPolicyPackageVersion=$(DOTNET_HOST_BOOTSTRAP_VERSION)</LibrariesBuildArguments>
<!-- installer -->
<InstallerBuildArguments>$(FlagParameterPrefix)restore $(FlagParameterPrefix)build</InstallerBuildArguments>
<InstallerBuildArguments>$(InstallerBuildArguments) /p:PortableBuild=$(OverridePortableBuild)</InstallerBuildArguments>
<InstallerBuildArguments>$(InstallerBuildArguments) /p:KeepNativeSymbols=true</InstallerBuildArguments>
<InstallerBuildArguments Condition="'$(UseSystemLibunwind)' == 'true'">$(InstallerBuildArguments) -cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE</InstallerBuildArguments>
<InstallerBuildArguments Condition="$(Platform.Contains('arm')) AND '$(BuildArchitecture)' != 'arm64'">$(InstallerBuildArguments) /p:TargetArchitecture=$(Platform) /p:DisableCrossgen=true /p:CrossBuild=true</InstallerBuildArguments>
<InstallerBuildArguments>$(InstallerBuildArguments) /p:BuildDebPackage=false</InstallerBuildArguments>
<InstallerBuildArguments>$(InstallerBuildArguments) /p:BuildAllPackages=true</InstallerBuildArguments>
<InstallerBuildArguments>$(InstallerBuildArguments) /p:RestoreAllBuildRids=false</InstallerBuildArguments>
<InstallerBuildArguments>$(InstallerBuildArguments) /p:OutputRid=$(OverrideTargetRid)</InstallerBuildArguments>
<InstallerBuildArguments>$(InstallerBuildArguments) /p:DotNetOutputBlobFeedDir=$(SourceBuiltBlobFeedDir)</InstallerBuildArguments>
<InstallerBuildArguments>$(InstallerBuildArguments) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltRuntimeDir)</InstallerBuildArguments>
<InstallerBuildArguments>$(InstallerBuildArguments) /p:BuiltSdkPackageOverride=""</InstallerBuildArguments> <!-- Clear PackageOverride for Installer - it only applies to coreclr -->
<InstallerBuildArguments>$(InstallerBuildArguments) $(FlagParameterPrefix)warnAsError $(ArcadeFalseBoolBuildArg)</InstallerBuildArguments>
<CommonBuildArguments>$(FlagParameterPrefix)arch $(Platform)</CommonBuildArguments>
<CommonBuildArguments>$(CommonBuildArguments) $(FlagParameterPrefix)configuration $(Configuration)</CommonBuildArguments>
<CommonBuildArguments>$(CommonBuildArguments) /p:RuntimeConfiguration=$(Configuration)</CommonBuildArguments>
<CommonBuildArguments>$(CommonBuildArguments) /p:MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.0</CommonBuildArguments>
<CommonBuildArguments>$(CommonBuildArguments) $(FlagParameterPrefix)binaryLog</CommonBuildArguments>
<CommonBuildArguments>$(CommonBuildArguments) $(FlagParameterPrefix)ci</CommonBuildArguments>
<CommonBuildArguments>$(CommonBuildArguments) $(FlagParameterPrefix)runtimeConfiguration $(Configuration)</CommonBuildArguments>
<CommonBuildArguments>$(CommonBuildArguments) $(FlagParameterPrefix)verbosity $(LogVerbosity)</CommonBuildArguments>
<!--
Disable node reuse (in the new/Arcade way) to avoid errors like this:
error MSB4062: The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the
assembly .../build/../tools/Microsoft.Build.Tasks.CodeAnalysis.dll. Assembly with same name
is already loaded
-->
<CommonBuildArguments>$(CommonBuildArguments) $(FlagParameterPrefix)nodereuse $(ArcadeFalseBoolBuildArg)</CommonBuildArguments>
<CommonBuildArguments>$(CommonBuildArguments) $(FlagParameterPrefix)warnAsError $(ArcadeFalseBoolBuildArg)</CommonBuildArguments>
<BuildCommand>$(ProjectDirectory)build-source-build$(ShellExtension) $(CommonBuildArguments) $(FlagParameterPrefix)coreclr-args $(CoreClrBuildArguments) $(FlagParameterPrefix)libraries-args $(LibrariesBuildArguments) $(FlagParameterPrefix)installer-args $(InstallerBuildArguments) $(FlagParameterPrefix)additional-args</BuildCommand>
<BuildCommand Condition="$(Platform.Contains('arm')) AND '$(BuildArchitecture)' != 'arm64'">$(ArmEnvironmentVariables) $(BuildCommand)</BuildCommand>
<CleanCommand>$(ProjectDirectory)/clean$(ShellExtension)</CleanCommand>
</PropertyGroup>
<!-- Output / source-build flags -->
<PropertyGroup>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
<PackagesOutput>$(ProjectDirectory)bin/Product/$(TargetOS).$(Platform).$(Configuration)/.nuget/pkg</PackagesOutput>
<ShippingPackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/</ShippingPackagesOutput>
<NonShippingPackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/NonShipping/</NonShippingPackagesOutput>
<NuGetConfigFile>$(ProjectDirectory)/NuGet.config</NuGetConfigFile>
<DependencyVersionInputRepoApiImplemented>true</DependencyVersionInputRepoApiImplemented>
</PropertyGroup>
<!-- Environment Restore Sources -->
<PropertyGroup>
<EnvironmentRestoreSources>$(SourceBuiltPackagesPath)</EnvironmentRestoreSources>
<EnvironmentRestoreSources>$(EnvironmentRestoreSources)%3B$(ShippingPackagesOutput)</EnvironmentRestoreSources>
<EnvironmentRestoreSources>$(EnvironmentRestoreSources)%3B$(NonShippingPackagesOutput)</EnvironmentRestoreSources>
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' == 'true'">$(EnvironmentRestoreSources)%3B$(ReferencePackagesDir)%3B$(PrebuiltPackagesPath)</EnvironmentRestoreSources>
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public%40Local/nuget/v3/index.json</EnvironmentRestoreSources>
</PropertyGroup>
<!-- SDK Overrides -->
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
<UseSourceBuiltSdkOverride Include="@(ArcadeCoreFxTestingOverride)" />
<UseSourceBuiltSdkOverride Include="@(ArcadePackagingOverride)" />
<UseSourceBuiltSdkOverride Include="@(ArcadeTargetFrameworkSdkOverride)" />
</ItemGroup>
<!-- Environment Variables -->
<ItemGroup>
<EnvironmentVariables Include="RestoreSources=$(EnvironmentRestoreSources)" />
<EnvironmentVariables Include="BuildInParallel=false" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,72 @@
<Project>
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="AddRidToRuntimeJson" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="PublishCoreSetupBinaries" />
<Target Name="SetOutputList" AfterTargets="Package" BeforeTargets="GatherBuiltPackages">
<ItemGroup>
<PackagesOutputList Include="$(ShippingPackagesOutput)" />
<PackagesOutputList Include="$(NonShippingPackagesOutput)" />
</ItemGroup>
</Target>
<Target Name="UpdateRuntimeGraph"
BeforeTargets="Build"
Condition="'$(_IsBootstrapping)' == 'true'">
<PropertyGroup>
<RuntimeJsonFile>$(ProjectDirectory)pkg/Microsoft.NETCore.Platforms/runtime.json</RuntimeJsonFile>
</PropertyGroup>
<Message Importance="High" Text="Adding rid, $(TargetRid), to $(RuntimeJsonFile)" />
<AddRidToRuntimeJson RuntimeJson="$(RuntimeJsonFile)"
Rid="$(TargetRid)-$(Platform)" />
</Target>
<Target Name="CopyTools"
AfterTargets="Package"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)CopyTools.complete">
<PropertyGroup>
<CoreClrDestinationDir>$(ToolPackageExtractDir)coreclr-tools</CoreClrDestinationDir>
<AssemblyExtension Condition="'$(TargetOS)' == 'Linux'">so</AssemblyExtension>
<AssemblyExtension Condition="'$(TargetOS)' == 'FreeBSD'">so</AssemblyExtension>
<AssemblyExtension Condition="'$(TargetOS)' == 'OSX'">dylib</AssemblyExtension>
<AssemblyExtension Condition="'$(AssemblyExtension)' == ''">please define AssemblyExtension for $(TargetOS)</AssemblyExtension>
</PropertyGroup>
<ItemGroup>
<CoreClrTools Include="$(ProjectDirectory)artifacts/bin/coreclr/$(TargetOS).$(Platform).$(Configuration)/ilasm" />
<CoreClrTools Include="$(ProjectDirectory)artifacts/bin/coreclr/$(TargetOS).$(Platform).$(Configuration)/ildasm" />
<CoreClrTools Include="$(ProjectDirectory)artifacts/bin/coreclr/$(TargetOS).$(Platform).$(Configuration)/libcoreclr.$(AssemblyExtension)" />
<CoreClrTools Include="$(ProjectDirectory)artifacts/bin/coreclr/$(TargetOS).$(Platform).$(Configuration)/System.Private.CoreLib.dll" />
</ItemGroup>
<Message Importance="High" Text="Copying source-built ILAsm and ILDasm '@(CoreClrTools)' to '$(CoreClrDestinationDir)'" />
<Copy SourceFiles="@(CoreClrTools)" DestinationFolder="$(CoreClrDestinationDir)" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)CopyTools.complete" Overwrite="true" />
</Target>
<Target Name="CopyBinariesToBinFolder"
AfterTargets="Build"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)CopyBinariesToBinFolder.complete">
<ItemGroup>
<_builtRuntimePackages Include="$(SourceBuiltAssetsDir)*.symbols.nupkg" />
<_builtRuntimePackages>
<TransformedFileName>$([System.String]::Copy('%(FileName)').Replace('symbols', 'nupkg'))</TransformedFileName>
</_builtRuntimePackages>
<BinariesToCopy Include="$(SourceBuiltAssetsDir)*.*" Exclude="$(SourceBuiltAssetsDir)*.nupkg;$(SourceBuiltAssetsDir)*.requires_nupkg_signing" />
<BinariesToCopy Include="@(_builtRuntimePackages->'$(SourceBuiltPackagesPath)%(TransformedFileName)')" />
</ItemGroup>
<Copy SourceFiles="@(BinariesToCopy)"
DestinationFolder="$(OutputPath)runtime"
Condition="'@(BinariesToCopy)'!=''" />
<WriteLinesToFile File="$(RepoCompletedSemaphorePath)CopyBinariesToBinFolder.complete" Overwrite="true" />
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,23 @@
<Project>
<Import Project="runtime.common.props"/>
<!-- Repository References -->
<ItemGroup>
<RepositoryReference Include="arcade" />
<RepositoryReference Include="symreader" />
<RepositoryReference Include="linker" />
<RepositoryReference Include="newtonsoft-json" />
<RepositoryReference Include="newtonsoft-json901" />
<RepositoryReference Include="roslyn" />
<RepositoryReference Include="runtime-portable" Condition="'$(TargetOS)' == 'Linux' and '$(BuildPortableRuntime)' == 'true'" />
</ItemGroup>
<!-- Additional Targets -->
<Target Name="InstallJustBuiltRuntime" AfterTargets="RemoveBuiltPackagesFromCache">
<!-- Install the runtime that was just built to be used by downstream repos, namely, aspnetcore -->
<Exec Command="tar -xvf $(SourceBuiltAssetsDir)dotnet-runtime-$(runtimeOutputPackageVersion)-$(OverrideTargetRid).tar.gz -C $(DotNetCliToolDir)" />
</Target>
<Import Project="runtime.common.targets" />
</Project>

View file

@ -0,0 +1,66 @@
<Project>
<PropertyGroup>
<SourceDirectory>sdk</SourceDirectory>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<BuildCommandArgs>--pack --configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PackageProjectUrl=https://github.com/dotnet/sdk</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltToolsetDir)</BuildCommandArgs>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<BuildCommandArgs>$(BuildCommandArgs) -v $(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -bl</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -ci</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)nodereuse $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)warnAsError $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:Projects=$(ProjectDirectory)source-build.slnf</BuildCommandArgs>
<!-- The sdk repo is building with an older version of the SDK where this property is
defaulted to false. The SDK that source-build is using defaults it to true.
Set it to false to get old behavior for building the sdk repo. -->
<BuildCommandArgs>$(BuildCommandArgs) /p:ProduceReferenceAssembly=false</BuildCommandArgs>
<!-- Pass in package version props using the Product Construction (ProdCon) API. -->
<BuildCommandArgs>$(BuildCommandArgs) /p:PB_PackageVersionPropsUrl=file:%2F%2F$(PackageVersionPropsPath)</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)\build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<!-- NuGet SDK resolver only checks nuget.config files. https://github.com/Microsoft/msbuild/issues/2914 -->
<NuGetConfigFile>$(ProjectDirectory)/NuGet.config</NuGetConfigFile>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<DependencyVersionInputRepoApiImplemented>true</DependencyVersionInputRepoApiImplemented>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/NonShipping/</PackagesOutput>
<EnvironmentRestoreSources>$(SourceBuiltPackagesPath)</EnvironmentRestoreSources>
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' == 'true'">$(EnvironmentRestoreSources)%3B$(ReferencePackagesDir)%3B$(PrebuiltPackagesPath)</EnvironmentRestoreSources>
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public%40Local/nuget/v3/index.json</EnvironmentRestoreSources>
</PropertyGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<ItemGroup>
<EnvironmentVariables Include="RestoreSources=$(EnvironmentRestoreSources)" />
</ItemGroup>
<ItemGroup>
<RepositoryReference Include="arcade" />
<RepositoryReference Include="xliff-tasks" />
<RepositoryReference Include="runtime" />
<RepositoryReference Include="msbuild" />
<RepositoryReference Include="newtonsoft-json" />
<RepositoryReference Include="newtonsoft-json901" />
<RepositoryReference Include="nuget-client" />
<RepositoryReference Include="roslyn-analyzers" />
<RepositoryReference Include="vstest" />
<RepositoryReference Include="fsharp" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,30 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)ci</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)restore</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)build</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)pack</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)publish</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -bl</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:ArcadeBuildFromSource=true</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:CopyWipIntoInnerSourceBuildRepo=true</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)\build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/NonShipping/</PackagesOutput>
<!-- SBRP builds before Arcade so it also needs the bootstrap Arcade version -->
<UseBootstrapArcade>true</UseBootstrapArcade>
</PropertyGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeBootstrapSdkOverride)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,34 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<BuildCommandArgs/>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)pack</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)binaryLog</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)ci</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)warnAsError $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:ArcadeBuildFromSource=true</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:CopyWipIntoInnerSourceBuildRepo=true</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/NonShipping/</PackagesOutput>
<!-- SourceLink builds before Arcade so it also needs the bootstrap Arcade version -->
<UseBootstrapArcade>true</UseBootstrapArcade>
</PropertyGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeBootstrapSdkOverride)" />
</ItemGroup>
<ItemGroup>
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftSourceLinkVersion" Version="$(SOURCE_LINK_BOOTSTRAP_VERSION)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,47 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<NuGetConfigFile>$(ProjectDirectory)nuget.config</NuGetConfigFile>
<PackagesOutput>$(ProjectDirectory)/artifacts/packages/$(Configuration)/Shipping</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
</PropertyGroup>
<ItemGroup>
<RepositoryReference Include="arcade" />
</ItemGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Target Name="RepoBuild">
<PropertyGroup>
<BuildCommandArgs>$(ProjectDirectory)/src//Microsoft.DiaSymReader//Microsoft.DiaSymReader.csproj</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:Configuration=$(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /v:$(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(RedirectRepoOutputToLog)</BuildCommandArgs>
</PropertyGroup>
<Exec Command="$(DotnetToolCommand) restore /bl:restore.binlog $(BuildCommandArgs) "
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="$(DotnetToolCommand) build /bl:build.binlog $(BuildCommandArgs)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
<Exec Command="$(DotnetToolCommand) pack /bl:pack.binlog $(BuildCommandArgs)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
</Project>

View file

@ -0,0 +1,53 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<ShippingPackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/</ShippingPackagesOutput>
<NonShippingPackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/NonShipping/</NonShippingPackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<BuildCommandArgs>--restore --pack --configuration $(Configuration) $(OutputVersionArgs)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)warnasError $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PackSpecific=true</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:UseAppHost=false</BuildCommandArgs>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<BuildCommandArgs>$(BuildCommandArgs) -v $(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -bl</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --ci</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)warnAsError $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
<!-- Pass in package version props using the Product Construction (ProdCon) API. -->
<BuildCommandArgs>$(BuildCommandArgs) /p:PB_PackageVersionPropsUrl=file:%2F%2F$(PackageVersionPropsPath)</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)\build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<DependencyVersionInputRepoApiImplemented>true</DependencyVersionInputRepoApiImplemented>
<EnvironmentRestoreSources>$(SourceBuiltPackagesPath)</EnvironmentRestoreSources>
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' == 'true'">$(EnvironmentRestoreSources)%3B$(ReferencePackagesDir)%3B$(PrebuiltPackagesPath)</EnvironmentRestoreSources>
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public%40Local/nuget/v3/index.json</EnvironmentRestoreSources>
</PropertyGroup>
<ItemGroup>
<RepositoryReference Include="clicommandlineparser" />
<RepositoryReference Include="newtonsoft-json" />
</ItemGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<ItemGroup>
<EnvironmentVariables Include="RestoreSources=$(EnvironmentRestoreSources)" />
</ItemGroup>
<Target Name="SetOutputList" AfterTargets="Package" BeforeTargets="GatherBuiltPackages">
<ItemGroup>
<PackagesOutputList Include="$(ShippingPackagesOutput)" />
<PackagesOutputList Include="$(NonShippingPackagesOutput)" />
</ItemGroup>
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,29 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<BuildCommandArgs>--restore --build --pack</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --configuration $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --binaryLog</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -ci</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)nodereuse $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
<NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/</PackagesOutput>
</PropertyGroup>
<ItemGroup>
<RepositoryReference Include="arcade" />
</ItemGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,31 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-x64</OverrideTargetRid>
<BuildCommandArgs>-DotNetBuildFromSource</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -DotNetCoreSdkDir $(DotNetCliToolDir)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -c $(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -r $(OverrideTargetRid)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) -v $(OutputPackageVersion)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)warnAsError $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)/build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<PackagesOutput>$(ProjectDirectory)/artifacts/$(Configuration)/packages</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
</PropertyGroup>
<ItemGroup>
<EnvironmentVariables Include="DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)" />
<RepositoryReference Include="diagnostics" />
<RepositoryReference Include="runtime" />
<RepositoryReference Include="newtonsoft-json" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,35 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<BuildCommandArgs>pack</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(ProjectDirectory)src\XliffTasks\XliffTasks.csproj</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /v:$(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /flp:Verbosity=Diag</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /bl</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:TreatWarningsAsErrors=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(RedirectRepoOutputToLog)</BuildCommandArgs>
<BuildCommand>$(DotnetToolCommand) $(BuildCommandArgs)</BuildCommand>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<DependencyVersionInputRepoApiImplemented>true</DependencyVersionInputRepoApiImplemented>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
<IsToolingProject>true</IsToolingProject>
<NuGetConfigFile>$(ProjectDirectory)/NuGet.config</NuGetConfigFile>
<EnvironmentRestoreSources>$(SourceBuiltPackagesPath)</EnvironmentRestoreSources>
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' == 'true'">$(EnvironmentRestoreSources)%3B$(ReferencePackagesDir)%3B$(PrebuiltPackagesPath)</EnvironmentRestoreSources>
<EnvironmentRestoreSources Condition="'$(OfflineBuild)' != 'true'">$(EnvironmentRestoreSources)%3Bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public%40Local/nuget/v3/index.json</EnvironmentRestoreSources>
</PropertyGroup>
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
<EnvironmentVariables Include="Configuration=$(Configuration)" />
<EnvironmentVariables Include="RestoreSources=$(EnvironmentRestoreSources)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,411 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
usage()
{
echo "Builds a bootstrap CLI from sources"
echo "Usage: $0 [BuildType] -rid <Rid> -seedcli <SeedCli> [-os <OS>] [-clang <Major.Minor>] [-corelib <CoreLib>]"
echo ""
echo "Options:"
echo " BuildType Type of build (-debug, -release), default: -release"
echo " -clang <Major.Minor> Override of the version of clang compiler to use"
echo " -corelib <CoreLib> Path to System.Private.CoreLib.dll, default: use the System.Private.CoreLib.dll from the seed CLI"
echo " -os <OS> Operating system (used for corefx build), default: Linux"
echo " -rid <Rid> Runtime identifier including the architecture part (e.g. rhel.6-x64)"
echo " -seedcli <SeedCli> Seed CLI used to generate the target CLI"
echo " -outputpath <path> Optional output directory to contain the generated cli and cloned repos, default: <Rid>"
}
disable_pax_mprotect()
{
if [[ $(command -v paxctl) ]]; then
paxctl -c -m $1
fi
}
get_max_version()
{
local maxversionhi=0
local maxversionmid=0
local maxversionlo=0
local maxversiontag
local versionrest
local versionhi
local versionmid
local versionlo
local versiontag
local foundmax
for d in $1/*; do
if [[ -d $d ]]; then
versionrest=$(basename $d)
versionhi=${versionrest%%.*}
versionrest=${versionrest#*.}
versionmid=${versionrest%%.*}
versionrest=${versionrest#*.}
versionlo=${versionrest%%-*}
versiontag=${versionrest#*-}
if [[ $versiontag == $versionrest ]]; then
versiontag=""
fi
foundmax=0
if [[ $versionhi -gt $maxversionhi ]]; then
foundmax=1
elif [[ $versionhi -eq $maxversionhi ]]; then
if [[ $versionmid -gt $maxversionmid ]]; then
foundmax=1
elif [[ $versionmid -eq $maxversionmid ]]; then
if [[ $versionlo -gt $maxversionlo ]]; then
foundmax=1
elif [[ $versionlo -eq $maxversionlo ]]; then
# tags are used to mark pre-release versions, so a version without a tag
# is newer than a version with one.
if [[ "$versiontag" == "" || $versiontag > $maxversiontag ]]; then
foundmax=1
fi
fi
fi
fi
if [[ $foundmax != 0 ]]; then
maxversionhi=$versionhi
maxversionmid=$versionmid
maxversionlo=$versionlo
maxversiontag=$versiontag
fi
fi
done
echo $maxversionhi.$maxversionmid.$maxversionlo${maxversiontag:+-$maxversiontag}
}
getrealpath()
{
if command -v realpath > /dev/null; then
realpath $1
else
readlink -e $1
fi
}
__build_os=Linux
__runtime_id=
__corelib=
__configuration=release
__clangversion=
__outputpath=
while [[ "${1:-}" != "" ]]; do
lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
-h|--help)
usage
exit 1
;;
-rid)
shift
__runtime_id=$1
;;
-os)
shift
__build_os=$1
;;
-debug)
__configuration=debug
;;
-release)
__configuration=release
;;
-corelib)
shift
__corelib=`getrealpath $1`
;;
-seedcli)
shift
__seedclipath=`getrealpath $1`
;;
-clang)
shift
__clangversion=clang$1
;;
-outputpath)
shift
__outputpath=$1
;;
*)
echo "Unknown argument to build.sh $1"; exit 1
esac
shift
done
if [[ -z "$__runtime_id" ]]; then
echo "Missing the required -rid argument"
exit 2
fi
if [[ -z "$__seedclipath" ]]; then
echo "Missing the required -seedcli argument"
exit 3
fi
__build_arch=${__runtime_id#*-}
if [[ -z "$__outputpath" ]]; then
__outputpath=$__runtime_id/dotnetcli
fi
if [[ -d "$__outputpath" ]]; then
/bin/rm -r $__outputpath
fi
mkdir -p $__runtime_id
mkdir -p $__outputpath
__outputpath=`getrealpath $__outputpath`
cd $__runtime_id
cp -r $__seedclipath/* $__outputpath
__frameworkversion="2.0.0"
__sdkversion="2.0.0"
__fxrversion="2.0.0"
echo "**** DETECTING VERSIONS IN SEED CLI ****"
__frameworkversion=`get_max_version $__seedclipath/shared/Microsoft.NETCore.App`
__sdkversion=`get_max_version $__seedclipath/sdk`
__fxrversion=`get_max_version $__seedclipath/host/fxr`
echo "Framework version: $__frameworkversion"
echo "SDK version: $__sdkversion"
echo "FXR version: $__fxrversion"
__frameworkpath=$__outputpath/shared/Microsoft.NETCore.App/$__frameworkversion
echo "**** DETECTING GIT COMMIT HASHES ****"
# Extract the git commit hashes representig the state of the three repos that
# the seed cli package was built from
__coreclrhash=`strings $__seedclipath/shared/Microsoft.NETCore.App/$__frameworkversion/libcoreclr.so | grep "@(#)" | grep -o "[a-f0-9]\{40\}"`
__corefxhash=`strings $__seedclipath/shared/Microsoft.NETCore.App/$__frameworkversion/System.Native.so | grep "@(#)" | grep -o "[a-f0-9]\{40\}"`
__coresetuphash=`strings $__seedclipath/dotnet | grep "@(#)" | grep -o "[a-f0-9]\{40\}"`
if [[ "$__coresetuphash" == "" ]]; then
__coresetuphash=`strings $__seedclipath/dotnet | grep -o "[a-f0-9]\{40\}"`
fi
echo "coreclr hash: $__coreclrhash"
echo "corefx hash: $__corefxhash"
echo "core-setup hash: $__coresetuphash"
# Clone the three repos if they were not cloned yet. If the folders already
# exist, leave them alone. This allows patching the cloned sources as needed
if [[ ! -d coreclr ]]; then
echo "**** CLONING CORECLR REPOSITORY ****"
git clone https://github.com/dotnet/coreclr.git
cd coreclr
git checkout $__coreclrhash
cd ..
fi
if [[ ! -d corefx ]]; then
echo "**** CLONING COREFX REPOSITORY ****"
git clone https://github.com/dotnet/corefx.git
cd corefx
git checkout $__corefxhash
cd ..
fi
if [[ ! -d core-setup ]]; then
echo "**** CLONING CORE-SETUP REPOSITORY ****"
git clone https://github.com/dotnet/core-setup.git
cd core-setup
git checkout $__coresetuphash
cd ..
fi
echo "**** BUILDING CORE-SETUP NATIVE COMPONENTS ****"
cd core-setup
src/corehost/build.sh --configuration $__configuration --arch "$__build_arch" --hostver "2.0.0" --apphostver "2.0.0" --fxrver "2.0.0" --policyver "2.0.0" --commithash `git rev-parse HEAD`
cd ..
echo "**** BUILDING CORECLR NATIVE COMPONENTS ****"
cd coreclr
./build.sh $__configuration $__build_arch $__clangversion -skipgenerateversion -skipmanaged -skipmscorlib -skiprestore -skiprestoreoptdata -skipnuget -nopgooptimize 2>&1 | tee coreclr.log
export __coreclrbin=$(cat coreclr.log | sed -n -e 's/^.*Product binaries are available at //p')
cd ..
echo "CoreCLR binaries will be copied from $__coreclrbin"
echo "**** BUILDING COREFX NATIVE COMPONENTS ****"
corefx/src/Native/build-native.sh $__build_arch $__configuration $__clangversion $__build_os 2>&1 | tee corefx.log
export __corefxbin=$(cat corefx.log | sed -n -e 's/^.*Build files have been written to: //p')
echo "CoreFX binaries will be copied from $__corefxbin"
echo "**** Copying new binaries to dotnetcli/ ****"
# First copy the coreclr repo binaries
cp $__coreclrbin/*so $__frameworkpath
cp $__coreclrbin/corerun $__frameworkpath
cp $__coreclrbin/crossgen $__frameworkpath
# Mark the coreclr executables as allowed to create executable memory mappings
disable_pax_mprotect $__frameworkpath/corerun
disable_pax_mprotect $__frameworkpath/crossgen
# Now copy the core-setup repo binaries
if [[ $__fxrversion == 2* ]]; then
cp core-setup/cli/exe/dotnet/dotnet $__outputpath
cp core-setup/cli/exe/dotnet/dotnet $__frameworkpath/corehost
cp core-setup/cli/dll/libhostpolicy.so $__frameworkpath
cp core-setup/cli/dll/libhostpolicy.so $__outputpath/sdk/$__sdkversion
cp core-setup/cli/fxr/libhostfxr.so $__frameworkpath
cp core-setup/cli/fxr/libhostfxr.so $__outputpath/host/fxr/$__fxrversion
cp core-setup/cli/fxr/libhostfxr.so $__outputpath/sdk/$__sdkversion
else
cp core-setup/bin/$__runtime_id.$__configuration/corehost/dotnet $__outputpath
cp core-setup/bin/$__runtime_id.$__configuration/corehost/dotnet $__frameworkpath/corehost
cp core-setup/bin/$__runtime_id.$__configuration/corehost/libhostpolicy.so $__frameworkpath
cp core-setup/bin/$__runtime_id.$__configuration/corehost/libhostpolicy.so $__outputpath/sdk/$__sdkversion
cp core-setup/bin/$__runtime_id.$__configuration/corehost/libhostfxr.so $__frameworkpath
cp core-setup/bin/$__runtime_id.$__configuration/corehost/libhostfxr.so $__outputpath/host/fxr/$__fxrversion
cp core-setup/bin/$__runtime_id.$__configuration/corehost/libhostfxr.so $__outputpath/sdk/$__sdkversion
fi
# Mark the core-setup executables as allowed to create executable memory mappings
disable_pax_mprotect $__outputpath/dotnet
disable_pax_mprotect $__frameworkpath/corehost
# Finally copy the corefx repo binaries
cp $__corefxbin/**/System.* $__frameworkpath
# Copy System.Private.CoreLib.dll override from somewhere if requested
if [[ "$__corelib" != "" ]]; then
cp "$__corelib" $__frameworkpath
fi
# Add the new RID to Microsoft.NETCore.App.deps.json
# Replace the linux-x64 RID in the target, runtimeTarget and runtimes by the new RID
# and add the new RID to the list of runtimes.
echo "**** Adding new rid to Microsoft.NETCore.App.deps.json ****"
#TODO: add parameter with the parent RID sequence
sed \
-e 's/runtime\.linux-x64/runtime.'$__runtime_id'/g' \
-e 's/runtimes\/linux-x64/runtimes\/'$__runtime_id'/g' \
-e 's/Version=v\([0-9].[0-9]\)\/linux-x64/Version=v\1\/'$__runtime_id'/g' \
$__seedclipath/shared/Microsoft.NETCore.App/$__frameworkversion/Microsoft.NETCore.App.deps.json \
>$__frameworkpath/Microsoft.NETCore.App.deps.json
# add the new RID to the list of runtimes iff it does not already exist (sed inplace)
__os_dependencies=
if [[ $__build_os == "Linux" ]]; then
__os_dependencies='"linux", "linux-'$__build_arch'", '
fi
grep -q "\"$__runtime_id\":" $__frameworkpath/Microsoft.NETCore.App.deps.json || \
sed -i \
-e 's/"runtimes": {/&\n "'$__runtime_id'": [\n '"$__os_dependencies"'"unix", "unix-'$__build_arch'", "any", "base"\n ],/g' \
$__frameworkpath/Microsoft.NETCore.App.deps.json
__crossgentimeout=120
function crossgenone(){
echo $2/crossgen /MissingDependenciesOK /Platform_Assemblies_Paths $2:$3 /in $1 /out $1.ni >$1.log 2>&1
timeout $__crossgentimeout $2/crossgen /MissingDependenciesOK /Platform_Assemblies_Paths $2:$3 /in $1 /out $1.ni >>$1.log 2>&1
exitCode=$?
if [ "$exitCode" == "0" ]
then
rm $1.log
mv $1.ni $1
elif grep -q -e 'The module was expected to contain an assembly manifest' \
-e 'An attempt was made to load a program with an incorrect format.' \
-e 'File is PE32' $1.log
then
rm $1.log
echo "$1" >> crossgenskipped
else
echo "$1" >> crossgenretry
fi
}
# Run an assembly through ildasm ilasm roundtrip to remove x64 crossgen
function uncrossgenone(){
echo >> $1.log 2>&1
echo mv $1 $1.x64 >> $1.log 2>&1
echo $2/ildasm -raweh -out=$1.il $1.x64 "&& \\" >> $1.log 2>&1
echo $2/ilasm -output=$1 -QUIET -NOLOGO -DEBUG -OPTIMIZE $1.il >> $1.log 2>&1
mv $1 $1.x64
$2/ildasm -raweh -out=$1.il $1.x64 && \
$2/ilasm -output=$1 -DLL -QUIET -NOLOGO -DEBUG -OPTIMIZE $1.il
exitCode=$?
if [ "$exitCode" == "0" ]
then
rm $1.x64
rm $1.il
else
echo "$1" >> uncrossgenfails
fi
}
# if $__build_arch is not x64 then any dll which was crossgened for x64 must be recrossgened for $__build_arch
if [[ "$__build_arch" != "x64" ]]
then
echo "**** Beginning crossgen for $__build_arch target ****"
export -f crossgenone
export __crossgentimeout
rm -f crossgenretry crossgendlls crossgenskipped uncrossgenfails
# Assumes System.Private.CoreLib was already crossgened
find $__outputpath -type f -name \*.dll -or -name \*.exe | grep -v System.Private.CoreLib > crossgendlls
cat crossgendlls | xargs -P 0 -n 1 -I {} bash -c 'crossgenone "$@"' _ {} "$__frameworkpath" "$__outputpath/sdk/$__sdkversion"
echo
echo "**** Crossgen skipped for non-managed assembly files:"
echo
touch crossgenskipped
cat crossgenskipped
echo
echo "**** Crossgen failed for the following dlls:"
echo
touch crossgenretry
cat crossgenretry
echo
echo "**** Beginning uncrossgen for failed dlls ****"
echo
export -f uncrossgenone
rm -f $__coreclrbin/System.Private.CoreLib.dll
ln -s $__corelib $__coreclrbin/System.Private.CoreLib.dll
cat crossgenretry | xargs -P 0 -n 1 -I {} bash -c 'uncrossgenone "$@"' _ {} "$__coreclrbin"
rm -f $__coreclrbin/System.Private.CoreLib.dll
echo
echo "**** Uncrossgen failed for the following dlls:"
echo
touch uncrossgenfails
cat uncrossgenfails
fi
echo "**** Bootstrap CLI was successfully built ****"

View file

@ -0,0 +1,47 @@
@echo off
setlocal
set SCRIPT_ROOT=%~dp0
set REPO_ROOT=%SCRIPT_ROOT%..\..\
:arg_loop
set SET_DOCKERFILE=
set SET_DOCKERIMAGE=
if /I "%1" equ "-d" (set SET_DOCKERFILE=1)
if /I "%1" equ "--dockerfile" (set SET_DOCKERFILE=1)
if "%SET_DOCKERFILE%" == "1" (
echo "1: %1 2: %2"
set DOCKER_FILE=%2
shift /1
shift /1
goto :arg_loop
)
if /I "%1" equ "-i" (set SET_DOCKERIMAGE=1)
if /I "%1" equ "--image" (set SET_DOCKERIMAGE=1)
if "%SET_DOCKERIMAGE%" == "1" (
set DOCKER_IMAGE=%2
shift /1
shift /1
goto :arg_loop
)
if "%DOCKER_FILE%" == "" (
echo Missing required parameter --dockerfile [docker file dir]
exit /b 1
)
if "%DOCKER_IMAGE%" == "" (
echo Missing required parameter --image [image name]
exit /b 1
)
if EXIST "%DOCKER_FILE%\Dockerfile" (
docker build -q -f %DOCKER_FILE%\Dockerfile -t %DOCKER_IMAGE% %DOCKER_FILE%
) else (
echo Error: %DOCKER_FILE%\Dockerfile does not exist
exit /b 1
)
docker run -i -t --rm --init -v %REPO_ROOT%:/code -t -w /code %DOCKER_IMAGE% /bin/sh
endlocal

View file

@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
DOCKER_FILE=""
DOCKER_IMAGE=""
SCRIPT_ROOT="$(cd -P "$( dirname "$0" )" && pwd)"
REPO_ROOT="$(cd -P "$SCRIPT_ROOT/../../" && pwd)"
case $(echo $1 | awk '{print tolower($0)}') in
-d | --dockerfile)
DOCKER_FILE=$2
;;
-i | --image)
DOCKER_IMAGE=$2
;;
*)
echo "usage: $0 [[-d | --dockerfile] <path-to-dockerfile>] | [-i | --image] <image-id>]] cmd-to-run"
exit 1
;;
esac
shift
shift
if [ $DOCKER_FILE ]; then
if [ -d $DOCKER_FILE ]; then
DOCKER_FILE="$DOCKER_FILE/Dockerfile"
fi
DOCKER_FILE_DIR=$(dirname $DOCKER_FILE)
DOCKER_IMAGE=$(set -x ; docker build -q -f $DOCKER_FILE $DOCKER_FILE_DIR)
fi
DOCKER_USERADD_AND_SWITCH_CMD=""
if [ ! $(id -u) = 0 ]; then
DOCKER_USERADD_AND_SWITCH_CMD="useradd -m -u $(id -u) $(id -n -u) && su $(id -n -u) -c "
fi
ARGS=$(IFS=' ' ; echo $@)
(set -x ; docker run --rm --init -v $REPO_ROOT:/code -t $DOCKER_IMAGE /bin/sh -c "cd /code ; $DOCKER_USERADD_AND_SWITCH_CMD\"$ARGS\"")

View file

@ -0,0 +1,96 @@
#!/usr/bin/env bash
set -euo pipefail
script_root="$(cd -P "$( dirname "$0" )" && pwd)"
branch=master
branch_azdo=$branch
readme="$script_root/../README.md"
if [ ! -f "$readme" ]; then
echo "$readme must exist."
exit 1
fi
print_rows() {
echo '| OS | *Azure DevOps*<br/>Release |'
echo '| -- | :-- |'
row 'CentOS7.1' 'Production'
row 'CentOS7.1' 'Online'
row 'CentOS7.1' 'Offline'
row 'CentOS7.1' 'Offline Portable'
row 'Debian8.2' 'Production'
row 'Debian8.2' 'Online'
row 'Fedora29' 'Production'
row 'Fedora29' 'Online'
row 'Fedora29' 'Offline'
row 'Fedora29' 'Offline Portable'
row 'OSX' 'Production'
row 'Ubuntu16.04' 'Production'
row 'Windows' 'Production'
}
raw_print() {
printf '%s' "$1"
}
row() {
os=$1
job_type=$2
display_name=$os
if [ "$job_type" != "Production" ]; then
display_name="$display_name ($job_type)"
fi
printf "| $display_name | "
azdo
end
}
end() {
printf '\n'
}
azdo() {
job=$(raw_print $os | awk '{print tolower($0)}' | sed 's/\.//g')
# Fix case: AzDO has "sticky" casing across build def lifetime, so these names are inconsistent.
# https://dev.azure.com/dnceng/internal/_workitems/edit/98
case $os in
OSX|Windows)
job=$os
;;
esac
job_type_escaped=$(raw_print "$job_type" | sed 's/ /%20/g')
query="?branchName=$branch_azdo&jobname=$job&configuration=$job_type_escaped"
raw_print "[![Build Status](https://dev.azure.com/dnceng/internal/_apis/build/status/dotnet/source-build/source-build-CI$query)]"
raw_print "(https://dev.azure.com/dnceng/internal/_build/latest?definitionId=114&branchName=$branch_azdo) | "
}
none() {
raw_print '| '
}
cp "$readme" "$readme.old"
phase=before
while read line; do
if [ "$phase" = before ]; then
echo "$line"
if [ "$line" = '<!-- Generated table start -->' ]; then
print_rows
phase=skip
fi
elif [ "$phase" = skip ]; then
if [ "$line" = '<!-- Generated table end -->' ]; then
echo "$line"
phase=after
fi
else
echo "$line"
fi
done < "$readme.old" > "$readme"
rm "$readme.old"

View file

@ -0,0 +1,674 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_ROOT="$(cd -P "$( dirname "$0" )" && pwd)"
TARBALL_PREFIX=dotnet-sdk-
VERSION_PREFIX=5.0
# See https://github.com/dotnet/source-build/issues/579, this version
# needs to be compatible with the runtime produced from source-build
DEV_CERTS_VERSION_DEFAULT=5.0.0-preview.3
__ROOT_REPO=$(sed 's/\r$//' "$SCRIPT_ROOT/artifacts/obj/rootrepo.txt") # remove CR if mounted repo on Windows drive
executingUserHome=${HOME:-}
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
# Use uname to determine what the CPU is.
cpuName=$(uname -p)
# Some Linux platforms report unknown for platform, but the arch for machine.
if [[ "$cpuName" == "unknown" ]]; then
cpuName=$(uname -m)
fi
case $cpuName in
aarch64)
buildArch=arm64
;;
amd64|x86_64)
buildArch=x64
;;
armv*l)
buildArch=arm
;;
i686)
buildArch=x86
;;
*)
echo "Unknown CPU $cpuName detected, treating it as x64"
buildArch=x64
;;
esac
projectOutput=false
keepProjects=false
dotnetDir=""
configuration="Release"
excludeNonWebTests=false
excludeWebTests=false
excludeWebNoHttpsTests=false
excludeWebHttpsTests=false
excludeLocalTests=false
excludeOnlineTests=false
devCertsVersion="$DEV_CERTS_VERSION_DEFAULT"
testingDir="$SCRIPT_ROOT/testing-smoke"
cliDir="$testingDir/builtCli"
logFile="$testingDir/smoke-test.log"
restoredPackagesDir="$testingDir/packages"
testingHome="$testingDir/home"
archiveRestoredPackages=false
archivedPackagesDir="$testingDir/smoke-test-packages"
smokeTestPrebuilts="$SCRIPT_ROOT/packages/smoke-test-packages"
runningOnline=false
runningHttps=false
function usage() {
echo ""
echo "usage:"
echo " --dotnetDir the directory from which to run dotnet"
echo " --configuration the configuration being tested (default=Release)"
echo " --targetRid override the target rid to use when needed (e.g. for self-contained publish tests)"
echo " --projectOutput echo dotnet's output to console"
echo " --keepProjects keep projects after tests are complete"
echo " --minimal run minimal set of tests - local sources only, no web"
echo " --excludeNonWebTests don't run tests for non-web projects"
echo " --excludeWebTests don't run tests for web projects"
echo " --excludeWebNoHttpsTests don't run web project tests with --no-https"
echo " --excludeWebHttpsTests don't run web project tests with https using dotnet-dev-certs"
echo " --excludeLocalTests exclude tests that use local sources for nuget packages"
echo " --excludeOnlineTests exclude test that use online sources for nuget packages"
echo " --devCertsVersion <version> use dotnet-dev-certs <version> instead of default $DEV_CERTS_VERSION_DEFAULT"
echo " --prodConBlobFeedUrl <url> override the prodcon blob feed specified in ProdConFeed.txt, removing it if empty"
echo " --archiveRestoredPackages capture all restored packages to $archivedPackagesDir"
echo "environment:"
echo " prodConBlobFeedUrl override the prodcon blob feed specified in ProdConFeed.txt, removing it if empty"
echo ""
}
while :; do
if [ $# -le 0 ]; then
break
fi
lowerI="$(echo "$1" | awk '{print tolower($0)}')"
case $lowerI in
'-?'|-h|--help)
usage
exit 0
;;
--dotnetdir)
shift
dotnetDir="$1"
;;
--configuration)
shift
configuration="$1"
;;
--targetrid)
shift
targetRid="$1"
;;
--projectoutput)
projectOutput=true
;;
--keepprojects)
keepProjects=true
;;
--minimal)
excludeOnlineTests=true
;;
--excludenonwebtests)
excludeNonWebTests=true
;;
--excludewebtests)
excludeWebTests=true
;;
--excludewebnohttpstests)
excludeWebNoHttpsTests=true
;;
--excludewebhttpstests)
excludeWebHttpsTests=true
;;
--excludelocaltests)
excludeLocalTests=true
;;
--excludeonlinetests)
excludeOnlineTests=true
;;
--devcertsversion)
shift
devCertsVersion="$1"
;;
--prodconblobfeedurl)
shift
prodConBlobFeedUrl="$1"
;;
--archiverestoredpackages)
archiveRestoredPackages=true
;;
*)
echo "Unrecognized argument '$1'"
usage
exit 1
;;
esac
shift
done
prodConBlobFeedUrl="${prodConBlobFeedUrl-$(cat "$SCRIPT_ROOT/ProdConFeed.txt")}"
function doCommand() {
lang=$1
proj=$2
shift; shift;
echo "starting language $lang, type $proj" | tee -a smoke-test.log
dotnetCmd=${dotnetDir}/dotnet
mkdir "${lang}_${proj}"
cd "${lang}_${proj}"
newArgs="new $proj -lang $lang"
while :; do
if [ $# -le 0 ]; then
break
fi
case "$1" in
--new-arg)
shift
newArgs="$newArgs $1"
;;
*)
break
;;
esac
shift
done
while :; do
if [ $# -le 0 ]; then
break
fi
binlogOnlinePart="local"
binlogHttpsPart="nohttps"
if [ "$runningOnline" == "true" ]; then
binlogOnlinePart="online"
fi
if [ "$runningHttps" == "true" ]; then
binlogHttpsPart="https"
fi
binlogPrefix="$testingDir/${lang}_${proj}_${binlogOnlinePart}_${binlogHttpsPart}_"
binlog="${binlogPrefix}$1.binlog"
echo " running $1" | tee -a "$logFile"
if [ "$1" == "new" ]; then
if [ "$projectOutput" == "true" ]; then
"${dotnetCmd}" $newArgs --no-restore | tee -a "$logFile"
else
"${dotnetCmd}" $newArgs --no-restore >> "$logFile" 2>&1
fi
elif [[ "$1" == "run" && "$proj" =~ ^(web|mvc|webapi|razor|blazorwasm|blazorserver)$ ]]; then
# A separate log file that we will over-write all the time.
exitLogFile="$testingDir/exitLogFile"
echo > "$exitLogFile"
# Run an application in the background and redirect its
# stdout+stderr to a separate process (tee). The tee process
# writes its input to 2 files:
# - Either the normal log or stdout
# - A log that's only used to find out when it's safe to kill
# the application.
if [ "$projectOutput" == "true" ]; then
"${dotnetCmd}" $1 2>&1 > >(tee -a "$exitLogFile") &
else
"${dotnetCmd}" $1 2>&1 > >(tee -a "$logFile" "$exitLogFile" >/dev/null) &
fi
webPid=$!
killCommand="pkill -SIGTERM -P $webPid"
echo " waiting up to 30 seconds for web project with pid $webPid..."
echo " to clean up manually after an interactive cancellation, run: $killCommand"
for seconds in $(seq 30); do
if grep 'Application started. Press Ctrl+C to shut down.' "$exitLogFile"; then
echo " app ready for shutdown after $seconds seconds"
break
fi
sleep 1
done
echo " stopping $webPid" | tee -a "$logFile"
$killCommand
wait $!
echo " terminated with exit code $?" | tee -a "$logFile"
elif [ "$1" == "multi-rid-publish" ]; then
runPublishScenarios() {
"${dotnetCmd}" publish --self-contained false /bl:"${binlogPrefix}publish-fx-dep.binlog"
"${dotnetCmd}" publish --self-contained true -r "$targetRid" /bl:"${binlogPrefix}publish-self-contained-${targetRid}.binlog"
"${dotnetCmd}" publish --self-contained true -r linux-x64 /bl:"${binlogPrefix}publish-self-contained-portable.binlog"
}
if [ "$projectOutput" == "true" ]; then
runPublishScenarios | tee -a "$logFile"
else
runPublishScenarios >> "$logFile" 2>&1
fi
else
if [ "$projectOutput" == "true" ]; then
"${dotnetCmd}" $1 /bl:"$binlog" | tee -a "$logFile"
else
"${dotnetCmd}" $1 /bl:"$binlog" >> "$logFile" 2>&1
fi
fi
if [ $? -eq 0 ]; then
echo " $1 succeeded" >> "$logFile"
else
echo " $1 failed with exit code $?" | tee -a "$logFile"
fi
shift
done
cd ..
if [ "$keepProjects" == "false" ]; then
rm -rf "${lang}_${proj}"
fi
echo "finished language $lang, type $proj" | tee -a smoke-test.log
}
function setupDevCerts() {
echo "Setting up dotnet-dev-certs $devCertsVersion to generate dev certificate" | tee -a "$logFile"
(
set -x
"$dotnetDir/dotnet" tool install -g dotnet-dev-certs --version "$devCertsVersion" --add-source https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
export DOTNET_ROOT="$dotnetDir"
"$testingHome/.dotnet/tools/dotnet-dev-certs" https
) >> "$logFile" 2>&1
}
function runAllTests() {
# Run tests for each language and template
if [ "$excludeNonWebTests" == "false" ]; then
doCommand C# console new restore build run multi-rid-publish
doCommand C# classlib new restore build multi-rid-publish
doCommand C# xunit new restore test
doCommand C# mstest new restore test
doCommand VB console new restore build run multi-rid-publish
doCommand VB classlib new restore build multi-rid-publish
doCommand VB xunit new restore test
doCommand VB mstest new restore test
doCommand F# console new restore build run multi-rid-publish
doCommand F# classlib new restore build multi-rid-publish
doCommand F# xunit new restore test
doCommand F# mstest new restore test
fi
if [ "$excludeWebTests" == "false" ]; then
if [ "$excludeWebNoHttpsTests" == "false" ]; then
runningHttps=false
runWebTests --new-arg --no-https
fi
if [ "$excludeWebHttpsTests" == "false" ]; then
runningHttps=true
setupDevCerts
runWebTests
fi
fi
}
function runWebTests() {
doCommand C# web "$@" new restore build run multi-rid-publish
doCommand C# mvc "$@" new restore build run multi-rid-publish
doCommand C# webapi "$@" new restore build multi-rid-publish
doCommand C# razor "$@" new restore build run multi-rid-publish
doCommand C# blazorwasm "$@" new restore build run publish
doCommand C# blazorserver "$@" new restore build run publish
doCommand F# web "$@" new restore build run multi-rid-publish
doCommand F# mvc "$@" new restore build run multi-rid-publish
doCommand F# webapi "$@" new restore build run multi-rid-publish
}
function runXmlDocTests() {
targetingPacksDir="$dotnetDir/packs/"
echo "Looking for xml docs in targeting packs in $targetingPacksDir"
netstandardIgnoreList=(
Microsoft.Win32.Primitives.xml
mscorlib.xml
System.AppContext.xml
System.Buffers.xml
System.Collections.Concurrent.xml
System.Collections.NonGeneric.xml
System.Collections.Specialized.xml
System.Collections.xml
System.ComponentModel.Composition.xml
System.ComponentModel.EventBasedAsync.xml
System.ComponentModel.Primitives.xml
System.ComponentModel.TypeConverter.xml
System.ComponentModel.xml
System.Console.xml
System.Core.xml
System.Data.Common.xml
System.Data.xml
System.Diagnostics.Contracts.xml
System.Diagnostics.Debug.xml
System.Diagnostics.FileVersionInfo.xml
System.Diagnostics.Process.xml
System.Diagnostics.StackTrace.xml
System.Diagnostics.TextWriterTraceListener.xml
System.Diagnostics.Tools.xml
System.Diagnostics.TraceSource.xml
System.Diagnostics.Tracing.xml
System.Drawing.Primitives.xml
System.Drawing.xml
System.Dynamic.Runtime.xml
System.Globalization.Calendars.xml
System.Globalization.Extensions.xml
System.Globalization.xml
System.IO.Compression.FileSystem.xml
System.IO.Compression.xml
System.IO.Compression.ZipFile.xml
System.IO.FileSystem.DriveInfo.xml
System.IO.FileSystem.Primitives.xml
System.IO.FileSystem.Watcher.xml
System.IO.FileSystem.xml
System.IO.IsolatedStorage.xml
System.IO.MemoryMappedFiles.xml
System.IO.Pipes.xml
System.IO.UnmanagedMemoryStream.xml
System.IO.xml
System.Linq.Expressions.xml
System.Linq.Parallel.xml
System.Linq.Queryable.xml
System.Linq.xml
System.Memory.xml
System.Net.Http.xml
System.Net.NameResolution.xml
System.Net.NetworkInformation.xml
System.Net.Ping.xml
System.Net.Primitives.xml
System.Net.Requests.xml
System.Net.Security.xml
System.Net.Sockets.xml
System.Net.WebHeaderCollection.xml
System.Net.WebSockets.Client.xml
System.Net.WebSockets.xml
System.Net.xml
System.Numerics.Vectors.xml
System.Numerics.xml
System.ObjectModel.xml
System.Reflection.DispatchProxy.xml
System.Reflection.Emit.ILGeneration.xml
System.Reflection.Emit.Lightweight.xml
System.Reflection.Emit.xml
System.Reflection.Extensions.xml
System.Reflection.Primitives.xml
System.Reflection.xml
System.Resources.Reader.xml
System.Resources.ResourceManager.xml
System.Resources.Writer.xml
System.Runtime.CompilerServices.VisualC.xml
System.Runtime.Extensions.xml
System.Runtime.Handles.xml
System.Runtime.InteropServices.RuntimeInformation.xml
System.Runtime.InteropServices.xml
System.Runtime.Numerics.xml
System.Runtime.Serialization.Formatters.xml
System.Runtime.Serialization.Json.xml
System.Runtime.Serialization.Primitives.xml
System.Runtime.Serialization.xml
System.Runtime.Serialization.Xml.xml
System.Runtime.xml
System.Security.Claims.xml
System.Security.Cryptography.Algorithms.xml
System.Security.Cryptography.Csp.xml
System.Security.Cryptography.Encoding.xml
System.Security.Cryptography.Primitives.xml
System.Security.Cryptography.X509Certificates.xml
System.Security.Principal.xml
System.Security.SecureString.xml
System.ServiceModel.Web.xml
System.Text.Encoding.Extensions.xml
System.Text.Encoding.xml
System.Text.RegularExpressions.xml
System.Threading.Overlapped.xml
System.Threading.Tasks.Extensions.xml
System.Threading.Tasks.Parallel.xml
System.Threading.Tasks.xml
System.Threading.ThreadPool.xml
System.Threading.Thread.xml
System.Threading.Timer.xml
System.Threading.xml
System.Transactions.xml
System.ValueTuple.xml
System.Web.xml
System.Windows.xml
System.xml
System.Xml.Linq.xml
System.Xml.ReaderWriter.xml
System.Xml.Serialization.xml
System.Xml.XDocument.xml
System.Xml.xml
System.Xml.XmlDocument.xml
System.Xml.XmlSerializer.xml
System.Xml.XPath.XDocument.xml
System.Xml.XPath.xml
)
netcoreappIgnoreList=(
Microsoft.VisualBasic.xml
netstandard.xml
System.AppContext.xml
System.Buffers.xml
System.ComponentModel.DataAnnotations.xml
System.Configuration.xml
System.Core.xml
System.Data.DataSetExtensions.xml
System.Data.xml
System.Diagnostics.Debug.xml
System.Diagnostics.Tools.xml
System.Drawing.xml
System.Dynamic.Runtime.xml
System.Globalization.Calendars.xml
System.Globalization.Extensions.xml
System.Globalization.xml
System.IO.Compression.FileSystem.xml
System.IO.FileSystem.Primitives.xml
System.IO.UnmanagedMemoryStream.xml
System.IO.xml
System.Net.xml
System.Numerics.xml
System.Reflection.Extensions.xml
System.Reflection.xml
System.Resources.Reader.xml
System.Resources.ResourceManager.xml
System.Runtime.Extensions.xml
System.Runtime.Handles.xml
System.Runtime.Serialization.xml
System.Security.Principal.xml
System.Security.SecureString.xml
System.Security.xml
System.ServiceModel.Web.xml
System.ServiceProcess.xml
System.Text.Encoding.xml
System.Threading.Tasks.Extensions.xml
System.Threading.Tasks.xml
System.Threading.Timer.xml
System.Transactions.xml
System.ValueTuple.xml
System.Web.xml
System.Windows.xml
System.xml
System.Xml.Linq.xml
System.Xml.Serialization.xml
System.Xml.xml
System.Xml.XmlDocument.xml
)
error=0
while IFS= read -r -d '' dllFile; do
xmlDocFile=${dllFile%.*}.xml
skip=0
if [[ "$xmlDocFile" == *"/packs/Microsoft.NETCore.App.Ref"* ]]; then
xmlFileBasename=$(basename "$xmlDocFile")
for ignoreItem in "${netcoreappIgnoreList[@]}"; do
if [[ "$ignoreItem" == "$xmlFileBasename" ]]; then
skip=1;
break
fi
done
fi
if [[ "$xmlDocFile" == *"/packs/NETStandard.Library.Ref"* ]]; then
xmlFileBasename=$(basename "$xmlDocFile")
for ignoreItem in "${netstandardIgnoreList[@]}"; do
if [[ "$ignoreItem" == "$xmlFileBasename" ]]; then
skip=1;
break
fi
done
fi
if [[ $skip == 0 ]] && [[ ! -f "$xmlDocFile" ]]; then
error=1
echo "error: missing $xmlDocFile"
fi
done < <(find "$targetingPacksDir" -name '*.dll' -print0)
if [[ $error != 0 ]]; then
echo "error: Missing xml documents"
exit 1
else
echo "All expected xml docs are present"
fi
}
function resetCaches() {
rm -rf "$testingHome"
mkdir "$testingHome"
HOME="$testingHome"
# clean restore path
rm -rf "$restoredPackagesDir"
# Copy NuGet plugins if running user has HOME and we have auth. In particular, the auth plugin.
if [ "${internalPackageFeedPat:-}" ] && [ "${executingUserHome:-}" ]; then
cp -r "$executingUserHome/.nuget/" "$HOME/.nuget/" || :
fi
}
function setupProdConFeed() {
if [ "$prodConBlobFeedUrl" ]; then
sed -i.bakProdCon "s|PRODUCT_CONTRUCTION_PACKAGES|$prodConBlobFeedUrl|g" "$testingDir/NuGet.Config"
else
sed -i.bakProdCon "/PRODUCT_CONTRUCTION_PACKAGES/d" "$testingDir/NuGet.Config"
fi
}
function setupSmokeTestFeed() {
# Setup smoke-test-packages if they exist
if [ -e "$smokeTestPrebuilts" ]; then
sed -i.bakSmokeTestFeed "s|SMOKE_TEST_PACKAGE_FEED|$smokeTestPrebuilts|g" "$testingDir/NuGet.Config"
else
sed -i.bakSmokeTestFeed "/SMOKE_TEST_PACKAGE_FEED/d" "$testingDir/NuGet.Config"
fi
}
function copyRestoredPackages() {
if [ "$archiveRestoredPackages" == "true" ]; then
mkdir -p "$archivedPackagesDir"
cp -rf "$restoredPackagesDir"/* "$archivedPackagesDir"
fi
}
echo "RID to test: ${targetRid?not specified. Use ./build.sh --run-smoke-test to detect RID, or specify manually.}"
if [ "$__ROOT_REPO" != "known-good" ]; then
echo "Skipping smoke-tests since cli was not built";
exit
fi
# Clean up and create directory
if [ -e "$testingDir" ]; then
read -p "testing-smoke directory exists, remove it? [Y]es / [n]o" -n 1 -r
echo
if [[ $REPLY == "" || $REPLY == " " || $REPLY =~ ^[Yy]$ ]]; then
rm -rf "$testingDir"
fi
fi
mkdir -p "$testingDir"
cd "$testingDir"
# Create blank Directory.Build files to avoid traversing to source-build infra.
echo "<Project />" | tee Directory.Build.props > Directory.Build.targets
# Unzip dotnet if the dotnetDir is not specified
if [ "$dotnetDir" == "" ]; then
OUTPUT_DIR="$SCRIPT_ROOT/artifacts/$buildArch/$configuration/"
DOTNET_TARBALL="$(ls "${OUTPUT_DIR}${TARBALL_PREFIX}${VERSION_PREFIX}"*)"
mkdir -p "$cliDir"
tar xzf "$DOTNET_TARBALL" -C "$cliDir"
dotnetDir="$cliDir"
else
if ! [[ "$dotnetDir" = /* ]]; then
dotnetDir="$SCRIPT_ROOT/$dotnetDir"
fi
fi
echo SDK under test is:
"$dotnetDir/dotnet" --info
# setup restore path
export NUGET_PACKAGES="$restoredPackagesDir"
SOURCE_BUILT_PKGS_PATH="$SCRIPT_ROOT/artifacts/obj/$buildArch/$configuration/blob-feed/packages/"
export DOTNET_ROOT="$dotnetDir"
# OSX also requires DOTNET_ROOT to be on the PATH
if [ "$(uname)" == 'Darwin' ]; then
export PATH="$dotnetDir:$PATH"
fi
# Run all tests, local restore sources first, online restore sources second
if [ "$excludeLocalTests" == "false" ]; then
resetCaches
runningOnline=false
# Setup NuGet.Config with local restore source
if [ -e "$SCRIPT_ROOT/smoke-testNuGet.Config" ]; then
cp "$SCRIPT_ROOT/smoke-testNuGet.Config" "$testingDir/NuGet.Config"
sed -i.bak "s|SOURCE_BUILT_PACKAGES|$SOURCE_BUILT_PKGS_PATH|g" "$testingDir/NuGet.Config"
setupProdConFeed
setupSmokeTestFeed
echo "$testingDir/NuGet.Config Contents:"
cat "$testingDir/NuGet.Config"
fi
echo "RUN ALL TESTS - LOCAL RESTORE SOURCE"
runAllTests
copyRestoredPackages
echo "LOCAL RESTORE SOURCE - ALL TESTS PASSED!"
fi
if [ "$excludeOnlineTests" == "false" ]; then
resetCaches
runningOnline=true
# Setup NuGet.Config to use online restore sources
if [ -e "$SCRIPT_ROOT/smoke-testNuGet.Config" ]; then
cp "$SCRIPT_ROOT/smoke-testNuGet.Config" "$testingDir/NuGet.Config"
sed -i.bak "/SOURCE_BUILT_PACKAGES/d" "$testingDir/NuGet.Config"
setupProdConFeed
setupSmokeTestFeed
echo "$testingDir/NuGet.Config Contents:"
cat "$testingDir/NuGet.Config"
fi
echo "RUN ALL TESTS - ONLINE RESTORE SOURCE"
runAllTests
copyRestoredPackages
echo "ONLINE RESTORE SOURCE - ALL TESTS PASSED!"
fi
runXmlDocTests
echo "ALL TESTS PASSED!"

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<!-- Begin: Package sources from dotnet-roslyn-analyzers -->
<add key="darc-pub-dotnet-roslyn-analyzers-ce71b27" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-roslyn-analyzers-ce71b27b/nuget/v3/index.json" />
<!-- End: Package sources from dotnet-roslyn-analyzers -->
<!-- Begin: Package sources from dotnet-templating -->
<add key="darc-pub-dotnet-templating-8470ff3-4" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-templating-8470ff31-4/nuget/v3/index.json" />
<add key="darc-pub-dotnet-templating-8470ff3-3" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-templating-8470ff31-3/nuget/v3/index.json" />
<add key="darc-pub-dotnet-templating-8470ff3-2" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-templating-8470ff31-2/nuget/v3/index.json" />
<add key="darc-pub-dotnet-templating-8470ff3-1" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-templating-8470ff31-1/nuget/v3/index.json" />
<add key="darc-pub-dotnet-templating-8470ff3" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-templating-8470ff31/nuget/v3/index.json" />
<!-- End: Package sources from dotnet-templating -->
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
<add key="source-built-packages" value="SOURCE_BUILT_PACKAGES" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public%40Local/nuget/v3/index.json" />
</packageSources>
</configuration>

View file

@ -0,0 +1,13 @@
<Project>
<!--
Do not import the Arcade SDK for the local tooling projects. This lets us
build them with just the .NET Core SDK, simplifying tarball build.
-->
<PropertyGroup>
<SkipArcadeSdkImport>true</SkipArcadeSdkImport>
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)..))" />
</Project>

View file

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Target Name="AcquireDarcCore">
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Installing Darc." />
<Exec Command="$(RepositoryEngineeringDir)common/darc-init.sh --darcversion $(DarcVersion) --toolpath $(DarcInstallDir)" />
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Done installing Darc." />
</Target>
</Project>

View file

@ -0,0 +1,49 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<Target Name="Build">
<ItemGroup>
<AllRepoProjects
Include="$(ProjectDir)repos\*.proj"
Exclude="
$(ProjectDir)repos\known-good.proj;
$(ProjectDir)repos\known-good-tests.proj" />
</ItemGroup>
<MSBuild
Projects="@(AllRepoProjects)"
Targets="GetRepositoryReferences">
<Output TaskParameter="TargetOutputs" ItemName="RepoReferences" />
</MSBuild>
<ItemGroup>
<RepoLink Include="%(RepoReferences.MSBuildSourceProjectFile)" SourceRepo="%(RepoReferences.Identity)" />
<RepoLink TargetRepo="%(Filename)" />
<RepoLink Text="&quot;%(SourceRepo)&quot; -> &quot;%(TargetRepo)&quot;" />
</ItemGroup>
<PropertyGroup>
<GraphVizFile>$(BaseIntermediatePath)graphviz.dot</GraphVizFile>
<GraphVizPngFile>$(BaseIntermediatePath)graphviz.png</GraphVizPngFile>
<GraphVizContent>digraph {
graph [ dpi = 150 ]
@(RepoLink -> '%(Text)')
}</GraphVizContent>
</PropertyGroup>
<WriteLinesToFile
Lines="$(GraphVizContent)"
File="$(GraphVizFile)"
Overwrite="True" />
<Message Importance="High" Text="$(MSBuildProjectName) -> $(GraphVizFile)" />
<Exec
Condition="'$(GraphVizDir)' != ''"
Command="$([MSBuild]::NormalizePath('$(GraphVizDir)', 'dot')) $(GraphVizFile) -Tpng:cairo -o $(GraphVizPngFile)" />
<Message Condition="'$(GraphVizDir)' != ''" Importance="High" Text="$(MSBuildProjectName) -> $(GraphVizPngFile)" />
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

View file

@ -0,0 +1,170 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Import Project="$(OfflineAllRepoPropsFile)" Condition="Exists('$(OfflineAllRepoPropsFile)')" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteSourceRepoProperties" />
<UsingTask AssemblyFile="$(LeakDetectionTasksAssembly)" TaskName="MarkAndCatalogPackages" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="NuGetPack" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ZipFileExtractToDirectory" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceTextInFile" />
<ItemGroup>
<BuildTasksTarget Include="Restore;Build;InstallResolver" />
</ItemGroup>
<!-- TODO: Don't setup these sources now. Need a switch for building to check prebuilts.
Currently, tarball build allows online restore sources.
See https://github.com/dotnet/source-build/issues/2255 -->
<PropertyGroup Condition="'$(OfflineBuild)' == 'true' AND 'false' == 'true' ">
<BuildTasksOfflineSources>$(ReferencePackagesDir)%3B$(PrebuiltPackagesPath)</BuildTasksOfflineSources>
</PropertyGroup>
<Target Name="Build">
<CallTarget Targets="
UnpackTarballs;
BuildXPlatTasks;
ExtractToolPackage;
GenerateRootFs;
ApplyPatches;
PoisonPrebuiltPackages" />
</Target>
<Target Name="PrepareOfflineLocalTools"
DependsOnTargets="
ExtractToolPackage;
BuildXPlatTasks" />
<Target Name="Clean">
<Delete Files="$(CompletedSemaphorePath)*.*" />
</Target>
<Target Name="UnpackTarballs"
Condition="'$(OfflineBuild)' == 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)UnpackTarballs.complete" >
<!-- Make this directory here even though we're no
longer unpacking into it because some restore sources are looking
for it. Keeping this because once source-build-reference-packages
is built, the resulting packages will be put here. -->
<MakeDir Directories="$(ReferencePackagesDir)" />
<MakeDir Directories="$(PrebuiltSourceBuiltPackagesPath)" Condition="'$(CustomPrebuiltSourceBuiltPackagesPath)' == ''" />
<Exec Command="tar -xzf $(ExternalTarballsDir)$(SourceBuiltArtifactsTarballName).*.tar.gz"
WorkingDirectory="$(PrebuiltSourceBuiltPackagesPath)"
Condition="'$(CustomPrebuiltSourceBuiltPackagesPath)' == ''" />
<Copy SourceFiles="$(PrebuiltSourceBuiltPackagesPath)PackageVersions.props" DestinationFiles="$(IntermediatePath)SourceBuiltPackageVersions.props" />
<!-- Setup the PackageVersions.props file to be a combination of SourceBuilt and GennedPackages -->
<PropertyGroup>
<PackageVersionsPropsFile>$(IntermediatePath)PackageVersions.props</PackageVersionsPropsFile>
<PackageVersionsPropsContents>
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="SourceBuiltPackageVersions.props" Condition="Exists('SourceBuiltPackageVersions.props')" />
<Import Project="GennedPackageVersions.props" Condition="Exists('GennedPackageVersions.props')" />
</Project>
]]>
</PackageVersionsPropsContents>
</PropertyGroup>
<WriteLinesToFile File="$(PackageVersionsPropsFile)"
Lines="$(PackageVersionsPropsContents)"
Overwrite="true" />
<WriteLinesToFile File="$(CompletedSemaphorePath)UnpackTarballs.complete" Overwrite="true" />
</Target>
<Target Name="BuildXPlatTasks"
DependsOnTargets="UnpackTarballs"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)BuildXPlatTasks.complete">
<MSBuild
Projects="
tasks\Microsoft.DotNet.SourceBuild.Tasks.XPlat\Microsoft.DotNet.SourceBuild.Tasks.XPlat.csproj;
tasks\SourceBuild.MSBuildSdkResolver\SourceBuild.MSBuildSdkResolver.csproj"
Targets="%(BuildTasksTarget.Identity)"
SkipNonexistentTargets="true"
Properties="
RestoreSources=$(BuildTasksOfflineSources);
__ToolInitPhase=%(BuildTasksTarget.Identity)" />
<WriteLinesToFile File="$(CompletedSemaphorePath)BuildXPlatTasks.complete" Overwrite="true" />
</Target>
<Target Name="GetRepoProjects">
<ItemGroup>
<RepoProjects Include="$(ProjectDir)repos/*.proj" />
</ItemGroup>
</Target>
<Target Name="ApplyPatches" DependsOnTargets="GetRepoProjects">
<Message Text="Applying patches only" />
<MSBuild Projects="@(RepoProjects)" Targets="ApplyPatches" BuildInParallel="$(BuildInParallel)" />
</Target>
<Target Name="GenerateRootFs" Condition="'$(OS)' != 'Windows_NT'">
<Exec Condition="$(Platform.Contains('arm')) AND '$(Platform)' != 'armel' AND '$(BuildArchitecture)' != 'arm64'" Command="$(ArmEnvironmentVariables) $(ProjectDir)cross/build-rootfs.sh" />
<Exec Condition="'$(Platform)' == 'armel'" Command="$(ArmEnvironmentVariables) $(ProjectDir)cross/armel/tizen-build-rootfs.sh" />
</Target>
<Target Name="BuildTextOnlyPackages"
Condition="'$(OfflineBuild)' == 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)BuildTextOnlyPackages.complete">
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Packing text-only packages." />
<ItemGroup>
<TextOnlyPackageNuspecFile Include="$(TextOnlyPackageBaseDir)/**/*.nuspec" />
</ItemGroup>
<NugetPack
Nuspecs="%(TextOnlyPackageNuspecFile.Identity)"
OutputDirectory="$(SourceBuiltPackagesPath)"
ExcludeEmptyDirectories="false"
CreateSymbolPackage="false" />
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Done packing text-only packages." />
<WriteLinesToFile File="$(CompletedSemaphorePath)BuildTextOnlyPackages.complete" Overwrite="true" />
</Target>
<Target Name="ExtractToolPackage"
DependsOnTargets="UnpackTarballs;BuildXPlatTasks"
Condition="'$(OfflineBuild)' == 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)ExtractToolPackage.complete">
<ZipFileExtractToDirectory SourceArchive="$(PrebuiltSourceBuiltPackagesPath)Microsoft.DotNet.Arcade.Sdk.$(ARCADE_BOOTSTRAP_VERSION).nupkg"
DestinationDirectory="$(ArcadeBootstrapPackageDir)microsoft.dotnet.arcade.sdk/$(ARCADE_BOOTSTRAP_VERSION)/"
OverwriteDestination="true" />
<!-- TODO: When unpacking using ZipFileExtractToDirectory, this executable file has the wrong
permissions. See https://github.com/dotnet/source-build/issues/2259 -->
<Exec Command="chmod 755 git-clone-to-dir.sh"
WorkingDirectory="$(ArcadeBootstrapPackageDir)microsoft.dotnet.arcade.sdk/$(ARCADE_BOOTSTRAP_VERSION)/tools/SourceBuild/" />
<ReplaceTextInFile InputFile="$(ArcadeBootstrapPackageDir)microsoft.dotnet.arcade.sdk/$(ARCADE_BOOTSTRAP_VERSION)/tools/SourceBuild/SourceBuildArcadeTools.targets"
OldText="%3CReadSourceBuildIntermediateNupkgDependencies"
NewText="%3CReadSourceBuildIntermediateNupkgDependencies Condition=&quot;'%24%28DotNetBuildOffline%29' != 'true'&quot;" />
<WriteLinesToFile File="$(CompletedSemaphorePath)ExtractToolPackage.complete" Overwrite="true" />
</Target>
<Target Name="PoisonPrebuiltPackages"
Condition="'$(EnablePoison)' == 'true' and '$(OfflineBuild)' == 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)PoisonPrebuiltPackages.complete">
<ItemGroup>
<PrebuiltPackages Include="$(PrebuiltPackagesPath)**/*.nupkg" />
<PrebuiltSourceBuiltPackages Include="$(PrebuiltSourceBuiltPackagesPath)**/*.nupkg" />
</ItemGroup>
<MarkAndCatalogPackages PackagesToMark="@(PrebuiltPackages)" CatalogOutputFilePath="$(PoisonReportDataFile)" MarkerFileName="$(PoisonMarkerFile)" />
<MarkAndCatalogPackages PackagesToMark="@(PrebuiltSourceBuiltPackages)" CatalogOutputFilePath="$(SourceBuiltPoisonReportDataFile)" MarkerFileName="$(SourceBuiltPoisonMarkerFile)" />
<WriteLinesToFile File="$(CompletedSemaphorePath)PoisonPrebuiltPackages.complete" Overwrite="true" />
</Target>
</Project>

View file

@ -0,0 +1,46 @@
<UsageData>
<CreatedByRid>centos.7-x64</CreatedByRid>
<ProjectDirectories>
<Dir>src/ApplicationInsights-dotnet.53b80940842204f78708a538628288ff5d741a1d/</Dir>
<Dir>src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/</Dir>
<Dir>src/xdt.c01a538851a8ab1a1fbeb2e6243f391fff7587b4/</Dir>
<Dir>src/dotnet-aspnetcore.2670c128d522473e146ff9f8159bfffdfe694cd9/</Dir>
<Dir>src/cliCommandLineParser.0e89c2116ad28e404ba56c14d1c3f938caa25a01/</Dir>
<Dir>src/command-line-api.afd010ba8cb3cbd714c734465d1a5de1ee133e2d/</Dir>
<Dir>src/common.6e37cdfe96ac8b06a923242120169fafacd720e6/</Dir>
<Dir>src/cssparser.d6d86bcd8c162b1ae22ef00955ff748d028dd0ee/</Dir>
<Dir>src/diagnostics.47296ca69bb66180c132f3b16667f904dfc7c6c7/</Dir>
<Dir>src/fsharp.da6be68280c89131cdba2045525b80890401defd/</Dir>
<Dir>src/Humanizer.b30550eed103a6970d8465fe7c5c16300b70be81/</Dir>
<Dir>src/dotnet-installer.71365b4d424b0860ceb9ad8ee47f7cd08c55c362/</Dir>
<Dir>src/known-good-tests./</Dir>
<Dir>src/known-good./</Dir>
<Dir>src/linker.25604250cf2663aed6630e305cc0538aeebda80a/</Dir>
<Dir>src/msbuild.39993bd9d02917993b6147a9973dc3aa6e9b00c7/</Dir>
<Dir>src/netcorecli-fsc/</Dir>
<Dir>src/Newtonsoft.Json.cac0690ad133c5e166ce5642dc71175791404fad/</Dir>
<Dir>src/Newtonsoft.Json.e43dae94c26f0c30e9095327a3a9eac87193923d/</Dir>
<Dir>src/NuGet.Client.830c8be45dbbccd411ecf6080abff0c2c98079cf/</Dir>
<Dir>src/package-source-build/</Dir>
<Dir>src/roslyn-analyzers.77b259353aa44ec1510951a75c6e7ed6e662a001/</Dir>
<Dir>src/roslyn.9ed4b774d20940880de8df1ca8b07508aa01c8cd/</Dir>
<Dir>src/dotnet-runtime.cb5f173b9696d9d00a544b953d95190ab3b56df2/</Dir>
<Dir>src/dotnet-runtime.cb5f173b9696d9d00a544b953d95190ab3b56df2/</Dir>
<Dir>src/dotnet-sdk.ef14c79a16171496e2d972edd9a7874d596f624d/</Dir>
<Dir>src/sourcelink.f175b06862f889474b689a57527e489101c774cc/</Dir>
<Dir>src/symreader.f8a3ba85aed339fb8d08ca26f3876b28c32d58ee/</Dir>
<Dir>src/templating.568c09b99075179607c572f7b9f3ad3d706f1fc3/</Dir>
<Dir>src/test-templates.956e14dedd3a3ac981b320d66c6d389387a2954a/</Dir>
<Dir>src/vstest.212656d7b384a506aa714999f678b3ace82d114e/</Dir>
<Dir>src/xliff-tasks.a52f3d7fb58470749ee4035fbbcb7e63c78b0459/</Dir>
<Dir>Tools/</Dir>
<Dir>tools-local/tasks/</Dir>
<Dir>artifacts/obj/</Dir>
<Dir></Dir>
</ProjectDirectories>
<Usages>
<Usage Id="Microsoft.DotNet.Web.ItemTemplates" Version="5.0.2" />
<Usage Id="Microsoft.DotNet.Web.ProjectTemplates.5.0" Version="5.0.2" />
<Usage Id="Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0" Version="5.0.2" />
</Usages>
</UsageData>

View file

@ -0,0 +1,457 @@
<UsageData>
<CreatedByRid>centos.7-x64</CreatedByRid>
<ProjectDirectories>
<Dir>artifacts/src/ApplicationInsights-dotnet.53b80940842204f78708a538628288ff5d741a1d/</Dir>
<Dir>artifacts/src/arcade.6eec4404c2df5bfa46e5da52383c881c5cca3a9f/</Dir>
<Dir>artifacts/src/xdt.c01a538851a8ab1a1fbeb2e6243f391fff7587b4/</Dir>
<Dir>artifacts/src/dotnet-aspnetcore.b7a2ec8c7ed6b48857af0a69688a73e8c14fe6cb/</Dir>
<Dir>artifacts/src/CliCommandLineParser.0e89c2116ad28e404ba56c14d1c3f938caa25a01/</Dir>
<Dir>artifacts/src/command-line-api.6ddde11ed45e3f4b9d80c97670f347dbfda15c3f/</Dir>
<Dir>artifacts/src/common.6e37cdfe96ac8b06a923242120169fafacd720e6/</Dir>
<Dir>artifacts/src/cssparser.d6d86bcd8c162b1ae22ef00955ff748d028dd0ee/</Dir>
<Dir>artifacts/src/diagnostics.47296ca69bb66180c132f3b16667f904dfc7c6c7/</Dir>
<Dir>artifacts/src/fsharp.7ce7132f1459095e635194d09d6f73265352029a/</Dir>
<Dir>artifacts/src/Humanizer.b30550eed103a6970d8465fe7c5c16300b70be81/</Dir>
<Dir>artifacts/src/dotnet-installer.db7cc87d512335808e3806067f2bf9b31379e1db/</Dir>
<Dir>artifacts/src/known-good-tests./</Dir>
<Dir>artifacts/src/known-good./</Dir>
<Dir>artifacts/src/linker.c43f981eec336c1dc4fd0ead84b5e09db9377d9e/</Dir>
<Dir>artifacts/src/msbuild.5e4b48a27efce55a613664b58d353ab4c8d1f6c1/</Dir>
<Dir>src/netcorecli-fsc/</Dir>
<Dir>artifacts/src/Newtonsoft.Json.cac0690ad133c5e166ce5642dc71175791404fad/</Dir>
<Dir>artifacts/src/Newtonsoft.Json.e43dae94c26f0c30e9095327a3a9eac87193923d/</Dir>
<Dir>artifacts/src/nuget.client.d525b0e670f3b6cbd5c73a35f04730a9f658c852/</Dir>
<Dir>src/package-source-build/</Dir>
<Dir>artifacts/src/roslyn-analyzers.ce71b27be743710012c0460071da188b2f05959c/</Dir>
<Dir>artifacts/src/roslyn.59eedc33d35754759994155ea2f4e1012a9951e3/</Dir>
<Dir>artifacts/src/dotnet-runtime.2f740adc1457e8a28c1c072993b66f515977eb51/</Dir>
<Dir>artifacts/src/dotnet-runtime.2f740adc1457e8a28c1c072993b66f515977eb51/</Dir>
<Dir>artifacts/src/dotnet-sdk.51369266643769f9f0c1184e89715cd1045126d0/</Dir>
<Dir>artifacts/src/sourcelink.f175b06862f889474b689a57527e489101c774cc/</Dir>
<Dir>artifacts/src/symreader.f8a3ba85aed339fb8d08ca26f3876b28c32d58ee/</Dir>
<Dir>artifacts/src/templating.8470ff317250d761c72f920b8ea1c0700b230eb3/</Dir>
<Dir>artifacts/src/test-templates.956e14dedd3a3ac981b320d66c6d389387a2954a/</Dir>
<Dir>artifacts/src/vstest.99b911a57a02fc5d2eeef23e9ab8cbea4505678b/</Dir>
<Dir>artifacts/src/xliff-tasks.a52f3d7fb58470749ee4035fbbcb7e63c78b0459/</Dir>
<Dir>Tools/</Dir>
<Dir>tools-local/tasks/</Dir>
<Dir>artifacts/obj/</Dir>
<Dir></Dir>
</ProjectDirectories>
<Usages>
<!-- OSX-only prebuilts. please do not remove these when updating this baseline, except for updating versions when necessary -->
<Usage Id="Microsoft.AspNetCore.App.Runtime.linux-x64" Version="5.0.0-rc.1.20451.17" />
<Usage Id="Microsoft.Dotnet.WinForms.ProjectTemplates" Version="4.8.1-servicing.19605.5" />
<Usage Id="Microsoft.Dotnet.WinForms.ProjectTemplates" Version="5.0.0-rc.1.20451.14" />
<Usage Id="Microsoft.NETCore.App.Host.linux-x64" Version="5.0.0-rc.1.20451.14" />
<!-- End OSX-only prebuilts -->
<Usage Id="MicroBuild.Core" Version="0.2.0" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="MicroBuild.Core" Version="0.3.0" IsDirectDependency="true" />
<Usage Id="MicroBuild.Core.Sentinel" Version="1.0.0" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="Microsoft.AspNetCore.App.Ref" Version="3.0.1" />
<Usage Id="Microsoft.AspNetCore.App.Ref" Version="3.1.10" />
<Usage Id="Microsoft.AspNetCore.App.Ref" Version="5.0.0" />
<Usage Id="Microsoft.AspNetCore.Components.WebAssembly.Templates" Version="3.2.1" />
<Usage Id="Microsoft.Bcl.AsyncInterfaces" Version="1.1.0" />
<Usage Id="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0-rc.1.20451.14" />
<Usage Id="Microsoft.Build" Version="15.7.179" IsDirectDependency="true" />
<Usage Id="Microsoft.Build.CentralPackageVersions" Version="2.0.1" />
<Usage Id="Microsoft.Build.Framework" Version="15.1.1012" IsDirectDependency="true" />
<Usage Id="Microsoft.Build.Framework" Version="15.3.409" IsDirectDependency="true" />
<Usage Id="Microsoft.Build.Framework" Version="15.4.8" IsDirectDependency="true" />
<Usage Id="Microsoft.Build.Framework" Version="15.7.179" />
<Usage Id="Microsoft.Build.Tasks.Core" Version="15.3.409" IsDirectDependency="true" />
<Usage Id="Microsoft.Build.Tasks.Core" Version="15.7.179" IsDirectDependency="true" />
<Usage Id="Microsoft.Build.Traversal" Version="2.1.1" />
<Usage Id="Microsoft.Build.Utilities.Core" Version="15.1.1012" IsDirectDependency="true" />
<Usage Id="Microsoft.Build.Utilities.Core" Version="15.3.409" />
<Usage Id="Microsoft.Build.Utilities.Core" Version="15.4.8" IsDirectDependency="true" />
<Usage Id="Microsoft.Build.Utilities.Core" Version="15.7.179" />
<Usage Id="Microsoft.CodeAnalysis.Analyzers" Version="2.6.1" />
<Usage Id="Microsoft.CodeAnalysis.Analyzers" Version="2.9.6" />
<Usage Id="Microsoft.CodeAnalysis.Analyzers" Version="3.0.0" />
<Usage Id="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.0" IsDirectDependency="true" />
<Usage Id="Microsoft.CodeAnalysis.Common" Version="2.9.0" />
<Usage Id="Microsoft.CodeAnalysis.Common" Version="3.4.0" />
<Usage Id="Microsoft.CodeAnalysis.Common" Version="3.8.0" IsDirectDependency="true" />
<Usage Id="Microsoft.CodeAnalysis.CSharp" Version="2.9.0" IsDirectDependency="true" />
<Usage Id="Microsoft.CodeAnalysis.CSharp" Version="3.4.0" IsDirectDependency="true" />
<Usage Id="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="3.8.0-5.20519.18" IsDirectDependency="true" />
<Usage Id="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="3.8.0" IsDirectDependency="true" />
<Usage Id="Microsoft.CodeAnalysis.VisualBasic.CodeStyle" Version="3.8.0-5.20519.18" IsDirectDependency="true" />
<Usage Id="Microsoft.CodeAnalysis.VisualBasic.CodeStyle" Version="3.8.0" IsDirectDependency="true" />
<Usage Id="Microsoft.CSharp" Version="4.0.1" IsDirectDependency="true" />
<Usage Id="Microsoft.CSharp" Version="4.3.0" IsDirectDependency="true" />
<Usage Id="Microsoft.Docker.Sdk" Version="1.1.0" />
<Usage Id="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.20426.4" />
<Usage Id="Microsoft.DotNet.Common.ItemTemplates" Version="1.0.2-beta3" />
<Usage Id="Microsoft.DotNet.Common.ItemTemplates" Version="2.0.0-preview8.19373.1" />
<Usage Id="Microsoft.DotNet.Common.ItemTemplates" Version="3.1.10" />
<Usage Id="Microsoft.DotNet.PlatformAbstractions" Version="2.1.0" />
<Usage Id="Microsoft.DotNet.SignTool" Version="5.0.0-beta.20426.4" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="microsoft.dotnet.templateLocator" Version="5.0.100-rc.1.20421.19" />
<Usage Id="Microsoft.DotNet.Web.ItemTemplates" Version="2.1.27" />
<Usage Id="Microsoft.DotNet.Web.ItemTemplates" Version="3.0.1" />
<Usage Id="Microsoft.DotNet.Web.ItemTemplates" Version="3.1.14" />
<Usage Id="Microsoft.DotNet.Web.ProjectTemplates.2.1" Version="2.1.27" />
<Usage Id="Microsoft.DotNet.Web.ProjectTemplates.3.0" Version="3.0.1" />
<Usage Id="Microsoft.DotNet.Web.ProjectTemplates.3.1" Version="3.1.14" />
<Usage Id="Microsoft.DotNet.Web.Spa.ProjectTemplates.2.1" Version="2.1.27" />
<Usage Id="Microsoft.DotNet.Web.Spa.ProjectTemplates.3.0" Version="3.0.1" />
<Usage Id="Microsoft.DotNet.Web.Spa.ProjectTemplates.3.1" Version="3.1.14" />
<Usage Id="Microsoft.Extensions.DependencyInjection" Version="5.0.0" />
<Usage Id="Microsoft.Extensions.DependencyModel" Version="2.1.0" IsDirectDependency="true" />
<Usage Id="Microsoft.Extensions.DependencyModel" Version="3.1.6" IsDirectDependency="true" />
<Usage Id="Microsoft.FSharp.Compiler" Version="11.3.2-beta.21102.9" IsDirectDependency="true" />
<Usage Id="Microsoft.NET.Sdk.IL" Version="5.0.0-preview.8.20359.4" />
<Usage Id="Microsoft.NETCore.App" Version="2.0.0" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="Microsoft.NETCore.App" Version="2.1.0" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="Microsoft.NETCore.App.Ref" Version="3.0.0" />
<Usage Id="Microsoft.NETCore.App.Ref" Version="3.1.0" />
<Usage Id="Microsoft.NETCore.App.Ref" Version="5.0.0" />
<Usage Id="Microsoft.NETCore.DotNetAppHost" Version="2.0.0" />
<Usage Id="Microsoft.NETCore.DotNetAppHost" Version="2.1.0" />
<Usage Id="Microsoft.NETCore.DotNetHostPolicy" Version="2.0.0" />
<Usage Id="Microsoft.NETCore.DotNetHostPolicy" Version="2.1.0" />
<Usage Id="Microsoft.NETCore.DotNetHostResolver" Version="2.0.0" />
<Usage Id="Microsoft.NETCore.DotNetHostResolver" Version="2.1.0" />
<Usage Id="Microsoft.NETCore.Platforms" Version="1.0.1" />
<Usage Id="Microsoft.NETCore.Platforms" Version="1.1.0" />
<Usage Id="Microsoft.NETCore.Platforms" Version="1.1.1" />
<Usage Id="Microsoft.NETCore.Platforms" Version="2.0.0" />
<Usage Id="Microsoft.NETCore.Platforms" Version="2.1.0" IsDirectDependency="true" />
<Usage Id="Microsoft.NETCore.Platforms" Version="2.1.2" />
<Usage Id="Microsoft.NETCore.Platforms" Version="3.1.0" />
<Usage Id="Microsoft.NETCore.Targets" Version="1.0.1" />
<Usage Id="Microsoft.NETCore.Targets" Version="1.1.0" />
<Usage Id="Microsoft.NETCore.Targets" Version="1.1.3" />
<Usage Id="Microsoft.NETCore.Targets" Version="2.1.0" />
<Usage Id="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="Microsoft.NETFramework.ReferenceAssemblies.net20" Version="1.0.0-preview.2" />
<Usage Id="Microsoft.NETFramework.ReferenceAssemblies.net40" Version="1.0.0" />
<Usage Id="Microsoft.NETFramework.ReferenceAssemblies.net45" Version="1.0.0" />
<Usage Id="Microsoft.NETFramework.ReferenceAssemblies.net46" Version="1.0.0" />
<Usage Id="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.0" />
<Usage Id="Microsoft.NETFramework.ReferenceAssemblies.net462" Version="1.0.0" />
<Usage Id="Microsoft.NETFramework.ReferenceAssemblies.net47" Version="1.0.0" />
<Usage Id="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.0-preview.2" />
<Usage Id="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.0" />
<Usage Id="Microsoft.NETFramework.ReferenceAssemblies.net48" Version="1.0.0" />
<Usage Id="Microsoft.SymbolUploader.Build.Task" Version="1.1.141804" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="1.16.30" />
<Usage Id="Microsoft.Win32.Primitives" Version="4.0.1" />
<Usage Id="Microsoft.Win32.Primitives" Version="4.3.0" />
<Usage Id="Microsoft.Win32.Registry" Version="4.0.0" />
<Usage Id="Microsoft.Win32.Registry" Version="4.3.0" />
<Usage Id="Microsoft.Win32.Registry" Version="4.7.0" />
<Usage Id="Microsoft.Win32.SystemEvents" Version="4.7.0" />
<Usage Id="NETStandard.Library" Version="1.6.0" />
<Usage Id="NETStandard.Library" Version="1.6.1" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="NETStandard.Library" Version="2.0.0" />
<Usage Id="NETStandard.Library" Version="2.0.3" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="NETStandard.Library" Version="2.2.0-prerelease.19564.1" />
<Usage Id="NETStandard.Library.NETFramework" Version="2.0.1-servicing-26011-01" IsDirectDependency="true" />
<Usage Id="NETStandard.Library.Ref" Version="2.1.0" />
<Usage Id="NuGet.Commands" Version="5.6.0-preview.2.6489+5433d816f748d4ad78b75fc320397d8117f57771" />
<Usage Id="NuGet.Common" Version="5.1.0+08414feaac77473f29f6ac182ab4c390ecd3542f" />
<Usage Id="NuGet.Common" Version="5.6.0-preview.2.6489+5433d816f748d4ad78b75fc320397d8117f57771" />
<Usage Id="NuGet.Configuration" Version="5.1.0+08414feaac77473f29f6ac182ab4c390ecd3542f" />
<Usage Id="NuGet.Configuration" Version="5.6.0-preview.2.6489+5433d816f748d4ad78b75fc320397d8117f57771" />
<Usage Id="NuGet.Credentials" Version="5.6.0-preview.2.6489+5433d816f748d4ad78b75fc320397d8117f57771" />
<Usage Id="NuGet.DependencyResolver.Core" Version="5.1.0+08414feaac77473f29f6ac182ab4c390ecd3542f" />
<Usage Id="NuGet.DependencyResolver.Core" Version="5.6.0-preview.2.6489+5433d816f748d4ad78b75fc320397d8117f57771" />
<Usage Id="NuGet.Frameworks" Version="5.1.0+08414feaac77473f29f6ac182ab4c390ecd3542f" />
<Usage Id="NuGet.Frameworks" Version="5.6.0-preview.2.6489+5433d816f748d4ad78b75fc320397d8117f57771" />
<Usage Id="NuGet.LibraryModel" Version="5.1.0+08414feaac77473f29f6ac182ab4c390ecd3542f" />
<Usage Id="NuGet.LibraryModel" Version="5.6.0-preview.2.6489+5433d816f748d4ad78b75fc320397d8117f57771" />
<Usage Id="NuGet.Packaging" Version="5.1.0+08414feaac77473f29f6ac182ab4c390ecd3542f" />
<Usage Id="NuGet.Packaging" Version="5.6.0-preview.2.6489+5433d816f748d4ad78b75fc320397d8117f57771" />
<Usage Id="NuGet.ProjectModel" Version="5.1.0+08414feaac77473f29f6ac182ab4c390ecd3542f" />
<Usage Id="NuGet.ProjectModel" Version="5.6.0-preview.2.6489+5433d816f748d4ad78b75fc320397d8117f57771" />
<Usage Id="NuGet.Protocol" Version="5.1.0+08414feaac77473f29f6ac182ab4c390ecd3542f" />
<Usage Id="NuGet.Protocol" Version="5.6.0-preview.2.6489+5433d816f748d4ad78b75fc320397d8117f57771" />
<Usage Id="NuGet.Versioning" Version="4.4.0" IsDirectDependency="true" />
<Usage Id="NuGet.Versioning" Version="5.1.0+08414feaac77473f29f6ac182ab4c390ecd3542f" />
<Usage Id="NuGet.Versioning" Version="5.6.0-preview.2.6489+5433d816f748d4ad78b75fc320397d8117f57771" />
<Usage Id="NUnit3.DotNetNew.Template" Version="1.5.3" />
<Usage Id="NUnit3.DotNetNew.Template" Version="1.6.5" />
<Usage Id="NUnit3.DotNetNew.Template" Version="1.7.2" />
<Usage Id="NUnit3.DotNetNew.Template" Version="1.8.1" />
<Usage Id="runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.0" Rid="debian.8-x64" />
<Usage Id="runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.2" Rid="debian.8-x64" />
<Usage Id="runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.0" Rid="fedora.23-x64" />
<Usage Id="runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.2" Rid="fedora.23-x64" />
<Usage Id="runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.0" Rid="fedora.24-x64" />
<Usage Id="runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.2" Rid="fedora.24-x64" />
<Usage Id="runtime.native.System" Version="4.0.0" />
<Usage Id="runtime.native.System" Version="4.3.0" />
<Usage Id="runtime.native.System.Data.SqlClient.sni" Version="4.7.0" />
<Usage Id="runtime.native.System.IO.Compression" Version="4.1.0" />
<Usage Id="runtime.native.System.IO.Compression" Version="4.3.0" />
<Usage Id="runtime.native.System.Net.Http" Version="4.0.1" />
<Usage Id="runtime.native.System.Net.Http" Version="4.3.0" />
<Usage Id="runtime.native.System.Net.Security" Version="4.3.0" />
<Usage Id="runtime.native.System.Security.Cryptography" Version="4.0.0" />
<Usage Id="runtime.native.System.Security.Cryptography.Apple" Version="4.3.0" />
<Usage Id="runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.0" />
<Usage Id="runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.2" />
<Usage Id="runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.0" Rid="opensuse.13.2-x64" />
<Usage Id="runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.2" Rid="opensuse.13.2-x64" />
<Usage Id="runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.0" Rid="opensuse.42.1-x64" />
<Usage Id="runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.2" Rid="opensuse.42.1-x64" />
<Usage Id="runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple" Version="4.3.0" Rid="osx.10.10-x64" />
<Usage Id="runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.0" Rid="osx.10.10-x64" />
<Usage Id="runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.2" Rid="osx.10.10-x64" />
<Usage Id="runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.0" Rid="rhel.7-x64" />
<Usage Id="runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.2" Rid="rhel.7-x64" />
<Usage Id="runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.0" Rid="ubuntu.14.04-x64" />
<Usage Id="runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.2" Rid="ubuntu.14.04-x64" />
<Usage Id="runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.0" Rid="ubuntu.16.04-x64" />
<Usage Id="runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.2" Rid="ubuntu.16.04-x64" />
<Usage Id="runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.0" Rid="ubuntu.16.10-x64" />
<Usage Id="runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl" Version="4.3.2" Rid="ubuntu.16.10-x64" />
<Usage Id="runtime.win-arm64.runtime.native.System.Data.SqlClient.sni" Version="4.4.0" Rid="win-arm64" />
<Usage Id="runtime.win-x64.runtime.native.System.Data.SqlClient.sni" Version="4.4.0" Rid="win-x64" />
<Usage Id="runtime.win-x86.runtime.native.System.Data.SqlClient.sni" Version="4.4.0" Rid="win-x86" />
<Usage Id="sn" Version="1.0.0" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="System.AppContext" Version="4.1.0" />
<Usage Id="System.AppContext" Version="4.3.0" />
<Usage Id="System.Buffers" Version="4.0.0" />
<Usage Id="System.Buffers" Version="4.3.0" />
<Usage Id="System.Buffers" Version="4.4.0" />
<Usage Id="System.Buffers" Version="4.5.0" />
<Usage Id="System.Buffers" Version="4.5.1" />
<Usage Id="System.CodeDom" Version="4.4.0" />
<Usage Id="System.Collections" Version="4.0.11" IsDirectDependency="true" />
<Usage Id="System.Collections" Version="4.3.0" />
<Usage Id="System.Collections.Concurrent" Version="4.0.12" />
<Usage Id="System.Collections.Concurrent" Version="4.3.0" />
<Usage Id="System.Collections.Immutable" Version="1.2.0" />
<Usage Id="System.Collections.Immutable" Version="1.3.0" />
<Usage Id="System.Collections.Immutable" Version="1.3.1" />
<Usage Id="System.Collections.Immutable" Version="1.4.0" />
<Usage Id="System.Collections.Immutable" Version="1.5.0" IsDirectDependency="true" />
<Usage Id="System.Collections.Immutable" Version="1.6.0" />
<Usage Id="System.Collections.Immutable" Version="1.7.0" />
<Usage Id="System.Collections.Immutable" Version="1.7.1" />
<Usage Id="System.Collections.NonGeneric" Version="4.0.1" />
<Usage Id="System.Collections.NonGeneric" Version="4.3.0" />
<Usage Id="System.Collections.Specialized" Version="4.3.0" IsDirectDependency="true" />
<Usage Id="System.ComponentModel" Version="4.3.0" />
<Usage Id="System.ComponentModel.Annotations" Version="4.7.0" />
<Usage Id="System.ComponentModel.Composition" Version="4.5.0" IsDirectDependency="true" />
<Usage Id="System.ComponentModel.Primitives" Version="4.3.0" />
<Usage Id="System.ComponentModel.TypeConverter" Version="4.3.0" IsDirectDependency="true" />
<Usage Id="System.Composition" Version="1.0.31" />
<Usage Id="System.Composition.AttributedModel" Version="1.0.31" />
<Usage Id="System.Composition.Convention" Version="1.0.31" />
<Usage Id="System.Composition.Hosting" Version="1.0.31" />
<Usage Id="System.Composition.Runtime" Version="1.0.31" />
<Usage Id="System.Composition.TypedParts" Version="1.0.31" />
<Usage Id="System.Console" Version="4.0.0" />
<Usage Id="System.Console" Version="4.3.0" />
<Usage Id="System.Data.SqlClient" Version="4.8.1" IsDirectDependency="true" />
<Usage Id="System.Diagnostics.Contracts" Version="4.3.0" IsDirectDependency="true" />
<Usage Id="System.Diagnostics.Debug" Version="4.0.11" IsDirectDependency="true" />
<Usage Id="System.Diagnostics.Debug" Version="4.3.0" />
<Usage Id="System.Diagnostics.DiagnosticSource" Version="4.3.0" />
<Usage Id="System.Diagnostics.DiagnosticSource" Version="4.4.0" IsDirectDependency="true" />
<Usage Id="System.Diagnostics.FileVersionInfo" Version="4.0.0" IsDirectDependency="true" />
<Usage Id="System.Diagnostics.FileVersionInfo" Version="4.3.0" />
<Usage Id="System.Diagnostics.Process" Version="4.1.0" />
<Usage Id="System.Diagnostics.Process" Version="4.3.0" />
<Usage Id="System.Diagnostics.StackTrace" Version="4.3.0" IsDirectDependency="true" />
<Usage Id="System.Diagnostics.Tools" Version="4.0.1" />
<Usage Id="System.Diagnostics.Tools" Version="4.3.0" />
<Usage Id="System.Diagnostics.TraceSource" Version="4.0.0" />
<Usage Id="System.Diagnostics.TraceSource" Version="4.3.0" />
<Usage Id="System.Diagnostics.Tracing" Version="4.1.0" />
<Usage Id="System.Diagnostics.Tracing" Version="4.3.0" />
<Usage Id="System.Drawing.Common" Version="4.7.0" />
<Usage Id="System.Dynamic.Runtime" Version="4.0.11" IsDirectDependency="true" />
<Usage Id="System.Dynamic.Runtime" Version="4.3.0" />
<Usage Id="System.Globalization" Version="4.0.11" IsDirectDependency="true" />
<Usage Id="System.Globalization" Version="4.3.0" />
<Usage Id="System.Globalization.Calendars" Version="4.0.1" />
<Usage Id="System.Globalization.Calendars" Version="4.3.0" />
<Usage Id="System.Globalization.Extensions" Version="4.0.1" />
<Usage Id="System.Globalization.Extensions" Version="4.3.0" />
<Usage Id="System.IO" Version="4.1.0" IsDirectDependency="true" />
<Usage Id="System.IO" Version="4.3.0" />
<Usage Id="System.IO.Compression" Version="4.1.0" />
<Usage Id="System.IO.Compression" Version="4.3.0" />
<Usage Id="System.IO.Compression.ZipFile" Version="4.0.1" />
<Usage Id="System.IO.Compression.ZipFile" Version="4.3.0" />
<Usage Id="System.IO.FileSystem" Version="4.0.1" />
<Usage Id="System.IO.FileSystem" Version="4.3.0" />
<Usage Id="System.IO.FileSystem.Primitives" Version="4.0.1" />
<Usage Id="System.IO.FileSystem.Primitives" Version="4.3.0" />
<Usage Id="System.IO.MemoryMappedFiles" Version="4.3.0" />
<Usage Id="System.IO.Pipelines" Version="5.0.0" />
<Usage Id="System.IO.Pipes" Version="4.3.0" />
<Usage Id="System.IO.Pipes.AccessControl" Version="4.3.0" />
<Usage Id="System.IO.Pipes.AccessControl" Version="4.5.1" IsDirectDependency="true" />
<Usage Id="System.IO.UnmanagedMemoryStream" Version="4.3.0" />
<Usage Id="System.Linq" Version="4.1.0" IsDirectDependency="true" />
<Usage Id="System.Linq" Version="4.3.0" />
<Usage Id="System.Linq.Expressions" Version="4.1.0" IsDirectDependency="true" />
<Usage Id="System.Linq.Expressions" Version="4.3.0" />
<Usage Id="System.Linq.Parallel" Version="4.0.1" />
<Usage Id="System.Linq.Queryable" Version="4.3.0" />
<Usage Id="System.Memory" Version="4.5.3" />
<Usage Id="System.Memory" Version="4.5.4" />
<Usage Id="System.Net.Http" Version="4.1.0" />
<Usage Id="System.Net.Http" Version="4.3.0" />
<Usage Id="System.Net.Http" Version="4.3.4" IsDirectDependency="true" />
<Usage Id="System.Net.Primitives" Version="4.0.11" />
<Usage Id="System.Net.Primitives" Version="4.3.0" />
<Usage Id="System.Net.Requests" Version="4.0.11" IsDirectDependency="true" />
<Usage Id="System.Net.Requests" Version="4.3.0" />
<Usage Id="System.Net.Security" Version="4.3.0" IsDirectDependency="true" />
<Usage Id="System.Net.Sockets" Version="4.1.0" />
<Usage Id="System.Net.Sockets" Version="4.3.0" />
<Usage Id="System.Net.WebHeaderCollection" Version="4.0.1" />
<Usage Id="System.Net.WebHeaderCollection" Version="4.3.0" />
<Usage Id="System.Numerics.Vectors" Version="4.4.0" />
<Usage Id="System.Numerics.Vectors" Version="4.5.0" />
<Usage Id="System.ObjectModel" Version="4.0.12" IsDirectDependency="true" />
<Usage Id="System.ObjectModel" Version="4.3.0" />
<Usage Id="System.Private.DataContractSerialization" Version="4.1.1" />
<Usage Id="System.Reflection" Version="4.1.0" IsDirectDependency="true" />
<Usage Id="System.Reflection" Version="4.3.0" />
<Usage Id="System.Reflection.Emit" Version="4.0.1" />
<Usage Id="System.Reflection.Emit" Version="4.3.0" />
<Usage Id="System.Reflection.Emit.ILGeneration" Version="4.0.1" />
<Usage Id="System.Reflection.Emit.ILGeneration" Version="4.3.0" />
<Usage Id="System.Reflection.Emit.Lightweight" Version="4.0.1" />
<Usage Id="System.Reflection.Emit.Lightweight" Version="4.3.0" />
<Usage Id="System.Reflection.Extensions" Version="4.0.1" IsDirectDependency="true" />
<Usage Id="System.Reflection.Extensions" Version="4.3.0" />
<Usage Id="System.Reflection.Metadata" Version="1.3.0" />
<Usage Id="System.Reflection.Metadata" Version="1.4.1" />
<Usage Id="System.Reflection.Metadata" Version="1.4.2" IsDirectDependency="true" />
<Usage Id="System.Reflection.Metadata" Version="1.5.0" IsDirectDependency="true" />
<Usage Id="System.Reflection.Metadata" Version="1.6.0" IsDirectDependency="true" />
<Usage Id="System.Reflection.Metadata" Version="1.7.0" IsDirectDependency="true" />
<Usage Id="System.Reflection.Metadata" Version="1.8.0" IsDirectDependency="true" />
<Usage Id="System.Reflection.Metadata" Version="1.8.1" />
<Usage Id="System.Reflection.Primitives" Version="4.0.1" />
<Usage Id="System.Reflection.Primitives" Version="4.3.0" />
<Usage Id="System.Reflection.TypeExtensions" Version="4.1.0" />
<Usage Id="System.Reflection.TypeExtensions" Version="4.3.0" />
<Usage Id="System.Resources.Reader" Version="4.0.0" />
<Usage Id="System.Resources.ResourceManager" Version="4.0.1" IsDirectDependency="true" />
<Usage Id="System.Resources.ResourceManager" Version="4.3.0" />
<Usage Id="System.Resources.Writer" Version="4.0.0" />
<Usage Id="System.Runtime" Version="4.1.0" IsDirectDependency="true" />
<Usage Id="System.Runtime" Version="4.3.0" />
<Usage Id="System.Runtime" Version="4.3.1" IsDirectDependency="true" />
<Usage Id="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
<Usage Id="System.Runtime.CompilerServices.Unsafe" Version="4.5.3" />
<Usage Id="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />
<Usage Id="System.Runtime.CompilerServices.Unsafe" Version="4.7.1" />
<Usage Id="System.Runtime.CompilerServices.Unsafe" Version="5.0.0-rc.1.20451.14" />
<Usage Id="System.Runtime.Extensions" Version="4.1.0" IsDirectDependency="true" />
<Usage Id="System.Runtime.Extensions" Version="4.3.0" />
<Usage Id="System.Runtime.Handles" Version="4.0.1" />
<Usage Id="System.Runtime.Handles" Version="4.3.0" />
<Usage Id="System.Runtime.InteropServices" Version="4.1.0" />
<Usage Id="System.Runtime.InteropServices" Version="4.3.0" />
<Usage Id="System.Runtime.InteropServices.RuntimeInformation" Version="4.0.0" />
<Usage Id="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<Usage Id="System.Runtime.Loader" Version="4.0.0" />
<Usage Id="System.Runtime.Loader" Version="4.3.0" />
<Usage Id="System.Runtime.Numerics" Version="4.0.1" />
<Usage Id="System.Runtime.Numerics" Version="4.3.0" />
<Usage Id="System.Runtime.Serialization.Formatters" Version="4.3.0" IsDirectDependency="true" />
<Usage Id="System.Runtime.Serialization.Primitives" Version="4.1.1" IsDirectDependency="true" />
<Usage Id="System.Runtime.Serialization.Primitives" Version="4.3.0" IsDirectDependency="true" />
<Usage Id="System.Runtime.Serialization.Xml" Version="4.1.1" />
<Usage Id="System.Security.AccessControl" Version="4.3.0" />
<Usage Id="System.Security.AccessControl" Version="4.5.0" />
<Usage Id="System.Security.AccessControl" Version="4.7.0" />
<Usage Id="System.Security.Claims" Version="4.0.1" />
<Usage Id="System.Security.Claims" Version="4.3.0" />
<Usage Id="System.Security.Cryptography.Algorithms" Version="4.2.0" />
<Usage Id="System.Security.Cryptography.Algorithms" Version="4.3.0" />
<Usage Id="System.Security.Cryptography.Algorithms" Version="4.3.1" />
<Usage Id="System.Security.Cryptography.Cng" Version="4.2.0" />
<Usage Id="System.Security.Cryptography.Cng" Version="4.3.0" />
<Usage Id="System.Security.Cryptography.Cng" Version="4.7.0" />
<Usage Id="System.Security.Cryptography.Csp" Version="4.0.0" />
<Usage Id="System.Security.Cryptography.Csp" Version="4.3.0" />
<Usage Id="System.Security.Cryptography.Encoding" Version="4.0.0" />
<Usage Id="System.Security.Cryptography.Encoding" Version="4.3.0" />
<Usage Id="System.Security.Cryptography.OpenSsl" Version="4.0.0" />
<Usage Id="System.Security.Cryptography.OpenSsl" Version="4.3.0" />
<Usage Id="System.Security.Cryptography.Pkcs" Version="4.7.0" />
<Usage Id="System.Security.Cryptography.Pkcs" Version="5.0.0" />
<Usage Id="System.Security.Cryptography.Primitives" Version="4.0.0" />
<Usage Id="System.Security.Cryptography.Primitives" Version="4.3.0" />
<Usage Id="System.Security.Cryptography.ProtectedData" Version="4.3.0" />
<Usage Id="System.Security.Cryptography.X509Certificates" Version="4.1.0" />
<Usage Id="System.Security.Cryptography.X509Certificates" Version="4.3.0" />
<Usage Id="System.Security.Cryptography.Xml" Version="4.7.0" />
<Usage Id="System.Security.Permissions" Version="4.5.0" />
<Usage Id="System.Security.Permissions" Version="4.7.0" />
<Usage Id="System.Security.Principal" Version="4.0.1" />
<Usage Id="System.Security.Principal" Version="4.3.0" />
<Usage Id="System.Security.Principal.Windows" Version="4.0.0" IsDirectDependency="true" />
<Usage Id="System.Security.Principal.Windows" Version="4.3.0" />
<Usage Id="System.Security.Principal.Windows" Version="4.5.0" />
<Usage Id="System.Security.Principal.Windows" Version="4.7.0" />
<Usage Id="System.Text.Encoding" Version="4.0.11" IsDirectDependency="true" />
<Usage Id="System.Text.Encoding" Version="4.3.0" />
<Usage Id="System.Text.Encoding.CodePages" Version="4.0.1" />
<Usage Id="System.Text.Encoding.CodePages" Version="4.3.0" />
<Usage Id="System.Text.Encoding.CodePages" Version="4.4.0" />
<Usage Id="System.Text.Encoding.CodePages" Version="4.5.1" />
<Usage Id="System.Text.Encoding.Extensions" Version="4.0.11" IsDirectDependency="true" />
<Usage Id="System.Text.Encoding.Extensions" Version="4.3.0" />
<Usage Id="System.Text.Encodings.Web" Version="4.7.0" />
<Usage Id="System.Text.Encodings.Web" Version="4.7.1" />
<Usage Id="System.Text.Encodings.Web" Version="5.0.0-rc.1.20451.14" />
<Usage Id="System.Text.Json" Version="4.7.0" IsDirectDependency="true" />
<Usage Id="System.Text.Json" Version="4.7.2" />
<Usage Id="System.Text.Json" Version="5.0.0-rc.1.20451.14" IsDirectDependency="true" />
<Usage Id="System.Text.RegularExpressions" Version="4.1.0" IsDirectDependency="true" />
<Usage Id="System.Text.RegularExpressions" Version="4.3.0" />
<Usage Id="System.Threading" Version="4.0.11" IsDirectDependency="true" />
<Usage Id="System.Threading" Version="4.3.0" />
<Usage Id="System.Threading.Overlapped" Version="4.3.0" />
<Usage Id="System.Threading.Tasks" Version="4.0.11" IsDirectDependency="true" />
<Usage Id="System.Threading.Tasks" Version="4.3.0" />
<Usage Id="System.Threading.Tasks.Dataflow" Version="4.5.24" />
<Usage Id="System.Threading.Tasks.Dataflow" Version="4.6.0" />
<Usage Id="System.Threading.Tasks.Dataflow" Version="4.9.0" />
<Usage Id="System.Threading.Tasks.Extensions" Version="4.0.0" />
<Usage Id="System.Threading.Tasks.Extensions" Version="4.3.0" />
<Usage Id="System.Threading.Tasks.Extensions" Version="4.5.3" />
<Usage Id="System.Threading.Tasks.Extensions" Version="4.5.4" />
<Usage Id="System.Threading.Tasks.Parallel" Version="4.3.0" />
<Usage Id="System.Threading.Thread" Version="4.0.0" />
<Usage Id="System.Threading.Thread" Version="4.3.0" />
<Usage Id="System.Threading.ThreadPool" Version="4.0.10" />
<Usage Id="System.Threading.ThreadPool" Version="4.3.0" />
<Usage Id="System.Threading.Timer" Version="4.0.1" />
<Usage Id="System.Threading.Timer" Version="4.3.0" />
<Usage Id="System.ValueTuple" Version="4.3.0" />
<Usage Id="System.ValueTuple" Version="4.4.0" />
<Usage Id="System.ValueTuple" Version="4.5.0" IsDirectDependency="true" />
<Usage Id="System.Windows.Extensions" Version="4.7.0" />
<Usage Id="System.Xml.ReaderWriter" Version="4.0.11" IsDirectDependency="true" />
<Usage Id="System.Xml.ReaderWriter" Version="4.3.0" />
<Usage Id="System.Xml.XDocument" Version="4.0.11" IsDirectDependency="true" />
<Usage Id="System.Xml.XDocument" Version="4.3.0" />
<Usage Id="System.Xml.XmlDocument" Version="4.0.1" />
<Usage Id="System.Xml.XmlDocument" Version="4.3.0" IsDirectDependency="true" />
<Usage Id="System.Xml.XmlSerializer" Version="4.0.11" />
<Usage Id="System.Xml.XPath" Version="4.0.1" />
<Usage Id="System.Xml.XPath" Version="4.3.0" />
<Usage Id="System.Xml.XPath.XDocument" Version="4.3.0" />
<Usage Id="System.Xml.XPath.XmlDocument" Version="4.0.1" />
<Usage Id="vswhere" Version="2.6.7" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="XliffTasks" Version="1.0.0-beta.20420.1" IsDirectDependency="true" IsAutoReferenced="true" />
</Usages>
</UsageData>

View file

@ -0,0 +1,29 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)..))" />
<PropertyGroup>
<!-- Build all tasks as AnyCPU to match NuGet DLLs in the SDK: avoid warnings. -->
<Platform>AnyCPU</Platform>
</PropertyGroup>
<!--
Use some assemblies from the SDK, instead of package references. This ensures they match what's
found when the task is loaded by the SDK's MSBuild.
-->
<ItemGroup>
<SdkAssembly Include="$(SdkReferenceDir)Newtonsoft.Json.dll" />
<!--
Reference NuGet assemblies, except a command line assembly that causes warnings such as:
MSB3277: Found conflicts between different versions of "System.Collections" that could not be resolved.
-->
<SdkAssembly
Include="$(SdkReferenceDir)NuGet.*.dll"
Exclude="$(SdkReferenceDir)NuGet.CommandLine.XPlat.dll" />
<SdkAssemblyReference
Include="@(SdkAssembly -> '%(FileName)')"
HintPath="$(SdkReferenceDir)%(Identity).dll" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,26 @@
// 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.
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Linq;
namespace Microsoft.DotNet.SourceBuild.Tasks.LeakDetection
{
internal class CatalogFileEntry
{
const string ElementName = "File";
internal string Path { get; set; }
internal byte[] OriginalHash { get; set; }
internal byte[] PoisonedHash { get; set; }
public XElement ToXml() => new XElement(ElementName,
new XAttribute(nameof(Path), Path),
new XAttribute(nameof(OriginalHash), OriginalHash.ToHexString()),
PoisonedHash == null ? null : new XAttribute(nameof(PoisonedHash), PoisonedHash.ToHexString())
);
}
}

View file

@ -0,0 +1,38 @@
// 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.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Microsoft.DotNet.SourceBuild.Tasks.LeakDetection
{
internal class CatalogPackageEntry
{
const string ElementName = "Package";
internal string Path { get; set; }
internal string Id { get; set; }
internal string Version { get; set; }
internal byte[] OriginalHash { get; set; }
internal byte[] PoisonedHash { get; set; }
internal List<CatalogFileEntry> Files { get; }
public CatalogPackageEntry()
{
this.Files = new List<CatalogFileEntry>();
}
public XElement ToXml() => new XElement(ElementName,
new XAttribute(nameof(Path), Path),
new XAttribute(nameof(Id), Id),
new XAttribute(nameof(Version), Version),
new XAttribute(nameof(OriginalHash), OriginalHash.ToHexString()),
PoisonedHash == null ? null : new XAttribute(nameof(PoisonedHash), PoisonedHash.ToHexString()),
Files.Select(f => f.ToXml())
);
}
}

View file

@ -0,0 +1,384 @@
// 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.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Mono.Cecil;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Xml;
using System.Xml.Linq;
namespace Microsoft.DotNet.SourceBuild.Tasks.LeakDetection
{
public class CheckForPoison : Task
{
/// <summary>
/// The files to check for poison and/or hash matches. Zips and
/// nupkgs will be extracted and checked recursively.
/// %(Identity): Path to the initial set of files.
/// </summary>
[Required]
public ITaskItem[] FilesToCheck { get; set; }
/// <summary>
/// The output path for an XML poison report, if desired.
/// </summary>
public string PoisonReportOutputFilePath { get; set; }
/// <summary>
/// The path of a previously-generated file hash catalog, if
/// hash checked is desired. If not, only assembly attributes
/// and package marker file checked will be done.
/// </summary>
public string HashCatalogFilePath { get; set; }
/// <summary>
/// The marker file name to check for in poisoned nupkg files.
/// </summary>
public string MarkerFileName { get; set; }
/// <summary>
/// If true, fails the build if any poisoned files are found.
/// </summary>
public bool FailOnPoisonFound { get; set; }
/// <summary>
/// Use this directory instead of the system temp directory for staging.
/// Intended for Linux systems with limited /tmp space, like Azure VMs.
/// </summary>
public string OverrideTempPath { get; set; }
private static readonly string[] ZipFileExtensions =
{
".zip",
".nupkg",
};
private static readonly string[] TarFileExtensions =
{
".tar",
};
private static readonly string[] TarGzFileExtensions =
{
".tgz",
".tar.gz",
};
private static readonly string[] FileNamesToSkip =
{
"_._",
"-.-",
".bowerrc",
".editorconfig",
".gitignore",
".gitkeep",
".rels",
"LICENSE",
"prefercliruntime",
"RunCsc",
"RunVbc",
};
private static readonly string[] FileExtensionsToSkip =
{
".config",
".cs",
".cshtml",
".csproj",
".css",
".db",
".eot",
".fs",
".fsproj",
".html",
".ico",
".js",
".json",
".map",
".md",
".nuspec",
".png",
".props",
".psmdcp",
".rtf",
".scss",
".svg",
".targets",
".ts",
".ttf",
".txt",
".vb",
".vbproj",
".woff",
".woff2",
".xaml",
".xml",
};
private const string PoisonMarker = "POISONED";
public override bool Execute()
{
IEnumerable<PoisonedFileEntry> poisons = GetPoisonedFiles(FilesToCheck.Select(f => f.ItemSpec), HashCatalogFilePath, MarkerFileName);
// if we should write out the poison report, do that
if (!string.IsNullOrWhiteSpace(PoisonReportOutputFilePath))
{
File.WriteAllText(PoisonReportOutputFilePath, (new XElement("PrebuiltLeakReport", poisons.Select(p => p.ToXml()))).ToString());
}
if (FailOnPoisonFound && poisons.Count() > 0)
{
Log.LogError($"Forced build error: {poisons.Count()} marked files leaked to output. See complete report '{PoisonReportOutputFilePath}' for details.");
return false;
}
else if (poisons.Count() > 0)
{
Log.LogWarning($"{poisons.Count()} marked files leaked to output. See complete report '{PoisonReportOutputFilePath}' for details.");
}
else
{
Log.LogError($"No leaked files found in output. Either something is broken or it is the future and we have fixed all leaks - please verify and remove this error if so (and default {nameof(FailOnPoisonFound)} to true).");
return false;
}
return !Log.HasLoggedErrors;
}
/// <summary>
/// Internal helper to allow other tasks to check for poisoned files.
/// </summary>
/// <param name="initialCandidates">Initial queue of candidate files (will be cleared when done)</param>
/// <param name="catalogedPackagesFilePath">File path to the file hash catalog</param>
/// <param name="markerFileName">Marker file name to check for in poisoned nupkgs</param>
/// <returns>List of poisoned packages and files found and reasons for each</returns>
internal IEnumerable<PoisonedFileEntry> GetPoisonedFiles(IEnumerable<string> initialCandidates, string catalogedPackagesFilePath, string markerFileName)
{
IEnumerable<CatalogPackageEntry> catalogedPackages = ReadCatalog(catalogedPackagesFilePath);
var poisons = new List<PoisonedFileEntry>();
var candidateQueue = new Queue<string>(initialCandidates);
// avoid collisions between nupkgs with the same name
var dirCounter = 0;
if (!string.IsNullOrWhiteSpace(OverrideTempPath))
{
Directory.CreateDirectory(OverrideTempPath);
}
var tempDirName = Path.GetRandomFileName();
var tempDir = Directory.CreateDirectory(Path.Combine(OverrideTempPath ?? Path.GetTempPath(), tempDirName));
while (candidateQueue.Any())
{
var checking = candidateQueue.Dequeue();
// if this is a zip or NuPkg, extract it, check for the poison marker, and
// add its contents to the list to be checked.
if (ZipFileExtensions.Concat(TarFileExtensions).Concat(TarGzFileExtensions).Any(e => checking.ToLowerInvariant().EndsWith(e)))
{
var tempCheckingDir = Path.Combine(tempDir.FullName, Path.GetRandomFileName(), Path.GetFileNameWithoutExtension(checking) + "." + (++dirCounter).ToString());
PoisonedFileEntry result = ExtractAndCheckZipFileOnly(catalogedPackages, checking, markerFileName, tempCheckingDir, candidateQueue);
if (result != null)
{
poisons.Add(result);
}
}
else
{
PoisonedFileEntry result = CheckSingleFile(catalogedPackages, tempDir.FullName, checking);
if (result != null)
{
poisons.Add(result);
}
}
}
tempDir.Delete(true);
return poisons;
}
private static PoisonedFileEntry CheckSingleFile(IEnumerable<CatalogPackageEntry> catalogedPackages, string rootPath, string fileToCheck)
{
// skip some common files that get copied verbatim from nupkgs - LICENSE, _._, etc as well as
// file types that we never care about - text files, .gitconfig, etc.
if (FileNamesToSkip.Any(f => Path.GetFileName(fileToCheck).ToLowerInvariant() == f.ToLowerInvariant()) ||
FileExtensionsToSkip.Any(e => Path.GetExtension(fileToCheck).ToLowerInvariant() == e.ToLowerInvariant()))
{
return null;
}
var poisonEntry = new PoisonedFileEntry();
poisonEntry.Path = Utility.MakeRelativePath(fileToCheck, rootPath);
// There seems to be some weird issues with using file streams both for hashing and assembly loading.
// Copy everything into a memory stream to avoid these problems.
var memStream = new MemoryStream();
using (var stream = File.OpenRead(fileToCheck))
{
stream.CopyTo(memStream);
}
memStream.Seek(0, SeekOrigin.Begin);
using (var sha = SHA256.Create())
{
poisonEntry.Hash = sha.ComputeHash(memStream);
}
foreach (var p in catalogedPackages)
{
// This hash can match either the original hash (we couldn't poison the file, or redownloaded it) or
// the poisoned hash (the obvious failure case of a poisoned file leaked).
foreach (var matchingCatalogedFile in p.Files.Where(f => f.OriginalHash.SequenceEqual(poisonEntry.Hash) || (f.PoisonedHash?.SequenceEqual(poisonEntry.Hash) ?? false)))
{
poisonEntry.Type |= PoisonType.Hash;
var match = new PoisonMatch
{
File = matchingCatalogedFile.Path,
Package = p.Path,
PackageId = p.Id,
PackageVersion = p.Version,
};
poisonEntry.Matches.Add(match);
}
}
try
{
memStream.Seek(0, SeekOrigin.Begin);
using (var asm = AssemblyDefinition.ReadAssembly(memStream))
{
foreach (var a in asm.CustomAttributes)
{
foreach (var ca in a.ConstructorArguments)
{
if (ca.Type.Name == asm.MainModule.TypeSystem.String.Name)
{
if (ca.Value.ToString().Contains(PoisonMarker))
{
poisonEntry.Type |= PoisonType.AssemblyAttribute;
}
}
}
}
}
}
catch
{
// this is fine, it's just not an assembly.
}
return poisonEntry.Type != PoisonType.None ? poisonEntry : null;
}
private static PoisonedFileEntry ExtractAndCheckZipFileOnly(IEnumerable<CatalogPackageEntry> catalogedPackages, string zipToCheck, string markerFileName, string tempDir, Queue<string> futureFilesToCheck)
{
var poisonEntry = new PoisonedFileEntry();
poisonEntry.Path = zipToCheck;
using (var sha = SHA256.Create())
using (var stream = File.OpenRead(zipToCheck))
{
poisonEntry.Hash = sha.ComputeHash(stream);
}
// first check for a matching poisoned or non-poisoned hash match:
// - non-poisoned is a potential error where the package was redownloaded.
// - poisoned is a use of a local package we were not expecting.
foreach (var matchingCatalogedPackage in catalogedPackages.Where(c => c.OriginalHash.SequenceEqual(poisonEntry.Hash) || (c.PoisonedHash?.SequenceEqual(poisonEntry.Hash) ?? false)))
{
poisonEntry.Type |= PoisonType.Hash;
var match = new PoisonMatch
{
Package = matchingCatalogedPackage.Path,
PackageId = matchingCatalogedPackage.Id,
PackageVersion = matchingCatalogedPackage.Version,
};
poisonEntry.Matches.Add(match);
}
// now extract and look for the marker file
if (ZipFileExtensions.Any(e => zipToCheck.ToLowerInvariant().EndsWith(e)))
{
ZipFile.ExtractToDirectory(zipToCheck, tempDir, true);
}
else if (TarFileExtensions.Any(e => zipToCheck.ToLowerInvariant().EndsWith(e)))
{
Directory.CreateDirectory(tempDir);
var psi = new ProcessStartInfo("tar", $"xf {zipToCheck} -C {tempDir}");
Process.Start(psi).WaitForExit();
}
else if (TarGzFileExtensions.Any(e => zipToCheck.ToLowerInvariant().EndsWith(e)))
{
Directory.CreateDirectory(tempDir);
var psi = new ProcessStartInfo("tar", $"xzf {zipToCheck} -C {tempDir}");
Process.Start(psi).WaitForExit();
}
else
{
throw new ArgumentOutOfRangeException($"Don't know how to decompress {zipToCheck}");
}
if (!string.IsNullOrWhiteSpace(markerFileName) && File.Exists(Path.Combine(tempDir, markerFileName)))
{
poisonEntry.Type |= PoisonType.NupkgFile;
}
foreach (var child in Directory.EnumerateFiles(tempDir, "*", SearchOption.AllDirectories))
{
// also add anything in this zip/package for checking
futureFilesToCheck.Enqueue(child);
}
return poisonEntry.Type != PoisonType.None ? poisonEntry : null;
}
private static IEnumerable<CatalogPackageEntry> ReadCatalog(string hashCatalogFilePath)
{
// catalog is optional, we can also just check assembly properties or nupkg marker files
if (string.IsNullOrWhiteSpace(hashCatalogFilePath))
{
return Enumerable.Empty<CatalogPackageEntry>();
}
var doc = new XmlDocument();
using (var stream = File.OpenRead(hashCatalogFilePath))
{
doc.Load(stream);
}
var packages = new List<CatalogPackageEntry>();
var catalog = doc.FirstChild;
foreach (XmlElement p in catalog.ChildNodes)
{
var package = new CatalogPackageEntry
{
Id = p.Attributes["Id"].Value,
Version = p.Attributes["Version"].Value,
OriginalHash = p.Attributes["OriginalHash"].Value.ToBytes(),
PoisonedHash = p.Attributes["PoisonedHash"]?.Value?.ToBytes(),
Path = p.Attributes["Path"].Value,
};
packages.Add(package);
foreach (XmlNode f in p.ChildNodes)
{
var fEntry = new CatalogFileEntry
{
OriginalHash = f.Attributes["OriginalHash"].Value.ToBytes(),
PoisonedHash = f.Attributes["PoisonedHash"]?.Value?.ToBytes(),
Path = f.Attributes["Path"].Value,
};
package.Files.Add(fEntry);
}
}
return packages;
}
}
}

View file

@ -0,0 +1,218 @@
// 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.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Mono.Cecil;
using Mono.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text;
using System.Xml.Linq;
namespace Microsoft.DotNet.SourceBuild.Tasks.LeakDetection
{
public class MarkAndCatalogPackages : Task
{
private const string CatalogElementName = "HashCatalog";
private const string PoisonMarker = "POISONED by DotNetSourceBuild - Should not ship";
private readonly Type[] AssemblyPropertiesToReplace = new Type[] {
typeof(AssemblyProductAttribute),
typeof(AssemblyInformationalVersionAttribute),
typeof(AssemblyDescriptionAttribute),
typeof(AssemblyTitleAttribute)
};
/// <summary>
/// The name of the XML file to write the hash catalog out to,
/// for later checking build output against. This is optional -
/// if not used, assemblies will still be poisoned in their attributes.
/// </summary>
public string CatalogOutputFilePath { get; set; }
/// <summary>
/// The name of the marker file to drop in the nupkgs. This can vary
/// with the packages, so you can use ".prebuilt" for one set of packages
/// and ".source-built" for another if you would like to tell the difference
/// between two sets of poisoned packages.
/// </summary>
public string MarkerFileName { get; set; }
/// <summary>
/// The packages to poison and/or catalog:
/// %(Identity): Path to the nupkg.
/// </summary>
[Required]
public ITaskItem[] PackagesToMark { get; set; }
/// <summary>
/// Use this directory instead of the system temp directory for staging.
/// Intended for Linux systems with limited /tmp space, like Azure VMs.
/// </summary>
public string OverrideTempPath { get; set; }
public override bool Execute()
{
var tempDirName = Path.GetRandomFileName();
if (!string.IsNullOrWhiteSpace(OverrideTempPath))
{
Directory.CreateDirectory(OverrideTempPath);
}
var tempDir = Directory.CreateDirectory(Path.Combine(OverrideTempPath ?? Path.GetTempPath(), tempDirName));
var packageEntries = new List<CatalogPackageEntry>();
using (var sha = SHA256.Create())
{
foreach (var p in PackagesToMark)
{
var packageEntry = new CatalogPackageEntry();
packageEntries.Add(packageEntry);
packageEntry.Path = p.ItemSpec;
using (var stream = File.OpenRead(p.ItemSpec))
{
packageEntry.OriginalHash = sha.ComputeHash(stream);
}
var packageIdentity = ReadNuGetPackageInfos.ReadIdentity(p.ItemSpec);
packageEntry.Id = packageIdentity.Id;
packageEntry.Version = packageIdentity.Version.OriginalVersion;
var packageTempPath = Path.Combine(tempDir.FullName, Path.GetFileName(p.ItemSpec));
ZipFile.ExtractToDirectory(p.ItemSpec, packageTempPath, true);
foreach (string f in Directory.EnumerateFiles(packageTempPath, "*", SearchOption.AllDirectories))
{
// remove signatures so we don't later fail validation
if (Path.GetFileName(f) == ".signature.p7s")
{
File.Delete(f);
continue;
}
var catalogFileEntry = new CatalogFileEntry();
packageEntry.Files.Add(catalogFileEntry);
catalogFileEntry.Path = Utility.MakeRelativePath(f, packageTempPath);
AssemblyDefinition asm = null;
// There seem to be some weird issues with using a file stream both for hashing and
// assembly loading, even closing it in between. Use a MemoryStream to avoid issues.
var memStream = new MemoryStream();
using (var stream = File.OpenRead(f))
{
stream.CopyTo(memStream);
}
// First get the original hash of the file
memStream.Seek(0, SeekOrigin.Begin);
catalogFileEntry.OriginalHash = sha.ComputeHash(memStream);
// Now try to read it as an assembly
memStream.Seek(0, SeekOrigin.Begin);
try
{
asm = AssemblyDefinition.ReadAssembly(memStream, new ReaderParameters(ReadingMode.Deferred));
}
catch
{
// this is okay, it's not an assembly we can read
}
// if we read it, now poison and write it back out
if (asm != null)
{
Poison(asm);
try
{
// Cecil doesn't try to do some modifications until it writes out the file,
// and then throws after we've already truncated the file if it finds out it can't do them.
// Write to a memory stream first and then copy to the real stream if it suceeds. If it
// fails, we won't truncate the file and we will depend on hashes instead in that case.
using (var testMemStream = new MemoryStream())
{
asm.Write(testMemStream);
testMemStream.Seek(0, SeekOrigin.Begin);
using (var stream = File.Open(f, FileMode.Create, FileAccess.ReadWrite))
{
testMemStream.CopyTo(stream);
}
}
// then get the hash of the now-poisoned file
using (var stream = File.OpenRead(f))
{
catalogFileEntry.PoisonedHash = sha.ComputeHash(stream);
}
}
catch
{
// see above note in the try - this is okay.
}
}
}
if (!string.IsNullOrWhiteSpace(MarkerFileName))
{
var markerFilePath = Path.Combine(packageTempPath, MarkerFileName);
if (File.Exists(markerFilePath))
{
throw new ArgumentException($"Marker file name '{MarkerFileName}' is not sufficiently unique! Exists in '{p.ItemSpec}'.", nameof(MarkerFileName));
}
// mostly we just need to write something unique to this so it's not hashed as a matching file when we check it later.
// but it's also convenient to have the package catalog handy.
File.WriteAllText(markerFilePath, packageEntry.ToXml().ToString());
}
// create a temp file for this so if something goes wrong in the process we're not in too weird of a state
var poisonedPackageName = Path.GetFileName(p.ItemSpec) + ".poisoned";
var poisonedPackagePath = Path.Combine(tempDir.FullName, poisonedPackageName);
ZipFile.CreateFromDirectory(packageTempPath, poisonedPackagePath);
// Get the hash of the poisoned package (with poisoned marker file and poisoned assemblies inside)
using (var stream = File.OpenRead(poisonedPackagePath))
{
packageEntry.PoisonedHash = sha.ComputeHash(stream);
}
File.Delete(p.ItemSpec);
File.Move(poisonedPackagePath, p.ItemSpec);
}
}
// if we should write out the catalog, do that
if (!string.IsNullOrWhiteSpace(CatalogOutputFilePath))
{
var outputFileDir = Path.GetDirectoryName(CatalogOutputFilePath);
if (!Directory.Exists(outputFileDir))
{
Directory.CreateDirectory(outputFileDir);
}
File.WriteAllText(CatalogOutputFilePath, (new XElement("HashCatalog",
packageEntries.Select(p => p.ToXml()))).ToString());
}
tempDir.Delete(true);
return !Log.HasLoggedErrors;
}
private void Poison(AssemblyDefinition asm)
{
foreach (var attr in asm.CustomAttributes)
{
if (this.AssemblyPropertiesToReplace.Any(p => p.Name == attr.AttributeType.Name))
{
attr.ConstructorArguments.Clear();
attr.ConstructorArguments.Add(new CustomAttributeArgument(asm.MainModule.TypeSystem.String, "POISONED by DotNetSourceBuild - Should not ship"));
}
}
}
}
}

View file

@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp5.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputPath>$(LeakDetectionTasksBinDir)</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build">
<Version>15.7.179</Version>
</PackageReference>
<PackageReference Include="Microsoft.Build.Utilities.Core">
<Version>15.7.179</Version>
</PackageReference>
<ProjectReference Include="$(ClonedSubmoduleDirectory)linker.$(linkerGitCommitHash)/external/cecil/Mono.Cecil.csproj" Condition="'$(OfflineBuild)' != 'true'">
<SetConfiguration Condition=" '$(Configuration)' == 'Debug' ">Configuration=netstandard_Debug</SetConfiguration>
<SetConfiguration Condition=" '$(Configuration)' == 'Release' ">Configuration=netstandard_Release</SetConfiguration>
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name>
</ProjectReference>
<ProjectReference Include="$(SubmoduleDirectory)linker.$(linkerGitCommitHash)/external/cecil/Mono.Cecil.csproj" Condition="'$(OfflineBuild)' == 'true'">
<SetConfiguration Condition=" '$(Configuration)' == 'Debug' ">Configuration=netstandard_Debug</SetConfiguration>
<SetConfiguration Condition=" '$(Configuration)' == 'Release' ">Configuration=netstandard_Release</SetConfiguration>
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name>
</ProjectReference>
<ProjectReference Include="../Microsoft.DotNet.SourceBuild.Tasks.XPlat/Microsoft.DotNet.SourceBuild.Tasks.XPlat.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="@(SdkAssemblyReference)" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
</packageSources>
</configuration>

View file

@ -0,0 +1,28 @@
// 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.
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Linq;
namespace Microsoft.DotNet.SourceBuild.Tasks.LeakDetection
{
internal class PoisonMatch
{
const string ElementName = "Match";
internal string Package { get; set; }
internal string File { get; set; }
internal string PackageId { get; set; }
internal string PackageVersion { get; set; }
public XElement ToXml() => new XElement(ElementName,
Package == null ? null : new XAttribute(nameof(Package), Package),
PackageId == null ? null : new XAttribute(nameof(PackageId), PackageId),
PackageVersion == null ? null : new XAttribute(nameof(PackageVersion), PackageVersion),
File == null ? null: new XAttribute(nameof(File), File)
);
}
}

View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Microsoft.DotNet.SourceBuild.Tasks.LeakDetection
{
[Flags]
internal enum PoisonType
{
None = 0,
Hash = 1,
AssemblyAttribute = 2,
NupkgFile = 4,
}
}

View file

@ -0,0 +1,36 @@
// 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.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Microsoft.DotNet.SourceBuild.Tasks.LeakDetection
{
internal class PoisonedFileEntry
{
const string ElementName = "File";
internal byte[] Hash { get; set; }
internal string Path { get; set; }
internal PoisonType Type { get; set; }
internal List<PoisonMatch> Matches { get; }
internal PoisonedFileEntry()
{
this.Matches = new List<PoisonMatch>();
}
public XElement ToXml() => this.ToXml(ElementName);
protected XElement ToXml(string myElementName) => new XElement(myElementName,
new XAttribute(nameof(Path), Path),
new XElement(nameof(Hash), Hash.ToHexString()),
new XElement(nameof(Type), Type.ToString()),
Matches.Select(m => m.ToXml())
);
}
}

View file

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace Microsoft.DotNet.SourceBuild.Tasks.LeakDetection
{
internal static class Utility
{
internal static string ToHexString(this byte[] bytes)
{
var sb = new StringBuilder();
foreach (var b in bytes)
{
sb.Append(b.ToString("x2"));
}
return sb.ToString();
}
internal static byte[] ToBytes(this string hex)
{
var bytes = new List<byte>();
for (var i = 0; i < hex.Length; i += 2)
{
bytes.Add(Convert.ToByte(hex.Substring(i, 2), 16));
}
return bytes.ToArray();
}
internal static string MakeRelativePath(string filePath, string relativeTo)
{
// Uri.MakeRelativeUri requires the last slash
if (!relativeTo.EndsWith("/") && !relativeTo.EndsWith("\\"))
{
relativeTo += Path.DirectorySeparatorChar;
}
var uri = new Uri(filePath);
var relativeToUri = new Uri(relativeTo);
return relativeToUri.MakeRelativeUri(uri).ToString();
}
}
}

View file

@ -0,0 +1,94 @@
// 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.
using System;
using System.IO;
using System.Text;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using NuGet.Packaging;
using NuGet.Packaging.Core;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Linq;
using NuGet.Versioning;
namespace Microsoft.DotNet.Build.Tasks
{
public class AddRidToRuntimeJson:Task
{
/// <summary>
/// [OS name].[version]-[architecture]
/// </summary>
[Required]
public string Rid { get; set; }
[Required]
public string RuntimeJson { get; set; }
private string runtimesIdentifier = "runtimes";
public override bool Execute()
{
string[] ridParts = Rid.Split('-');
string osNameAndVersion = ridParts[0];
string[] osParts = osNameAndVersion.Split(new char[] { '.' }, 2);
if (ridParts.Length < 1 || osParts.Length < 2)
{
throw new System.InvalidOperationException($"Unknown rid format {Rid}.");
}
// Acquire Rid parts:
// osName
// version
// arch
string arch = ridParts[1];
string osName = osParts[0];
string version = osParts[1];
JObject projectRoot = ReadProject(RuntimeJson);
if (projectRoot.SelectToken($"{runtimesIdentifier}.{osName}") == null)
{
AddRidToRuntimeGraph(projectRoot, osName, "linux");
AddRidToRuntimeGraph(projectRoot, $"{osName}-{arch}", osName, $"linux-{arch}");
}
if(projectRoot.SelectToken($"{runtimesIdentifier}.{osName}.{version}") == null)
{
AddRidToRuntimeGraph(projectRoot, $"{osName}.{version}", osName);
AddRidToRuntimeGraph(projectRoot, $"{osName}.{version}-{arch}", $"{osName}.{version}", $"{osName}-{arch}");
}
WriteProject(projectRoot, RuntimeJson);
return true;
}
private void AddRidToRuntimeGraph(JObject projectRoot, string name, params string[] imports)
{
projectRoot[runtimesIdentifier][name] = new JObject(new JProperty("#import", new JArray(imports)));
}
private static JObject ReadProject(string projectJsonPath)
{
using (TextReader projectFileReader = File.OpenText(projectJsonPath))
{
var projectJsonReader = new JsonTextReader(projectFileReader);
var serializer = new JsonSerializer();
return serializer.Deserialize<JObject>(projectJsonReader);
}
}
private static void WriteProject(JObject projectRoot, string projectJsonPath)
{
string projectJson = JsonConvert.SerializeObject(projectRoot, Formatting.Indented) + Environment.NewLine;
if (!File.Exists(projectJsonPath) || !projectJson.Equals(File.ReadAllText(projectJsonPath)))
{
Directory.CreateDirectory(Path.GetDirectoryName(projectJsonPath));
File.WriteAllText(projectJsonPath, projectJson);
}
}
}
}

View file

@ -0,0 +1,63 @@
// 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.
using System;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Microsoft.DotNet.Build.Tasks
{
/*
* This task adds a source to a well-formed NuGet.Config file. If a source with `SourceName` is already present, then
* the path of the source is changed. Otherwise, the source is added as the first source in the list, after any clear
* elements (if present).
*/
public class AddSourceToNuGetConfig : Task
{
[Required]
public string NuGetConfigFile { get; set; }
[Required]
public string SourceName { get; set; }
[Required]
public string SourcePath { get; set; }
public override bool Execute()
{
XDocument d = XDocument.Load(NuGetConfigFile);
XElement packageSourcesElement = d.Root.Descendants().First(e => e.Name == "packageSources");
XElement toAdd = new XElement("add", new XAttribute("key", SourceName), new XAttribute("value", SourcePath));
XElement clearTag = new XElement("clear");
XElement exisitingSourceBuildElement = packageSourcesElement.Descendants().FirstOrDefault(e => e.Name == "add" && e.Attribute(XName.Get("key")).Value == SourceName);
XElement lastClearElement = packageSourcesElement.Descendants().LastOrDefault(e => e.Name == "clear");
if (exisitingSourceBuildElement != null)
{
exisitingSourceBuildElement.ReplaceWith(toAdd);
}
else if (lastClearElement != null)
{
lastClearElement.AddAfterSelf(toAdd);
}
else
{
packageSourcesElement.AddFirst(toAdd);
packageSourcesElement.AddFirst(clearTag);
}
using (FileStream fs = new FileStream(NuGetConfigFile, FileMode.Create, FileAccess.ReadWrite))
{
d.Save(fs);
}
return true;
}
}
}

View file

@ -0,0 +1,61 @@
// 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.
using Microsoft.Build.Utilities;
using System.Text.RegularExpressions;
namespace Microsoft.DotNet.Build.Tasks
{
public abstract class AzureConnectionStringBuildTask : Task
{
/// <summary>
/// Azure Storage account connection string. Supersedes Account Key / Name.
/// Will cause errors if both are set.
/// </summary>
public string ConnectionString { get; set; }
/// <summary>
/// The Azure account key used when creating the connection string.
/// When we fully deprecate these, can just make them get; only.
/// </summary>
public string AccountKey { get; set; }
/// <summary>
/// The Azure account name used when creating the connection string.
/// When we fully deprecate these, can just make them get; only.
/// </summary>
public string AccountName { get; set; }
public void ParseConnectionString()
{
if (!string.IsNullOrEmpty(ConnectionString))
{
if (!(string.IsNullOrEmpty(AccountKey) && string.IsNullOrEmpty(AccountName)))
{
Log.LogError("If the ConnectionString property is set, you must not provide AccountKey / AccountName. These values will be deprecated in the future.");
}
else
{
Regex storageConnectionStringRegex = new Regex("AccountName=(?<name>.+?);AccountKey=(?<key>.+?);");
MatchCollection matches = storageConnectionStringRegex.Matches(ConnectionString);
if (matches.Count > 0)
{
// When we deprecate this format, we'll want to demote these to private
AccountName = matches[0].Groups["name"].Value;
AccountKey = matches[0].Groups["key"].Value;
}
else
{
Log.LogError("Error parsing connection string. Please review its value.");
}
}
}
else if (string.IsNullOrEmpty(AccountKey) || string.IsNullOrEmpty(AccountName))
{
Log.LogError("Error, must provide either ConnectionString or AccountName with AccountKey");
}
}
}
}

View file

@ -0,0 +1,461 @@
// 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.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Microsoft.DotNet.Build.Tasks
{
public static class AzureHelper
{
/// <summary>
/// The storage api version.
/// </summary>
public static readonly string StorageApiVersion = "2015-04-05";
public const string DateHeaderString = "x-ms-date";
public const string VersionHeaderString = "x-ms-version";
public const string AuthorizationHeaderString = "Authorization";
public const string CacheControlString = "x-ms-blob-cache-control";
public const string ContentTypeString = "x-ms-blob-content-type";
public enum SasAccessType
{
Read,
Write,
};
public static string AuthorizationHeader(
string storageAccount,
string storageKey,
string method,
DateTime now,
HttpRequestMessage request,
string ifMatch = "",
string contentMD5 = "",
string size = "",
string contentType = "")
{
string stringToSign = string.Format(
"{0}\n\n\n{1}\n{5}\n{6}\n\n\n{2}\n\n\n\n{3}{4}",
method,
(size == string.Empty) ? string.Empty : size,
ifMatch,
GetCanonicalizedHeaders(request),
GetCanonicalizedResource(request.RequestUri, storageAccount),
contentMD5,
contentType);
byte[] signatureBytes = Encoding.UTF8.GetBytes(stringToSign);
string authorizationHeader;
using (HMACSHA256 hmacsha256 = new HMACSHA256(Convert.FromBase64String(storageKey)))
{
authorizationHeader = "SharedKey " + storageAccount + ":"
+ Convert.ToBase64String(hmacsha256.ComputeHash(signatureBytes));
}
return authorizationHeader;
}
public static string CreateContainerSasToken(
string accountName,
string containerName,
string key,
SasAccessType accessType,
int validityTimeInDays)
{
string signedPermissions = string.Empty;
switch (accessType)
{
case SasAccessType.Read:
signedPermissions = "r";
break;
case SasAccessType.Write:
signedPermissions = "wdl";
break;
default:
throw new ArgumentOutOfRangeException(nameof(accessType), accessType, "Unrecognized value");
}
string signedStart = DateTime.UtcNow.ToString("O");
string signedExpiry = DateTime.UtcNow.AddDays(validityTimeInDays).ToString("O");
string canonicalizedResource = "/blob/" + accountName + "/" + containerName;
string signedIdentifier = string.Empty;
string signedVersion = StorageApiVersion;
string stringToSign = ConstructServiceStringToSign(
signedPermissions,
signedVersion,
signedExpiry,
canonicalizedResource,
signedIdentifier,
signedStart);
byte[] signatureBytes = Encoding.UTF8.GetBytes(stringToSign);
string signature;
using (HMACSHA256 hmacSha256 = new HMACSHA256(Convert.FromBase64String(key)))
{
signature = Convert.ToBase64String(hmacSha256.ComputeHash(signatureBytes));
}
string sasToken = string.Format(
"?sv={0}&sr={1}&sig={2}&st={3}&se={4}&sp={5}",
WebUtility.UrlEncode(signedVersion),
WebUtility.UrlEncode("c"),
WebUtility.UrlEncode(signature),
WebUtility.UrlEncode(signedStart),
WebUtility.UrlEncode(signedExpiry),
WebUtility.UrlEncode(signedPermissions));
return sasToken;
}
public static string GetCanonicalizedHeaders(HttpRequestMessage request)
{
StringBuilder sb = new StringBuilder();
List<string> headerNameList = (from headerName in request.Headers
where
headerName.Key.ToLowerInvariant()
.StartsWith("x-ms-", StringComparison.Ordinal)
select headerName.Key.ToLowerInvariant()).ToList();
headerNameList.Sort();
foreach (string headerName in headerNameList)
{
StringBuilder builder = new StringBuilder(headerName);
string separator = ":";
foreach (string headerValue in GetHeaderValues(request.Headers, headerName))
{
string trimmedValue = headerValue.Replace("\r\n", string.Empty);
builder.Append(separator);
builder.Append(trimmedValue);
separator = ",";
}
sb.Append(builder);
sb.Append("\n");
}
return sb.ToString();
}
public static string GetCanonicalizedResource(Uri address, string accountName)
{
StringBuilder str = new StringBuilder();
StringBuilder builder = new StringBuilder("/");
builder.Append(accountName);
builder.Append(address.AbsolutePath);
str.Append(builder);
Dictionary<string, HashSet<string>> queryKeyValues = ExtractQueryKeyValues(address);
Dictionary<string, HashSet<string>> dictionary = GetCommaSeparatedList(queryKeyValues);
foreach (KeyValuePair<string, HashSet<string>> pair in dictionary.OrderBy(p => p.Key))
{
StringBuilder stringBuilder = new StringBuilder(string.Empty);
stringBuilder.Append(pair.Key + ":");
string commaList = string.Join(",", pair.Value);
stringBuilder.Append(commaList);
str.Append("\n");
str.Append(stringBuilder);
}
return str.ToString();
}
public static List<string> GetHeaderValues(HttpRequestHeaders headers, string headerName)
{
List<string> list = new List<string>();
IEnumerable<string> values;
headers.TryGetValues(headerName, out values);
if (values != null)
{
list.Add((values.FirstOrDefault() ?? string.Empty).TrimStart(null));
}
return list;
}
private static bool IsWithinRetryRange(HttpStatusCode statusCode)
{
// Retry on http client and server error codes (4xx - 5xx) as well as redirect
var rawStatus = (int)statusCode;
if (rawStatus == 302)
return true;
else if (rawStatus >= 400 && rawStatus <= 599)
return true;
else
return false;
}
public static async Task<HttpResponseMessage> RequestWithRetry(TaskLoggingHelper loggingHelper, HttpClient client,
Func<HttpRequestMessage> createRequest, Func<HttpResponseMessage, bool> validationCallback = null, int retryCount = 5,
int retryDelaySeconds = 5)
{
if (loggingHelper == null)
throw new ArgumentNullException(nameof(loggingHelper));
if (client == null)
throw new ArgumentNullException(nameof(client));
if (createRequest == null)
throw new ArgumentNullException(nameof(createRequest));
if (retryCount < 1)
throw new ArgumentException(nameof(retryCount));
if (retryDelaySeconds < 1)
throw new ArgumentException(nameof(retryDelaySeconds));
int retries = 0;
HttpResponseMessage response = null;
// add a bit of randomness to the retry delay
var rng = new Random();
while (retries < retryCount)
{
if (retries > 0)
{
if (response != null)
{
response.Dispose();
response = null;
}
int delay = retryDelaySeconds * retries * rng.Next(1, 5);
loggingHelper.LogMessage(MessageImportance.Low, "Waiting {0} seconds before retry", delay);
await System.Threading.Tasks.Task.Delay(delay * 1000);
}
try
{
using (var request = createRequest())
response = await client.SendAsync(request);
}
catch (Exception e)
{
loggingHelper.LogWarningFromException(e, true);
// if this is the final iteration let the exception bubble up
if (retries + 1 == retryCount)
throw;
}
// response can be null if we fail to send the request
if (response != null)
{
if (validationCallback == null)
{
// check if the response code is within the range of failures
if (!IsWithinRetryRange(response.StatusCode))
{
return response;
}
}
else
{
bool isSuccess = validationCallback(response);
if (!isSuccess)
{
loggingHelper.LogMessage("Validation callback returned retry for status code {0}", response.StatusCode);
}
else
{
loggingHelper.LogMessage("Validation callback returned success for status code {0}", response.StatusCode);
return response;
}
}
}
++retries;
}
// retry count exceeded
loggingHelper.LogWarning("Retry count {0} exceeded", retryCount);
// set some default values in case response is null
var statusCode = "None";
var contentStr = "Null";
if (response != null)
{
statusCode = response.StatusCode.ToString();
contentStr = await response.Content.ReadAsStringAsync();
response.Dispose();
}
throw new HttpRequestException($"Request {createRequest().RequestUri} failed with status {statusCode}. Response : {contentStr}");
}
private static string ConstructServiceStringToSign(
string signedPermissions,
string signedVersion,
string signedExpiry,
string canonicalizedResource,
string signedIdentifier,
string signedStart,
string signedIP = "",
string signedProtocol = "",
string rscc = "",
string rscd = "",
string rsce = "",
string rscl = "",
string rsct = "")
{
// constructing string to sign based on spec in https://msdn.microsoft.com/en-us/library/azure/dn140255.aspx
var stringToSign = string.Join(
"\n",
signedPermissions,
signedStart,
signedExpiry,
canonicalizedResource,
signedIdentifier,
signedIP,
signedProtocol,
signedVersion,
rscc,
rscd,
rsce,
rscl,
rsct);
return stringToSign;
}
private static Dictionary<string, HashSet<string>> ExtractQueryKeyValues(Uri address)
{
Dictionary<string, HashSet<string>> values = new Dictionary<string, HashSet<string>>();
//Decode this to allow the regex to pull out the correct groups for signing
address = new Uri(WebUtility.UrlDecode(address.ToString()));
Regex newreg = new Regex(@"(?:\?|&)([^=]+)=([^&]+)");
MatchCollection matches = newreg.Matches(address.Query);
foreach (Match match in matches)
{
string key, value;
if (!string.IsNullOrEmpty(match.Groups[1].Value))
{
key = match.Groups[1].Value;
value = match.Groups[2].Value;
}
else
{
key = match.Groups[3].Value;
value = match.Groups[4].Value;
}
HashSet<string> setOfValues;
if (values.TryGetValue(key, out setOfValues))
{
setOfValues.Add(value);
}
else
{
HashSet<string> newSet = new HashSet<string> { value };
values.Add(key, newSet);
}
}
return values;
}
private static Dictionary<string, HashSet<string>> GetCommaSeparatedList(
Dictionary<string, HashSet<string>> queryKeyValues)
{
Dictionary<string, HashSet<string>> dictionary = new Dictionary<string, HashSet<string>>();
foreach (string queryKeys in queryKeyValues.Keys)
{
HashSet<string> setOfValues;
queryKeyValues.TryGetValue(queryKeys, out setOfValues);
List<string> list = new List<string>();
list.AddRange(setOfValues);
list.Sort();
string commaSeparatedValues = string.Join(",", list);
string key = queryKeys.ToLowerInvariant();
HashSet<string> setOfValues2;
if (dictionary.TryGetValue(key, out setOfValues2))
{
setOfValues2.Add(commaSeparatedValues);
}
else
{
HashSet<string> newSet = new HashSet<string> { commaSeparatedValues };
dictionary.Add(key, newSet);
}
}
return dictionary;
}
public static Func<HttpRequestMessage> RequestMessage(string method, string url, string accountName, string accountKey, List<Tuple<string, string>> additionalHeaders = null, string body = null)
{
Func<HttpRequestMessage> requestFunc = () =>
{
HttpMethod httpMethod = HttpMethod.Get;
if (method == "PUT")
{
httpMethod = HttpMethod.Put;
}
else if (method == "DELETE")
{
httpMethod = HttpMethod.Delete;
}
DateTime dateTime = DateTime.UtcNow;
var request = new HttpRequestMessage(httpMethod, url);
request.Headers.Add(AzureHelper.DateHeaderString, dateTime.ToString("R", CultureInfo.InvariantCulture));
request.Headers.Add(AzureHelper.VersionHeaderString, AzureHelper.StorageApiVersion);
if (additionalHeaders != null)
{
foreach (Tuple<string, string> additionalHeader in additionalHeaders)
{
request.Headers.Add(additionalHeader.Item1, additionalHeader.Item2);
}
}
if (body != null)
{
request.Content = new StringContent(body);
request.Headers.Add(AzureHelper.AuthorizationHeaderString, AzureHelper.AuthorizationHeader(
accountName,
accountKey,
method,
dateTime,
request,
"",
"",
request.Content.Headers.ContentLength.ToString(),
request.Content.Headers.ContentType.ToString()));
}
else
{
request.Headers.Add(AzureHelper.AuthorizationHeaderString, AzureHelper.AuthorizationHeader(
accountName,
accountKey,
method,
dateTime,
request));
}
return request;
};
return requestFunc;
}
public static string GetRootRestUrl(string accountName)
{
return $"https://{accountName}.blob.core.windows.net";
}
public static string GetContainerRestUrl(string accountName, string containerName)
{
return $"{GetRootRestUrl(accountName)}/{containerName}";
}
public static string GetBlobRestUrl(string accountName, string containerName, string blob)
{
return $"{GetContainerRestUrl(accountName, containerName)}/{blob}";
}
}
}

View file

@ -0,0 +1,37 @@
// 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.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Microsoft.DotNet.Build.Tasks
{
public abstract partial class BuildTask : ITask
{
private TaskLoggingHelper _log = null;
internal TaskLoggingHelper Log
{
get { return _log ?? (_log = new TaskLoggingHelper(this)); }
}
public BuildTask()
{
}
public IBuildEngine BuildEngine
{
get;
set;
}
public ITaskHost HostObject
{
get;
set;
}
public abstract bool Execute();
}
}

View file

@ -0,0 +1,409 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// This task is sourced from https://github.com/microsoft/msbuild/blob/04e508c36f9c1fe826264aef7c26ffb8f16e9bdc/src/Tasks/DownloadFile.cs
// Contains further modifications in followup commits.
// It alleviates the problem of time outs on DownloadFile Task. We are not the version of msbuild that has this fix, hence we have to locally
// build it to get rid of the issue.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.DotNet.Build.Tasks;
using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Task = System.Threading.Tasks.Task;
namespace Microsoft.Build.Tasks
{
/// <summary>
/// Represents a task that can download a file.
/// </summary>
public sealed class DownloadFileSB : BuildTask, ICancelableTask
{
private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
/// <summary>
/// Gets or sets an optional filename for the destination file. By default, the filename is derived from the <see cref="SourceUrl"/> if possible.
/// </summary>
public ITaskItem DestinationFileName { get; set; }
/// <summary>
/// Gets or sets a <see cref="ITaskItem"/> that specifies the destination folder to download the file to.
/// </summary>
[Required]
public ITaskItem DestinationFolder { get; set; }
/// <summary>
/// Gets or sets a <see cref="ITaskItem"/> that contains details about the downloaded file.
/// </summary>
[Output]
public ITaskItem DownloadedFile { get; set; }
/// <summary>
/// Gets or sets an optional number of times to retry if possible.
/// </summary>
public int Retries { get; set; }
/// <summary>
/// Gets or sets the number of milliseconds to wait before retrying.
/// </summary>
public int RetryDelayMilliseconds { get; set; } = 5 * 1000;
/// <summary>
/// Gets or sets an optional value indicating whether or not the download should be skipped if the file is up-to-date.
/// </summary>
public bool SkipUnchangedFiles { get; set; } = true;
/// <summary>
/// Gets or sets the URL to download.
/// </summary>
[Required]
public string SourceUrl { get; set; }
/// <summary>
/// Gets or sets the timeout for a successful download. If exceeded, the download continues
/// for another two timeout durations before failing. This makes it sometimes possible to
/// determine whether the timeout is just a little too short, or if the download would never
/// have finished.
/// </summary>
public string TimeoutSeconds { get; set; }
/// <summary>
/// Gets or sets a <see cref="HttpMessageHandler"/> to use. This is used by unit tests to mock a connection to a remote server.
/// </summary>
internal HttpMessageHandler HttpMessageHandler { get; set; }
/// <inheritdoc cref="ICancelableTask.Cancel"/>
public void Cancel()
{
_cancellationTokenSource.Cancel();
}
public override bool Execute()
{
return ExecuteAsync().GetAwaiter().GetResult();
}
private async Task<bool> ExecuteAsync()
{
if (!Uri.TryCreate(SourceUrl, UriKind.Absolute, out Uri uri))
{
Log.LogError($"DownloadFileSB.ErrorInvalidUrl {SourceUrl}");
return false;
}
int retryAttemptCount = 0;
CancellationToken cancellationToken = _cancellationTokenSource.Token;
var startTime = DateTime.UtcNow;
// Use the same API for the "success timeout" and the "would it ever succeed" timeout.
var timeout = TimeSpan.Zero;
var successCancellationTokenSource = new CancellationTokenSource();
if (double.TryParse(TimeoutSeconds, out double timeoutSeconds))
{
timeout = TimeSpan.FromSeconds(timeoutSeconds);
Log.LogMessage(MessageImportance.High, $"DownloadFileSB timeout set to {timeout}");
successCancellationTokenSource.CancelAfter(timeout);
_cancellationTokenSource.CancelAfter((int)(timeout.TotalMilliseconds * 3));
}
while (true)
{
try
{
await DownloadAsync(uri, cancellationToken);
break;
}
catch (OperationCanceledException e) when (e.CancellationToken == cancellationToken)
{
// This task is being cancelled. Exit the loop.
break;
}
catch (Exception e)
{
bool canRetry = IsRetriable(e, out Exception actualException) && retryAttemptCount++ < Retries;
if (canRetry)
{
Log.LogWarning($"DownloadFileSB.Retrying {SourceUrl} {retryAttemptCount + 1} {RetryDelayMilliseconds} {actualException}");
try
{
await Task.Delay(RetryDelayMilliseconds, cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException delayException) when (delayException.CancellationToken == cancellationToken)
{
// This task is being cancelled, exit the loop
break;
}
}
else
{
Log.LogError($"DownloadFileSB.ErrorDownloading {SourceUrl} {actualException}");
break;
}
}
}
var finishTime = DateTime.UtcNow;
if (successCancellationTokenSource.IsCancellationRequested)
{
string error = $"{TimeoutSeconds} second timeout exceeded";
if (!_cancellationTokenSource.IsCancellationRequested)
{
error +=
$", but download completed after {finishTime - startTime}. " +
$"Try increasing timeout from {TimeoutSeconds} if this is acceptable.";
}
else
{
error +=
$", and didn't complete within leeway after {finishTime - startTime}. " +
$"The download was likely never going to terminate. Investigate logs and " +
$"add additional logging if necessary.";
}
Log.LogError(error);
}
else
{
Log.LogMessage(
MessageImportance.High,
$"DownloadFileSB.Downloading Complete! Elapsed: {finishTime - startTime}");
}
return !_cancellationTokenSource.IsCancellationRequested && !Log.HasLoggedErrors;
}
/// <summary>
/// Attempts to download the file.
/// </summary>
/// <param name="uri">The parsed <see cref="Uri"/> of the request.</param>
private async Task DownloadAsync(Uri uri, CancellationToken cancellationToken)
{
// The main reason to use HttpClient vs WebClient is because we can pass a message handler for unit tests to mock
using (var client = new HttpClient(HttpMessageHandler ?? new HttpClientHandler(), disposeHandler: true))
{
// Only get the response without downloading the file so we can determine if the file is already up-to-date
using (HttpResponseMessage response = await client.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false))
{
try
{
response.EnsureSuccessStatusCode();
}
catch (HttpRequestException e)
{
// HttpRequestException does not have the status code so its wrapped and thrown here so that later on we can determine
// if a retry is possible based on the status code
throw new CustomHttpRequestException(e.Message, e.InnerException, response.StatusCode);
}
if (!TryGetFileName(response, out string filename))
{
Log.LogError($"DownloadFileSB.ErrorUnknownFileName {SourceUrl} {nameof(DestinationFileName)}");
return;
}
DirectoryInfo destinationDirectory = Directory.CreateDirectory(DestinationFolder.ItemSpec);
var destinationFile = new FileInfo(Path.Combine(destinationDirectory.FullName, filename));
// The file is considered up-to-date if its the same length. This could be inaccurate, we can consider alternatives in the future
if (ShouldSkip(response, destinationFile))
{
Log.LogMessage(MessageImportance.Normal, $"DownloadFileSB.DidNotDownloadBecauseOfFileMatch {SourceUrl}", destinationFile.FullName, nameof(SkipUnchangedFiles), "true");
DownloadedFile = new TaskItem(destinationFile.FullName);
return;
}
var progressMonitorCancellationTokenSource = new CancellationTokenSource();
CancellationToken progressMonitorToken = progressMonitorCancellationTokenSource.Token;
try
{
cancellationToken.ThrowIfCancellationRequested();
var startTime = DateTime.UtcNow;
var progressMonitor = Task.Run(
async () =>
{
while (!progressMonitorToken.IsCancellationRequested)
{
destinationFile.Refresh();
if (destinationFile.Exists)
{
long current = destinationFile.Length;
long total = response.Content.Headers.ContentLength ?? 1;
var elapsed = DateTime.UtcNow - startTime;
double kbytesPerSecond = current / elapsed.TotalSeconds / 1000.0;
Log.LogMessage(
MessageImportance.High,
$"Progress... {elapsed}, " +
$"current file size {current / (double)total:00.0%} " +
$"({destinationFile.Length:#,0} / {total:#,0}) " +
$"~ {kbytesPerSecond:#,0.00} kB/s");
}
await Task.Delay(TimeSpan.FromSeconds(5), progressMonitorToken);
}
},
progressMonitorToken)
.ConfigureAwait(false);
using (var target = new FileStream(destinationFile.FullName, FileMode.Create, FileAccess.Write, FileShare.None))
{
Log.LogMessage(
MessageImportance.High,
$"DownloadFileSB.Downloading {SourceUrl} to " +
$"{destinationFile.FullName}");
Log.LogMessage( MessageImportance.Low, $"All response headers:\n{response.Headers}");
Log.LogMessage( MessageImportance.Low, $"All content headers:\n{response.Content.Headers}");
using (Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
{
await responseStream.CopyToAsync(target, 1024, cancellationToken).ConfigureAwait(false);
}
Log.LogMessage(MessageImportance.High, $"DownloadFileSB.StreamCopyComplete {SourceUrl}");
DownloadedFile = new TaskItem(destinationFile.FullName);
}
}
finally
{
if (DownloadedFile == null)
{
// Delete the file if anything goes wrong during download. This could be destructive but we don't want to leave
// partially downloaded files on disk either. Alternatively we could download to a temporary location and copy
// on success but we are concerned about the added I/O
destinationFile.Delete();
}
progressMonitorCancellationTokenSource.Cancel();
}
}
}
}
/// <summary>
/// Determines if the specified exception is considered retriable.
/// </summary>
/// <param name="exception">The originally thrown exception.</param>
/// <param name="actualException">The actual exception to be used for logging errors.</param>
/// <returns><code>true</code> if the exception is retriable, otherwise <code>false</code>.</returns>
private static bool IsRetriable(Exception exception, out Exception actualException)
{
actualException = exception;
// Get aggregate inner exception
if (actualException is AggregateException aggregateException && aggregateException.InnerException != null)
{
actualException = aggregateException.InnerException;
}
// Some HttpRequestException have an inner exception that has the real error
if (actualException is HttpRequestException httpRequestException && httpRequestException.InnerException != null)
{
actualException = httpRequestException.InnerException;
// An IOException inside of a HttpRequestException means that something went wrong while downloading
if (actualException is IOException)
{
return true;
}
}
if (actualException is CustomHttpRequestException customHttpRequestException)
{
// A wrapped CustomHttpRequestException has the status code from the error
switch (customHttpRequestException.StatusCode)
{
case HttpStatusCode.InternalServerError:
case HttpStatusCode.RequestTimeout:
return true;
}
}
if (actualException is WebException webException)
{
// WebException is thrown when accessing the Content of the response
switch (webException.Status)
{
// Don't retry on anything that cannot be compensated for
case WebExceptionStatus.TrustFailure:
case WebExceptionStatus.MessageLengthLimitExceeded:
case WebExceptionStatus.RequestProhibitedByCachePolicy:
case WebExceptionStatus.RequestProhibitedByProxy:
return false;
default:
// Retry on all other WebExceptions
return true;
}
}
return false;
}
/// <summary>
/// Attempts to get the file name to use when downloading the file.
/// </summary>
/// <param name="response">The <see cref="HttpResponseMessage"/> with information about the response.</param>
/// <param name="filename">Receives the name of the file.</param>
/// <returns><code>true</code> if a file name could be determined, otherwise <code>false</code>.</returns>
private bool TryGetFileName(HttpResponseMessage response, out string filename)
{
if (response == null)
{
throw new ArgumentNullException(nameof(response));
}
// Not all URIs contain a file name so users will have to specify one
// Example: http://www.download.com/file/1/
filename = !String.IsNullOrWhiteSpace(DestinationFileName?.ItemSpec)
? DestinationFileName.ItemSpec // Get the file name from what the user specified
: response.Content?.Headers?.ContentDisposition?.FileName // Attempt to get the file name from the content-disposition header value
?? Path.GetFileName(response.RequestMessage.RequestUri.LocalPath); // Otherwise attempt to get a file name from the URI
return !String.IsNullOrWhiteSpace(filename);
}
/// <summary>
/// Represents a wrapper around the <see cref="HttpRequestException"/> that also contains the <see cref="HttpStatusCode"/>.
/// </summary>
private sealed class CustomHttpRequestException : HttpRequestException
{
public CustomHttpRequestException(string message, Exception inner, HttpStatusCode statusCode)
: base(message, inner)
{
StatusCode = statusCode;
}
public HttpStatusCode StatusCode { get; }
}
private bool ShouldSkip(HttpResponseMessage response, FileInfo destinationFile)
{
return SkipUnchangedFiles
&& destinationFile.Exists
&& destinationFile.Length == response.Content.Headers.ContentLength
&& response.Content.Headers.LastModified.HasValue
&& destinationFile.LastWriteTimeUtc > response.Content.Headers.LastModified.Value.UtcDateTime;
}
}
}

View file

@ -0,0 +1,17 @@
// 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.
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.DotNet.SourceBuild.Tasks
{
internal static class EnumerableExtensions
{
public static IEnumerable<T> NullAsEmpty<T>(this IEnumerable<T> source)
{
return source ?? Enumerable.Empty<T>();
}
}
}

View file

@ -0,0 +1,86 @@
// 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.
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Microsoft.DotNet.Build.Tasks
{
/*
* This task replaces both types of path separators ('/' and '\') with the separator for the current
* platform. This workaround a NuGet issue where `nuget pack` does not translate path separators causing
* packages that don't appear to have the right assets in them.
*/
public class FixPathSeparator : Task
{
[Required]
public ITaskItem[] NuSpecFiles { get; set; }
public override bool Execute()
{
foreach (ITaskItem item in NuSpecFiles)
{
string pathToNuSpec = item.GetMetadata("FullPath");
XDocument doc = XDocument.Load(pathToNuSpec);
XElement contentFilesElement = doc.ElementIgnoringNamespace("package").ElementIgnoringNamespace("metadata").ElementIgnoringNamespace("contentFiles");
XElement filesElement = doc.ElementIgnoringNamespace("package").ElementIgnoringNamespace("files");
if (contentFilesElement != null)
{
foreach (XElement element in contentFilesElement.ElementsIgnroingNamespace("files"))
{
UpdateDirectorySeperatorInAttribute(element, "include");
UpdateDirectorySeperatorInAttribute(element, "exclude");
}
}
if (filesElement != null)
{
foreach (XElement element in filesElement.ElementsIgnroingNamespace("file"))
{
UpdateDirectorySeperatorInAttribute(element, "src");
UpdateDirectorySeperatorInAttribute(element, "target");
UpdateDirectorySeperatorInAttribute(element, "exclude");
}
}
using (FileStream fs = File.Open(pathToNuSpec, FileMode.Truncate))
{
doc.Save(fs);
}
}
return true;
}
private static void UpdateDirectorySeperatorInAttribute(XElement element, XName name)
{
XAttribute attribute = element.Attribute(name);
if (attribute != null)
{
element.SetAttributeValue(name, attribute.Value.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar));
}
}
}
static class XContainerExtensions
{
public static IEnumerable<XElement> ElementsIgnroingNamespace(this XContainer container, XName elementName)
{
return container.Elements().Where(e => e.Name.LocalName == elementName.LocalName);
}
public static XElement ElementIgnoringNamespace(this XContainer container, XName elementName)
{
return container.ElementsIgnroingNamespace(elementName).FirstOrDefault();
}
}
}

View file

@ -0,0 +1,153 @@
// 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.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using NuGet.Packaging.Core;
using NuGet.Versioning;
using System;
using System.IO;
using System.Linq;
namespace Microsoft.DotNet.SourceBuild.Tasks
{
/// <summary>
/// For each source-built nupkg info given, ensure that if the package cache contains a package
/// with the same id and version, the cached nupkg is the same as the source-built one.
///
/// If the package cache contains a package with the same package id and version as a
/// source-built one, nuget restore short-circuits and doesn't look for the source-built one.
/// This usually results in prebuilt packages being used, which can either break the build or
/// end up in the outputs.
/// </summary>
public class GetSourceBuiltNupkgCacheConflicts : Task
{
/// <summary>
/// Items containing package id and version of each source-built package.
/// ReadNuGetPackageInfos is recommended to generate these.
///
/// %(Identity): Path to the original nupkg.
/// %(PackageId): Identity of the package.
/// %(PackageVersion): Version of the package.
/// </summary>
[Required]
public ITaskItem[] SourceBuiltPackageInfos { get; set; }
/// <summary>
/// Package cache dir containing nupkgs to compare. Path is expected to be like:
///
/// {PackageCacheDir}/{lowercase id}/{version}/{lowercase id}.{version}.nupkg
/// </summary>
[Required]
public string PackageCacheDir { get; set; }
/// <summary>
/// Paths to packages to compare against when conflicts are detected. Knowing where the
/// package in the cache came from can help diagnose a conflict. For example, is it from
/// prebuilt/source-built? Or does the build not have the nupkg anywhere else, and
/// therefore it most likely came from the internet?
/// </summary>
public string[] KnownOriginPackagePaths { get; set; }
[Output]
public ITaskItem[] ConflictingPackageInfos { get; set; }
public override bool Execute()
{
DateTime startTime = DateTime.Now;
var knownNupkgs = new Lazy<ILookup<PackageIdentity, string>>(() =>
{
Log.LogMessage(
MessageImportance.Low,
$"Reading all {nameof(KnownOriginPackagePaths)} package identities to search " +
"for conflicting package origin...");
return KnownOriginPackagePaths.NullAsEmpty().ToLookup(
ReadNuGetPackageInfos.ReadIdentity,
path => path);
});
ConflictingPackageInfos = SourceBuiltPackageInfos
.Where(item =>
{
string sourceBuiltPath = item.ItemSpec;
string id = item.GetMetadata("PackageId");
string version = item.GetMetadata("PackageVersion");
string packageCachePath = Path.Combine(
PackageCacheDir,
id.ToLowerInvariant(),
version,
$"{id.ToLowerInvariant()}.{version}.nupkg");
if (!File.Exists(packageCachePath))
{
Log.LogMessage(
MessageImportance.Low,
$"OK: Package not found in package cache: {id} {version}");
return false;
}
Log.LogMessage(
MessageImportance.Low,
$"Package id/version found in package cache, verifying: {id} {version}");
byte[] packageCacheBytes = File.ReadAllBytes(packageCachePath);
if (packageCacheBytes.SequenceEqual(File.ReadAllBytes(sourceBuiltPath)))
{
Log.LogMessage(
MessageImportance.Low,
$"OK: Package in cache is identical to source-built: {id} {version}");
return false;
}
Log.LogMessage(
MessageImportance.Low,
"BAD: Source-built nupkg is not byte-for-byte identical " +
$"to nupkg in cache: {id} {version}");
var ident = new PackageIdentity(id, NuGetVersion.Parse(version));
string message = null;
foreach (string knownNupkg in knownNupkgs.Value[ident])
{
if (packageCacheBytes.SequenceEqual(File.ReadAllBytes(knownNupkg)))
{
Log.LogMessage(
MessageImportance.Low,
$"Found identity match with identical contents: {knownNupkg}");
message = (message ?? "Nupkg found at") + $" '{knownNupkg}'";
}
else
{
Log.LogMessage(
MessageImportance.Low,
$"Package identity match, but contents differ: {knownNupkg}");
}
}
item.SetMetadata(
"WarningMessage",
message ??
"Origin nupkg not found in build directory. It may have been " +
"downloaded by NuGet restore.");
return true;
})
.ToArray();
// Tell the user about this task, in case it takes a while.
Log.LogMessage(
MessageImportance.High,
"Checked cache for conflicts with source-built nupkgs. " +
$"Took {DateTime.Now - startTime}");
return !Log.HasLoggedErrors;
}
}
}

View file

@ -0,0 +1,118 @@
// 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.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Microsoft.DotNet.Build.Tasks.Packaging
{
internal class Log : ILog
{
private readonly TaskLoggingHelper _logger;
public Log(TaskLoggingHelper logger)
{
_logger = logger;
}
public void LogError(string message, params object[] messageArgs)
{
_logger.LogError(message, messageArgs);
}
public void LogMessage(string message, params object[] messageArgs)
{
_logger.LogMessage(message, messageArgs);
}
public void LogMessage(LogImportance importance, string message, params object[] messageArgs)
{
_logger.LogMessage((MessageImportance)importance, message, messageArgs);
}
public void LogWarning(string message, params object[] messageArgs)
{
_logger.LogWarning(message, messageArgs);
}
public bool HasLoggedErrors { get { return _logger.HasLoggedErrors; } }
}
public enum LogImportance
{
Low = MessageImportance.Low,
Normal = MessageImportance.Normal,
High = MessageImportance.High
}
public interface ILog
{
//
// Summary:
// Logs an error with the specified message.
//
// Parameters:
// message:
// The message.
//
// messageArgs:
// Optional arguments for formatting the message string.
//
// Exceptions:
// T:System.ArgumentNullException:
// message is null.
void LogError(string message, params object[] messageArgs);
//
// Summary:
// Logs a message with the specified string.
//
// Parameters:
// message:
// The message.
//
// messageArgs:
// The arguments for formatting the message.
//
// Exceptions:
// T:System.ArgumentNullException:
// message is null.
void LogMessage(string message, params object[] messageArgs);
//
// Summary:
// Logs a message with the specified string and importance.
//
// Parameters:
// importance:
// One of the enumeration values that specifies the importance of the message.
//
// message:
// The message.
//
// messageArgs:
// The arguments for formatting the message.
//
// Exceptions:
// T:System.ArgumentNullException:
// message is null.
void LogMessage(LogImportance importance, string message, params object[] messageArgs);
//
// Summary:
// Logs a warning with the specified message.
//
// Parameters:
// message:
// The message.
//
// messageArgs:
// Optional arguments for formatting the message string.
//
// Exceptions:
// T:System.ArgumentNullException:
// message is null.
void LogWarning(string message, params object[] messageArgs);
}
}

Some files were not shown because too many files have changed in this diff Show more