Use vsixbootstrapper for vsix install.

This commit is contained in:
Charles Betros 2017-05-01 21:07:34 -05:00
parent 0dccc8e69b
commit 2e2f7e2318
6 changed files with 10 additions and 330 deletions

Binary file not shown.

View file

@ -1 +0,0 @@
Generously provided by Jeroen W. Pluimers. For more details, contact him or Matthijs ter Woord

View file

@ -1,41 +0,0 @@
<project>
<!-- do checks for required parameters -->
<if test="${not property::exists('CCnetDir')}">
<!-- property is neccessary to be able to use the msbuild xml logger -->
<fail message="CCnetDir property not specified!"/>
</if>
<if test="${not property::exists('NUnitDir')}">
<!-- property is neccessary to be able to run nunit tests -->
<fail message="NUnitDir property not specified!"/>
</if>
<!-- end of check for required parameters -->
<property name="IsCIRun" value="false" unless="${property::exists('IsCIRun')}"/>
<property name="BaseRepositoryPath" value="${directory::get-parent-directory(directory::get-parent-directory(directory::get-parent-directory(directory::get-parent-directory(project::get-base-directory()))))}"/>
<property name="CosmosSlnBuildOutputDir" value="${path::combine(BaseRepositoryPath, 'BuildOutput')}"/>
<delete dir="${CosmosSlnBuildOutputDir}" unless="${not directory::exists(CosmosSlnBuildOutputDir)}"/>
<mkdir dir="${CosmosSlnBuildOutputDir}"/>
<property name="BuildResultsDir" value="${path::combine(BaseRepositoryPath, 'BuildOutput')}"/>
<delete dir="${BuildResultsDir}" unless="${not directory::exists(BuildResultsDir)}"/>
<mkdir dir="${BuildResultsDir}"/>
<echo message="${BaseRepositoryPath}"/>
<!-- first compile Cosmos.sln -->
<msbuild project="${path::combine(path::combine(BaseRepositoryPath, 'Source'), 'Cosmos.sln')}"
target="Rebuild"
verbosity="Minimal">
<arg line="/p:OutputPath=&quot;${CosmosSlnBuildOutputDir}&quot;"/>
<arg line="/p:Configuration=Debug"/>
<!--<arg line="/logger:&quot;${path::combine(CCnetDir, 'ThoughtWorks.CruiseControl.MSBuild.dll')}&quot;"/>-->
</msbuild>
<exec program="${path::combine(NUnitDir, 'nunit-console.exe')}" failonerror="false" workingdir="${CosmosSlnBuildOutputDir}">
<arg line="Indy.IL2CPU.Tests.dll /exclude=NOTWORKING /xml=&quot;${path::combine(BuildResultsDir, 'UnitTests-Results.xml')}&quot;"/>
</exec>
<exec program="${path::combine(BuildResultsDir, 'Cosmos.TestRunner.exe')}" failonerror="false" workingdir="${BuildResultsDir}">
</exec>
</project>

View file

