Differentiate insider builds from stable builds

Summary: Each build will have an embedded file specifying the target release channel for the build. This allows us to do some customisations, e.g. show "Insiders" label in the title and enable Sandy by default for insiders builds.

Reviewed By: jknoxville

Differential Revision: D25399045

fbshipit-source-id: 8e26d0754d0713ced823f86b30b54491d55b4d97
This commit is contained in:
Anton Nikolaev
2020-12-08 12:35:53 -08:00
committed by Facebook GitHub Bot
parent bc9412426f
commit 56361debb2
6 changed files with 45 additions and 7 deletions

View File

@@ -61,6 +61,11 @@ const argv = yargs
type: 'number',
default: 0,
},
channel: {
description: 'Release channel for the build',
choices: ['stable', 'insiders'],
default: 'stable',
},
})
.help()
.strict()
@@ -79,6 +84,12 @@ const argv = yargs
})
.parse(process.argv.slice(1));
if (isFB) {
process.env.FLIPPER_FB = 'true';
}
process.env.FLIPPER_RELEASE_CHANNEL = argv.channel;
async function generateManifest(versionNumber: string) {
await fs.writeFile(
path.join(distDir, 'manifest.json'),
@@ -93,6 +104,7 @@ async function modifyPackageManifest(
buildFolder: string,
versionNumber: string,
hgRevision: string | null,
channel: string,
) {
// eslint-disable-next-line no-console
console.log('Creating package.json manifest');
@@ -108,6 +120,7 @@ async function modifyPackageManifest(
if (hgRevision != null) {
manifest.revision = hgRevision;
}
manifest.releaseChannel = channel;
await fs.writeFile(
path.join(buildFolder, 'package.json'),
JSON.stringify(manifest, null, ' '),
@@ -244,9 +257,6 @@ function downloadIcons(buildFolder: string) {
}
(async () => {
if (isFB) {
process.env.FLIPPER_FB = 'true';
}
const dir = await buildFolder();
// eslint-disable-next-line no-console
console.log('Created build directory', dir);
@@ -258,7 +268,7 @@ function downloadIcons(buildFolder: string) {
await compileRenderer(dir);
const versionNumber = getVersionNumber(argv.version);
const hgRevision = await genMercurialRevision();
await modifyPackageManifest(dir, versionNumber, hgRevision);
await modifyPackageManifest(dir, versionNumber, hgRevision, argv.channel);
await fs.ensureDir(distDir);
await generateManifest(versionNumber);
await buildDist(dir);

View File

@@ -71,6 +71,11 @@ const argv = yargs
'[FB-internal only] Will yield `true` on any GK. Disabled by default. Setting env var FLIPPER_ENABLE_ALL_GKS is equivalent',
type: 'boolean',
},
channel: {
describe:
'[FB-internal only] Release channel. "stable" by default. Setting env var "FLIPPER_RELEASE_CHANNEL" is equivalent.',
choices: ['stable', 'insiders'],
},
})
.version('DEV')
.help()
@@ -115,6 +120,10 @@ if (argv['enabled-plugins'] !== undefined) {
process.env.FLIPPER_ENABLED_PLUGINS = argv['enabled-plugins'].join(',');
}
if (argv.channel !== undefined) {
process.env.FLIPPER_RELEASE_CHANNEL = argv.channel;
}
function looksLikeDevServer(): boolean {
const hn = hostname();
if (/^devvm.*\.facebook\.com$/.test(hn)) {