Merge pull request #7112 from dotnet/merges/release/2.0.0-to-master-20170710-070027

Merge release/2.0.0 to master
This commit is contained in:
Tom Meschter 2017-07-10 08:54:29 -07:00 committed by GitHub
commit 5a37290f24
9 changed files with 129 additions and 15 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CLI_SharedFrameworkVersion>2.0.0-preview3-25502-01</CLI_SharedFrameworkVersion>
<CLI_SharedFrameworkVersion>2.0.0-preview3-25507-02</CLI_SharedFrameworkVersion>
<CLI_MSBuild_Version>15.3.0-preview-000402-01</CLI_MSBuild_Version>
<CLI_Roslyn_Version>2.3.0-beta4-61830-03</CLI_Roslyn_Version>
<CLI_Roslyn_Satellites_Version>2.3.0-pre-20170624-6</CLI_Roslyn_Satellites_Version>
@ -22,22 +22,22 @@
<SharedFrameworkVersion>$(CLI_SharedFrameworkVersion)</SharedFrameworkVersion>
<SharedHostVersion>$(CLI_SharedFrameworkVersion)</SharedHostVersion>
<HostFxrVersion>$(CLI_SharedFrameworkVersion)</HostFxrVersion>
<TemplateEngineVersion>1.0.0-beta2-20170629-268</TemplateEngineVersion>
<TemplateEngineTemplateVersion>1.0.0-beta2-20170706-274</TemplateEngineTemplateVersion>
<TemplateEngineTemplate2_0Version>1.0.0-beta2-20170706-274</TemplateEngineTemplate2_0Version>
<PlatformAbstractionsVersion>2.0.0-preview3-25428-01</PlatformAbstractionsVersion>
<DependencyModelVersion>2.0.0-preview3-25428-01</DependencyModelVersion>
<TemplateEngineVersion>1.0.0-beta2-20170707-280</TemplateEngineVersion>
<TemplateEngineTemplateVersion>1.0.0-beta2-20170707-280</TemplateEngineTemplateVersion>
<TemplateEngineTemplate2_0Version>1.0.0-beta2-20170707-280</TemplateEngineTemplate2_0Version>
<PlatformAbstractionsVersion>2.0.0-preview3-25507-02</PlatformAbstractionsVersion>
<DependencyModelVersion>2.0.0-preview3-25507-02</DependencyModelVersion>
<CliCommandLineParserVersion>0.1.1-alpha-167</CliCommandLineParserVersion>
<CliMigrateVersion>1.2.1-alpha-002133</CliMigrateVersion>
<MicroBuildVersion>0.2.0</MicroBuildVersion>
<SpaTemplateVersion>1.0.0-preview-000321</SpaTemplateVersion>
<SpaTemplateVersion>1.0.0-preview-000358</SpaTemplateVersion>
<XliffTasksVersion>0.2.0-beta-000042</XliffTasksVersion>
<!-- This should either be timestamped or notimestamp as appropriate -->
<AspNetCoreRuntimePackageFlavor>timestamped</AspNetCoreRuntimePackageFlavor>
<AspNetCoreRuntimeVersion>dev-256</AspNetCoreRuntimeVersion>
<AspNetCoherenceLabel>preview3</AspNetCoherenceLabel>
<AspNetCoreCoherenceTimestamp>26096</AspNetCoreCoherenceTimestamp>
<AspNetCoreRuntimeVersion>dev-270</AspNetCoreRuntimeVersion>
<AspNetCoherenceLabel>rtm</AspNetCoherenceLabel>
<AspNetCoreCoherenceTimestamp>26151</AspNetCoreCoherenceTimestamp>
</PropertyGroup>

View file

@ -37,6 +37,7 @@
</MsiPackage>
<MsiPackage SourceFile="$(var.CLISDKMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
<MsiProperty Name="EXEFULLPATH" Value="[WixBundleOriginalSource]" />
</MsiPackage>
<?if $(var.Platform)=x86?>
<PackageGroupRef Id="PG_AspNetCorePackageStore_x86"/>

View file

@ -30,12 +30,20 @@
<CustomActionRef Id="WixBroadcastEnvironmentChange" />
<CustomAction Id="PropertyAssign" Property="QtExecDotnetnew" Value="&quot;[DOTNETHOME]\dotnet.exe&quot; new" Execute="immediate" />
<CustomAction Id="QtExecDotnetnew" BinaryKey="WixCA" DllEntry="$(var.WixQuietExec)" Execute="deferred" Return="ignore" Impersonate="no"/>
<CustomAction Id="PropertyAssignPrimeCacheAndTelemetry"
Property="QtExecPrimeCacheAndTelemetryTarget"
Value="&quot;[DOTNETHOME]\dotnet.exe&quot; internal-reportinstallsuccess &quot;[EXEFULLPATH]&quot;"
Execute="immediate" />
<CustomAction Id="QtExecPrimeCacheAndTelemetryTarget"
BinaryKey="WixCA"
DllEntry="$(var.WixQuietExec)"
Execute="deferred"
Return="ignore"
Impersonate="no"/>
<InstallExecuteSequence>
<Custom Action="PropertyAssign" Before="QtExecDotnetnew" />
<Custom Action="QtExecDotnetnew" Before="InstallFinalize" />
<Custom Action="PropertyAssignPrimeCacheAndTelemetry" Before="QtExecPrimeCacheAndTelemetryTarget" />
<Custom Action="QtExecPrimeCacheAndTelemetryTarget" Before="InstallFinalize" />
</InstallExecuteSequence>
</Product>
<Fragment>

