Merge remote-tracking branch 'dotnet/release/2.1.3xx' into merges/release/2.1.3xx-to-master
* dotnet/release/2.1.3xx: Update to aspnetcore 2.1.0-preview1-28275 and react to feed layout changes (#8611) "ExternalRestoreSources" needs to be set in the docker container (#8602) Signing nupkg contents (Cli.Utils and MSBuildResolver) along with the rest of the compiled assemblies. Use satellites from roslyn package, not cli-deps-satellites Update to roslyn 2.7.0-beta3-62612-07 for 2.1.1xx Support TildeSlash expand (#8589) Port Kernel Version telemetry to preview1 Do not create a directory with a trailing space; it cannot be deleted by conventional methods. (#8587) Consume generic aspnetcore rpm installers Insert NuGet Build 4.6.0-rtm-4918 into cli Adding roslyn to automatic dependency flow through maestro. Fixing update dependency by using the new APIs. We broke this when we updated the version of VersionTools. MSBuild 15.6.81 Update SDK to 2.1.300-preview1-62608-07 MSBuild 15.6.80 Conflicts: build/DependencyVersions.props test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs
This commit is contained in:
commit
f19b3fddc9
14 changed files with 130 additions and 146 deletions
|
@ -32,8 +32,7 @@
|
|||
<AspNetCoreSharedFxInstallerRid Condition="'$(SharedFrameworkRid)' == 'alpine.3.6-x64'">linux-x64</AspNetCoreSharedFxInstallerRid>
|
||||
<AspNetCoreSharedFxInstallerRid Condition="'$(SharedFrameworkRid)' == 'rhel.6-x64'">linux-x64</AspNetCoreSharedFxInstallerRid>
|
||||
<AspNetCoreSharedFxArchiveRid>$(AspNetCoreSharedFxInstallerRid)</AspNetCoreSharedFxArchiveRid>
|
||||
<AspNetCoreSharedFxInstallerRid Condition="'$(InstallerExtension)' == '.deb'">x64</AspNetCoreSharedFxInstallerRid>
|
||||
<AspNetCoreSharedFxInstallerRid Condition="'$(InstallerExtension)' == '.rpm'">$(CoreSetupRid)</AspNetCoreSharedFxInstallerRid>
|
||||
<AspNetCoreSharedFxInstallerRid Condition="'$(InstallerExtension)' == '.deb' OR '$(InstallerExtension)' == '.rpm'">x64</AspNetCoreSharedFxInstallerRid>
|
||||
|
||||
<DownloadedAspNetCoreSharedFxInstallerFileName Condition=" '$(InstallerExtension)' != '' AND '$(HostOSName)' != 'osx' ">aspnetcore-runtime-$(AspNetCoreVersion)-$(AspNetCoreSharedFxInstallerRid)$(InstallerExtension)</DownloadedAspNetCoreSharedFxInstallerFileName>
|
||||
<!-- Note: we use the "-internal" archives and installers that contain only the aspnetcore shared framework, and shouldn't overlap with Microsoft.NETCore.App. -->
|
||||
|
@ -50,6 +49,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<CoreSetupRootUrl>$(CoreSetupBlobRootUrl)Runtime/</CoreSetupRootUrl>
|
||||
<AspNetCoreSharedFxRootUrl>$(CoreSetupBlobRootUrl)aspnetcore/Runtime/</AspNetCoreSharedFxRootUrl>
|
||||
<CoreSetupDownloadDirectory>$(IntermediateDirectory)/coreSetupDownload/$(MicrosoftNETCoreAppPackageVersion)</CoreSetupDownloadDirectory>
|
||||
<CombinedSharedHostAndFrameworkArchive>$(CoreSetupDownloadDirectory)/combinedSharedHostAndFrameworkArchive$(ArchiveExtension)</CombinedSharedHostAndFrameworkArchive>
|
||||
</PropertyGroup>
|
||||
|
@ -57,7 +57,7 @@
|
|||
<ItemGroup>
|
||||
<_DownloadAndExtractItem Include="AspNetCoreSharedFxArchiveFile"
|
||||
Condition="!Exists('$(AspNetCoreSharedFxArchiveFile)')">
|
||||
<Url>$(CoreSetupRootUrl)$(AspNetCoreVersion)/$(AspNetCoreSharedFxArchiveFileName)$(CoreSetupBlobAccessTokenParam)</Url>
|
||||
<Url>$(AspNetCoreSharedFxRootUrl)$(AspNetCoreVersion)/$(AspNetCoreSharedFxArchiveFileName)$(CoreSetupBlobAccessTokenParam)</Url>
|
||||
<DownloadFileName>$(AspNetCoreSharedFxArchiveFile)</DownloadFileName>
|
||||
<ExtractDestination>$(AspNetCoreSharedFxPublishDirectory)</ExtractDestination>
|
||||
</_DownloadAndExtractItem>
|
||||
|
@ -99,14 +99,14 @@
|
|||
|
||||
<_DownloadAndExtractItem Include="DownloadedAspNetCoreSharedFxInstallerFile"
|
||||
Condition="'$(SkipBuildingInstallers)' != 'true' AND '$(DownloadedAspNetCoreSharedFxInstallerFile)' != '' AND !Exists($(DownloadedAspNetCoreSharedFxInstallerFile)) And '$(InstallerExtension)' != ''">
|
||||
<Url>$(CoreSetupRootUrl)$(AspNetCoreVersion)/$(DownloadedAspNetCoreSharedFxInstallerFileName)$(CoreSetupBlobAccessTokenParam)</Url>
|
||||
<Url>$(AspNetCoreSharedFxRootUrl)$(AspNetCoreVersion)/$(DownloadedAspNetCoreSharedFxInstallerFileName)$(CoreSetupBlobAccessTokenParam)</Url>
|
||||
<DownloadFileName>$(DownloadedAspNetCoreSharedFxInstallerFile)</DownloadFileName>
|
||||
<ExtractDestination></ExtractDestination>
|
||||
</_DownloadAndExtractItem>
|
||||
|
||||
<_DownloadAndExtractItem Include="AspNetCoreSharedFxBaseRuntimeVersionFile"
|
||||
Condition="!Exists('$(AspNetCoreSharedFxBaseRuntimeVersionFile)')">
|
||||
<Url>$(CoreSetupRootUrl)$(AspNetCoreVersion)/$(AspNetCoreSharedFxBaseRuntimeVersionFileName)$(CoreSetupBlobAccessTokenParam)</Url>
|
||||
<Url>$(AspNetCoreSharedFxRootUrl)$(AspNetCoreVersion)/$(AspNetCoreSharedFxBaseRuntimeVersionFileName)$(CoreSetupBlobAccessTokenParam)</Url>
|
||||
<DownloadFileName>$(AspNetCoreSharedFxBaseRuntimeVersionFile)</DownloadFileName>
|
||||
<ExtractDestination></ExtractDestination>
|
||||
</_DownloadAndExtractItem>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<MicrosoftAspNetCoreAllPackageVersion>2.1.0-preview2-30057</MicrosoftAspNetCoreAllPackageVersion>
|
||||
<MicrosoftNETCoreAppPackageVersion>2.1.0-preview2-26131-06</MicrosoftNETCoreAppPackageVersion>
|
||||
<MicrosoftNETCoreDotNetHostResolverPackageVersion>$(MicrosoftNETCoreAppPackageVersion)</MicrosoftNETCoreDotNetHostResolverPackageVersion>
|
||||
<MicrosoftBuildPackageVersion>15.6.0-preview-000054-1286830</MicrosoftBuildPackageVersion>
|
||||
<MicrosoftBuildPackageVersion>15.6.81</MicrosoftBuildPackageVersion>
|
||||
<MicrosoftBuildFrameworkPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildFrameworkPackageVersion>
|
||||
<MicrosoftBuildRuntimePackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildRuntimePackageVersion>
|
||||
<MicrosoftBuildLocalizationPackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildLocalizationPackageVersion>
|
||||
|
@ -49,7 +49,6 @@
|
|||
<MicrosoftTestPlatformBuildPackageVersion>$(MicrosoftNETTestSdkPackageVersion)</MicrosoftTestPlatformBuildPackageVersion>
|
||||
<XliffTasksPackageVersion>0.2.0-beta-000042</XliffTasksPackageVersion>
|
||||
<MicroBuildCorePackageVersion>0.2.0</MicroBuildCorePackageVersion>
|
||||
<CliDepsSatellitesRoslynPackageVersion>2.6.0-pre-20171122-1</CliDepsSatellitesRoslynPackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- NOTE: The property group above is in alignment with orchestrated build version naming conventions. -->
|
||||
|
@ -60,7 +59,7 @@
|
|||
|
||||
<SharedHostVersion>$(MicrosoftNETCoreAppPackageVersion)</SharedHostVersion>
|
||||
<HostFxrVersion>$(MicrosoftNETCoreAppPackageVersion)</HostFxrVersion>
|
||||
<AspNetCoreVersion>$(MicrosoftAspNetCoreAllPackageVersion)</AspNetCoreVersion>
|
||||
<AspNetCoreVersion>$(MicrosoftAspNetCoreAppPackageVersion)</AspNetCoreVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- infrastructure and test only dependencies -->
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<UsingTask TaskName="AddMetadataIsPE" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="AddToDeps" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="ChangeEntryPointLibraryName" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="CheckIfAllBuildsHavePublished" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="ChMod" AssemblyFile="$(CLIBuildDll)" />
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="PostCompileSign" DependsOnTargets="GetPostCompileSignFiles;SignFiles" />
|
||||
<Target Name="PostCompileSign" DependsOnTargets="GetPostCompileSignFiles;GetSignNuPkgContentsFiles;GetSignSdkResolverContentsFiles;SignFiles" />
|
||||
|
||||
<Target Name="GetPostCompileSignFiles">
|
||||
<ItemGroup>
|
||||
|
@ -71,18 +71,21 @@
|
|||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="SignNuPkgContents" DependsOnTargets="GetSignNuPkgContentsFiles;SignFiles" />
|
||||
<!-- Keeping this target around so as not to break existing build definitions. -->
|
||||
<Target Name="SignNuPkgContents" />
|
||||
|
||||
<Target Name="GetSignNuPkgContentsFiles">
|
||||
<ItemGroup>
|
||||
<!-- NuPkg contents -->
|
||||
<FilesToSign Include="$(BaseOutputDirectory)/bin/Microsoft.DotNet.Cli.Utils/**/Microsoft.DotNet.Cli.Utils.dll">
|
||||
<FilesToSign Include="$(BaseOutputDirectory)/bin/Microsoft.DotNet.Cli.Utils/**/Microsoft.DotNet.Cli.Utils.dll;
|
||||
$(BaseOutputDirectory)/bin/Microsoft.DotNet.Cli.Utils/**/Microsoft.DotNet.Cli.Utils.resources.dll">
|
||||
<Authenticode>$(InternalCertificateId)</Authenticode>
|
||||
</FilesToSign>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="SignSdkResolverContents" DependsOnTargets="GetSignSdkResolverContentsFiles;SignFiles" />
|
||||
<!-- Keeping this target around so as not to break existing build definitions. -->
|
||||
<Target Name="SignSdkResolverContents" />
|
||||
|
||||
<Target Name="GetSignSdkResolverContentsFiles">
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using Microsoft.Extensions.DependencyModel;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
/// <summary>
|
||||
/// Merges additional .deps.json files into target .deps.json files.
|
||||
/// </summary>
|
||||
public class AddToDeps : Task
|
||||
{
|
||||
/// <summary>
|
||||
/// Paths to target .deps.json files, into which <see cref="AdditionalDeps" /> will be merged.
|
||||
/// These files will be overwritten with the merge result.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string[] TargetDeps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Paths to additional .deps.json files to merge into <see cref="TargetDeps" />.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string[] AdditionalDeps { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
DependencyContext additionalContext = Read(AdditionalDeps.First());
|
||||
|
||||
foreach (string additionalPath in AdditionalDeps.Skip(1))
|
||||
{
|
||||
additionalContext = additionalContext.Merge(Read(additionalPath));
|
||||
}
|
||||
|
||||
foreach (string targetPath in TargetDeps)
|
||||
{
|
||||
DependencyContext targetContext = Read(targetPath).Merge(additionalContext);
|
||||
Write(targetContext, targetPath);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static DependencyContext Read(string path)
|
||||
{
|
||||
using (FileStream stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var reader = new DependencyContextJsonReader())
|
||||
{
|
||||
return reader.Read(stream);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Write(DependencyContext context, string path)
|
||||
{
|
||||
using (FileStream stream = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
{
|
||||
var writer = new DependencyContextWriter(); // unlike reader, writer is not disposable
|
||||
writer.Write(context, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -139,5 +139,6 @@ docker run $INTERACTIVE -t --rm --sig-proxy=true \
|
|||
-e PB_ASSETROOTURL \
|
||||
-e PB_PACKAGEVERSIONPROPSURL \
|
||||
-e PB_PUBLISHBLOBFEEDURL \
|
||||
-e EXTERNALRESTORESOURCES \
|
||||
$DOTNET_BUILD_CONTAINER_TAG \
|
||||
$BUILD_COMMAND "$@"
|
||||
|
|
32
scripts/obtain/dotnet-install.ps1
vendored
32
scripts/obtain/dotnet-install.ps1
vendored
|
@ -43,8 +43,8 @@
|
|||
.PARAMETER Runtime
|
||||
Installs just a shared runtime, not the entire SDK.
|
||||
Possible values:
|
||||
- dotnet
|
||||
- aspnetcore
|
||||
- dotnet - the Microsoft.NETCore.App shared runtime
|
||||
- aspnetcore - the Microsoft.AspNetCore.App shared runtime
|
||||
.PARAMETER DryRun
|
||||
If set it will not perform installation but instead display what command line to use to consistently install
|
||||
currently requested version of dotnet cli. In example if you specify version 'latest' it will display a link
|
||||
|
@ -249,10 +249,10 @@ function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel, [bool]$Co
|
|||
if ($Runtime -eq "dotnet") {
|
||||
$VersionFileUrl = "$UncachedFeed/Runtime/$Channel/latest.version"
|
||||
}
|
||||
elseif ($Runtime) {
|
||||
$VersionFileUrl = "$UncachedFeed/Runtime/$Channel/latest.$Runtime.version"
|
||||
elseif ($Runtime -eq "aspnetcore") {
|
||||
$VersionFileUrl = "$UncachedFeed/aspnetcore/Runtime/$Channel/latest.version"
|
||||
}
|
||||
else {
|
||||
elseif (-not $Runtime) {
|
||||
if ($Coherent) {
|
||||
$VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.coherent.version"
|
||||
}
|
||||
|
@ -260,6 +260,9 @@ function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel, [bool]$Co
|
|||
$VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.version"
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw "Invalid value for `$Runtime"
|
||||
}
|
||||
|
||||
$Response = GetHTTPResponse -Uri $VersionFileUrl
|
||||
$StringContent = $Response.Content.ReadAsStringAsync().Result
|
||||
|
@ -296,11 +299,17 @@ function Get-Specific-Version-From-Version([string]$AzureFeed, [string]$Channel,
|
|||
function Get-Download-Link([string]$AzureFeed, [string]$SpecificVersion, [string]$CLIArchitecture) {
|
||||
Say-Invocation $MyInvocation
|
||||
|
||||
if ($Runtime) {
|
||||
$PayloadURL = "$AzureFeed/Runtime/$SpecificVersion/$Runtime-runtime-$SpecificVersion-win-$CLIArchitecture.zip"
|
||||
if ($Runtime -eq "dotnet") {
|
||||
$PayloadURL = "$AzureFeed/Runtime/$SpecificVersion/dotnet-runtime-$SpecificVersion-win-$CLIArchitecture.zip"
|
||||
}
|
||||
elseif ($Runtime -eq "aspnetcore") {
|
||||
$PayloadURL = "$AzureFeed/aspnetcore/Runtime/$SpecificVersion/aspnetcore-runtime-$SpecificVersion-win-$CLIArchitecture.zip"
|
||||
}
|
||||
elseif (-not $Runtime) {
|
||||
$PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-sdk-$SpecificVersion-win-$CLIArchitecture.zip"
|
||||
}
|
||||
else {
|
||||
$PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-sdk-$SpecificVersion-win-$CLIArchitecture.zip"
|
||||
throw "Invalid value for `$Runtime"
|
||||
}
|
||||
|
||||
Say-Verbose "Constructed primary payload URL: $PayloadURL"
|
||||
|
@ -503,12 +512,15 @@ if ($Runtime -eq "dotnet") {
|
|||
}
|
||||
elseif ($Runtime -eq "aspnetcore") {
|
||||
$assetName = "ASP.NET Core Runtime"
|
||||
$dotnetPackageRelativePath = "shared\Microsoft.AspNetCore.All"
|
||||
$dotnetPackageRelativePath = "shared\Microsoft.AspNetCore.App"
|
||||
}
|
||||
else {
|
||||
elseif (-not $Runtime) {
|
||||
$assetName = ".NET Core SDK"
|
||||
$dotnetPackageRelativePath = "sdk"
|
||||
}
|
||||
else {
|
||||
throw "Invalid value for `$Runtime"
|
||||
}
|
||||
|
||||
$isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $SpecificVersion
|
||||
if ($isAssetInstalled) {
|
||||
|
|
30
scripts/obtain/dotnet-install.sh
vendored
30
scripts/obtain/dotnet-install.sh
vendored
|
@ -390,14 +390,17 @@ get_latest_version_info() {
|
|||
local version_file_url=null
|
||||
if [[ "$runtime" == "dotnet" ]]; then
|
||||
version_file_url="$uncached_feed/Runtime/$channel/latest.version"
|
||||
elif [ ! -z "$runtime" ]; then
|
||||
version_file_url="$uncached_feed/Runtime/$channel/latest.$runtime.version"
|
||||
else
|
||||
elif [[ "$runtime" == "aspnetcore" ]]; then
|
||||
version_file_url="$uncached_feed/aspnetcore/Runtime/$channel/latest.version"
|
||||
elif [ -z "$runtime" ]; then
|
||||
if [ "$coherent" = true ]; then
|
||||
version_file_url="$uncached_feed/Sdk/$channel/latest.coherent.version"
|
||||
else
|
||||
version_file_url="$uncached_feed/Sdk/$channel/latest.version"
|
||||
fi
|
||||
else
|
||||
say_err "Invalid value for \$runtime"
|
||||
return 1
|
||||
fi
|
||||
say_verbose "get_latest_version_info: latest url: $version_file_url"
|
||||
|
||||
|
@ -457,10 +460,14 @@ construct_download_link() {
|
|||
osname="$(get_current_os_name)" || return 1
|
||||
|
||||
local download_link=null
|
||||
if [ ! -z "$runtime" ]; then
|
||||
download_link="$azure_feed/Runtime/$specific_version/$runtime-runtime-$specific_version-$osname-$normalized_architecture.tar.gz"
|
||||
else
|
||||
if [[ "$runtime" == "dotnet" ]]; then
|
||||
download_link="$azure_feed/Runtime/$specific_version/dotnet-runtime-$specific_version-$osname-$normalized_architecture.tar.gz"
|
||||
elif [[ "$runtime" == "aspnetcore" ]]; then
|
||||
download_link="$azure_feed/aspnetcore/Runtime/$specific_version/aspnetcore-runtime-$specific_version-$osname-$normalized_architecture.tar.gz"
|
||||
elif [ -z "$runtime" ]; then
|
||||
download_link="$azure_feed/Sdk/$specific_version/dotnet-sdk-$specific_version-$osname-$normalized_architecture.tar.gz"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$download_link"
|
||||
|
@ -706,11 +713,14 @@ install_dotnet() {
|
|||
asset_relative_path="shared/Microsoft.NETCore.App"
|
||||
asset_name=".NET Core Runtime"
|
||||
elif [[ "$runtime" == "aspnetcore" ]]; then
|
||||
asset_relative_path="shared/Microsoft.AspNetCore.All"
|
||||
asset_relative_path="shared/Microsoft.AspNetCore.App"
|
||||
asset_name="ASP.NET Core Runtime"
|
||||
else
|
||||
elif [ -z "$runtime" ]; then
|
||||
asset_relative_path="sdk"
|
||||
asset_name=".NET Core SDK"
|
||||
else
|
||||
say_err "Invalid value for \$runtime"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$specific_version"; then
|
||||
|
@ -866,8 +876,8 @@ do
|
|||
echo " --runtime <RUNTIME> Installs a shared runtime only, without the SDK."
|
||||
echo " -Runtime"
|
||||
echo " Possible values:"
|
||||
echo " - dotnet - the Microsoft.NETCore.App shared framework"
|
||||
echo " - aspnetcore - the Microsoft.AspNetCore.All shared framework"
|
||||
echo " - dotnet - the Microsoft.NETCore.App shared runtime"
|
||||
echo " - aspnetcore - the Microsoft.AspNetCore.App shared runtime"
|
||||
echo " --skip-non-versioned-files Skips non-versioned files if they already exist, such as the dotnet executable."
|
||||
echo " -SkipNonVersionedFiles"
|
||||
echo " --dry-run,-DryRun Do not perform installation. Display download link."
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
private static char[] s_pathSeparator = new char[] { Path.PathSeparator };
|
||||
private static char[] s_quote = new char[] { '"' };
|
||||
private IEnumerable<string> _searchPaths;
|
||||
private readonly Lazy<string> _userHomeDirectory = new Lazy<string>(() => Environment.GetEnvironmentVariable("HOME") ?? string.Empty);
|
||||
private IEnumerable<string> _executableExtensions;
|
||||
|
||||
public IEnumerable<string> ExecutableExtensions
|
||||
|
@ -45,7 +46,8 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
searchPaths.AddRange(Environment
|
||||
.GetEnvironmentVariable("PATH")
|
||||
.Split(s_pathSeparator)
|
||||
.Select(p => p.Trim(s_quote)));
|
||||
.Select(p => p.Trim(s_quote))
|
||||
.Select(p => ExpandTildeSlash(p)));
|
||||
|
||||
_searchPaths = searchPaths;
|
||||
}
|
||||
|
@ -54,6 +56,19 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
}
|
||||
}
|
||||
|
||||
private string ExpandTildeSlash(string path)
|
||||
{
|
||||
const string tildeSlash = "~/";
|
||||
if (path.StartsWith(tildeSlash, StringComparison.Ordinal) && !string.IsNullOrEmpty(_userHomeDirectory.Value))
|
||||
{
|
||||
return Path.Combine(_userHomeDirectory.Value, path.Substring(tildeSlash.Length));
|
||||
}
|
||||
else
|
||||
{
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
public EnvironmentProvider(
|
||||
IEnumerable<string> extensionsOverride = null,
|
||||
IEnumerable<string> searchPathsOverride = null)
|
||||
|
|
|
@ -8,6 +8,8 @@ using Microsoft.DotNet.PlatformAbstractions;
|
|||
using System.IO;
|
||||
using Microsoft.DotNet.Configurer;
|
||||
using System.Linq;
|
||||
using RuntimeEnvironment = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment;
|
||||
using RuntimeInformation = System.Runtime.InteropServices.RuntimeInformation;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Telemetry
|
||||
{
|
||||
|
@ -40,6 +42,8 @@ namespace Microsoft.DotNet.Cli.Telemetry
|
|||
private const string CurrentPathHash = "Current Path Hash";
|
||||
private const string MachineId = "Machine ID";
|
||||
private const string DockerContainer = "Docker Container";
|
||||
private const string KernelVersion = "Kernel Version";
|
||||
|
||||
private const string TelemetryProfileEnvironmentVariable = "DOTNET_CLI_TELEMETRY_PROFILE";
|
||||
private const string CannotFindMacAddress = "Unknown";
|
||||
|
||||
|
@ -57,7 +61,8 @@ namespace Microsoft.DotNet.Cli.Telemetry
|
|||
{TelemetryProfile, Environment.GetEnvironmentVariable(TelemetryProfileEnvironmentVariable)},
|
||||
{DockerContainer, _userLevelCacheWriter.RunWithCache(IsDockerContainerCacheKey, () => _dockerContainerDetector.IsDockerContainer().ToString("G") )},
|
||||
{CurrentPathHash, _hasher(_getCurrentDirectory())},
|
||||
{MachineId, _userLevelCacheWriter.RunWithCache(MachineIdCacheKey, GetMachineId)}
|
||||
{MachineId, _userLevelCacheWriter.RunWithCache(MachineIdCacheKey, GetMachineId)},
|
||||
{KernelVersion, GetKernelVersion()}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -73,5 +78,44 @@ namespace Microsoft.DotNet.Cli.Telemetry
|
|||
return Guid.NewGuid().ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a string identifying the OS kernel.
|
||||
/// For Unix this currently comes from "uname -srv".
|
||||
/// For Windows this currently comes from RtlGetVersion().
|
||||
///
|
||||
/// Here are some example values:
|
||||
///
|
||||
/// Alpine.36 Linux 4.9.60-linuxkit-aufs #1 SMP Mon Nov 6 16:00:12 UTC 2017
|
||||
/// Centos.73 Linux 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017
|
||||
/// Debian.87 Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07)
|
||||
/// Debian.90 Linux 4.9.0-2-amd64 #1 SMP Debian 4.9.18-1 (2017-03-30)
|
||||
/// fedora.25 Linux 4.11.3-202.fc25.x86_64 #1 SMP Mon Jun 5 16:38:21 UTC 2017
|
||||
/// Fedora.26 Linux 4.14.15-200.fc26.x86_64 #1 SMP Wed Jan 24 04:26:15 UTC 2018
|
||||
/// Fedora.27 Linux 4.14.14-300.fc27.x86_64 #1 SMP Fri Jan 19 13:19:54 UTC 2018
|
||||
/// OpenSuse.423 Linux 4.4.104-39-default #1 SMP Thu Jan 4 08:11:03 UTC 2018 (7db1912)
|
||||
/// RedHat.69 Linux 2.6.32-696.20.1.el6.x86_64 #1 SMP Fri Jan 12 15:07:59 EST 2018
|
||||
/// RedHat.72 Linux 3.10.0-514.21.1.el7.x86_64 #1 SMP Sat Apr 22 02:41:35 EDT 2017
|
||||
/// RedHat.73 Linux 3.10.0-514.21.1.el7.x86_64 #1 SMP Sat Apr 22 02:41:35 EDT 2017
|
||||
/// SLES.12 Linux 4.4.103-6.38-default #1 SMP Mon Dec 25 20:44:33 UTC 2017 (e4b9067)
|
||||
/// suse.422 Linux 4.4.49-16-default #1 SMP Sun Feb 19 17:40:35 UTC 2017 (70e9954)
|
||||
/// Ubuntu.1404 Linux 3.19.0-65-generic #73~14.04.1-Ubuntu SMP Wed Jun 29 21:05:22 UTC 2016
|
||||
/// Ubuntu.1604 Linux 4.13.0-1005-azure #7-Ubuntu SMP Mon Jan 8 21:37:36 UTC 2018
|
||||
/// Ubuntu.1604.WSL Linux 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014
|
||||
/// Ubuntu.1610 Linux 4.8.0-45-generic #48-Ubuntu SMP Fri Mar 24 11:46:39 UTC 2017
|
||||
/// Ubuntu.1704 Linux 4.10.0-19-generic #21-Ubuntu SMP Thu Apr 6 17:04:57 UTC 2017
|
||||
/// Ubuntu.1710 Linux 4.13.0-25-generic #29-Ubuntu SMP Mon Jan 8 21:14:41 UTC 2018
|
||||
/// OSX1012 Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jan 11 22:59:40 PST 2018; root:xnu-3789.73.8~1/RELEASE_X86_64
|
||||
/// OSX1013 Darwin 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64
|
||||
/// Windows.10 Microsoft Windows 10.0.14393
|
||||
/// Windows.10.Core Microsoft Windows 10.0.14393
|
||||
/// Windows.10.Nano Microsoft Windows 10.0.14393
|
||||
/// Windows.7 Microsoft Windows 6.1.7601 S
|
||||
/// Windows.81 Microsoft Windows 6.3.9600
|
||||
/// </summary>
|
||||
private static string GetKernelVersion()
|
||||
{
|
||||
return RuntimeInformation.OSDescription;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,15 +74,12 @@
|
|||
<RoslynBits Include="$(NuGetPackagesDir)/microsoft.netcore.compilers/$(MicrosoftNETCoreCompilersPackageVersion)/tools/**/*" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(RoslynBits)" DestinationFiles="@(RoslynBits->'$(RoslynDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
<Copy SourceFiles="@(RoslynSatelliteBits)" DestinationFiles="@(RoslynSatelliteBits->'$(RoslynDirectory)/bincore/%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
<ItemGroup>
|
||||
<RoslynRuntimeConfigs Include="$(RoslynDirectory)/bincore/csc.runtimeconfig.json" />
|
||||
<RoslynRuntimeConfigs Include="$(RoslynDirectory)/bincore/vbc.runtimeconfig.json" />
|
||||
<RoslynRuntimeConfigs Include="$(RoslynDirectory)/bincore/VBCSCompiler.runtimeconfig.json" />
|
||||
<RoslynDeps Include="$(RoslynDirectory)/bincore/csc.deps.json" />
|
||||
<RoslynDeps Include="$(RoslynDirectory)/bincore/vbc.deps.json" />
|
||||
<RoslynDeps Include="$(RoslynDirectory)/bincore/VBCSCompiler.deps.json" />
|
||||
<RoslynSatelliteDeps Include="$(RoslynDirectory)/bincore/tool_roslyn_satellites.deps.json" />
|
||||
<RoslynFrameworkAssemblies Include="$(RoslynDirectory)/System.*.dll;$(RoslynDirectory)/runtimes/**/System.*.dll" Exclude="$(RoslynDirectory)/runtimes/**/System.IO.Pipes.AccessControl.dll"/>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
|
@ -94,12 +91,7 @@
|
|||
DestinationFile="%(RoslynRuntimeConfigs.Identity)"
|
||||
ReplacementPatterns="$(ReplacementPattern)"
|
||||
ReplacementStrings="$(ReplacementString)" />
|
||||
<DotNetPublish
|
||||
ToolPath="$(PreviousStageDirectory)"
|
||||
Configuration="$(Configuration)"
|
||||
ProjectPath="$(SrcDirectory)/tool_roslyn_satellites/tool_roslyn_satellites.csproj" />
|
||||
<AddToDeps TargetDeps="@(RoslynDeps)" AdditionalDeps="@(RoslynSatelliteDeps)" />
|
||||
<Delete Files="@(RoslynSatelliteDeps);@(RoslynFrameworkAssemblies)" />
|
||||
<Delete Files="@(RoslynFrameworkAssemblies)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="PublishFSharp"
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.tasks" />
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
|
||||
<TargetFramework>$(CliTargetFramework)</TargetFramework>
|
||||
<RuntimeFrameworkVersion>$(MicrosoftNETCoreAppPackageVersion)</RuntimeFrameworkVersion>
|
||||
<PublishDir>$(RoslynDirectory)/bincore</PublishDir>
|
||||
<VersionSuffix>$(CommitCount)</VersionSuffix>
|
||||
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
|
||||
<CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
|
||||
<CopyOutputSymbolsToPublishDirectory>false</CopyOutputSymbolsToPublishDirectory>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NetCore.App" Version="$(MicrosoftNETCoreAppPackageVersion)" />
|
||||
<PackageReference Include="CliDeps.Satellites.Roslyn" Version="$(CliDepsSatellitesRoslynPackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="MoveBuildTasksSatellitesAndRemoveBuildOutputAsset"
|
||||
AfterTargets="Publish">
|
||||
|
||||
<RemoveAssetFromDepsPackages DepsFile="$(PublishDir)/$(TargetName).deps.json"
|
||||
SectionName="runtime"
|
||||
AssetPath="$(TargetFileName)" />
|
||||
|
||||
<ItemGroup>
|
||||
<BuildTaskSatellites Include="$(PublishDir)/**/Microsoft.Build.Tasks.CodeAnalysis.resources.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<Move SourceFiles="@(BuildTaskSatellites)"
|
||||
DestinationFiles="@(BuildTaskSatellites->'$(PublishDir)/../%(RecursiveDir)/%(Filename)%(Extension)')" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -297,8 +297,9 @@ namespace Microsoft.DotNet.ShellShim.Tests
|
|||
{
|
||||
const string testAppName = "TestAppSimple";
|
||||
const string emptySpaceToTestSpaceInPath = " ";
|
||||
const string directoryNamePostFix = "Test";
|
||||
TestAssetInstance testInstance = TestAssets.Get(testAppName)
|
||||
.CreateInstance(testAppName + emptySpaceToTestSpaceInPath + "test")
|
||||
.CreateInstance(testAppName + emptySpaceToTestSpaceInPath + directoryNamePostFix)
|
||||
.UseCurrentRuntimeFrameworkVersion()
|
||||
.WithRestoreFiles()
|
||||
.WithBuildFiles();
|
||||
|
|
|
@ -5,9 +5,11 @@ using FluentAssertions;
|
|||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli;
|
||||
using Microsoft.DotNet.Cli.Telemetry;
|
||||
using Microsoft.DotNet.Configurer;
|
||||
using RuntimeEnvironment = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment;
|
||||
|
||||
namespace Microsoft.DotNet.Tests
|
||||
{
|
||||
|
@ -43,6 +45,13 @@ namespace Microsoft.DotNet.Tests
|
|||
Guid.TryParse(assignedMachineId, out var _).Should().BeTrue("it should be a guid");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TelemetryCommonPropertiesShouldContainKernelVersion()
|
||||
{
|
||||
var unitUnderTest = new TelemetryCommonProperties(getMACAddress: () => null, userLevelCacheWriter: new NothingCache());
|
||||
unitUnderTest.GetTelemetryCommonProperties()["Kernel Version"].Should().Be(RuntimeInformation.OSDescription);
|
||||
}
|
||||
|
||||
private class NothingCache : IUserLevelCacheWriter
|
||||
{
|
||||
public string RunWithCache(string cacheKey, Func<string> getValueToCache)
|
||||
|
|
Loading…
Add table
Reference in a new issue