@ -1,234 +0,0 @@
[Code]
var
__NET_FRAMEWORK_INSTALLED,
__NET_FRAMEWORK2_INSTALLED,
__NET_FRAMEWORK3_INSTALLED,
__NET_FRAMEWORK4_INSTALLED,
__NET_FRAMEWORK_SDK_INSTALLED,
__NET_FRAMEWORK_64BIT_INSTALLED,
__VSNET2013,
__PathsInitialized: Boolean;
__FRAMEWORK_INSTALL_ROOT,
__FRAMEWORK64_INSTALL_ROOT,
__SDK_INSTALL_ROOT,
__SDK2_INSTALL_ROOT,
__REGASM,
__REGASM64,
__VSNET2013_PATH,
__VSNET2013_BASE_PATH,
__CSharpExpress2013ProjectTemplatePath,
__VBExpress2013ProjectTemplatePath: string;
procedure InitializePaths;
var __VisualStudioLocation,
__VSRegistryLocation: string;
begin
if __PathsInitialized then exit;
__PathsInitialized := true;
__NET_FRAMEWORK_SDK_INSTALLED := true;
__FRAMEWORK_INSTALL_ROOT := ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\.NETFramework,InstallRoot|}');
__NET_FRAMEWORK_INSTALLED := __FRAMEWORK_INSTALL_ROOT <> '';
if __NET_FRAMEWORK_INSTALLED then begin
__FRAMEWORK64_INSTALL_ROOT := ExpandFileName(AddBackslash(__FRAMEWORK_INSTALL_ROOT)+'..\Framework64');
if not DirExists(__FRAMEWORK64_INSTALL_ROOT) then __FRAMEWORK64_INSTALL_ROOT := '';
end;
__NET_FRAMEWORK2_INSTALLED := ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\.NETFramework\policy\v2.0,50727|}') <> '';
if __NET_FRAMEWORK2_INSTALLED then begin
__REGASM64 := AddBackslash(__FRAMEWORK64_INSTALL_ROOT)+'v2.0.50727\regasm.exe';
if not FileExists(__REGASM64) then __REGASM64 := '';
__REGASM := AddBackslash(__FRAMEWORK_INSTALL_ROOT)+'v2.0.50727\regasm.exe';
end;
__NET_FRAMEWORK3_INSTALLED := ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\v3.5,All Assemblies In|}') <> '';
__NET_FRAMEWORK4_INSTALLED := ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\.NETFramework\policy\v4.0,30128|}') <> '';
__SDK_INSTALL_ROOT := ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\.NETFramework,sdkInstallRootv1.1|}');
__SDK2_INSTALL_ROOT := ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\.NETFramework,sdkInstallRootv2.0|}');
__NET_FRAMEWORK_SDK_INSTALLED := (__SDK2_INSTALL_ROOT <> '') or (__SDK_INSTALL_ROOT <> '');
if __SDK2_INSTALL_ROOT <> '' then
__SDK_INSTALL_ROOT := __SDK2_INSTALL_ROOT;
__NET_FRAMEWORK_64BIT_INSTALLED := ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\.NETFramework,Enable64Bit|0}') = '1';
__NET_FRAMEWORK_64BIT_INSTALLED := __NET_FRAMEWORK_64BIT_INSTALLED or ((__RegAsm64<> '') and FileExists(__RegAsm64));
if not IsWin64 then
begin
__VSRegistryLocation := '{#VsRegRootLM}';
Log('not 64');
end
else
__VSRegistryLocation := '{#VsRegRootWowLM}';
Log(__VSRegistryLocation);
__VSNET2013_PATH := ExpandConstant('{reg:HKLM\' + __VSRegistryLocation + ',InstallDir|}');
__VSNET2013 := __VSNET2013_PATH <> '';
if __VSNET2013 then
__VSNET2013_BASE_PATH := ExpandFilename(AddBackslash(__VSNET2013_PATH)+'..\..');
if RegQueryStringValue(HKCU, __VSRegistryLocation, 'UserProjectTemplatesLocation', __CSharpExpress2013ProjectTemplatePath) then
begin
StringChangeEx(__CSharpExpress2013ProjectTemplatePath, '%USERPROFILE%', GetEnv('USERPROFILE'), False);
end
else
begin
if RegQueryStringValue(HKCU, __VSRegistryLocation, 'VisualStudioLocation', __VisualStudioLocation) then
begin
StringChangeEx(__VisualStudioLocation, '%USERPROFILE%', GetEnv('USERPROFILE'), False);
__CSharpExpress2013ProjectTemplatePath := __VisualStudioLocation + '\Templates\ProjectTemplates';
end
else
begin
#if VsVersion == "vs2015"
__CSharpExpress2013ProjectTemplatePath := ExpandConstant('{userdocs}\Visual Studio {#VsVersionHuman}\Templates\ProjectTemplates');
#else
__CSharpExpress2013ProjectTemplatePath := ExpandConstant('{userdocs}\Visual Studio {#VsVersionHuman}\Templates\ProjectTemplates');
#endif
end;
end;
__VBExpress2013ProjectTemplatePath := __CSharpExpress2013ProjectTemplatePath;
Log('VS path:' + __VSNET2013_PATH);
end;
procedure DeInitializePaths;
begin
__PathsInitialized := False;
end;
function VSNET2013: Boolean;
begin
Result := __VSNET2013;
end;
function VSNET2013UP: Boolean;
begin
Result := VSNET2013;
end;
function VSNET2013_PATH(dummy: string): string;
begin
Result := __VSNET2013_PATH;
end;
function FRAMEWORK_INSTALL_ROOT(dummy: string): string;
begin
Result := __FRAMEWORK_INSTALL_ROOT;
end;
function FRAMEWORK64_INSTALL_ROOT(dummy: string): string;
begin
Result := __FRAMEWORK64_INSTALL_ROOT;
end;
function booltostr(value: Boolean) : string;
begin
if value then
Result := 'true'
else
Result := 'false';
end;
function Csharp2013_Installed(dummy: string): Boolean;
begin
Result := RegKeyExists(HKLM,'{#VsRegRoot}\Projects\{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}')
or RegKeyExists(HKLM,'{#VsRegRootWow}\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}');
end;
function PythonTools2013_Installed: Boolean;
begin
Result := RegKeyExists(HKLM,'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7AD18985-A5E6-443D-B0AB-A9ECFBB389A0}');
end;
function Fsharp2013_Installed(dummy: string): Boolean;
begin
Result := RegKeyExists(HKLM,'{#VsRegRoot}\Projects\{f2a71f9b-5d33-465a-a702-920d77279786}')
or RegKeyExists(HKLM,'{#VsRegRootWow}\Projects\{f2a71f9b-5d33-465a-a702-920d77279786}');
end;
function Vb2013_Installed(dummy: string): Boolean;
begin
Result := RegKeyExists(HKLM,'{#VsRegRoot}\Projects\{F184B08F-C81C-45f6-A57F-5ABD9991F28F}')
or RegKeyExists(HKLM,'{#VsRegRootWow}\Projects\{F184B08F-C81C-45f6-A57F-5ABD9991F28F}');
end;
function VS2013_REGISTRY_HIVE(dummy: string): string;
begin
Result := '{#VsRegVersion}';
end;
function VS2013_BASE_PATH(dummy: string): string;
begin
Result := __VSNET2013_BASE_PATH;
end;
function Get_SDK_INSTALL_ROOT(dummy: string): string;
begin
Result := __SDK_INSTALL_ROOT;
end;
function Get_SDK2_INSTALL_ROOT(dummy: string): string;
begin
Result := __SDK2_INSTALL_ROOT;
end;
function GET_NET_FRAMEWORK3_INSTALLED:Boolean;
begin
Result := __NET_FRAMEWORK3_INSTALLED;
end;
function GET_NET_FRAMEWORK2_INSTALLED:Boolean;
begin
Result := __NET_FRAMEWORK2_INSTALLED;
end;
function GET_NET_FRAMEWORK_INSTALLED:Boolean;
begin
Result := __NET_FRAMEWORK_INSTALLED;
end;
function GET_NET_FRAMEWORK4_INSTALLED:Boolean;
begin
Result := __NET_FRAMEWORK4_INSTALLED;
end;
function IsCSharpExpress2013Installed(dummy: string): Boolean;
begin
Result := RegValueExists(HKLM,'SOFTWARE\Microsoft\VCExpress\{#VsRegVersion}\Setup\VC','ProductDir');
end;
function GetCSharpExpress2013ProjectTemplatePath(dummy: string): string;
begin
Result := __CSharpExpress2013ProjectTemplatePath;
end;
function IsVBExpress2013Installed(dummy: string) : Boolean;
begin
Result := IsCSharpExpress2013Installed('dummy');
end;
function GetVBExpress2013ProjectTemplatePath(dummy: string) : string;
begin
Result := __CSharpExpress2013ProjectTemplatePath;
end;
function InitializeSetup: Boolean;
begin
InitializePaths;
if not VSNET2013 then begin
MsgBox(ExpandConstant('Either Visual Studio {#VsVersionHuman} or Visual Studio {#VsVersionHuman} (integrated shell) is not installed! Please see Cosmos documentation on GitHub for supported editions/versions of Visual Studio.'), MbError, MB_OK);
Result := false;
exit;
end;
Result := true;
end;

