Unverified Commit 6b3fa4fe authored by Jeremy Bokobza's avatar Jeremy Bokobza Committed by GitHub

Packaging for Windows (#370)

* packaging for Windows

* configure appveyor file for windows packaging

* modify daemon path
parent 02f08981
...@@ -10,13 +10,21 @@ ...@@ -10,13 +10,21 @@
}, },
"win": { "win": {
"icon": "dist/assets/images/breeze-logo", "icon": "dist/assets/images/breeze-logo",
"target": ["nsis"], "target": ["nsis"]
"asarUnpack": "assets/daemon/*"
}, },
"nsis": { "nsis": {
"oneClick": false "oneClick": false,
"perMachine": true,
"allowToChangeInstallationDirectory": true,
"deleteAppDataOnUninstall": true,
"guid": "ed20df62-ff5a-4b83-a5e3-a361357c6e51",
"createDesktopShortcut": false,
"createStartMenuShortcut": true,
"artifactName": "${productName}.v${version}.setup.${env.win_runtime}.${ext}"
}, },
"msi": { "msi": {
"warningsAsErrors": false "warningsAsErrors": false
} },
"extraResources": ["daemon/**/*"]
} }
...@@ -157,9 +157,14 @@ function startBitcoinApi() { ...@@ -157,9 +157,14 @@ function startBitcoinApi() {
//Start Breeze Bitcoin Daemon //Start Breeze Bitcoin Daemon
let apiPath = path.resolve(__dirname, 'assets//daemon//Stratis.BreezeD'); let apiPath = path.resolve(__dirname, 'assets//daemon//Stratis.BreezeD');
if (os.platform() === 'win32') { if (os.platform() === 'win32') {
apiPath = path.resolve(__dirname, 'assets\\daemon\\Stratis.BreezeD.exe'); apiPath = path.resolve(__dirname, '..\\..\\resources\\daemon\\Stratis.BreezeD.exe');
//apiPath = path.resolve(__dirname, '..\\app.asar.unpacked\\assets\\daemon\\Stratis.BreezeD.exe'); }
} // else if(os.platform() === 'darwin') {
// apiPath = path.resolve(__dirname, '..//..//Content//resources//daemon//Stratis.BreezeD.exe');
// } else {
// apiPath = path.resolve(__dirname, '..//..//resources//daemon//Stratis.BreezeD.exe');
// }
if(!testnet) { if(!testnet) {
bitcoinProcess = spawnBitcoin(apiPath, { bitcoinProcess = spawnBitcoin(apiPath, {
...@@ -184,9 +189,13 @@ function startStratisApi() { ...@@ -184,9 +189,13 @@ function startStratisApi() {
//Start Breeze Stratis Daemon //Start Breeze Stratis Daemon
let apiPath = path.resolve(__dirname, 'assets//daemon//Stratis.BreezeD'); let apiPath = path.resolve(__dirname, 'assets//daemon//Stratis.BreezeD');
if (os.platform() === 'win32') { if (os.platform() === 'win32') {
apiPath = path.resolve(__dirname, 'assets\\daemon\\Stratis.BreezeD.exe'); apiPath = path.resolve(__dirname, '..\\..\\resources\\daemon\\Stratis.BreezeD.exe');
//apiPath = path.resolve(__dirname, '..\\app.asar.unpacked\\assets\\daemon\\Stratis.BreezeD.exe'); }
} // else if(os.platform() === 'darwin') {
// apiPath = path.resolve(__dirname, '..//..//Content//resources//daemon//Stratis.BreezeD.exe');
// } else {
// apiPath = path.resolve(__dirname, '..//..//resources//daemon//Stratis.BreezeD.exe');
// }
if (!testnet) { if (!testnet) {
stratisProcess = spawnStratis(apiPath, ['stratis'], { stratisProcess = spawnStratis(apiPath, ['stratis'], {
......
...@@ -76,7 +76,8 @@ before_build: ...@@ -76,7 +76,8 @@ before_build:
cd $env:APPVEYOR_BUILD_FOLDER/Breeze.UI cd $env:APPVEYOR_BUILD_FOLDER/Breeze.UI
Install-Product node 6 Install-Product node 8
npm config set unsafe-perm=true
npm install npm install
Write-Host "$env:log_prefix FINISHED restoring dotnet and npm packages" -foregroundcolor "magenta" Write-Host "$env:log_prefix FINISHED restoring dotnet and npm packages" -foregroundcolor "magenta"
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
...@@ -85,24 +86,22 @@ build_script: ...@@ -85,24 +86,22 @@ build_script:
- ps: | - ps: |
Write-Host "$env:log_prefix running 'dotnet publish'" -foregroundcolor "magenta" Write-Host "$env:log_prefix running 'dotnet publish'" -foregroundcolor "magenta"
cd $env:APPVEYOR_BUILD_FOLDER/StratisBitcoinFullNode/Stratis.BreezeD cd $env:APPVEYOR_BUILD_FOLDER/StratisBitcoinFullNode/Stratis.BreezeD
dotnet publish -c $env:configuration -v m -r $env:win_runtime -o $env:APPVEYOR_BUILD_FOLDER\dotnet_out\$env:win_runtime dotnet publish -c $env:configuration -v m -r $env:win_runtime -o $env:APPVEYOR_BUILD_FOLDER\Breeze.UI\daemon
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
Write-Host "$env:log_prefix running 'npm run'" -foregroundcolor "magenta" Write-Host "$env:log_prefix building Breeze" -foregroundcolor "magenta"
cd $env:APPVEYOR_BUILD_FOLDER/Breeze.UI cd $env:APPVEYOR_BUILD_FOLDER/Breeze.UI
npm run build:prod npm run build:prod
Write-Host "$env:log_prefix packaging breeze" -foregroundcolor "magenta" if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
node package.js --platform=$env:plat --arch=$env:arch --path=$env:APPVEYOR_BUILD_FOLDER\breeze_out
Write-Host "$env:log_prefix rename the folder generated by npm from $env:node_output_name to $env:app_output_name" -foregroundcolor "magenta" Write-Host "$env:log_prefix packaging breeze" -foregroundcolor "magenta"
Rename-Item $env:APPVEYOR_BUILD_FOLDER\breeze_out\$env:node_output_name $env:app_output_name npx electron-builder build --windows --$env:arch
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
Write-Host "[$env:configuration][$env:win_runtime] FINISHED Breeze packaging" -foregroundcolor "magenta"
Write-Host "$env:log_prefix copying the Breeze api into the app" -foregroundcolor "magenta" dir
New-Item -Path $env:APPVEYOR_BUILD_FOLDER\breeze_out\$env:app_output_name\resources\app\assets\daemon -ItemType directory cd app-builds
xcopy /s $env:APPVEYOR_BUILD_FOLDER\dotnet_out\$env:win_runtime\* $env:APPVEYOR_BUILD_FOLDER\breeze_out\$env:app_output_name\resources\app\assets\daemon\ dir
Write-Host "$env:log_prefix zipping the result" -foregroundcolor "magenta"
7z a $env:APPVEYOR_BUILD_FOLDER\breeze_out\$env:app_output_zip_name $env:APPVEYOR_BUILD_FOLDER\breeze_out\$env:app_output_name
Write-Host "[$env:configuration][$env:win_runtime] FINISHED dotnet build" -foregroundcolor "magenta"
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
test_script: test_script:
...@@ -116,7 +115,7 @@ test_script: ...@@ -116,7 +115,7 @@ test_script:
# pushing all files in build directory recursively # pushing all files in build directory recursively
artifacts: artifacts:
- path: breeze_out\*.zip - path: Breeze.UI\app-builds\*.exe
name: Breeze app name: Breeze app
#----------------------------------# #----------------------------------#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment