Set DOTNET_CLI_TELEMETRY_PROFILE for CLI Repo builds (#3228)
This commit is contained in:
parent
8422fcb9b0
commit
8ffba3c029
1 changed files with 17 additions and 1 deletions
|
@ -38,7 +38,8 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
nameof(UpdateTemplateVersions),
|
||||
nameof(CheckPrereqs),
|
||||
nameof(LocateStage0),
|
||||
nameof(ExpectedBuildArtifacts))]
|
||||
nameof(ExpectedBuildArtifacts),
|
||||
nameof(SetTelemetryProfile))]
|
||||
public static BuildTargetResult Init(BuildTargetContext c)
|
||||
{
|
||||
var configEnv = Environment.GetEnvironmentVariable("CONFIGURATION");
|
||||
|
@ -359,6 +360,21 @@ cmake is required to build the native host 'corehost'";
|
|||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult SetTelemetryProfile(BuildTargetContext c)
|
||||
{
|
||||
var gitResult = Cmd("git", "rev-parse", "HEAD")
|
||||
.CaptureStdOut()
|
||||
.Execute();
|
||||
gitResult.EnsureSuccessful();
|
||||
|
||||
var commitHash = gitResult.StdOut.Trim();
|
||||
|
||||
Environment.SetEnvironmentVariable("DOTNET_CLI_TELEMETRY_PROFILE", $"https://github.com/dotnet/cli;{commitHash}");
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
private static string GetVersionFromProjectJson(string pathToProjectJson)
|
||||
{
|
||||
Regex r = new Regex($"\"{Regex.Escape(Monikers.SharedFrameworkName)}\"\\s*:\\s*\"(?'version'[^\"]*)\"");
|
||||
|
|
Loading…
Add table
Reference in a new issue