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
81 changes: 81 additions & 0 deletions azure-pipelines/e2e-projects/applocal/qt/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
@echo off
setlocal
cd /d %~dp0

call :build_qt 5 "" qt5-release installed\bin installed\plugins
if errorlevel 1 exit /b 1
call :build_qt 5 d qt5-debug installed\debug\bin installed\debug\plugins
if errorlevel 1 exit /b 1
call :build_qt 6 "" qt6-release installed\bin installed\Qt6\plugins
if errorlevel 1 exit /b 1
call :build_qt 6 d qt6-debug installed\debug\bin installed\debug\Qt6\plugins
if errorlevel 1 exit /b 1
exit /b 0

:build_qt
set "qt_major=%~1"
set "debug_suffix=%~2"
set "app_dir=%~3"
set "bin_dir=%~4"
set "plugins_dir=%~5"

if not exist "%app_dir%" mkdir "%app_dir%"
if not exist "%bin_dir%" mkdir "%bin_dir%"
if not exist "%plugins_dir%\generic" mkdir "%plugins_dir%\generic"
if not exist "%plugins_dir%\imageformats" mkdir "%plugins_dir%\imageformats"
if not exist "%plugins_dir%\platforms" mkdir "%plugins_dir%\platforms"
if not exist "%plugins_dir%\platformthemes" mkdir "%plugins_dir%\platformthemes"
if not exist "%plugins_dir%\printsupport" mkdir "%plugins_dir%\printsupport"
if not exist "%plugins_dir%\sqldrivers" mkdir "%plugins_dir%\sqldrivers"
if not exist "%plugins_dir%\styles" mkdir "%plugins_dir%\styles"

cl /nologo /LD qtcore.cpp /Fe:%bin_dir%\Qt%qt_major%Core%debug_suffix%.dll /link /IMPLIB:%bin_dir%\Qt%qt_major%Core%debug_suffix%.lib
if errorlevel 1 exit /b 1
cl /nologo /LD qtnetwork.cpp %bin_dir%\Qt%qt_major%Core%debug_suffix%.lib /Fe:%bin_dir%\Qt%qt_major%Network%debug_suffix%.dll /link /IMPLIB:%bin_dir%\Qt%qt_major%Network%debug_suffix%.lib
if errorlevel 1 exit /b 1
cl /nologo /LD qtsql.cpp %bin_dir%\Qt%qt_major%Core%debug_suffix%.lib /Fe:%bin_dir%\Qt%qt_major%Sql%debug_suffix%.dll /link /IMPLIB:%bin_dir%\Qt%qt_major%Sql%debug_suffix%.lib
if errorlevel 1 exit /b 1
cl /nologo /LD qtprintsupport.cpp %bin_dir%\Qt%qt_major%Core%debug_suffix%.lib /Fe:%bin_dir%\Qt%qt_major%PrintSupport%debug_suffix%.dll /link /IMPLIB:%bin_dir%\Qt%qt_major%PrintSupport%debug_suffix%.lib
if errorlevel 1 exit /b 1
cl /nologo /LD qtgui.cpp %bin_dir%\Qt%qt_major%Core%debug_suffix%.lib /Fe:%bin_dir%\Qt%qt_major%Gui%debug_suffix%.dll /link /IMPLIB:%bin_dir%\Qt%qt_major%Gui%debug_suffix%.lib
if errorlevel 1 exit /b 1
cl /nologo /LD qtwidgets.cpp %bin_dir%\Qt%qt_major%Gui%debug_suffix%.lib /Fe:%bin_dir%\Qt%qt_major%Widgets%debug_suffix%.dll /link /IMPLIB:%bin_dir%\Qt%qt_major%Widgets%debug_suffix%.lib
if errorlevel 1 exit /b 1
cl /nologo /EHsc main.cpp %bin_dir%\Qt%qt_major%Gui%debug_suffix%.lib %bin_dir%\Qt%qt_major%Network%debug_suffix%.lib %bin_dir%\Qt%qt_major%PrintSupport%debug_suffix%.lib %bin_dir%\Qt%qt_major%Sql%debug_suffix%.lib %bin_dir%\Qt%qt_major%Widgets%debug_suffix%.lib /Fe:%app_dir%\main.exe
if errorlevel 1 exit /b 1
cl /nologo /LD qtplugin.cpp /Fe:%plugins_dir%\qtplugin.dll
if errorlevel 1 exit /b 1
call :copy_plugin "%plugins_dir%\qtplugin.dll" "%bin_dir%\libssl-unused.dll"
if errorlevel 1 exit /b 1

