Skip to content

Commit 0da036a

Browse files
authored
Merge pull request #433 from mikeller/add_debug_release
Added 'debug-release' gulp target, and made the Azure build default to it.
2 parents 7c5f9f4 + 8ea7323 commit 0da036a

File tree

3 files changed

+94
-38
lines changed

3 files changed

+94
-38
lines changed

assets/windows/installer.nsi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
# ${VERSION} - Version to generate (x.y.z)
99
# ${PLATFORM} - Platform to generate (win32 or win64)
1010
# ${DEST_FOLDER} - Destination folder for the installer files
11+
# ${SOURCE_FOLDER} - Source folder for the application files
12+
1113

1214
# Some definitions
13-
!define SOURCE_FILES "..\..\apps\betaflight-blackbox-explorer\${PLATFORM}\*"
15+
!define SOURCE_FILES "..\..\${SOURCE_FOLDER}\betaflight-blackbox-explorer\${PLATFORM}\*"
1416
!define APP_NAME "Betaflight Blackbox Explorer"
1517
!define COMPANY_NAME "Betaflight Team"
1618
!define GROUP_NAME "Betaflight"
@@ -218,4 +220,4 @@ Section "Uninstall"
218220
${unregisterExtension} "${EXT1}" "${EXT1_NAME}"
219221
${unregisterExtension} "${EXT2}" "${EXT2_NAME}"
220222

221-
SectionEnd
223+
SectionEnd

azure-pipelines.yml

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
# "owner" - The owner of the repository to release to e.g. betaflight
1212
# "repoName" - The name of the repository to release to e.g. blackbox-log-viewer-nightlies
1313

14+
variables:
15+
owner: betaflight
16+
repoName: blackbox-log-viewer-nightlies
17+
debugReleaseNotes: This is a nightly build off the tip of 'master'. It may be unstable and result in corrupted configurations or data loss. **Use only for testing.**
18+
releaseNotes: This is a release build. It does not contain the debug console.
19+
20+
parameters:
21+
- name: releaseBuild
22+
type: boolean
23+
default: false
24+
1425
name: $(Date:yyyyMMdd).$(BuildID)
1526

1627
trigger:
@@ -35,8 +46,12 @@ stages:
3546
displayName: 'Install Node.js 10.16.3'
3647
- script: yarn install
3748
displayName: 'Run yarn install'
38-
- script: yarn release --win32
39-
displayName: 'Run gulp release'
49+
- script: yarn gulp release --win32
50+
displayName: 'Run yarn release for win32'
51+
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', true))
52+
- script: yarn gulp debug-release --win32
53+
displayName: 'Run yarn debug release for win32'
54+
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', false))
4055
- powershell: Set-Content -Path '$(System.DefaultWorkingDirectory)/release/log.txt' -Value $env:BUILD_SOURCEVERSIONMESSAGE
4156

4257
- task: PublishPipelineArtifact@1
@@ -59,8 +74,11 @@ stages:
5974
- script: yarn install
6075
displayName: 'Run yarn install'
6176
- script: yarn gulp release --osx64
62-
displayName: 'Run release'
63-
77+
displayName: 'Run yarn release for OSX'
78+
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', true))
79+
- script: yarn gulp debug-release --osx64
80+
displayName: 'Run yarn debug release for OSX'
81+
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', false))
6482
- task: PublishPipelineArtifact@1
6583
displayName: 'Publish MacOS release'
6684
inputs:
@@ -78,8 +96,12 @@ stages:
7896
displayName: 'Install Node.js 10.16.3'
7997
- script: yarn install
8098
displayName: 'Run yarn install'
81-
- script: yarn release --linux64
82-
displayName: 'Run gulp release'
99+
- script: yarn gulp release --linux64
100+
displayName: 'Run yarn release for linux'
101+
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', true))
102+
- script: yarn gulp debug-release --linux64
103+
displayName: 'Run yarn debug-release for linux'
104+
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', false))
83105
- script: cd $(System.DefaultWorkingDirectory)/release; find -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \;
84106
displayName: 'Clean release folders'
85107

@@ -99,15 +121,19 @@ stages:
99121
inputs:
100122
buildType: 'current'
101123
targetPath: '$(Pipeline.Workspace)'
102-
- powershell: Write-Output ("##vso[task.setvariable variable=releaseNotes;]$(gc $(Pipeline.Workspace)/blackbox-log-viewer-windows/log.txt)")
103-
124+
- powershell: Write-Output ("##vso[task.setvariable variable=changelog;]$(gc $(Pipeline.Workspace)/betaflight-configurator-windows/log.txt)")
125+
- powershell: Write-Output ("##vso[task.setvariable variable=releaseNotes;]$(debugReleaseNotes)")
126+
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', false))
104127
- task: GitHubReleasePublish@1
105128
inputs:
106129
githubEndpoint: '$(endpoint)'
107130
manuallySetRepository: true
108131
githubOwner: '$(owner)'
109132
githubRepositoryName: '$(repoName)'
110-
githubReleaseNotes: '$(releaseNotes)'
133+
githubReleaseNotes: |+
134+
$(releaseNotes)
135+
136+
$(changelog)
111137
githubReleaseDraft: false
112138
githubReleasePrerelease: false
113139
githubIgnoreAssets: false

