diff --git a/assets/windows/installer.nsi b/assets/windows/installer.nsi index c8b38c22..a7452a58 100644 --- a/assets/windows/installer.nsi +++ b/assets/windows/installer.nsi @@ -7,9 +7,10 @@ # ${VERSION} - Version to generate (x.y.z) # ${PLATFORM} - Platform to generate (win32 or win64) # ${DEST_FOLDER} - Destination folder for the installer files +# ${SOURCE_FOLDER} - Source folder for the application files # Some definitions -!define SOURCE_FILES "..\..\apps\betaflight-configurator\${PLATFORM}\*" +!define SOURCE_FILES "..\..\${SOURCE_FOLDER}\betaflight-configurator\${PLATFORM}\*" !define APP_NAME "Betaflight Configurator" !define COMPANY_NAME "The Betaflight open source project." !define GROUP_NAME "Betaflight" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cab3dd8e..f7bae0b3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -42,8 +42,8 @@ stages: testResultsFiles: '**/test_results.xml' testRunTitle: 'Windows' buildPlatform: 'Win32' - - script: yarn release --win32 - displayName: 'Run yarn release for win32' + - script: yarn debug-release --win32 + displayName: 'Run yarn debug release for win32' - powershell: Set-Content -Path '$(System.DefaultWorkingDirectory)/release/log.txt' -Value $env:BUILD_SOURCEVERSIONMESSAGE - task: PublishPipelineArtifact@1 displayName: 'Publish Windows release' @@ -64,8 +64,8 @@ stages: displayName: 'Install Gulp' - script: yarn install displayName: 'Run yarn install' - - script: yarn gulp release --osx64 - displayName: 'Run yarn release for OSX64' + - script: yarn gulp debug-release --osx64 + displayName: 'Run yarn debug release for OSX64' - task: PublishPipelineArtifact@1 displayName: 'Publish MacOS release' inputs: @@ -83,8 +83,8 @@ stages: displayName: 'Install Node.js 10.16.3' - script: yarn install displayName: 'Run yarn install' - - script: yarn release --linux64 - displayName: 'Run yarn release for linux64' + - script: yarn debug-release --linux64 + displayName: 'Run yarn debug release for linux64' - script: cd $(System.DefaultWorkingDirectory)/release; find -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \; displayName: 'Clean release folders' - task: PublishPipelineArtifact@1 diff --git a/gulpfile.js b/gulpfile.js index 131fcb36..212d5378 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -75,19 +75,24 @@ const getChangesetId = gulp.series(getHash, writeChangesetId); gulp.task('get-changeset-id', getChangesetId); // dist_yarn MUST be done after dist_src -var distBuild = gulp.series(dist_src, dist_changelog, dist_yarn, dist_locale, dist_libraries, dist_resources, getChangesetId); -var distRebuild = gulp.series(clean_dist, distBuild); +const distBuild = gulp.series(dist_src, dist_changelog, dist_yarn, dist_locale, dist_libraries, dist_resources, getChangesetId); +const distRebuild = gulp.series(clean_dist, distBuild); gulp.task('dist', distRebuild); -var appsBuild = gulp.series(gulp.parallel(clean_apps, distRebuild), apps, gulp.parallel(listPostBuildTasks(APPS_DIR))); +const appsBuild = gulp.series(gulp.parallel(clean_apps, distRebuild), apps, gulp.parallel(listPostBuildTasks(APPS_DIR))); gulp.task('apps', appsBuild); -var debugBuild = gulp.series(distBuild, debug, gulp.parallel(listPostBuildTasks(DEBUG_DIR)), start_debug) +const debugAppsBuild = gulp.series(gulp.parallel(clean_debug, distRebuild), debug, gulp.parallel(listPostBuildTasks(DEBUG_DIR))); + +const debugBuild = gulp.series(distBuild, debug, gulp.parallel(listPostBuildTasks(DEBUG_DIR)), start_debug); gulp.task('debug', debugBuild); -var releaseBuild = gulp.series(gulp.parallel(clean_release, appsBuild), gulp.parallel(listReleaseTasks())); +const releaseBuild = gulp.series(gulp.parallel(clean_release, appsBuild), gulp.parallel(listReleaseTasks(APPS_DIR))); gulp.task('release', releaseBuild); +const debugReleaseBuild = gulp.series(gulp.parallel(clean_release, debugAppsBuild), gulp.parallel(listReleaseTasks(DEBUG_DIR))); +gulp.task('debug-release', debugReleaseBuild); + gulp.task('default', debugBuild); // ----------------- @@ -503,12 +508,12 @@ function start_debug(done) { } // Create installer package for windows platforms -function release_win(arch, done) { +function release_win(arch, appDirectory, done) { // Check if makensis exists if (!commandExistsSync('makensis')) { console.warn('makensis command not found, not generating win package for ' + arch); - return done(); + done(); } // The makensis does not generate the folder correctly, manually @@ -520,7 +525,8 @@ function release_win(arch, done) { define: { 'VERSION': pkg.version, 'PLATFORM': arch, - 'DEST_FOLDER': RELEASE_DIR + 'DEST_FOLDER': RELEASE_DIR, + 'SOURCE_FOLDER': appDirectory, } } @@ -534,10 +540,10 @@ function release_win(arch, done) { } // Create distribution package (zip) for windows and linux platforms -function release_zip(arch) { - var src = path.join(APPS_DIR, pkg.name, arch, '**'); - var output = getReleaseFilename(arch, 'zip'); - var base = path.join(APPS_DIR, pkg.name, arch); +function release_zip(arch, appDirectory) { + const src = path.join(appDirectory, pkg.name, arch, '**'); + const output = getReleaseFilename(arch, 'zip'); + const base = path.join(appDirectory, pkg.name, arch); return compressFiles(src, base, output, 'Betaflight Configurator'); } @@ -561,15 +567,15 @@ function compressFiles(srcPath, basePath, outputFile, zipFolder) { .pipe(gulp.dest(RELEASE_DIR)); } -function release_deb(arch, done) { +function release_deb(arch, appDirectory, done) { // Check if dpkg-deb exists if (!commandExistsSync('dpkg-deb')) { console.warn('dpkg-deb command not found, not generating deb package for ' + arch); - return done(); + done(); } - return gulp.src([path.join(APPS_DIR, pkg.name, arch, '*')]) + return gulp.src([path.join(appDirectory, pkg.name, arch, '*')]) .pipe(deb({ package: pkg.name, version: pkg.version, @@ -590,12 +596,12 @@ function release_deb(arch, done) { })); } -function release_rpm(arch, done) { +function release_rpm(arch, appDirectory, done) { // Check if dpkg-deb exists if (!commandExistsSync('rpmbuild')) { console.warn('rpmbuild command not found, not generating rpm package for ' + arch); - return done(); + done(); } // The buildRpm does not generate the folder correctly, manually @@ -613,7 +619,7 @@ function release_rpm(arch, done) { requires: 'libgconf-2-4', prefix: '/opt', files: - [ { cwd: path.join(APPS_DIR, pkg.name, arch), + [ { cwd: path.join(appDirectory, pkg.name, arch), src: '*', dest: `${LINUX_INSTALL_DIR}/${pkg.name}` } ], postInstallScript: [`xdg-desktop-menu install ${LINUX_INSTALL_DIR}/${pkg.name}/${pkg.name}.desktop`], @@ -656,7 +662,7 @@ function getLinuxPackageArch(type, arch) { return packArch; } // Create distribution package for macOS platform -function release_osx64() { +function release_osx64(appDirectory) { var appdmg = require('gulp-appdmg'); // The appdmg does not generate the folder correctly, manually @@ -666,7 +672,7 @@ function release_osx64() { return gulp.src(['.']) .pipe(appdmg({ target: path.join(RELEASE_DIR, getReleaseFilename('macOS', 'dmg')), - basepath: path.join(APPS_DIR, pkg.name, 'osx64'), + basepath: path.join(appDirectory, pkg.name, 'osx64'), specification: { title: 'Betaflight Configurator', contents: [ @@ -698,7 +704,7 @@ function createDirIfNotExists(dir) { } // Create a list of the gulp tasks to execute for release -function listReleaseTasks(done) { +function listReleaseTasks(appDirectory) { var platforms = getPlatforms(); @@ -710,47 +716,49 @@ function listReleaseTasks(done) { if (platforms.indexOf('linux64') !== -1) { releaseTasks.push(function release_linux64_zip() { - return release_zip('linux64'); + return release_zip('linux64', appDirectory); }); releaseTasks.push(function release_linux64_deb(done) { - return release_deb('linux64', done); + return release_deb('linux64', appDirectory, done); }); releaseTasks.push(function release_linux64_rpm(done) { - return release_rpm('linux64', done); + return release_rpm('linux64', appDirectory, done); }); } if (platforms.indexOf('linux32') !== -1) { releaseTasks.push(function release_linux32_zip() { - return release_zip('linux32'); + return release_zip('linux32', appDirectory); }); releaseTasks.push(function release_linux32_deb(done) { - return release_deb('linux32', done); + return release_deb('linux32', appDirectory, done); }); releaseTasks.push(function release_linux32_rpm(done) { - return release_rpm('linux32', done); + return release_rpm('linux32', appDirectory, done); }); } if (platforms.indexOf('armv7') !== -1) { releaseTasks.push(function release_armv7_zip() { - return release_zip('armv7'); + return release_zip('armv7', appDirectory); }); } if (platforms.indexOf('osx64') !== -1) { - releaseTasks.push(release_osx64); + releaseTasks.push(function () { + return release_osx64(appDirectory); + }); } if (platforms.indexOf('win32') !== -1) { releaseTasks.push(function release_win32(done) { - return release_win('win32', done); + return release_win('win32', appDirectory, done); }); } if (platforms.indexOf('win64') !== -1) { releaseTasks.push(function release_win64(done) { - return release_win('win64', done); + return release_win('win64', appDirectory, done); }); }