Skip to content

Commit

Permalink
Installer work.
Browse files Browse the repository at this point in the history
  • Loading branch information
jp2masa committed Mar 23, 2017
1 parent ddc3268 commit dbf1358
Show file tree
Hide file tree
Showing 23 changed files with 622 additions and 617 deletions.
4 changes: 2 additions & 2 deletions Builder.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Build.Builder", "source\Cosmos.Build.Builder\Cosmos.Build.Builder.csproj", "{74A9329A-2B0B-4C0A-976C-E4FB7228D8B2}"
EndProject
Expand Down
262 changes: 34 additions & 228 deletions Setup/Cosmos.iss

Large diffs are not rendered by default.

36 changes: 0 additions & 36 deletions Setup/Events.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ begin
Result := sUnInstallString;
end;


/////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin
Result := (GetUninstallString() <> '');
end;


/////////////////////////////////////////////////////////////////////
// Uninstall previously installed application.
/////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -47,31 +39,3 @@ begin
end else
Result := 1;
end;

/////////////////////////////////////////////////////////////////////
// Uninstall previously installed application.
/////////////////////////////////////////////////////////////////////
procedure CleanupInterferringWithPyToolsGuid;
begin
if not PythonTools2013_Installed then
begin
// Remove interferring registry string.
RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\CLSID\{8355452D-6D2F-41B0-89B8-BB2AA2529E94}')
RegDeleteKeyIncludingSubkeys(HKLM, 'Software\Microsoft\VisualStudio\12.0\CLSID\{8355452D-6D2F-41B0-89B8-BB2AA2529E94}');
end;
end;

/////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssInstall) then
begin
if (IsUpgrade()) then
begin
CleanupInterferringWithPyToolsGuid();
end;
end;
end;

[Run]
Filename: {code:VSNET2013_PATH}\devenv.exe; Parameters: /setup; Flags: waituntilterminated;
10 changes: 0 additions & 10 deletions install-VS2015.bat

This file was deleted.

3 changes: 3 additions & 0 deletions install-VS2017.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

powershell -File install-VS2017.ps1 %1 %2 %3 %4 %5 %6 %7 %8 %9
62 changes: 62 additions & 0 deletions install-VS2017.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#Requires -Modules VSSetup

if ([System.IO.Directory]::Exists("source\Cosmos.Build.Builder\bin\Debug"))
{
[System.IO.Directory]::Delete("source\Cosmos.Build.Builder\bin\Debug", $true)
}

<#if (!(Get-Module VSSetup))
{
Install-Module -Name VSSetup -Scope CurrentUser -ErrorAction Stop
}#>

Write-Host "Visual Studio 2017 instances:"
Get-VSSetupInstance -All -OutVariable Instances

if ($Instances.Count -eq 0)
{
Write-Error "No Visual Studio 2017 instances found!" -ErrorAction Stop
}
elseif ($Instances.Count -eq 1)
{
$CurrentInstance = $Instances[0]
}
else
{
Write-Host "You have more than one instance of Visual Studio 2017."
Write-Host "Instance ID of the instance to use:"

$InstanceId = Read-Host

foreach ($Instance in $Instances)
{
if ($Instance.InstanceId -eq $InstanceId)
{
$CurrentInstance = $Instance
break;
}
}

if ($CurrentInstance -eq $null)
{
Write-Error "There is no Visual Studio 2017 instance for the given Instance ID!" -ErrorAction Stop
}
}

Start-Process "dotnet" "restore", "Cosmos.sln" -Wait

$MSBuildPath = [System.IO.Path]::Combine($CurrentInstance.InstallationPath, "MSBuild", "15.0", "Bin", "MSBuild.exe")
Start-Process "$MSBuildPath" "Builder.sln", "/nologo", "/maxcpucount", '/p:Configuration="Debug"', '/p:Platform="Any CPU"' -Wait

$BuilderArgs = [string[]]::new(3 + $args.Length)