call :copy_plugin "%plugins_dir%\qtplugin.dll" "%plugins_dir%\imageformats\qjpeg%debug_suffix%.dll"
if errorlevel 1 exit /b 1
call :copy_plugin "%plugins_dir%\qtplugin.dll" "%plugins_dir%\platforms\qwindows%debug_suffix%.dll"
if errorlevel 1 exit /b 1
call :copy_plugin "%plugins_dir%\qtplugin.dll" "%plugins_dir%\generic\qgeneric%debug_suffix%.dll"
if errorlevel 1 exit /b 1
call :copy_plugin "%plugins_dir%\qtplugin.dll" "%plugins_dir%\platformthemes\qplatformtheme%debug_suffix%.dll"
if errorlevel 1 exit /b 1
call :copy_plugin "%plugins_dir%\qtplugin.dll" "%plugins_dir%\printsupport\qprint%debug_suffix%.dll"
if errorlevel 1 exit /b 1
call :copy_plugin "%plugins_dir%\qtplugin.dll" "%plugins_dir%\sqldrivers\qsqlite%debug_suffix%.dll"
if errorlevel 1 exit /b 1
call :copy_plugin "%plugins_dir%\qtplugin.dll" "%plugins_dir%\styles\qstyle%debug_suffix%.dll"
if errorlevel 1 exit /b 1

if "%qt_major%"=="5" (
if not exist "%plugins_dir%\bearer" mkdir "%plugins_dir%\bearer"
call :copy_plugin "%plugins_dir%\qtplugin.dll" "%plugins_dir%\bearer\qbearer%debug_suffix%.dll"
) else (
if not exist "%plugins_dir%\networkinformation" mkdir "%plugins_dir%\networkinformation"
if not exist "%plugins_dir%\tls" mkdir "%plugins_dir%\tls"
call :copy_plugin "%plugins_dir%\qtplugin.dll" "%plugins_dir%\networkinformation\qnetworkinformation%debug_suffix%.dll"
if errorlevel 1 exit /b 1
call :copy_plugin "%plugins_dir%\qtplugin.dll" "%plugins_dir%\tls\qtls%debug_suffix%.dll"
)
if errorlevel 1 exit /b 1
exit /b 0

