Skip to content

Commit

Permalink
remove telemetry (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
spebl authored Nov 14, 2017
1 parent d141196 commit 3b5f67b
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 178 deletions.
3 changes: 0 additions & 3 deletions GoogleTestAdapter/NewProjectWizard/ApplicationInsights.config

This file was deleted.

5 changes: 0 additions & 5 deletions GoogleTestAdapter/NewProjectWizard/NewProjectWizard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@
</ItemGroup>
<ItemGroup>
<Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.ApplicationInsights, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>$(NuGetPackages)Microsoft.ApplicationInsights.2.3.0\lib\net45\Microsoft.ApplicationInsights.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>$(NuGetPackages)Microsoft.Build.Utilities.Core.14.3.0\lib\net45\Microsoft.Build.Utilities.Core.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -126,7 +123,6 @@
<Compile Include="SinglePageWizardDialog.xaml.cs">
<DependentUpon>SinglePageWizardDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Telemetry.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WizardImplementation.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
Expand All @@ -139,7 +135,6 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="ApplicationInsights.config" />
<None Include="Key.snk" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
Expand Down
69 changes: 0 additions & 69 deletions GoogleTestAdapter/NewProjectWizard/Telemetry.cs

This file was deleted.

190 changes: 90 additions & 100 deletions GoogleTestAdapter/NewProjectWizard/WizardImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,134 +74,124 @@ public void RunStarted(object automationObject,
Dictionary<string, string> replacementsDictionary,
WizardRunKind runKind, object[] customParams)
{
try
{
DTE dte = (DTE)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SDTE));
Projects dteProjects = dte.Solution.Projects;
List<string> projectNames = new List<string>();
bool isPlatformSet = false;
DTE dte = (DTE)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SDTE));
Projects dteProjects = dte.Solution.Projects;
List<string> projectNames = new List<string>();
bool isPlatformSet = false;

foreach (Project project in dteProjects)
{
// TODO: Filter out projects not applicable
projects.Add(project);
projectNames.Add(project.Name);
}
foreach (Project project in dteProjects)
{
// TODO: Filter out projects not applicable
projects.Add(project);
projectNames.Add(project.Name);
}

ConfigurationData configurationData = new ConfigurationData(dte, projectNames.ToArray());
ConfigurationData configurationData = new ConfigurationData(dte, projectNames.ToArray());

SinglePageWizardDialog wiz = new SinglePageWizardDialog(Resources.WizardTitle, configurationData);
SinglePageWizardDialog wiz = new SinglePageWizardDialog(Resources.WizardTitle, configurationData);

bool? success = false;
bool? success = false;

// If RunSilent is true, we're in automated testing
if (replacementsDictionary[RunSilent] == "True")
{
success = true;
SetDefaultData(ref configurationData);
}
else
{
success = wiz.ShowModal();
}
// If RunSilent is true, we're in automated testing
if (replacementsDictionary[RunSilent] == "True")
{
success = true;
SetDefaultData(ref configurationData);
}
else
{
success = wiz.ShowModal();
}

if (success == false)
{
throw new WizardCancelledException();
}
if (success == false)
{
throw new WizardCancelledException();
}

selectedProjectIndex = configurationData.ProjectIndex;
selectedProjectIndex = configurationData.ProjectIndex;

if (selectedProjectIndex >= 0)
if (selectedProjectIndex >= 0)
{
foreach (Property prop in projects[selectedProjectIndex].Properties)
{
foreach (Property prop in projects[selectedProjectIndex].Properties)
if (prop.Name.Equals("WindowsTargetPlatformVersion"))
{
if (prop.Name.Equals("WindowsTargetPlatformVersion"))
{
replacementsDictionary[TargetPlatformVersion] = (string)prop.Value;
isPlatformSet = true;
}
replacementsDictionary[TargetPlatformVersion] = (string)prop.Value;
isPlatformSet = true;
}
}
}

string consumeGTestAs = configurationData.IsGTestStatic ? "static" : "dyn";
string runtimeLibs = configurationData.IsRuntimeStatic ? "static" : "dyn";
string nugetPackage = "Microsoft.googletest.v140.windesktop.msvcstl." + consumeGTestAs + ".rt-" + runtimeLibs;
string consumeGTestAs = configurationData.IsGTestStatic ? "static" : "dyn";
string runtimeLibs = configurationData.IsRuntimeStatic ? "static" : "dyn";
string nugetPackage = "Microsoft.googletest.v140.windesktop.msvcstl." + consumeGTestAs + ".rt-" + runtimeLibs;

// Work around so we can choose the package for the nuget wizard
string tmpWizardData = Path.GetTempFileName();
File.AppendAllText(tmpWizardData, "<VSTemplate Version=\"3.0.0\" xmlns=\"http://schemas.microsoft.com/developer/vstemplate/2005\" Type=\"Project\"><WizardData>");
File.AppendAllText(tmpWizardData, replacementsDictionary[WizardData].Replace("$nugetpackage$", nugetPackage));
File.AppendAllText(tmpWizardData, "</WizardData></VSTemplate>");
customParams[0] = tmpWizardData;
// Work around so we can choose the package for the nuget wizard
string tmpWizardData = Path.GetTempFileName();
File.AppendAllText(tmpWizardData, "<VSTemplate Version=\"3.0.0\" xmlns=\"http://schemas.microsoft.com/developer/vstemplate/2005\" Type=\"Project\"><WizardData>");
File.AppendAllText(tmpWizardData, replacementsDictionary[WizardData].Replace("$nugetpackage$", nugetPackage));
File.AppendAllText(tmpWizardData, "</WizardData></VSTemplate>");
customParams[0] = tmpWizardData;

