Skip to content

Commit

Permalink
added ability to run flutter doctor on exit
Browse files Browse the repository at this point in the history
sampathbalivada committed Jul 18, 2020
1 parent 1001fac commit 27fc1b7
Showing 9 changed files with 242 additions and 14 deletions.
14 changes: 14 additions & 0 deletions FlutterInstaller.sln
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DownloadSDK", "DownloadSDK\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnpackSDK", "UnpackSDK\UnpackSDK.csproj", "{C7DB64FD-31F2-41A3-AAFF-C459CADD1BDA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenREADME", "OpenREADME\OpenREADME.csproj", "{759A8965-1F9E-4619-8A62-BAABD5424AF8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -30,33 +32,45 @@ Global
{70A234C6-94F8-49CD-B82D-E4CEBBB591DC}.Release|x86.ActiveCfg = Release|x86
{70A234C6-94F8-49CD-B82D-E4CEBBB591DC}.Release|x86.Build.0 = Release|x86
{FB96A676-9570-491C-8998-824FBA6FA5DC}.Debug|x64.ActiveCfg = Debug|x64
{FB96A676-9570-491C-8998-824FBA6FA5DC}.Debug|x64.Build.0 = Debug|x64
{FB96A676-9570-491C-8998-824FBA6FA5DC}.Debug|x86.ActiveCfg = Debug|x86
{FB96A676-9570-491C-8998-824FBA6FA5DC}.Debug|x86.Build.0 = Debug|x86
{FB96A676-9570-491C-8998-824FBA6FA5DC}.Release|x64.ActiveCfg = Release|x64
{FB96A676-9570-491C-8998-824FBA6FA5DC}.Release|x64.Build.0 = Release|x64
{FB96A676-9570-491C-8998-824FBA6FA5DC}.Release|x86.ActiveCfg = Release|x86
{FB96A676-9570-491C-8998-824FBA6FA5DC}.Release|x86.Build.0 = Release|x86
{9A6A3A2E-9271-4291-9718-B532A52E0CF7}.Debug|x64.ActiveCfg = Debug|x64
{9A6A3A2E-9271-4291-9718-B532A52E0CF7}.Debug|x64.Build.0 = Debug|x64
{9A6A3A2E-9271-4291-9718-B532A52E0CF7}.Debug|x86.ActiveCfg = Debug|x86
{9A6A3A2E-9271-4291-9718-B532A52E0CF7}.Debug|x86.Build.0 = Debug|x86
{9A6A3A2E-9271-4291-9718-B532A52E0CF7}.Release|x64.ActiveCfg = Release|x64
{9A6A3A2E-9271-4291-9718-B532A52E0CF7}.Release|x64.Build.0 = Release|x64
{9A6A3A2E-9271-4291-9718-B532A52E0CF7}.Release|x86.ActiveCfg = Release|x86
{9A6A3A2E-9271-4291-9718-B532A52E0CF7}.Release|x86.Build.0 = Release|x86
{73387ECE-FEFD-49D3-9C20-CDC219B245FA}.Debug|x64.ActiveCfg = Debug|x64
{73387ECE-FEFD-49D3-9C20-CDC219B245FA}.Debug|x64.Build.0 = Debug|x64
{73387ECE-FEFD-49D3-9C20-CDC219B245FA}.Debug|x86.ActiveCfg = Debug|x86
{73387ECE-FEFD-49D3-9C20-CDC219B245FA}.Debug|x86.Build.0 = Debug|x86
{73387ECE-FEFD-49D3-9C20-CDC219B245FA}.Release|x64.ActiveCfg = Release|x64
{73387ECE-FEFD-49D3-9C20-CDC219B245FA}.Release|x64.Build.0 = Release|x64
{73387ECE-FEFD-49D3-9C20-CDC219B245FA}.Release|x86.ActiveCfg = Release|x86
{73387ECE-FEFD-49D3-9C20-CDC219B245FA}.Release|x86.Build.0 = Release|x86
{C7DB64FD-31F2-41A3-AAFF-C459CADD1BDA}.Debug|x64.ActiveCfg = Debug|x64
{C7DB64FD-31F2-41A3-AAFF-C459CADD1BDA}.Debug|x64.Build.0 = Debug|x64
{C7DB64FD-31F2-41A3-AAFF-C459CADD1BDA}.Debug|x86.ActiveCfg = Debug|x86
{C7DB64FD-31F2-41A3-AAFF-C459CADD1BDA}.Debug|x86.Build.0 = Debug|x86
{C7DB64FD-31F2-41A3-AAFF-C459CADD1BDA}.Release|x64.ActiveCfg = Release|x64
{C7DB64FD-31F2-41A3-AAFF-C459CADD1BDA}.Release|x64.Build.0 = Release|x64
{C7DB64FD-31F2-41A3-AAFF-C459CADD1BDA}.Release|x86.ActiveCfg = Release|x86
{C7DB64FD-31F2-41A3-AAFF-C459CADD1BDA}.Release|x86.Build.0 = Release|x86
{759A8965-1F9E-4619-8A62-BAABD5424AF8}.Debug|x64.ActiveCfg = Debug|x64
{759A8965-1F9E-4619-8A62-BAABD5424AF8}.Debug|x64.Build.0 = Debug|x64
{759A8965-1F9E-4619-8A62-BAABD5424AF8}.Debug|x86.ActiveCfg = Debug|x86
{759A8965-1F9E-4619-8A62-BAABD5424AF8}.Debug|x86.Build.0 = Debug|x86
{759A8965-1F9E-4619-8A62-BAABD5424AF8}.Release|x64.ActiveCfg = Release|x64
{759A8965-1F9E-4619-8A62-BAABD5424AF8}.Release|x64.Build.0 = Release|x64
{759A8965-1F9E-4619-8A62-BAABD5424AF8}.Release|x86.ActiveCfg = Release|x86
{759A8965-1F9E-4619-8A62-BAABD5424AF8}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
6 changes: 3 additions & 3 deletions FlutterInstaller/Common.wxl
Original file line number Diff line number Diff line change
@@ -10,12 +10,12 @@

<String Id="DowngradeErrorMessage">A newer version of Flutter is already installed.</String>
<String Id="ExitMessage">
Run "flutter doctor" from a new command window
to finish setting up Flutter SDK.
Run "flutter doctor" to finish setting up Flutter SDK

For more information visit https://bit.ly/flutterdoctorwin
View the README file for additional information on setting up Flutter SDK on you PC.
</String>

<String Id="Language">1033</String>

</WixLocalization>

20 changes: 14 additions & 6 deletions FlutterInstaller/FlutterInstaller.wixproj
Original file line number Diff line number Diff line change
@@ -34,12 +34,6 @@
<ItemGroup>
<EmbeddedResource Include="Common.wxl" />
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DownloadSDK\DownloadSDK.csproj">
<Name>DownloadSDK</Name>
@@ -49,6 +43,14 @@
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
<ProjectReference Include="..\OpenREADME\OpenREADME.csproj">
<Name>OpenREADME</Name>
<Project>{759a8965-1f9e-4619-8a62-baabd5424af8}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
<ProjectReference Include="..\RemoveFilesAndRegistry\RemoveFilesAndRegistry.csproj">
<Name>RemoveFilesAndRegistry</Name>
<Project>{9a6a3a2e-9271-4291-9718-b532a52e0cf7}</Project>
@@ -74,6 +76,12 @@
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
20 changes: 16 additions & 4 deletions FlutterInstaller/Product.wxs
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
Codepage="1252">

<!-- Provide package details -->
<Package InstallerVersion="200"
<Package InstallerVersion="500"
Compressed="yes"
InstallScope="perMachine"
Platform="x64"
@@ -55,14 +55,18 @@

<!-- Disable Repair/Modify from Control Panel -->
<Property Id="ARPNOREPAIR" Value="yes" Secure="yes" />
<!-- Add a checkbox to open README and run flutter doctor on exit and set the default state to checked -->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Open README and run flutter doctor" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />

<!-- Add custom action DLL -->
<!-- Add custom actions DLLs -->
<Binary Id="DownloadSDKDLL" SourceFile="$(var.DownloadSDK.TargetDir)DownloadSDK.CA.dll" />
<Binary Id="UnpackSDKDLL" SourceFile="$(var.UnpackSDK.TargetDir)UnpackSDK.CA.dll" />
<Binary Id="RemoveFilesDLL" SourceFile="$(var.RemoveFiles.TargetDir)RemoveFiles.CA.dll" />
<Binary Id="RemoveFilesAndRegistryDLL" SourceFile="$(var.RemoveFilesAndRegistry.TargetDir)RemoveFilesAndRegistry.CA.dll" />
<Binary Id="OpenREADMEDLL" SourceFile="$(var.OpenREADME.TargetDir)OpenREADME.CA.dll" />

<!-- Custom Action that points to the binary -->
<!-- Custom Actions that point to the binary -->
<CustomAction Id="CA_DownloadSDK"
BinaryKey="DownloadSDKDLL"
DllEntry="DownloadSDK"
@@ -96,6 +100,12 @@
Impersonate="no"
Return="ignore"
/>
<CustomAction Id="CA_OpenREADME"
BinaryKey="OpenREADMEDLL"
DllEntry="OpenREADME"
Impersonate="yes"
Return="ignore"
/>

<!-- Note: Use InstallUISequence when necessary to run a Custom Action during the info gathering process -->
<!-- InstallExecuteSequence determines the sequence during the actual installation process -->
@@ -107,10 +117,12 @@
<Custom Action="CA_RemoveFiles" After="InstallInitialize">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
</InstallExecuteSequence>

<!-- Update UI to reflect the current status -->
<UI>
<!-- Update UI to reflect the current status -->
<ProgressText Action="CA_DownloadSDK">Downloading SDK... (this might take a while depending on your internet)</ProgressText>
<ProgressText Action="CA_UnpackSDK">Extracting Files... (this usually takes 10-15 minutes)</ProgressText>
<!-- Invoke custom action if Exit Dialog checkbox is in checked state -->
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="CA_OpenREADME">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>

<Feature Id="ProductFeature" Title="FlutterSDK" Level="1">
32 changes: 32 additions & 0 deletions OpenREADME/CustomAction.config
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>
51 changes: 51 additions & 0 deletions OpenREADME/CustomAction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using System.IO;
using Microsoft.Deployment.WindowsInstaller;

namespace OpenREADME
{
public class CustomActions
{
[CustomAction]
public static ActionResult OpenREADME(Session session)
{
var path = @"C:\flutter\InstallREADME.txt";

string[] lines = {
"For more information on Flutter Doctor",
"visit https://flutter.dev/docs/get-started/install/windows#run-flutter-doctor",
" ",
"For details about installing Android Studio and/or Visual Studio Code visit",
"Android Studio - https://developer.android.com/studio",
"Visual Studio Code - https://code.visualstudio.com/",
"",
"To know more about the Flutter SDK",
"visit https://flutter.dev"
};

try
{
// Write contents to the README file.
File.WriteAllLines(path, lines);

// Open README File after writing
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = @"/C notepad.exe /a C:\flutter\InstallREADME.txt";
process.StartInfo = startInfo;
process.Start();

System.Diagnostics.Process.Start("cmd.exe", @"/K SET PATH=%PATH%;C:\flutter\bin & cd C:\flutter\bin & flutter doctor");
}
catch (Exception e)
{
session.Log(e.ToString());
return ActionResult.Failure;
}

return ActionResult.Success;
}
}
}
73 changes: 73 additions & 0 deletions OpenREADME/OpenREADME.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?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>{759A8965-1F9E-4619-8A62-BAABD5424AF8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenREADME</RootNamespace>
<AssemblyName>OpenREADME</AssemblyName>
<TargetFrameworkVersion>v3.5</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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Deployment.WindowsInstaller">
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CustomAction.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" Condition=" '$(WixCATargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target>
</Project>
35 changes: 35 additions & 0 deletions OpenREADME/Properties/AssemblyInfo.cs
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("OpenREADME")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenREADME")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[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("759a8965-1f9e-4619-8a62-baabd5424af8")]

// 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")]
5 changes: 4 additions & 1 deletion UnpackSDK/CustomAction.cs
Original file line number Diff line number Diff line change
@@ -32,6 +32,9 @@ public static ActionResult UnpackSDK(Session session)
return ActionResult.Failure;
}

return ActionResult.Success; }
//session.Log("Extracted");

return ActionResult.Success;
}
}
}

0 comments on commit 27fc1b7

Please sign in to comment.