$BuilderArgs[0] = "-bat"
$BuilderArgs[1] = "-VS2017"
$BuilderArgs[2] = "-VSINSTANCE=" + $CurrentInstance.InstanceId

for ($i = 0; $i -lt $args.Length; $i++)
{
$BuilderArgs[$i + 3] = $args[$i]
}

Start-Process "source\Cosmos.Build.Builder\bin\Debug\Cosmos.Build.Builder.exe" $BuilderArgs
39 changes: 24 additions & 15 deletions source/Cosmos.Build.Builder/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,56 +1,65 @@
using System.Linq;
using System;
using System.Linq;
using System.Windows;

using Cosmos.Build.Installer;

namespace Cosmos.Build.Builder {
public partial class App : Application {
namespace Cosmos.Build.Builder
{
public partial class App : Application
{
public static bool DoNotLaunchVS;
public static bool IsUserKit;
public static bool ResetHive;
public static bool StayOpen;
public static bool UseTask;
public static bool NoMsBuildClean;
public static bool NoMSBuildClean;
public static bool InstallTask;
public static bool IgnoreVS;
public static bool TestMode = false;
public static bool HasParams = false;

/// <summary>
/// Version of Visual Studio to use.
/// </summary>
public static VsVersion VsVersion;
public static VSVersion VSVersion;

/// <summary>
/// Use Visual Studio Experimental Hive for installing Cosmos Kit.
/// </summary>
public static bool UseVsHive;

protected override void OnStartup(StartupEventArgs e) {
protected override void OnStartup(StartupEventArgs e)
{
HasParams = e.Args.Length > 0;

var xArgs = new string[e.Args.Length];
for (int i = 0; i < xArgs.Length; i++) {
for (int i = 0; i < xArgs.Length; i++)
{
xArgs[i] = e.Args[i].ToUpper();
}
IsUserKit = xArgs.Contains("-USERKIT");
ResetHive = xArgs.Contains("-RESETHIVE");
StayOpen = xArgs.Contains("-STAYOPEN");
UseTask = !xArgs.Contains("-NOTASK");
NoMsBuildClean = xArgs.Contains("-NOCLEAN");
NoMSBuildClean = xArgs.Contains("-NOCLEAN");
InstallTask = xArgs.Contains("-INSTALLTASK");
DoNotLaunchVS = xArgs.Contains("-NOVSLAUNCH");
// For use during dev of Builder only.
IgnoreVS = xArgs.Contains("-IGNOREVS");
TestMode = xArgs.Contains("-TESTMODE");
if (xArgs.Contains("-VS2015") || xArgs.Contains("/VS2015")) {
VsVersion = VsVersion.Vs2015;
Paths.VsVersion = VsVersion.Vs2015;
}

if (xArgs.Contains("-VSEXPHIVE") || xArgs.Contains("/VSEXPHIVE")) {
UseVsHive = true;
if (xArgs.Contains("-VS2017") || xArgs.Contains("/VS2017"))
{
VSVersion = VSVersion.VS2017;
}

Paths.VSVersion = VSVersion;

Paths.VSInstanceID = xArgs.Where(arg => arg.StartsWith("-VSINSTANCE=") || arg.StartsWith("/VSINSTANCE=")).SingleOrDefault()?.Substring(12).ToLowerInvariant();

UseVsHive = xArgs.Contains("-VSEXPHIVE") || xArgs.Contains("/VSEXPHIVE");

base.OnStartup(e);
}
}
Expand Down
25 changes: 8 additions & 17 deletions source/Cosmos.Build.Builder/Cosmos.Build.Builder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand All @@ -84,27 +89,13 @@
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include=".editorconfig" />
<None Include="app.config" />
<None Include="App.config" />
<AppDesigner Include="Properties\" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cosmos.Build.Installer\Cosmos.Build.Installer.csproj">
Expand All @@ -123,4 +114,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
Loading

0 comments on commit dbf1358

Please sign in to comment.