Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging installer changes required for autoupdate to function #1

Merged
merged 14 commits into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ xcodebuild/*
*.vcxproj
*.vcxproj.filters
*.vcxproj.user
*.sln

*.pbxuser
*.perspective
Expand Down
13 changes: 13 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,19 @@ module.exports = function (grunt) {
}
]
},
"winInstallerDLLs": {
"files": [
{
"flatten" : true,
"expand" : true,
"src" : [
"installer/win/LaunchBrackets/LaunchBrackets/bin/Release/LaunchBrackets.CA.dll",
"installer/win/BracketsConfigurator/BracketsConfigurator/bin/Release/BracketsConfigurator.CA.dll"
],
"dest" : "installer/win/"
}
]
},
"mac": {
"files": [
{
Expand Down
6 changes: 6 additions & 0 deletions installer/mac/buildInstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ rm -rf $tempDir
mkdir $tempDir
cp -r "./staging/${BRACKETS_APP_NAME}.app/" "$tempDir/$appName"

# copy update.sh to hidden location in the dmg
if [ -f ./update.sh ]; then
echo "Adding update.sh"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gavankar, it would be safer to give the file "executable" permissions(chmod) programmatically before copying. Since we would simply be invoking the script later on, we don't want to end up in a situation where the script is present but is not executable due to any number of reasons.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in commit de725a8

cp ./update.sh "$tempDir/.update.sh"
fi

# create symlink to Applications folder in staging area
# with a single space as the name so it doesn't show an unlocalized name
ln -s /Applications "$tempDir/ "
Expand Down
10 changes: 10 additions & 0 deletions installer/mac/dropDmgConfig/layouts/bracketsLayout/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@
<key>type</key>
<string>file</string>
</dict>
<dict>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gavankar can you verify this layouting change and see if it's correct. The DMG GUI layout is getting messed up on my machine when I simply mount it. The container bounds seem to be off.

image

@ayushrathi15 can you confirm this issue?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This layout change was added after this bug was found, to fix this bug

<key>identifier</key>
<string>LayoutItem.3E1B7344-C175-4BE0-87DB-880A4A30E80F</string>
<key>name</key>
<string>.update.sh</string>
<key>position</key>
<string>{228, 424}</string>
<key>type</key>
<string>file</string>
</dict>
<dict>
<key>identifier</key>
<string>LayoutItem.0679B008-641D-4857-A4B8-156BF67D8320</string>
Expand Down
Empty file modified installer/mac/update.sh
100644 → 100755
Empty file.
75 changes: 67 additions & 8 deletions installer/win/Brackets.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<Component Id="AddContextMenu"
Guid="5E95F75D-91C4-44B6-B8A3-83005388B4BF" Directory="INSTALLDIR" KeyPath="yes">

<Condition>ADDCONTEXTMENU="1" OR CONTEXTMENUREGISTRY</Condition>
<!-- Add Open With Brackets to explorer's file context menu -->
<RegistryValue Root="HKCR" Key="*\shell\!(loc.ProductName)" Value="!(loc.ExplorerFileOpenContextMenu)"
Type="string" />
Expand Down Expand Up @@ -114,18 +114,70 @@
<UIRef Id="WixUI_ErrorProgressText" />

<!-- Launch app after install -->
<!--

<Property Id="LAUNCHAPPONEXIT" Value="1" />
<Property Id="LAUNCH_APPLICATION_SILENT" Value="0" />
<Property Id="MSIFASTINSTALL" Value="3"/>

<Property Id="WixShellExecTarget" Value="[#fil7EE01D0693DA0F92C26C5F3007D1BF2C]" />
<CustomAction Id="LaunchApplication" FileKey="fil7EE01D0693DA0F92C26C5F3007D1BF2C" ExeCommand=""
Execute="immediate" Impersonate="yes" Return="asyncNoWait" />
-->
<UI>

<CustomAction Id="LaunchApplicationCancel"
Return="check"
Execute="immediate"
BinaryKey="BracketsExecutor.dll"
DllEntry="LaunchBrackets" />

<CustomAction Id="LaunchApplicationError"
Return="check"
Execute="immediate"
BinaryKey="BracketsExecutor.dll"
DllEntry="LaunchBrackets" />

<CustomAction Id="LaunchApplicationSuspend"
Return="check"
Execute="immediate"
BinaryKey="BracketsExecutor.dll"
DllEntry="LaunchBrackets" />

<Property Id="INSTALLDIRREGISTRY">
<RegistrySearch Id="InstallDirRegistryID"
Root="HKLM"
Type="raw"
Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\$(var.ExeName).exe"
/>
</Property>

<Property Id="CONTEXTMENUREGISTRY">
<RegistrySearch Id="ContextMenuRegistryID"
Root="HKCR"
Type="raw"
Key="directory\shell\!(loc.ProductName)"
/>
</Property>

<SetProperty Id="CURRENTPATH"
Before="CostInitialize"
Sequence="execute"
Value="[%PATH]" />

<Binary Id="InstallLocationChecker.dll" SourceFile="BracketsConfigurator.CA.dll" />
<Binary Id="BracketsExecutor.dll" SourceFile="LaunchBrackets.CA.dll" />

<CustomAction Id="InstallDirCustomAction"
Return="check"
Execute="immediate"
BinaryKey="InstallLocationChecker.dll"
DllEntry="BracketsConfigurator" />


<UI>
<Publish Dialog="MyExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<!--
<Publish Dialog="MyExitDialog" Control="Finish" Order="1" Event="DoAction"
<!--
<Publish Dialog="MyExitDialog" Control="Finish" Order="1" Event="DoAction"
Value="LaunchApplication">LAUNCHAPPONEXIT=1 and NOT INSTALLED AND NOT REMOVE="ALL"</Publish>
-->
-->
</UI>

<!-- Add image assets -->
Expand All @@ -137,6 +189,7 @@
<Directory Id='INSTALLDIR' Name='!(loc.ShortProductName)'>
<Component Id="UpdatePath"
Guid="1781A625-8ACB-45E7-A8BA-219D81760B2E">
<Condition>UPDATEPATH="1"</Condition>
<CreateFolder />
<Environment Id="PATH"
Action="set"
Expand Down Expand Up @@ -184,10 +237,16 @@
DllEntry="BroadcastEnvironmentVariablesChange" />

<InstallExecuteSequence>
<Custom Action="BroadcastEnvironmentVariablesChange" After="InstallFinalize"/>
<Custom Action="BroadcastEnvironmentVariablesChange" After="InstallFinalize"/>
<Custom Action="InstallDirCustomAction" Before="CostFinalize">LAUNCH_APPLICATION_SILENT = 1</Custom>
<Custom Action="LaunchApplication" After="InstallFinalize">LAUNCH_APPLICATION_SILENT = 1</Custom>
<Custom Action="LaunchApplicationCancel" OnExit="cancel">LAUNCH_APPLICATION_SILENT = 1</Custom>
<Custom Action="LaunchApplicationError" OnExit="error">LAUNCH_APPLICATION_SILENT = 1</Custom>
<Custom Action="LaunchApplicationSuspend" OnExit="suspend">LAUNCH_APPLICATION_SILENT = 1</Custom>
</InstallExecuteSequence>

<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize" />

</Product>
</Wix>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Microsoft.Deployment.WindowsInstaller;

namespace BracketsConfigurator
{
public class BracketsConfiguratorClass
{
[CustomAction]
public static ActionResult BracketsConfigurator(Session session)
{
session.Log("Begin BracketsConfigurator");

//Set Install Directory if available
string installRegistry = session["INSTALLDIRREGISTRY"];
string installDirValue = "";
if (!string.IsNullOrEmpty(installRegistry))
{
session.Log("Install Registry Value: " + installRegistry);
string[] path = installRegistry.Split('\\');
//Remove executable name
path = path.Take(path.Count() - 1).ToArray();
//Get path without executable
installDirValue = string.Join("\\", path) + "\\";
session["INSTALLDIR"] = installDirValue;
session.Log("Updating Install Dir To: " + installDirValue);
}
else
{
session.Log("No Registry Value for installation directory");
}

//Set AddContextMenu if required
string contextMenuRegistry = session["CONTEXTMENUREGISTRY"];
if (!string.IsNullOrEmpty(contextMenuRegistry))
{
session.Log("Context Menu Registry Value: " + contextMenuRegistry);
session["ADDCONTEXTMENU"] = "1";
session.Log("Setting Context Menu Option");
}
else
{
session["ADDCONTEXTMENU"] = "0";
session.Log("Not Adding to Context Menu");
}

//Set UpdatePath if required
string currentPathValue = session["CURRENTPATH"];
session.Log("Current Path Value: " + currentPathValue);
if (!string.IsNullOrEmpty(currentPathValue) && currentPathValue.Contains(installDirValue))
{
session["UPDATEPATH"] = "1";
session.Log("Updating Path for Brackets");
}
else
{
session["UPDATEPATH"] = "0";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gavankar In case we are unable to read the values from registry, I am seeing that we're defaulting to 0. Has this workflow been confirmed with upper management. Because the default values in case of a fresh launch I think is 1.

@ayushrathi15 can you confirm this as well?

Copy link
Author

@gavankar gavankar Apr 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbhavi Adding Brackets to the system path is an optional feature in the installer.
This piece of code is used to figure out what an upgrading user chose the last time they ran the installer, not what the option should be for a new user.
If we see that Brackets is already on the path, updatepath is set to 1 and we continue to keep Brackets on the path. If brackets is not on the path then, we shouldn't add it now and updatepath is set to 0.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gavankar , I think my comment was misunderstood. What i meant was, if we are unable to read the registry, irrespective of whatever value it contains, what are we doing with the registry entries? Do we default them back to 0, or do we don't do anything? If we don't touch the registry entries, does the installer at the time of update, pick up the already existing entries, so that the user selected options are kept intact for the new version as well?
How are you handling this case here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbhavi, in this piece of code we are not directly reading entries from the registry. We are asking the msi installer for a copy of the entries that it has loaded as part of its execution, this is very unlikely to fail.

session.Log("Not Updating Path");
}

session.Log("End BracketsConfigurator");
return ActionResult.Success;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CECF9330-C626-4D7F-87DA-5387E97881B2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BracketsConfigurator</RootNamespace>
<AssemblyName>BracketsConfigurator</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Deployment.WindowsInstaller">
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BracketsConfigurator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Content Include="CustomAction.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(WixCATargetsPath)" Condition=" '$(WixCATargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets" Condition=" '$(WixCATargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets') " />
<Target Name="EnsureWixToolsetInstalled">
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">

<!--
Use supportedRuntime tags to explicitly specify the version(s) of the .NET Framework runtime that
the custom action should run on. If no versions are specified, the chosen version of the runtime
will be the "best" match to what Microsoft.Deployment.WindowsInstaller.dll was built against.

WARNING: leaving the version unspecified is dangerous as it introduces a risk of compatibility
problems with future versions of the .NET Framework runtime. It is highly recommended that you specify
only the version(s) of the .NET Framework runtime that you have tested against.

Note for .NET Framework v3.0 and v3.5, the runtime version is still v2.0.

In order to enable .NET Framework version 2.0 runtime activation policy, which is to load all assemblies
by using the latest supported runtime, @useLegacyV2RuntimeActivationPolicy="true".

For more information, see http://msdn.microsoft.com/en-us/library/bbx34a2h.aspx
-->

<supportedRuntime version="v4.0" />
<!-- <supportedRuntime version="v2.0.50727"/> -->

</startup>

<!--
Add additional configuration settings here. For more information on application config files,
see http://msdn.microsoft.com/en-us/library/kza1yk3a.aspx
-->

</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BracketsConfigurator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BracketsConfigurator")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cecf9330-c626-4d7f-87da-5387e97881b2")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BracketsConfigurator", "BracketsConfigurator\BracketsConfigurator.csproj", "{CECF9330-C626-4D7F-87DA-5387E97881B2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CECF9330-C626-4D7F-87DA-5387E97881B2}.Debug|x86.ActiveCfg = Debug|x86
{CECF9330-C626-4D7F-87DA-5387E97881B2}.Debug|x86.Build.0 = Debug|x86
{CECF9330-C626-4D7F-87DA-5387E97881B2}.Release|x86.ActiveCfg = Release|x86
{CECF9330-C626-4D7F-87DA-5387E97881B2}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading