From: Hannah von Reth Date: Wed, 21 Jun 2017 12:17:50 +0000 (+0200) Subject: Use craft on appveyor X-Git-Tag: travis-deploy-test~185 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=d42211c299e2bb0d4371b7508259b26b55547d30 Use craft on appveyor This will use the well maintained packages from Craft. It will reduce the maintenance cost for providing a Windows installer. Additionally we now use up to date binaries built exactly for this compiler, so we no longer depend on 33dparty openssl binaries etc. Using and deploying KDE Framework 5 libaries on Windows is also possible now. This build provides KDE Sonnet Find out more about Craft: https://community.kde.org/Craft Contribute to the Quassel blueprint: https://github.com/KDE/craft-blueprints-kde/blob/master/qt-apps/quassel/quassel.py Closes GH-312. --- diff --git a/appveyor.ini b/appveyor.ini new file mode 100644 index 00000000..8189a038 --- /dev/null +++ b/appveyor.ini @@ -0,0 +1,31 @@ +[General] +Command = craft +Branch = master +ShallowClone = True + +# Variables defined here override the default value +# The variable names are casesensitive +[Variables] +#Root = D:\qt-sdk + +# Settings applicable for all Crafts matrices +# Settings are Category/key=value +# Category is case sensitive +[GeneralSettings] +Paths/Python = C:\Python36 +Paths/Python27 = C:\Python27 +ShortPath/Enabled = False +Compile/BuildType = Release +ContinuousIntegration/Enabled = True +Packager/PackageType = MultiCollectionPackager + +[BlueprintSettings] +qt-apps/quassel.version = master + +binary/mysql.ignored = True + +[windows-msvc2017_32-cl] +General/ABI = windows-msvc2017_32-cl + +[windows-msvc2017_64-cl] +General/ABI = windows-msvc2017_64-cl diff --git a/appveyor.yml b/appveyor.yml index dc1419eb..30d9dc12 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,156 +1,38 @@ version: '{build}' -build_script: -- ps: | - $ErrorActionPreference="Stop" - - Import-Module $env:APPVEYOR_BUILD_FOLDER\scripts\build\appveyorHelp.psm1 - - Init @("ninja", "png2ico", "nsis", "7zip.commandline") ([ordered]@{"git://anongit.kde.org/extra-cmake-modules.git" = @{"branch" = "master"}; - "https://github.com/Snorenotify/SnoreGrowl.git" = @{"branch" = "v0.4.0"; "buildType" = "Release"}; - "git://anongit.kde.org/snorenotify.git" = @{"branch" = "v0.7.0"; "buildType" = "Release"}}) - - mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\build\$env:APPVEYOR_PROJECT_NAME - cd $env:APPVEYOR_BUILD_FOLDER\work\build\$env:APPVEYOR_PROJECT_NAME +image: Visual Studio 2017 - $webPrevOption = "-DWITH_WEBKIT=OFF -DWITH_WEBENGINE=ON" - $webPrevFiles = @( - "bin\\Qt5Positioning\.dll", - "bin\\Qt5PrintSupport\.dll", - "bin\\Qt5Sensors\.dll", - "bin\\Qt5WebChannel\.dll", - "bin\\QtWebEngineProcess\.exe", - "bin\\Qt5WebEngine\.dll", - "bin\\Qt5WebEngineCore\.dll", - "bin\\Qt5WebEngineWidgets\.dll", - "resources\\icudtl\.dat", - "resources\\qtwebengine_resources.pak", - "resources\\qtwebengine_resources_100p.pak", - "resources\\qtwebengine_resources_200p.pak") - - if($env:COMPILER -eq "mingw49_32") { - $webPrevOption = "-DWITH_WEBKIT=OFF -DWITH_WEBENGINE=OFF" - $webPrevFiles = @() +init: +- ps: | + function craft() { + & C:\python36\python.exe "C:\CraftMaster\$env:TARGET\craft\bin\craft.py" $args + if($LASTEXITCODE -ne 0) {exit $LASTEXITCODE} } - - LogExec cmake -G"Ninja" $env:APPVEYOR_BUILD_FOLDER -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_ROOT" -DUSE_QT5=ON -DWITH_BREEZE=ON -DWITH_BREEZE_DARK=ON -DWITH_OXYGEN=ON $webPrevOption - CmakeImageInstall - $whitelist = @( - # whitelist - #quassel - "quassel.*", - # - #gccruntime", - "bin\\libgomp.*\.dll", - "bin\\libgcc_s_.*\.dll", - "bin\\libwinpthread.*\.dll", - "bin\\libstdc.*\.dll", - # - #snore - "bin\\.*snore.*\.dll", - "lib\\plugins\\libsnore.*\\libsnore_backend.*\.dll", - "lib\\plugins\\libsnore.*\\libsnore_settings_backend.*\.dll", - "lib\\plugins\\libsnore.*\\libsnore_secondarybackend.*\.dll", "lib\\plugins\\libsnore.*\\libsnore_settings_secondarybackend.*\.dll", "bin\\SnoreToast\.exe", - # - #Growl - "bin\\.*snoregrowl.*\.dll", - # - #ssl - ".*\\libeay32\.dll", - ".*\\ssleay32\.dll", - # - #icu - "bin\\icuin\d+\.dll", - "bin\\icuuc\d+\.dll", - "bin\\icudt\d+\.dll", - # - #qt - "bin\\Qt5Core\.dll", - "bin\\Qt5Declarative\.dll", - "bin\\Qt5Gui\.dll", - "bin\\Qt5Network\.dll", - "bin\\Qt5Opengl\.dll", - "bin\\Qt5Multimedia\.dll", - "bin\\Qt5MultimediaWidgets\.dll", - "bin\\Qt5Qml\.dll", - "bin\\Qt5Quick\.dll", - "bin\\Qt5Script\.dll", - "bin\\Qt5Sql\.dll", - "bin\\Qt5Svg\.dll", - "bin\\Qt5WebChannel\.dll", - "bin\\Qt5Widgets\.dll", - "bin\\Qt5Xml\.dll", - "bin\\Qt5XmlPatterns\.dll", - "bin\\.*libglesv2\.dll", - "bin\\.*libEGL\.dll", - "qml\\.*", - #bin\\QtXml\.dll - # - "plugins\\imageformats\\(?!.*d\.dll).*\.dll$", - "plugins\\sqldrivers\\qsqlite(?!.*d\.dll).*\.dll$", - "plugins\\codecs\\(?!.*d\.dll).*\.dll$", - "plugins\\platforms\\qwindows(?!.*d\.dll).*\.dll$", - "plugins\\iconengines\\(?!.*d\.dll).*\.dll$", - # - # - #zlib - "bin\\libz.dll", - # - #qca - "bin\\libqca.*\.dll", - "lib\\qca-qt5\\crypto\\.*", - "certs\\.*", - # - #phonon - "bin\\libphonon.*\.dll", - "bin\\phonon.*\.dll", - "bin\\libphononexperimental.*\.dll", - "bin\\phonon_backend\\.*", - "plugins\\phonon_backend\\.*", - "plugins\\phonon4qt5_backend\\.*") +install: +- ps: | + mkdir C:\CraftMaster | Out-Null + #use cmd to silence powershell behaviour for stderr + & cmd /C "git clone -q --depth=1 git://anongit.kde.org/craftmaster.git C:\CraftMaster\CraftMaster 2>&1" + & C:\python36\python.exe C:\CraftMaster\CraftMaster\CraftMaster.py --config $env:APPVEYOR_BUILD_FOLDER\appveyor.ini --target $env:TARGET + craft -p quassel + craft nsis + craft --install-deps quassel - $whitelist += $webPrevFiles +build_script: +- ps: | + craft --no-cache --src-dir $env:APPVEYOR_BUILD_FOLDER quassel - $imageDir = CreateDeployImage $whitelist @( - #blacklist - "include", - ".*\.h", - "lib\\plugins\\libsnore.*\\libsnore_backend_freedesktop\.dll", - ".*\.pdb", - ".*plugind\.dll" - ) +test_script: +- ps: | + craft --src-dir $env:APPVEYOR_BUILD_FOLDER --test quassel - mv "$imageDir\bin\*" "$imageDir\" - #mv "$imageDir\lib\qca-qt5\crypto" "$imageDir\crypto" - mv "$imageDir\qml\*" "$imageDir" - mv "$imageDir\plugins\*" "$imageDir" - if(Test-Path "$imageDir\lib\plugins") - { - mv "$imageDir\lib\plugins\*" "$imageDir" - } - if(Test-Path "$imageDir\resources") - { - mv "$imageDir\resources\*" "$imageDir" - } - DeleteEmptyFodlers $imageDir - 7ZipDeployImage - NsisDeployImage $env:APPVEYOR_BUILD_FOLDER\scripts\build\NullsoftInstaller.nsi +on_success: +- ps: | + craft --src-dir $env:APPVEYOR_BUILD_FOLDER --package quassel + Get-ChildItem C:\CraftMaster\$env:TARGET\tmp\* | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } environment: - QT_VER: 5.7 - matrix: - #msvc - - COMPILER: msvc2015_64 - - COMPILER: msvc2015 - - #mingw - - COMPILER: mingw53_32 - -test: off - -cache: - - work\install -> appveyor.yml - - C:\ProgramData\chocolatey\bin -> appveyor.yml - - C:\ProgramData\chocolatey\lib -> appveyor.yml + - TARGET: windows-msvc2017_64-cl + - TARGET: windows-msvc2017_32-cl diff --git a/scripts/build/appveyorHelp.psm1 b/scripts/build/appveyorHelp.psm1 deleted file mode 100644 index da21095e..00000000 --- a/scripts/build/appveyorHelp.psm1 +++ /dev/null @@ -1,374 +0,0 @@ -$ErrorActionPreference="Stop" - -$script:INSTALL_DIR="$env:APPVEYOR_BUILD_FOLDER\work\install" -$CMAKE_INSTALL_ROOT="`"$INSTALL_DIR`"" -replace "\\", "/" -$env:PATH="$env:PATH;$script:INSTALL_DIR" - -if(!$env:CI -eq "true") -{ - function Push-AppveyorArtifact() - { - Write-Host "Push-AppveyorArtifact $ARGS" - } - function Start-FileDownload([string] $url, [string] $out) - { - if(!$out) - { - $out = $url.SubString($url.LastIndexOf("/")) - } - wget $url -Outfile $out - } -} - -function LogExec() -{ - $OldErrorActionPreference=$ErrorActionPreference - $ErrorActionPreference="Continue" - $LastExitCode = 0 - Write-Host $Args[0], $Args[1..(($Args.Count)-1)] - & $Args[0] $Args[1..(($Args.Count)-1)] - if(!$LastExitCode -eq 0) - { - exit $LastExitCode - } - $ErrorActionPreference=$OldErrorActionPreference -} - -#Set environment variables for Visual Studio Command Prompt -#http://stackoverflow.com/questions/2124753/how-i-can-use-powershell-with-the-visual-studio-command-prompt -function BAT-CALL([string] $path, [string] $arg) -{ - Write-Host "Calling `"$path`" `"$arg`"" - cmd /c "$path" "$arg" `&`& set `|`| exit 1| - foreach { - if ($_ -match "=") { - $v = $_.split("=") - #Write-Host "ENV:\$($v[0])=$($v[1])" - set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" - } - } - if($LastExitCode -eq 1) { - Write-Error "$path not found." - } -} - -function Get-QtDir() -{ - $ver = 5.5 - if($env:QT_VER) - { - $ver = $env:QT_VER - } - return "C:\Qt\$ver\$env:COMPILER\" -} - -function SETUP-QT() -{ - [string] $compiler=$env:COMPILER - $qtDir = Get-QtDir - $script:QT_BINARY_DIRS = @($qtDir) - - BAT-CALL "$qtDir\bin\qtenv2.bat" - - if ($compiler.StartsWith("mingw")) - { - # supported values are - #mingw49_32 - #mingw53_32 - #remove sh.exe from path - $env:PATH=$env:PATH -replace "C:\\Program Files \(x86\)\\Git\\bin", "" - $script:MAKE="mingw32-make" - $script:CMAKE_GENERATOR="MinGW Makefiles" - $script:STRIP=@("strip", "-s") - if ($compiler -eq "mingw49_32") - { - $script:QT_BINARY_DIRS += (Resolve-Path "$qtDir\..\..\Tools\mingw492_32\opt\") - } - elseif ($compiler -eq "mingw53_32") - { - $script:QT_BINARY_DIRS += (Resolve-Path "$qtDir\..\..\Tools\mingw530_32\opt\") - } - } - elseif ($compiler.StartsWith("msvc")) - { - $arch = "x86" - if($compiler.EndsWith("64")) - { - $arch = "amd64" - } - $compilerDirs = @{ - "msvc2010" = "VS100COMNTOOLS"; - "msvc2012" = "VS110COMNTOOLS"; - "msvc2013" = "VS120COMNTOOLS"; - "msvc2015" = "VS140COMNTOOLS" - } - - $compilerVar = $compilerDirs[$compiler.Split("_")[0]] - $compilerDir = (get-item -path "env:\$($compilerVar)").Value - BAT-CALL "$compilerDir\..\..\VC\vcvarsall.bat" $arch - $script:MAKE="nmake" - $script:CMAKE_GENERATOR="NMake Makefiles" - if($arch -eq "x86") - { - $script:QT_BINARY_DIRS += ("C:\OpenSSL-Win32") - } - else - { - $script:QT_BINARY_DIRS += ("C:\OpenSSL-Win64") - } - } -} - -function Install-ChocolateyModule([string] $module, [string[]] $myargs) -{ - Write-Host "Install chocolatey package $module" - LogExec appveyor-retry cinst $module @myargs -y - # Retry installation in case it fails; remove 'appveyor-retry' to run in a generic manner - # See http://help.appveyor.com/discussions/suggestions/816-generic-wrapper-for-retry#comment_40579488 - # And https://github.com/appveyor/ci/issues/418 -} - -function Install-CmakeGitModule([string] $url, [hashtable] $arguments) -{ - $module = $url.SubString($url.LastIndexOf("/")+1) - $module = $module.Substring(0,$module.Length - 4) - if(!$arguments.Contains("branch")) - { - $arguments["branch"] = "master" - } - if(!$arguments.Contains("buildType")) - { - $arguments["buildType"] = "Release" - } - mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\build\$module - pushd $env:APPVEYOR_BUILD_FOLDER\work\git - LogExec git clone -q --depth 1 --branch ([string]$arguments["branch"]) $url $module - popd - pushd $env:APPVEYOR_BUILD_FOLDER\work\build\$module - LogExec cmake -G $script:CMAKE_GENERATOR ("-DCMAKE_BUILD_TYPE=`"{0}`"" -f [string]$arguments["buildType"]) $env:APPVEYOR_BUILD_FOLDER\work\git\$module -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_ROOT" $arguments["options"] - LogExec $script:MAKE install - popd -} - -function Init([string[]] $chocoDeps, [System.Collections.Specialized.OrderedDictionary] $cmakeModules) -{ - $script:MAKE="" - $script:CMAKE_GENERATOR="" - $script:STRIP=$null - - mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\image | Out-Null - mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\build | Out-Null - - SETUP-QT - - if($chocoDeps -contains "ninja") { - $script:CMAKE_GENERATOR="Ninja" - $script:MAKE="ninja" - } - - if ( !(Test-Path "$env:APPVEYOR_BUILD_FOLDER\work\install" ) ) - { - mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\install | Out-Null - mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\git | Out-Null - - foreach($module in $chocoDeps) { - if($module -eq "nsis") - { - Install-ChocolateyModule "nsis.portable" @("-pre") - continue - } - Install-ChocolateyModule $module - } - - foreach($key in $cmakeModules.Keys) { - Install-CmakeGitModule $key $cmakeModules[$key] - } - - [string] $compiler=$env:COMPILER - if($compiler.StartsWith("msvc")) - { - Write-Host "Downloading vcredist.exe" - if ($compiler.StartsWith("msvc2015")) - { - if($compiler.EndsWith("64")) - { - Start-FileDownload https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe $env:APPVEYOR_BUILD_FOLDER\work\install\vcredist.exe - } - else - { - Start-FileDownload https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe $env:APPVEYOR_BUILD_FOLDER\work\install\vcredist.exe - } - } - else - { - if($compiler.EndsWith("64")) - { - Start-FileDownload http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe $env:APPVEYOR_BUILD_FOLDER\work\install\vcredist.exe - } - else - { - Start-FileDownload http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe $env:APPVEYOR_BUILD_FOLDER\work\install\vcredist.exe - } - } - } - } -} - -function relativePath([string] $root, [string] $path) -{ - pushd $root - $out = Resolve-Path -Relative $path - popd - return $out -} - -function StripFile([string] $name) -{ - if($script:STRIP) { - if( $name.EndsWith(".dll") -or $name.EndsWith(".exe")) - { - Write-Host "strip file $name" - LogExec @script:STRIP $name - } - } -} - -function Get-DeployImageName() -{ - $version = Get-Version - if($env:APPVEYOR_REPO_TAG -eq "true") { - return "$env:APPVEYOR_PROJECT_NAME`_$version`_Qt$env:QT_VER`_$env:COMPILER" - }else{ - return "$env:APPVEYOR_PROJECT_NAME`_$env:APPVEYOR_REPO_BRANCH`_$version`_Qt$env:QT_VER`_$env:COMPILER" - } -} - -function Get-Version() -{ - if($env:APPVEYOR_REPO_TAG -eq "true") { - return $env:APPVEYOR_REPO_TAG_NAME - }else{ - $commit = ([string]$env:APPVEYOR_REPO_COMMIT).SubString(0,6) - return $commit - } -} - -function CmakeImageInstall() -{ - $imageName = Get-DeployImageName - $destDir = "$env:APPVEYOR_BUILD_FOLDER\work\cmakeDeployImage\$imageName" - $env:DESTDIR = $destDir - LogExec $script:MAKE install - $env:DESTDIR = $null - if(!$LastExitCode -eq 0) - { - Write-Error "Build Failed" - } - $env:DESTDIR=$null - $prefix=$script:INSTALL_DIR - if( $prefix.substring(1,1) -eq ":") - { - $prefix=$prefix.substring(3) - } - Write-Host "move $destDir\$prefix to $destDir" - mv -Force "$destDir\$prefix\*" "$destDir" - $rootLeftOver = $prefix.substring(0, $prefix.indexOf("\")) - rm -Recurse "$destDir\$rootLeftOver" -} - -function CreateDeployImage([string[]] $whiteList, [string[]] $blackList) -{ - $imageName = Get-DeployImageName - $deployPath = "$env:APPVEYOR_BUILD_FOLDER\work\deployImage\$imageName" - - function copyWithWhitelist([string] $root) - { - $files = ls $root -Recurse - foreach($fileName in $files.FullName) - { - $relPath = (relativePath $root $fileName).SubString(2) - if($whiteList | Where {$relPath -match $_}) - { - if($blackList | Where {$relPath -match $_}) - { - continue - } - if(!(Test-Path $deployPath\$relPath)) - { - Write-Host "copy $fileName to $deployPath\$relPath" - mkdir -Force (Split-Path -Parent $deployPath\$relPath) | Out-Null - cp -Force $fileName $deployPath\$relPath - StripFile $deployPath\$relPath - } - } - } - } - Write-Host "CreateDeployImage $imageName" - mkdir $deployPath | Out-Null - - copyWithWhitelist "$env:APPVEYOR_BUILD_FOLDER\work\cmakeDeployImage\$imageName" - copyWithWhitelist "$env:APPVEYOR_BUILD_FOLDER\work\install\" - foreach($folder in $script:QT_BINARY_DIRS) - { - copyWithWhitelist $folder - } - Write-Host "Deploy path $deployPath" - return $deployPath -} - -function 7ZipDeployImage() -{ - $imageName = Get-DeployImageName - LogExec 7za a "$env:APPVEYOR_BUILD_FOLDER\work\deployImage\$imageName.7z" "$env:APPVEYOR_BUILD_FOLDER\work\deployImage\$imageName" - Push-AppveyorArtifact "$env:APPVEYOR_BUILD_FOLDER\work\deployImage\$imageName.7z" -} - -function NsisDeployImage([string] $scriptName) -{ - $imageName = Get-DeployImageName - $installerName = "$env:APPVEYOR_BUILD_FOLDER\work\deployImage\$imageName.exe" - $version = Get-Version - if(([string]$env:COMPILER).StartsWith("msvc")) - { - $redist = "$env:APPVEYOR_BUILD_FOLDER\work\install\vcredist.exe" - }else{ - $redist = "none" - } - if($env:COMPILER.EndsWith("64")) - { - $defaultinstdir = "`$PROGRAMFILES64" - }else{ - $defaultinstdir = "`$PROGRAMFILES" - } - LogExec makensis.exe /DgitDir=$env:APPVEYOR_BUILD_FOLDER /Dsetupname=$installerName /Dcaption=$imageName /Dversion=$version /Dcompiler=$env:COMPILER /Dvcredist=$redist /Ddefaultinstdir=$defaultinstdir /Dsrcdir=$env:APPVEYOR_BUILD_FOLDER\work\deployImage\$imageName $scriptName - Push-AppveyorArtifact $installerName -} - -# based on http://thesurlyadmin.com/2013/01/07/remove-empty-directories-recursively/ -function DeleteEmptyFodlers([string] $root) -{ - $Folders = @() - foreach($Folder in (Get-ChildItem -Path $root -Recurse -Directory)) - { - $Folders += New-Object PSObject -Property @{ - Object = $Folder - Depth = ($Folder.FullName.Split("\")).Count - } - } - $Folders = $Folders | Sort Depth -Descending - - foreach($Folder in $Folders) - { - If ($Folder.Object.GetFileSystemInfos().Count -eq 0) - { - Write-Host "Delete empty dir:" $Folder.Object.FullName - Remove-Item -Path $Folder.Object.FullName -Force - } - } - -} - -Write-Host "CMAKE_INSTALL_ROOT: $CMAKE_INSTALL_ROOT" -Write-Host "Image-Name: ", (Get-DeployImageName) - -Export-ModuleMember -Function @("Init","CmakeImageInstall", "CreateDeployImage", "LogExec", "7ZipDeployImage", "NsisDeployImage", "DeleteEmptyFodlers") -Variable @("CMAKE_INSTALL_ROOT")