View file

@ -143,6 +143,10 @@ namespace Microsoft.DotNet.Cli
["parse"] = new BuiltInCommandMetadata
{
Command = ParseCommand.Run
},
["internal-reportinstallsuccess"] = new BuiltInCommandMetadata
{
Command = InternalReportinstallsuccess.Run
}
};
}

View file

@ -54,6 +54,7 @@ namespace Microsoft.DotNet.Cli
Create.Command("msbuild", ""),
Create.Command("vstest", ""),
CompleteCommandParser.Complete(),
InternalReportinstallsuccessCommandParser.InternalReportinstallsuccess(),
CommonOptions.HelpOption(),
Create.Option("--info", ""),
Create.Option("-d", ""),

View file

@ -76,6 +76,15 @@ namespace Microsoft.DotNet.Cli
);
}
public void ThreadBlockingTrackEvent(string eventName, IDictionary<string, string> properties, IDictionary<string, double> measurements)
{
if (!Enabled)
{
return;
}
TrackEventTask(eventName, properties, measurements);
}
private void InitializeTelemetry()
{
try

View file

@ -0,0 +1,56 @@
// 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;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Microsoft.DotNet.Configurer;
namespace Microsoft.DotNet.Cli
{
public class InternalReportinstallsuccess
{
internal const string TelemetrySessionIdEnvironmentVariableName = "DOTNET_CLI_TELEMETRY_SESSIONID";
public static int Run(string[] args)
{
var telemetry = new ThreadBlockingTelemetry();
ProcessInputAndSendTelemetry(args, telemetry);
return 0;
}
public static void ProcessInputAndSendTelemetry(string[] args, ITelemetry telemetry)
{
var parser = Parser.Instance;
var result = parser.ParseFrom("dotnet internal-reportinstallsuccess", args);
var internalReportinstallsuccess = result["dotnet"]["internal-reportinstallsuccess"];
var exeName = Path.GetFileName(internalReportinstallsuccess.Arguments.Single());
telemetry.TrackEvent(
"reportinstallsuccess",
new Dictionary<string, string> { { "exeName", exeName } },
new Dictionary<string, double>());
}
internal class ThreadBlockingTelemetry : ITelemetry
{
private Telemetry telemetry;
internal ThreadBlockingTelemetry()
{
var sessionId =
Environment.GetEnvironmentVariable(TelemetrySessionIdEnvironmentVariableName);
telemetry = new Telemetry(new FirstTimeUseNoticeSentinel(new CliFallbackFolderPathCalculator()), sessionId);
}
public bool Enabled => telemetry.Enabled;
public void TrackEvent(string eventName, IDictionary<string, string> properties, IDictionary<string, double> measurements)
{
telemetry.ThreadBlockingTrackEvent(eventName, properties, measurements);
}
}
}
}

View file

@ -0,0 +1,16 @@
// 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.Linq;
using Microsoft.DotNet.Cli.CommandLine;
namespace Microsoft.DotNet.Cli
{
internal static class InternalReportinstallsuccessCommandParser
{
public static Command InternalReportinstallsuccess() =>
Create.Command(
"internal-reportinstallsuccess", "internal only",
Accept.ExactlyOneArgument());
}
}

View file

@ -17,14 +17,15 @@ namespace Microsoft.DotNet.Tests
public bool Enabled { get; set; }
public string EventName { get; set; }
public IDictionary<string, string> Properties { get; set; }
public void TrackEvent(string eventName, IDictionary<string, string> properties, IDictionary<string, double> measurements)
{
EventName = eventName;
Properties = properties;
}
}
public class TelemetryCommandTests : TestBase
{
[Fact]
@ -35,5 +36,23 @@ namespace Microsoft.DotNet.Tests
Microsoft.DotNet.Cli.Program.ProcessArgs(args, mockTelemetry);
Assert.Equal(mockTelemetry.EventName, args[0]);
}
[WindowsOnlyFact]
public void InternalreportinstallsuccessCommandCollectExeNameWithEventname()
{
MockTelemetry mockTelemetry = new MockTelemetry();
string[] args = { "c:\\mypath\\dotnet-sdk-latest-win-x64.exe" };
InternalReportinstallsuccess.ProcessInputAndSendTelemetry(args, mockTelemetry);
mockTelemetry.EventName.Should().Be("reportinstallsuccess");
mockTelemetry.Properties["exeName"].Should().Be("dotnet-sdk-latest-win-x64.exe");
}
[Fact]
public void InternalreportinstallsuccessCommandIsRegistedInBuiltIn()
{
BuiltInCommandsCatalog.Commands.Should().ContainKey("internal-reportinstallsuccess");
}
}
}