gulpfile.js

Lines changed: 55 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,23 @@ gulp.task('clean-release', clean_release);
5656

5757
gulp.task('clean-cache', clean_cache);
5858

59-
var distRebuild = gulp.series(clean_dist, dist);
59+
const distRebuild = gulp.series(clean_dist, dist);
6060
gulp.task('dist', distRebuild);
6161

62-
var appsBuild = gulp.series(gulp.parallel(clean_apps, distRebuild), apps, gulp.parallel(listPostBuildTasks(APPS_DIR)));
62+
const appsBuild = gulp.series(gulp.parallel(clean_apps, distRebuild), apps, gulp.parallel(listPostBuildTasks(APPS_DIR)));
6363
gulp.task('apps', appsBuild);
6464

65-
var debugBuild = gulp.series(dist, debug, gulp.parallel(listPostBuildTasks(DEBUG_DIR)), start_debug)
65+
const debugAppsBuild = gulp.series(gulp.parallel(clean_debug, distRebuild), debug, gulp.parallel(listPostBuildTasks(DEBUG_DIR)));
66+
67+
const debugBuild = gulp.series(dist, debug, gulp.parallel(listPostBuildTasks(DEBUG_DIR)), start_debug);
6668
gulp.task('debug', debugBuild);
6769

68-
var releaseBuild = gulp.series(gulp.parallel(clean_release, appsBuild), gulp.parallel(listReleaseTasks()));
70+
const releaseBuild = gulp.series(gulp.parallel(clean_release, appsBuild), gulp.parallel(listReleaseTasks(APPS_DIR)));
6971
gulp.task('release', releaseBuild);
7072

73+
const debugReleaseBuild = gulp.series(gulp.parallel(clean_release, debugAppsBuild), gulp.parallel(listReleaseTasks(DEBUG_DIR)));
74+
gulp.task('debug-release', debugReleaseBuild);
75+
7176
gulp.task('default', debugBuild);
7277

7378
// -----------------
@@ -432,7 +437,11 @@ function start_debug(done) {
432437
}
433438