try
{
Assembly nugetAssembly = Assembly.Load("NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
nugetWizard = (IWizard)nugetAssembly.CreateInstance("NuGet.VisualStudio.TemplateWizard");
nugetWizard.RunStarted(automationObject, replacementsDictionary, runKind, customParams);
}
catch (Exception)
{
ShowRtlAwareMessageBox(Resources.NuGetInteropNotFound);
throw;
}
try
{
Assembly nugetAssembly = Assembly.Load("NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
nugetWizard = (IWizard)nugetAssembly.CreateInstance("NuGet.VisualStudio.TemplateWizard");
nugetWizard.RunStarted(automationObject, replacementsDictionary, runKind, customParams);
}
catch (Exception)
{
ShowRtlAwareMessageBox(Resources.NuGetInteropNotFound);
throw;
}

if (configurationData.IsRuntimeStatic)
{
replacementsDictionary[RuntimeRelease] = "MultiThreaded";
replacementsDictionary[RuntimeDebug] = "MultiThreadedDebug";
}
else
if (configurationData.IsRuntimeStatic)
{
replacementsDictionary[RuntimeRelease] = "MultiThreaded";
replacementsDictionary[RuntimeDebug] = "MultiThreadedDebug";
}
else
{
replacementsDictionary[RuntimeRelease] = "MultiThreadedDLL";
replacementsDictionary[RuntimeDebug] = "MultiThreadedDebugDLL";
}

if (!isPlatformSet)
{
IEnumerable<TargetPlatformSDK> platformSdks = ToolLocationHelper.GetTargetPlatformSdks();
IEnumerable<TargetPlatformSDK> allSdks = WizardImplementation.GetAllPlatformSdks();
TargetPlatformSDK latestSdk = allSdks.FirstOrDefault();

if (latestSdk == null)
{
replacementsDictionary[RuntimeRelease] = "MultiThreadedDLL";
replacementsDictionary[RuntimeDebug] = "MultiThreadedDebugDLL";
ShowRtlAwareMessageBox(Resources.WinSDKNotFound);
throw new WizardCancelledException(Resources.WinSDKNotFound);
}

if (!isPlatformSet)
string versionString;

if (latestSdk.TargetPlatformVersion.Major >= 10)
{
IEnumerable<TargetPlatformSDK> platformSdks = ToolLocationHelper.GetTargetPlatformSdks();
IEnumerable<TargetPlatformSDK> allSdks = WizardImplementation.GetAllPlatformSdks();
TargetPlatformSDK latestSdk = allSdks.FirstOrDefault();
List<Platform> allPlatformsForLatestSdk = ToolLocationHelper.GetPlatformsForSDK("Windows", latestSdk.TargetPlatformVersion)
.Select(moniker => TryParsePlatformVersion(moniker))
.Where(name => name != null)
.OrderByDescending(p => p.Version).ToList();
Platform latestPlatform = allPlatformsForLatestSdk.FirstOrDefault();

if (latestSdk == null)
if (latestPlatform == null)
{
ShowRtlAwareMessageBox(Resources.WinSDKNotFound);
throw new WizardCancelledException(Resources.WinSDKNotFound);
}

string versionString;

if (latestSdk.TargetPlatformVersion.Major >= 10)
{
List<Platform> allPlatformsForLatestSdk = ToolLocationHelper.GetPlatformsForSDK("Windows", latestSdk.TargetPlatformVersion)
.Select(moniker => TryParsePlatformVersion(moniker))
.Where(name => name != null)
.OrderByDescending(p => p.Version).ToList();
Platform latestPlatform = allPlatformsForLatestSdk.FirstOrDefault();

if (latestPlatform == null)
{
ShowRtlAwareMessageBox(Resources.WinSDKNotFound);
throw new WizardCancelledException(Resources.WinSDKNotFound);
}

versionString = latestPlatform.Version.ToString();
}
else
{
versionString = latestSdk.TargetPlatformVersion.ToString();
}

replacementsDictionary[TargetPlatformVersion] = versionString;
versionString = latestPlatform.Version.ToString();
}
else
{
versionString = latestSdk.TargetPlatformVersion.ToString();
}

//Telemetry.LogProjectCreated(nugetPackage);
}
catch (WizardCancelledException ex)
{
//Telemetry.LogProjectCancelled(ex.Message);
throw;
replacementsDictionary[TargetPlatformVersion] = versionString;
}
}

Expand Down
1 change: 0 additions & 1 deletion GoogleTestAdapter/NewProjectWizard/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.ApplicationInsights" version="2.3.0" targetFramework="net45" />
<package id="Microsoft.Build.Framework" version="14.3.0" targetFramework="net452" />
<package id="Microsoft.Build.Utilities.Core" version="14.3.0" targetFramework="net452" />
</packages>

0 comments on commit 3b5f67b

Please sign in to comment.