:copy_plugin
copy /Y "%~1" "%~2" >nul
exit /b %errorlevel%
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file exists to tell z-applocal that Qt 5 is installed and is not executed by the test.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file exists to tell z-applocal that Qt 5 is installed and is not executed by the test.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Core",
"plugin_types": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Gui",
"plugin_types": [
"accessiblebridge",
"platforms",
"platformthemes",
"platforminputcontexts",
"generic",
"iconengines",
"imageformats"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Network",
"plugin_types": [
"networkaccess",
"networkinformation",
"tls"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "PrintSupport",
"plugin_types": [
"printsupport"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Sql",
"plugin_types": [
"sqldrivers"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Widgets",
"plugin_types": [
"styles"
]
}
7 changes: 7 additions & 0 deletions azure-pipelines/e2e-projects/applocal/qt/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extern "C" __declspec(dllimport) int qt_gui();
extern "C" __declspec(dllimport) int qt_network();
extern "C" __declspec(dllimport) int qt_printsupport();
extern "C" __declspec(dllimport) int qt_sql();
extern "C" __declspec(dllimport) int qt_widgets();

int main() { return qt_gui() + qt_network() + qt_printsupport() + qt_sql() + qt_widgets(); }
1 change: 1 addition & 0 deletions azure-pipelines/e2e-projects/applocal/qt/qtcore.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extern "C" __declspec(dllexport) int qt_core() { return 0; }
3 changes: 3 additions & 0 deletions azure-pipelines/e2e-projects/applocal/qt/qtgui.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extern "C" __declspec(dllimport) int qt_core();

extern "C" __declspec(dllexport) int qt_gui() { return qt_core(); }
3 changes: 3 additions & 0 deletions azure-pipelines/e2e-projects/applocal/qt/qtnetwork.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extern "C" __declspec(dllimport) int qt_core();

extern "C" __declspec(dllexport) int qt_network() { return qt_core(); }
1 change: 1 addition & 0 deletions azure-pipelines/e2e-projects/applocal/qt/qtplugin.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extern "C" __declspec(dllexport) int qt_plugin() { return 0; }
3 changes: 3 additions & 0 deletions azure-pipelines/e2e-projects/applocal/qt/qtprintsupport.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extern "C" __declspec(dllimport) int qt_core();

extern "C" __declspec(dllexport) int qt_printsupport() { return qt_core(); }
3 changes: 3 additions & 0 deletions azure-pipelines/e2e-projects/applocal/qt/qtsql.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extern "C" __declspec(dllimport) int qt_core();

extern "C" __declspec(dllexport) int qt_sql() { return qt_core(); }
3 changes: 3 additions & 0 deletions azure-pipelines/e2e-projects/applocal/qt/qtwidgets.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extern "C" __declspec(dllimport) int qt_gui();

extern "C" __declspec(dllexport) int qt_widgets() { return qt_gui(); }
143 changes: 143 additions & 0 deletions azure-pipelines/end-to-end-tests-dir/z-applocalcpp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,149 @@ if ($IsWindows) {
--installed-bin-dir=$basicDir
Throw-IfNotFailed

# Tests deploy Qt 5 and Qt 6 libraries and plugins when both versions are installed
$qtDir = "$TestingRoot/applocal/qt"
Run-Vcpkg env "$qtDir/build.bat"

$qtCases = @(
@{
Name = "Qt 5 release"
Major = 5
Suffix = ""
AppDir = "qt5-release"
InstalledBinDir = "installed/bin"
PluginsDir = "installed/plugins"
OtherPluginsDir = "installed/Qt6/plugins"
},
@{
Name = "Qt 5 debug"
Major = 5
Suffix = "d"
AppDir = "qt5-debug"
InstalledBinDir = "installed/debug/bin"
PluginsDir = "installed/debug/plugins"
OtherPluginsDir = "installed/debug/Qt6/plugins"
},
@{
Name = "Qt 6 release"
Major = 6
Suffix = ""
AppDir = "qt6-release"
InstalledBinDir = "installed/bin"
PluginsDir = "installed/Qt6/plugins"
OtherPluginsDir = "installed/plugins"
},
@{
Name = "Qt 6 debug"
Major = 6
Suffix = "d"
AppDir = "qt6-debug"
InstalledBinDir = "installed/debug/bin"
PluginsDir = "installed/debug/Qt6/plugins"
OtherPluginsDir = "installed/debug/plugins"
}
)

foreach ($qtCase in $qtCases)
{
$appDir = Join-Path $qtDir $qtCase.AppDir
$installedBinDir = Join-Path $qtDir $qtCase.InstalledBinDir
$coreLibrary = "Qt$($qtCase.Major)Core$($qtCase.Suffix).dll"
$guiLibrary = "Qt$($qtCase.Major)Gui$($qtCase.Suffix).dll"
$networkLibrary = "Qt$($qtCase.Major)Network$($qtCase.Suffix).dll"
$printSupportLibrary = "Qt$($qtCase.Major)PrintSupport$($qtCase.Suffix).dll"
$sqlLibrary = "Qt$($qtCase.Major)Sql$($qtCase.Suffix).dll"
$widgetsLibrary = "Qt$($qtCase.Major)Widgets$($qtCase.Suffix).dll"
$imageFormatPlugin = "qjpeg$($qtCase.Suffix).dll"
$platformPlugin = "qwindows$($qtCase.Suffix).dll"
$otherSuffix = if ($qtCase.Suffix) { "" } else { "d" }
$otherImageFormatPlugin = "qjpeg$otherSuffix.dll"
$otherPlatformPlugin = "qwindows$otherSuffix.dll"
$copiedFilesLog = Join-Path $appDir "copied-files.log"
$pluginFiles = @(
"imageformats/$imageFormatPlugin",
"platforms/$platformPlugin",
"printsupport/qprint$($qtCase.Suffix).dll",
"sqldrivers/qsqlite$($qtCase.Suffix).dll",
"styles/qstyle$($qtCase.Suffix).dll"
)
if ($qtCase.Major -eq 5)
{
$pluginFiles += "bearer/qbearer$($qtCase.Suffix).dll"
}
else
{
$pluginFiles += @(
"generic/qgeneric$($qtCase.Suffix).dll",
"networkinformation/qnetworkinformation$($qtCase.Suffix).dll",
"platformthemes/qplatformtheme$($qtCase.Suffix).dll",
"tls/qtls$($qtCase.Suffix).dll"
)
}

Require-FileNotExists (Join-Path $appDir $coreLibrary)
Require-FileNotExists (Join-Path $appDir $guiLibrary)
Require-FileNotExists (Join-Path $appDir $networkLibrary)
Require-FileNotExists (Join-Path $appDir $printSupportLibrary)
Require-FileNotExists (Join-Path $appDir $sqlLibrary)
Require-FileNotExists (Join-Path $appDir $widgetsLibrary)
Require-FileNotExists (Join-Path $appDir "qt.conf")
foreach ($pluginFile in $pluginFiles)
{
Require-FileNotExists (Join-Path $appDir "plugins/$pluginFile")
}

Run-Vcpkg z-applocal `
"--target-binary=$(Join-Path $appDir 'main.exe')" `
"--installed-bin-dir=$installedBinDir" `
"--copied-files-log=$copiedFilesLog"
Throw-IfFailed
Require-FileExists (Join-Path $appDir $coreLibrary)
Require-FileExists (Join-Path $appDir $guiLibrary)
Require-FileExists (Join-Path $appDir $networkLibrary)
Require-FileExists (Join-Path $appDir $printSupportLibrary)
Require-FileExists (Join-Path $appDir $sqlLibrary)
Require-FileExists (Join-Path $appDir $widgetsLibrary)
Require-FileExists (Join-Path $appDir "qt.conf")
foreach ($pluginFile in $pluginFiles)
{
Require-FileExists (Join-Path $appDir "plugins/$pluginFile")
}

Require-FileNotExists (Join-Path $appDir "plugins/imageformats/$otherImageFormatPlugin")
Require-FileNotExists (Join-Path $appDir "plugins/platforms/$otherPlatformPlugin")
if ($qtCase.Major -eq 5)
{
Require-FileNotExists (Join-Path $appDir "plugins/generic/qgeneric$($qtCase.Suffix).dll")
Require-FileNotExists (Join-Path $appDir "plugins/platformthemes/qplatformtheme$($qtCase.Suffix).dll")
Require-FileNotExists (Join-Path $appDir "plugins/tls/qtls$($qtCase.Suffix).dll")
Require-FileExists (Join-Path $appDir "libssl-unused.dll")
}
else
{
Require-FileNotExists (Join-Path $appDir "plugins/bearer/qbearer$($qtCase.Suffix).dll")
Require-FileNotExists (Join-Path $appDir "libssl-unused.dll")
}

if ((Get-Content -Raw -LiteralPath (Join-Path $appDir "qt.conf")) -ne "[Paths]`n")
{
throw "z-applocal generated an unexpected $($qtCase.Name) qt.conf"
}

$copiedFiles = Get-Content -LiteralPath $copiedFilesLog
$expectedPluginSource = Join-Path (Join-Path $qtDir $qtCase.PluginsDir) "platforms/$platformPlugin"
$unexpectedPluginSource = Join-Path (Join-Path $qtDir $qtCase.OtherPluginsDir) "platforms/$platformPlugin"
Comment on lines +166 to +167
if ($copiedFiles -notcontains $expectedPluginSource)
{
throw "z-applocal didn't deploy the $($qtCase.Name) platform plugin from $expectedPluginSource"
}

if ($copiedFiles -contains $unexpectedPluginSource)
{
throw "z-applocal deployed the $($qtCase.Name) platform plugin from $unexpectedPluginSource"
}
}

# Tests deploy azure kinect sensor SDK plugins
$pluginsDir = "$TestingRoot/applocal/plugins"
Run-Vcpkg env "$pluginsDir/build.bat"
Expand Down
Loading
Loading