View file

@ -109,8 +109,9 @@ Source: ".\Build\PXE\*"; DestDir: "{app}\Build\PXE"
Source: ".\Build\mboot.c32"; DestDir: "{app}\Build\PXE\"
Source: ".\Build\syslinux.cfg"; DestDir: "{app}\Build\PXE\pxelinux.cfg"; DestName: "default"
; VSIP
Source: ".\Build\Tools\VSIXBootstrapper.exe"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.targets"; DestDir: "{app}"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.VS.ProjectSystem.vsix"; DestDir: "{app}"; Flags: ignoreversion uninsremovereadonly;
Source: ".\Build\VSIP\Cosmos.VS.ProjectSystem.vsix"; DestDir: "{app}"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.VS.Windows.vsix"; DestDir: "{app}"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.VS.DebugEngine.vsix"; DestDir: "{app}"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\XSharp.VS.vsix"; DestDir: "{app}"; Flags: ignoreversion uninsremovereadonly
@ -127,15 +128,11 @@ Root: HKCU; SubKey: Software\Cosmos; ValueType: none; ValueName: "DevKit"; Flags
UseRelativePaths=True
[Run]
Filename: "{code:GetVsixInstallCommand}"; Parameters: "{code:GetVsixInstallParams|Cosmos.VS.ProjectSystem.vsix}"; Description: "Install Cosmos Project System"; StatusMsg: "Installing Visual Studio Extension: Cosmos Project System"
Filename: "{code:GetVsixInstallCommand}"; Parameters: "{code:GetVsixInstallParams|Cosmos.VS.DebugEngine.vsix}"; Description: "Install Cosmos Debug Engine"; StatusMsg: "Installing Visual Studio Extension: Cosmos Debug Engine"
Filename: "{code:GetVsixInstallCommand}"; Parameters: "{code:GetVsixInstallParams|Cosmos.VS.Windows.vsix}"; Description: "Install Cosmos Debug Engine Windows"; StatusMsg: "Installing Visual Studio Extension: Cosmos Debug Engine Windows"
Filename: "{code:GetVsixInstallCommand}"; Parameters: "{code:GetVsixInstallParams|XSharp.VS.vsix}"; Description: "Install Cosmos X# Language Service"; StatusMsg: "Installing Visual Studio Extension: Cosmos X# Language Service"
Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/a /u:Cosmos.VS.ProjectSystem"; Description: "Remove Cosmos Project System"; StatusMsg: "Removing Visual Studio Extension: Cosmos Project System"
Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/a Cosmos.VS.ProjectSystem.vsix"; WorkingDir: "{app}"; Description: "Install Cosmos Project System"; StatusMsg: "Installing Visual Studio Extension: Cosmos Project System"
[UninstallRun]
Filename: "{code:GetVsixInstallCommand}"; Parameters: "{code:GetVsixUninstallParams|Cosmos.VS.ProjectSystem}"
Filename: "{code:GetVsixInstallCommand}"; Parameters: "{code:GetVsixUninstallParams|Cosmos.VS.DebugEngine}"
Filename: "{code:GetVsixInstallCommand}"; Parameters: "{code:GetVsixUninstallParams|Cosmos.VS.Windows}"
Filename: "{code:GetVsixInstallCommand}"; Parameters: "{code:GetVsixUninstallParams|XSharp.VS}"
[Code]
@ -147,9 +144,9 @@ var
begin
TempFilename :=
ExpandConstant('{tmp}\~execwithresult.txt');
Command :=
Command :=
Format('"%s" /S /C ""%s" %s > "%s""', [ExpandConstant('{cmd}'), Filename, Params, TempFilename]);
Result :=
Result :=
Exec(ExpandConstant('{cmd}'), Command, WorkingDir, ShowCmd, Wait, ResultCode);
if not Result then
Exit;
@ -164,9 +161,9 @@ function ExecWithoutResult(const Filename, Params, WorkingDir: String; const Sho
var
Command: String;
begin
Command :=
Command :=
Format('"%s" /S /C ""%s" %s"', [ExpandConstant('{cmd}'), Filename, Params]);
Result :=
Result :=
Exec(ExpandConstant('{cmd}'), Command, WorkingDir, ShowCmd, Wait, ResultCode);
if not Result then
Exit;
@ -209,7 +206,7 @@ function GetVsixInstallParams(const Filename: String): String;
var
Params: String;
begin
Params := '/quiet "' + ExpandConstant('{app}\') + Filename + '"';
Params := ' "' + ExpandConstant('{app}\') + Filename + '"';
Result := Params;
end;
@ -217,7 +214,7 @@ function GetVsixUninstallParams(const Filename: String): String;
var
Params: String;
begin
Params := '/quiet /uninstall:"' + Filename + '"';
Params := ' /uninstall:"' + Filename + '"';
Result := Params;
end;

View file

@ -1,41 +0,0 @@
[Code]
/////////////////////////////////////////////////////////////////////
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
/////////////////////////////////////////////////////////////////////
// Uninstall previously installed application.
/////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
sUnInstallString: String;
iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString
// default return value
Result := 0;
// get the uninstall string of the old app
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then begin
sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end else
Result := 1;
end;