Skip to content

Commit

Permalink
Merge pull request #67 from springcomp/msi_version
Browse files Browse the repository at this point in the history
Authored .MSI using WiX Toolset.
  • Loading branch information
springcomp authored Jun 15, 2019
2 parents b21170b + 884ed29 commit 722c55e
Show file tree
Hide file tree
Showing 20 changed files with 530 additions and 23 deletions.
13 changes: 8 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@ init:
if ($env:APPVEYOR_REPO_TAG -eq "true") {
$Env:KBFRZ71_VERSION = "$($env:APPVEYOR_REPO_TAG_NAME.TrimStart("v"))"
} else {
$Env:KBFRZ71_VERSION = ""
$Env:KBFRZ71_VERSION = "1.0.3.40"
}
before_build:
- ps: docker build --cache-from sprinccompdocker/msklc:1.4 --tag private/msklc:1.4 --file .\Dockerfile .\context\

build_script:
- ps: dir env:\
- ps: Set-Content -Path ".\bin\KBFRZ71.klc" -Encoding Unicode -Value (Get-Content -Path ".\KBFRZ71.klc" -Raw -Encoding UTF8)
- ps: Set-Content -Path ".\src\KBFRZ71.klc" -Encoding Unicode -Value (Get-Content -Path ".\KBFRZ71.klc" -Raw -Encoding UTF8)
- ps: |
docker run `
--rm `
--mount "type=bind,source=C:\projects\optimized-azerty-win\bin,target=C:\sources" `
--mount "type=bind,source=C:\projects\optimized-azerty-win\src,target=C:\sources" `
--env "KBFRZ71_VERSION=$Env:KBFRZ71_VERSION" `
private/msklc:1.4 > build.log
- ps: |
Expand All @@ -36,9 +35,13 @@ build_script:
Write-Host $content -ForegroundColor Green
Remove-Item -Path ".\KBFRZ71.klc"
}
- ps: nuget restore .\src\Setup.sln
- ps: msbuild .\src\Setup.sln /p:Configuration=Release /p:SolutionDir=.\src /p:ProductVersion=$Env:KBFRZ71_VERSION

after_build:
- ps: 7z a artifacts\setup.zip C:\projects\optimized-azerty-win\bin\* -xr!artifacts
- ps: 7z a artifacts\setup.zip C:\projects\optimized-azerty-win\src\Setup\bin\x86\Release\net452\*.msi
- ps: 7z a artifacts\setup.zip C:\projects\optimized-azerty-win\src\Setup\bin\x86\Release\net452\*.exe
- ps: 7z a artifacts\setup.zip C:\projects\optimized-azerty-win\src\Setup\bin\x86\Release\net452\*.config

artifacts:
- path: artifacts\setup.zip
Expand Down
Binary file removed bin/KBFRZ71_amd64.msi
Binary file not shown.
Binary file removed bin/KBFRZ71_i386.msi
Binary file not shown.
Binary file removed bin/KBFRZ71_ia64.msi
Binary file not shown.
Binary file removed bin/setup.exe
Binary file not shown.
31 changes: 13 additions & 18 deletions context/Make-KeyboardLayout.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ BEGIN {
## for testing purposes
## When launched from a Docker container
## via AppVeyor, we use an environment
## variable to specify our requestion version number.
## variable to specify our requested version number.

if ($version = "1.0.3.40"){
$version = $Env:KBFRZ71_VERSION
Expand All @@ -39,10 +39,8 @@ PROCESS {
## These folder should not exist previously but this
## is useful for testing

Remove-Item -Path i386 -Recurse -Force -EA SilentlyContinue | Out-Null
Remove-Item -Path ia64 -Recurse -Force -EA SilentlyContinue | Out-Null
Remove-Item -Path amd64 -Recurse -Force -EA SilentlyContinue | Out-Null
Remove-Item -Path wow64 -Recurse -Force -EA SilentlyContinue | Out-Null
Remove-Item -Path Package_x86\bin -Recurse -Force -EA SilentlyContinue | Out-Null
Remove-Item -Path Package_x64\bin -Recurse -Force -EA SilentlyContinue | Out-Null

## kbdutool.exe converts the KLC layout to a .C source file
## and then builds a resulting DLL for each supported target CPU.
Expand Down Expand Up @@ -100,21 +98,13 @@ PROCESS {
## warnings an errors feedback in the output

C:\MSKLC\bin\i386\kbdutool.exe -v -w -u -x KBFRZ71.klc | ? { -not $_.Contains("can't open for write.") } | Out-Null
New-Item -Path i386 -ItemType Directory | Out-Null
Move-Item -Path KBFRZ71.DLL -Destination i386 -Force
New-Item -Path Package_x86\bin -ItemType Directory | Out-Null
Move-Item -Path KBFRZ71.DLL -Destination Package_x86\bin -Force

C:\MSKLC\bin\i386\kbdutool.exe -v -w -u -i KBFRZ71.klc | ? { -not $_.Contains("can't open for write.") } | Out-Null
New-Item -Path ia64 -ItemType Directory | Out-Null
Move-Item -Path KBFRZ71.DLL -Destination ia64 -Force

C:\MSKLC\bin\i386\kbdutool.exe -v -w -u -m KBFRZ71.klc | ? { -not $_.Contains("can't open for write.") } | Out-Null
New-Item -Path amd64 -ItemType Directory | Out-Null
Move-Item -Path KBFRZ71.DLL -Destination amd64 -Force
C:\MSKLC\bin\i386\kbdutool.exe -v -w -u -m KBFRZ71.klc | ? { -not $_.Contains("can't open for write.") }
New-Item -Path Package_x64\bin -ItemType Directory | Out-Null
Move-Item -Path KBFRZ71.DLL -Destination Package_x64\bin -Force

C:\MSKLC\bin\i386\kbdutool.exe -v -w -u -o KBFRZ71.klc | ? { -not $_.Contains("can't open for write.") }
New-Item -Path wow64 -ItemType Directory | Out-Null
Move-Item -Path KBFRZ71.DLL -Destination wow64 -Force

attrib -R KBFRZ71.C
attrib -R KBFRZ71.H
attrib -R KBFRZ71.RC
Expand All @@ -125,5 +115,10 @@ PROCESS {
Remove-Item -Path KBFRZ71.RC
Remove-Item -Path KBFRZ71.DEF

## Copy MSKLC KbdMsi.dll used as Windows Installer custom actions
## in the resulting .MSI packages

Copy-Item -Path C:\MSKLC\bin\i386\KbdMsi.dll -Destination Package_x86\bin | Out-Null

Pop-Location
}
10 changes: 10 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
\.vs/
\.vscode/

[Bb]in/
[Oo]bj/
*.klc
*.C
*.H
*.DEF
*.RES
77 changes: 77 additions & 0 deletions src/Package_x64/Package_x64.wixproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?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)' == '' ">x64</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>9c0beb66-cfca-4d29-9bbc-31ec8adbdf7e</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>KBFRZ71_amd64</OutputName>
<OutputType>Package</OutputType>
<ProductVersion Condition=" '$(ProductVersion)' == '' ">1.0.3.40</ProductVersion>
<DefineSolutionProperties>false</DefineSolutionProperties>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<OutputPath>..\Setup\bin\x86\$(Configuration)\net452\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;ProductVersion=$(ProductVersion)</DefineConstants>
<SuppressIces>ICE09</SuppressIces>
<CompilerAdditionalOptions>-sw1091</CompilerAdditionalOptions>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>..\Setup\bin\x86\$(Configuration)\net452\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>ProductVersion=$(ProductVersion)</DefineConstants>
<CompilerAdditionalOptions>-sw1091</CompilerAdditionalOptions>
<SuppressIces>ICE09</SuppressIces>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Package_x86\CustomAction.wxs">
<Link>CustomAction.wxs</Link>
</Compile>
<Compile Include="..\Package_x86\Product.wxs">
<Link>Product.wxs</Link>
</Compile>
<Content Include="..\Package_x86\Components_x64.wxi">
<Link>Components_x64.wxi</Link>
</Content>
<Content Include="..\Package_x86\Components_x86.wxi">
<Link>Components_x86.wxi</Link>
</Content>
<Content Include="..\Package_x86\Conditions.wxi">
<Link>Conditions.wxi</Link>
</Content>
<Content Include="..\Package_x86\Features.wxi">
<Link>Features.wxi</Link>
</Content>
<Content Include="..\Package_x86\InstallExecuteSequence.wxi">
<Link>InstallExecuteSequence.wxi</Link>
</Content>
<Content Include="..\Package_x86\Properties.wxi">
<Link>Properties.wxi</Link>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Setup\Setup.csproj">
<Name>Setup</Name>
<Project>{2be83297-a293-47a1-9f79-5ab75aebaf55}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</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' ">
<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>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
8 changes: 8 additions & 0 deletions src/Package_x86/Components_x64.wxi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Include>

<Component Id="Component.x64.KBFRZ71_caps" Guid="261854A1-16A3-4C79-8A80-7AD57490C74D" Win64="yes">
<File Id="File.x64.KBFRZ71.dll" Source="$(var.Setup.ProjectDir)..\Package_x64\bin\KBFRZ71.dll" KeyPath="yes" />
</Component>

</Include>
9 changes: 9 additions & 0 deletions src/Package_x86/Components_x86.wxi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Include>

<Component Id="Component.x86.KBFRZ71_caps" Guid="07C83047-A24A-46C2-B783-C120AB7C5591" Win64="no">
<Condition><![CDATA[ 1 = 1 ]]></Condition>
<File Id="File.x86.KBFRZ71.dll" Source="$(var.Setup.ProjectDir)..\Package_x86\bin\KBFRZ71.dll" KeyPath="yes" />
</Component>

</Include>
25 changes: 25 additions & 0 deletions src/Package_x86/Conditions.wxi
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Include>

<MajorUpgrade
AllowDowngrades="no" DowngradeErrorMessage="Une version précédente de ce produit est déjà installée. Supprimer la version précédente avant de poursuivre l'installation."
AllowSameVersionUpgrades="no"
/>

<Condition Message="La disposition de clavier AZERTY NF Z71-300 (KBFRZ71.DLL) est déjà installée sur cet ordinateur. L’installation ne peut pas se poursuivre.">
<![CDATA[ KEYBOARD_ALREADY_PRESENT = "" OR Installed ]]>
</Condition>

<Condition Message="La disposition de clavier AZERTY NF Z71-300 ne peut pas être installée sur Windows95, Windows98 ou Windows Me. L’installation ne peut pas se poursuivre.">
<![CDATA[ Version9X = "" ]]>
</Condition>

<?if $(var.Platform) = x64 ?>

<Condition Message="L’installation de ce package n’est pas supportée sur une machine dotée d’un processeur de ce type.">
<![CDATA[ NOT Intel64 ]]>
</Condition>

<?endif?>

</Include>
26 changes: 26 additions & 0 deletions src/Package_x86/CustomAction.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

<Fragment>

<?if $(var.Platform) = x64 ?>

<CustomAction Id="SetFilePath.x64" Property="RegisterKeyboard" Value="[#File.x64.KBFRZ71.dll]|[LCIDValue]" Execute="immediate" />

<?else?>

<CustomAction Id="SetFilePath.x86" Property="RegisterKeyboard" Value="[#File.x86.KBFRZ71.dll]|[LCIDValue]" Execute="immediate" />

<?endif?>

<CustomAction Id="RegisterKeyboard" BinaryKey="KbdMsi" DllEntry="CA01" Execute="deferred" Impersonate="no" Return="check" />
<CustomAction Id="UnregisterKeyboard" BinaryKey="KbdMsi" DllEntry="CA02" Execute="deferred" Impersonate="no" Return="check" />

<CustomAction Id="AddKeyboardToLangBar" BinaryKey="KbdMsi" DllEntry="CA03" Execute="deferred" Return="check" />
<CustomAction Id="RemoveKeyboardFromLangBar" BinaryKey="KbdMsi" DllEntry="CA04" Execute="deferred" Return="check" />

<Binary Id="KbdMsi" SourceFile="$(var.Setup.ProjectDir)..\Package_x86\bin\KbdMsi.dll" />

</Fragment>

</Wix>
19 changes: 19 additions & 0 deletions src/Package_x86/Features.wxi
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Include>

<?if $(var.Platform) = x64 ?>

<Feature Id="F_CA8158D1_4371_4866_B39E_8A199A62131F" Title="AZERTY NF Z71-300 (SGCaps)" Level="1" TypicalDefault="install" InstallDefault="local" AllowAdvertise="no" Absent="disallow">
<ComponentRef Id="Component.x86.KBFRZ71_caps" />
<ComponentRef Id="Component.x64.KBFRZ71_caps" />
</Feature>

<?else?>

<Feature Id="F_CA8158D1_4371_4866_B39E_8A199A62131F" Title="AZERTY NF Z71-300 (SGCaps)" Level="1" TypicalDefault="install" InstallDefault="local" AllowAdvertise="no" Absent="disallow">
<ComponentRef Id="Component.x86.KBFRZ71_caps" />
</Feature>

<?endif?>

</Include>
28 changes: 28 additions & 0 deletions src/Package_x86/InstallExecuteSequence.wxi
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Include>

<?if $(var.Platform) = x64 ?>

<InstallExecuteSequence>
<Custom Action="SetFilePath.x64" Sequence="4030"> <![CDATA[ 1 = 1 ]]></Custom>

<Custom Action="RemoveKeyboardFromLangBar" Sequence="4040"><![CDATA[ $Component.x64.KBFRZ71_caps = 2 ]]></Custom>
<Custom Action="UnregisterKeyboard" Sequence="4060"><![CDATA[ $Component.x64.KBFRZ71_caps = 2 ]]></Custom>
<Custom Action="RegisterKeyboard" Sequence="4050"><![CDATA[ $Component.x64.KBFRZ71_caps > 2 ]]></Custom>
<Custom Action="AddKeyboardToLangBar" Sequence="4065"><![CDATA[ $Component.x64.KBFRZ71_caps > 2 ]]></Custom>
</InstallExecuteSequence>

<?else?>

<InstallExecuteSequence>
<Custom Action="SetFilePath.x86" Sequence="4030"> <![CDATA[ 1 = 1 ]]></Custom>

<Custom Action="RemoveKeyboardFromLangBar" Sequence="4040"><![CDATA[ $Component.x86.KBFRZ71_caps = 2 ]]></Custom>
<Custom Action="UnregisterKeyboard" Sequence="4060"><![CDATA[ $Component.x86.KBFRZ71_caps = 2 ]]></Custom>
<Custom Action="RegisterKeyboard" Sequence="4050"><![CDATA[ $Component.x86.KBFRZ71_caps > 2 ]]></Custom>
<Custom Action="AddKeyboardToLangBar" Sequence="4065"><![CDATA[ $Component.x86.KBFRZ71_caps > 2 ]]></Custom>
</InstallExecuteSequence>

<?endif?>

</Include>
63 changes: 63 additions & 0 deletions src/Package_x86/Package_x86.wixproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?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>3.10</ProductVersion>
<ProjectGuid>31449d77-5f06-456f-812f-4ac4d05119a6</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>KBFRZ71_i386</OutputName>
<OutputType>Package</OutputType>
<ProductVersion Condition=" '$(ProductVersion)' == '' ">1.0.3.40</ProductVersion>
<DefineSolutionProperties>false</DefineSolutionProperties>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>..\Setup\bin\x86\$(Configuration)\net452\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;ProductVersion=$(ProductVersion)</DefineConstants>
<SuppressIces>ICE09</SuppressIces>
<CompilerAdditionalOptions>-sw1091</CompilerAdditionalOptions>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\Setup\bin\x86\$(Configuration)\net452\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>ProductVersion=$(ProductVersion)</DefineConstants>
<CompilerAdditionalOptions>-sw1091</CompilerAdditionalOptions>
<SuppressIces>ICE09</SuppressIces>
</PropertyGroup>
<ItemGroup>
<Compile Include="CustomAction.wxs" />
<Compile Include="Product.wxs" />
</ItemGroup>
<ItemGroup>
<Content Include="Components_x64.wxi" />
<Content Include="Components_x86.wxi" />
<Content Include="Conditions.wxi" />
<Content Include="Features.wxi" />
<Content Include="InstallExecuteSequence.wxi" />
<Content Include="Properties.wxi" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Setup\Setup.csproj">
<Name>Setup</Name>
<Project>{2be83297-a293-47a1-9f79-5ab75aebaf55}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</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' ">
<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>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Loading

0 comments on commit 722c55e

Please sign in to comment.