434439
// Create installer package for windows platforms
435-
function release_win(arch, done) {
440+
function release_win(arch, appDirectory, done) {
441+
if (!commandExistsSync('makensis')) {
442+
console.warn(`makensis command not found, not generating win package for ${arch}`);
443+
done();
444+
}
436445

437446
// The makensis does not generate the folder correctly, manually
438447
createDirIfNotExists(RELEASE_DIR);
@@ -443,7 +452,8 @@ function release_win(arch, done) {
443452
define: {
444453
'VERSION': pkg.version,
445454
'PLATFORM': arch,
446-
'DEST_FOLDER': RELEASE_DIR
455+
'DEST_FOLDER': RELEASE_DIR,
456+
'SOURCE_FOLDER': appDirectory,
447457
}
448458
}
449459

@@ -457,10 +467,10 @@ function release_win(arch, done) {
457467
}
458468

459469
// Create distribution package (zip) for windows and linux platforms
460-
function release_zip(arch) {
461-
var src = path.join(APPS_DIR, pkg.name, arch, '**');
462-
var output = getReleaseFilename(arch, 'zip');
463-
var base = path.join(APPS_DIR, pkg.name, arch);
470+
function release_zip(arch, appDirectory) {
471+
const src = path.join(appDirectory, pkg.name, arch, '**');
472+
const output = getReleaseFilename(arch, 'zip');
473+
const base = path.join(appDirectory, pkg.name, arch);
464474

465475
return compressFiles(src, base, output, 'Betaflight Blackbox Explorer');
466476
}
@@ -482,7 +492,7 @@ function compressFiles(srcPath, basePath, outputFile, zipFolder) {
482492
.pipe(gulp.dest(RELEASE_DIR));
483493
}
484494

485-
function release_deb(arch, done) {
495+
function release_deb(arch, appDirectory, done) {
486496
// Check if dpkg-deb exists
487497
if (!commandExistsSync('dpkg-deb')) {
488498
console.warn('dpkg-deb command not found, not generating deb package for ' + arch);
@@ -504,7 +514,7 @@ function release_deb(arch, done) {
504514
break;
505515
}
506516

507-
return gulp.src([path.join(APPS_DIR, pkg.name, arch, '*')])
517+
return gulp.src([path.join(appDirectory, pkg.name, arch, '*')])
508518
.pipe(deb({
509519
package: pkg.name,
510520
version: pkg.version,
@@ -529,12 +539,12 @@ function release_deb(arch, done) {
529539
}));
530540
}
531541

532-
function release_rpm(arch, done) {
542+
function release_rpm(arch, appDirectory, done) {
533543

534544
// Check if dpkg-deb exists
535545
if (!commandExistsSync('rpmbuild')) {
536546
console.warn('rpmbuild command not found, not generating rpm package for ' + arch);
537-
return done();
547+
done();
538548
}
539549

540550
// The buildRpm does not generate the folder correctly, manually
@@ -550,7 +560,7 @@ function release_rpm(arch, done) {
550560
requires: 'libgconf-2-4',
551561
prefix: '/opt',
552562
files:
553-
[ { cwd: path.join(APPS_DIR, pkg.name, arch),
563+
[ { cwd: path.join(appDirectory, pkg.name, arch),
554564
src: '*',
555565
dest: `${LINUX_INSTALL_DIR}/${pkg.name}` } ],
556566
postInstallScript: [`cp ${LINUX_INSTALL_DIR}/${pkg.name}/mime/${pkg.name}.xml /usr/share/mime/packages/`, 'update-mime-database /usr/share/mime',
@@ -575,7 +585,7 @@ function release_rpm(arch, done) {
575585
}
576586

577587
// Create distribution package for macOS platform
578-
function release_osx64() {
588+
function release_osx64(appDirectory) {
579589
var appdmg = require('gulp-appdmg');
580590

581591
// The appdmg does not generate the folder correctly, manually
@@ -585,7 +595,7 @@ function release_osx64() {
585595
return gulp.src(['.'])
586596
.pipe(appdmg({
587597
target: path.join(RELEASE_DIR, getReleaseFilename('macOS', 'dmg')),
588-
basepath: path.join(APPS_DIR, pkg.name, 'osx64'),
598+
basepath: path.join(appDirectory, pkg.name, 'osx64'),
589599
specification: {
590600
title: 'BF Blackbox Explorer', // <= volume name; should be smaller than 27 chars.
591601
contents: [
@@ -640,7 +650,7 @@ function createDirIfNotExists(dir) {
640650
}
641651

642652
// Create a list of the gulp tasks to execute for release
643-
function listReleaseTasks(done) {
653+
function listReleaseTasks(appDirectory) {
644654

645655
createDirIfNotExists(RELEASE_DIR);
646656

@@ -653,27 +663,45 @@ function listReleaseTasks(done) {
653663
}
654664

655665
if (platforms.indexOf('linux64') !== -1) {
656-
releaseTasks.push(function release_linux64_zip(){ return release_zip('linux64') });
657-
releaseTasks.push(function release_linux64_deb(done){ return release_deb('linux64', done) });
658-
releaseTasks.push(function release_linux64_rpm(done){ return release_rpm('linux64', done) });
666+
releaseTasks.push(function release_linux64_zip(){
667+
return release_zip('linux64', appDirectory);
668+
});
669+
releaseTasks.push(function release_linux64_deb(done){
670+
return release_deb('linux64', appDirectory, done);
671+
});
672+
releaseTasks.push(function release_linux64_rpm(done){
673+
return release_rpm('linux64', appDirectory, done);
674+
});
659675
}
660676

661677
if (platforms.indexOf('linux32') !== -1) {
662-
releaseTasks.push(function release_linux32_zip(){ return release_zip('linux32') });
663-
releaseTasks.push(function release_linux32_deb(done){ return release_deb('linux32', done) });
664-
releaseTasks.push(function release_linux32_rpm(done){ return release_rpm('linux32', done) });
678+
releaseTasks.push(function release_linux32_zip(){
679+
return release_zip('linux32', appDirectory);
680+
});
681+
releaseTasks.push(function release_linux32_deb(done){
682+
return release_deb('linux32', appDirectory, done);
683+
});
684+
releaseTasks.push(function release_linux32_rpm(done){
685+
return release_rpm('linux32', appDirectory, done);
686+
});
665687
}
666688

667689
if (platforms.indexOf('osx64') !== -1) {
668-
releaseTasks.push(release_osx64);
690+
releaseTasks.push(function () {
691+
return release_osx64(appDirectory);
692+
});
669693
}
670694

671695
if (platforms.indexOf('win32') !== -1) {
672-
releaseTasks.push(function release_win32(done){ return release_win('win32', done) });
696+
releaseTasks.push(function release_win32(done) {
697+
return release_win('win32', appDirectory, done);
698+
});
673699
}
674700

675701
if (platforms.indexOf('win64') !== -1) {
676-
releaseTasks.push(function release_win64(done){ return release_win('win64', done) });
702+
releaseTasks.push(function release_win64(done) {
703+
return release_win('win64', appDirectory, done);
704+
});
677705
}
678706

679707
return releaseTasks;

0 commit comments

Comments
 (0)