Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
34 changes: 15 additions & 19 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: Visual Studio 2017
image: Visual Studio 2019

branches:
only:
Expand All @@ -17,42 +17,37 @@ before_build:
- ps: docker build --cache-from sprinccompdocker/msklc:1.4 --tag private/msklc:1.4 --file .\Dockerfile .\context\

build_script:
- ps: .\Make-KLC.ps1 -Name KBFRZ71 -Force
- ps: .\Make-KLC.ps1 -Name KBFRZ71N -Force
- ps: Set-Content -Path ".\src\KBFRZ71.klc" -Encoding Unicode -Value (Get-Content -Path ".\KBFRZ71.klc" -Raw -Encoding UTF8)
- ps: Set-Content -Path ".\src\KBFRZ71N.klc" -Encoding Unicode -Value (Get-Content -Path ".\KBFRZ71N.klc" -Raw -Encoding UTF8)
## - ps: .\Make-KLC.ps1 -Name KBFRZ71 -Force
## - ps: .\Make-KLC.ps1 -Name KBFRZ71N -Force
## - ps: Set-Content -Path ".\src\KBFRZ71.klc" -Encoding Unicode -Value (Get-Content -Path ".\KBFRZ71.klc" -Raw -Encoding UTF8)
## - ps: Set-Content -Path ".\src\KBFRZ71N.klc" -Encoding Unicode -Value (Get-Content -Path ".\KBFRZ71N.klc" -Raw -Encoding UTF8)
- ps: |
docker run `
--rm `
--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: |
$content = (Get-Content -Path ".\build.log" -Raw)
Write-Host "`r`n"
if ($content.Contains("Error")) {
Write-Host $content -ForegroundColor Red
throw "Build failed."
}
else {
Write-Host $content -ForegroundColor Green
Remove-Item -Path ".\KBFRZ71.klc"
}

- ps: msbuild .\src\KBFRZ71 /p:Configuration=Release /p:Platform=Win32
- ps: msbuild .\src\KBFRZ71 /p:Configuration=Release /p:Platform=x64
- ps: msbuild .\src\KBFRZ71N /p:Configuration=Release /p:Platform=Win32
- ps: msbuild .\src\KBFRZ71N /p:Configuration=Release /p:Platform=x64

- 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 .\src\Setup\bin\x86\Release\net452\*.msi
- ps: 7z a artifacts\setup.zip .\src\Setup\bin\x86\Release\net452\*.exe
- ps: 7z a artifacts\setup.zip .\src\Setup\bin\x86\Release\net452\*.exe
- ps: 7z a artifacts\setup.zip .\src\Setup\bin\x86\Release\net452\*.config
- ps: copy .\src\Setup\bin\x86\Release\net452\*.msi .\artifacts\

artifacts:
- path: artifacts\setup.zip
name: setup
type: file
type: File
- path: 'artifacts\*.msi'
type: file
type: File

deploy:
- provider: GitHub
Expand All @@ -65,3 +60,4 @@ deploy:
on:
branch: main # only release from main branch
APPVEYOR_REPO_TAG: true # only release on new tag

95 changes: 14 additions & 81 deletions context/Make-KeyboardLayout.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,73 +16,6 @@ BEGIN {
Write-Output $result
}

Function Build-Layout {
param(
[string] $name
)

BEGIN {

Function Compile-Layout {
param(
[string] $name,
[string] $option,
[string] $target,
[switch] $quiet = $false
)

$expression = "C:\MSKLC\bin\i386\kbdutool.exe -v -w -u $option `"$name.klc`""
Invoke-Expression -Command $expression | ? {
-not $_.Contains("can't open for write.")
} | % {
if (-not $quiet.IsPresent) {
Write-Host $_
}
}

New-Item -Path $target -ItemType Directory -EA SilentlyContinue | Out-Null
Move-Item -Path "$name.DLL" -Destination $target -Force
}

Function Make-Readonly {
param(
[string] $name,
[switch] $readwrite = $false
)
if ($readwrite.IsPresent) {
attrib -R "$name.C"
attrib -R "$name.H"
attrib -R "$name.RC"
attrib -R "$name.DEF"
}
else {
attrib +R "$name.C"
attrib +R "$name.H"
attrib +R "$name.RC"
attrib +R "$name.DEF"
}
}

$x86 = ".\Package_x86\bin\"
$x64 = ".\Package_x64\bin\"
}

PROCESS {

## Protect the files to prevent kbdutool from overwriting them

Make-ReadOnly -Name $name

## Only the last group of commands report
## warnings an errors feedback in the output

Compile-Layout -Name $name -Option "-x" -Target $x86 -Quiet
Compile-Layout -Name $name -Option "-m" -Target $x64

Make-Readonly -Name $name -ReadWrite
}
}

Function Fix-Encoding {
param(
[string] $name
Expand Down Expand Up @@ -169,33 +102,33 @@ PROCESS {

## First create C source file

C:\MSKLC\bin\i386\kbdutool.exe -u -s KBFRZ71.klc | Out-Null
C:\MSKLC\bin\i386\kbdutool.exe -u -s KBFRZ71N.klc | Out-Null
## C:\MSKLC\bin\i386\kbdutool.exe -u -s KBFRZ71.klc | Out-Null
## C:\MSKLC\bin\i386\kbdutool.exe -u -s KBFRZ71N.klc | Out-Null

## Restore corrupted accented characters

Fix-Encoding -Name KBFRZ71
Fix-Encoding -Name KBFRZ71N
## Fix-Encoding -Name KBFRZ71
## Fix-Encoding -Name KBFRZ71N

## Update version in RC source file
## MSKLC creates a DLL with version fixed to 1.0.3.40.
## We need to patch the file to update our version

Patch-Version -Name KBFRZ71 -Version $version
Patch-Version -Name KBFRZ71N -Version $version
## Patch-Version -Name KBFRZ71 -Version $version
## Patch-Version -Name KBFRZ71N -Version $version

Build-Layout -Name KBFRZ71
Build-Layout -Name KBFRZ71N
## Move C source code to Visual Studio project folder

##Remove-Item -Path KBFRZ71.C
##Remove-Item -Path KBFRZ71.H
##Remove-Item -Path KBFRZ71.RC
##Remove-Item -Path KBFRZ71.DEF
## ".C", ".DEF", ".H", ".RC" |% {
## Move-Item -Force -Path "KBFRZ71$($_)" -Destination "KBFRZ71/KBFRZ71$($_)"
## Move-Item -Force -Path "KBFRZ71N$($_)" -Destination "KBFRZ71N/KBFRZ71N$($_)"
## }

## 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
New-Item -ItemType Directory -Path Package_x86\bin -EA SilentlyContinue | Out-Null
Copy-Item -Path C:\MSKLC\bin\i386\KbdMsi.dll -Destination Package_x86\bin\ | Out-Null

Pop-Location
}
}
4 changes: 4 additions & 0 deletions src/KBFRZ71/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
x64/
Release/

*.vcxproj.user
Loading