1 # Copyright (C) 2017
2 # Albrecht Lohofener (albrechtloh@gmx.de)
3 #
4 # This file is part of the welle.io.
5 # Many of the ideas as implemented in welle.io are derived from
6 # other work, made available through the GNU general Public License.
7 # All copyrights of the original authors are recognized.
8 #
9 # welle.io is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
13 #
14 # welle.io is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with welle.io; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22 
23 # Parameter
24 param(
25 [string]$welleExePath = "build\bin",
26 [string]$QTPath = "C:\Qt\5.9.3\mingw53_32\bin",
27 [string]$ToolsPath = "C:\Qt\Tools\mingw530_32\bin",
28 [string]$InstallerPath = "C:\Qt\Tools\QtInstallerFramework\2.0\bin\"
29 )
30 
31 # Get current GIT hash and date
32 & "git" "-C" "..\" "rev-parse" "--short" "HEAD" | Tee-Object -Variable gitHash | Out-Null
33 Write-Host "Current GIT hash $gitHash"  -ForegroundColor Green
34 
35 $Date = Get-Date -Format FileDate
36 Write-Host "Current date $Date"  -ForegroundColor Green
37 
38 # Set PATH
39 $env:path += "$QTPath;$ToolsPath;$InstallerPath"
40 
41 # Delete old folder and create a new one
42 if(Test-Path installer)
43 {
44 	Write-Host "*** Delete old installer folder ***" -ForegroundColor Red
45 	Remove-Item -Recurse -Force installer
46 }
47 
48 Write-Host "*** Create new installer folder ***" -ForegroundColor Red
49 New-Item -ItemType directory -Path installer
50 
51 # Copy installer data to installer folder
52 Write-Host "*** Copy installer data to installer folder ***" -ForegroundColor Red
53 Copy-Item config installer\config -recurse
54 Copy-Item packages installer\packages -recurse
55 
56 Write-Host "*** Copy non QT DLLs from welle.io-win-libs repository ***" -ForegroundColor Red
57 Copy-Item ..\..\welle.io-win-libs\x86_install\* installer\packages\io.welle.welle\data  -recurse
58 
59 Write-Host "*** Copy welle-io binary files ***" -ForegroundColor Red
60 $welleExePath = $welleExePath + "\*"
61 Copy-Item $welleExePath installer\packages\io.welle.welle\data\ -recurse
62 
63 # Deploy QT and related plugins
64 Write-Host "*** Deploy QT and related plugins ***" -ForegroundColor Red
65 & windeployqt installer\packages\io.welle.welle\data\welle-io.exe --plugindir installer\packages\io.welle.welle\data\plugins\ --no-translations
66 & windeployqt installer\packages\io.welle.welle\data\welle-io.exe --dir installer\packages\io.welle.welle\data\qml\ --qmldir ..\src\welle-gui\QML\ --no-translations --no-plugins
67 
68 Copy-Item installer\packages\io.welle.welle\data\qml\Qt5QuickControls2.dll installer\packages\io.welle.welle\data
69 Copy-Item installer\packages\io.welle.welle\data\qml\Qt5QuickTemplates2.dll installer\packages\io.welle.welle\data
70 Remove-Item installer\packages\io.welle.welle\data\qml\*.dll
71 
72 # For some reason windeployqt deploys the wrong DLL on AppVeyor
73 Copy-Item $QTPath\libgcc_s_dw2-1.dll installer\packages\io.welle.welle\data
74 Copy-Item $QTPath\libstdc++-6.dll installer\packages\io.welle.welle\data
75 
76 # Run binarycreator.exe
77 $Filename = $Date + "_" + $gitHash + "_Windows_welle-io-setup.exe"
78 
79 Write-Host "*** Creating $Filename ***" -ForegroundColor Red
80 & "binarycreator" "--offline-only" "--config" "installer\config\config.xml" "--packages" "installer\packages" "$Filename"
81 
82 # Store file name to a enviroment variable
83 $env:welle_io_filename = $Filename
84