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:
committed by
Facebook GitHub Bot
parent
bc9412426f
commit
56361debb2
@@ -7,10 +7,13 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import ReleaseChannel from '../ReleaseChannel';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
updateServer: 'https://www.facebook.com/fbflipper/public/latest.json',
|
updateServer: 'https://www.facebook.com/fbflipper/public/latest.json',
|
||||||
showLogin: false,
|
showLogin: false,
|
||||||
showFlipperRating: false,
|
showFlipperRating: false,
|
||||||
warnFBEmployees: true,
|
warnFBEmployees: true,
|
||||||
isFBBuild: false,
|
isFBBuild: false,
|
||||||
|
getReleaseChannel: () => ReleaseChannel.STABLE,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import {Store} from './reducers/index';
|
|||||||
import dispatcher from './dispatcher/index';
|
import dispatcher from './dispatcher/index';
|
||||||
import TooltipProvider from './ui/components/TooltipProvider';
|
import TooltipProvider from './ui/components/TooltipProvider';
|
||||||
import config from './utils/processConfig';
|
import config from './utils/processConfig';
|
||||||
|
import appConfig from '../src/fb-stubs/config';
|
||||||
import {initLauncherHooks} from './utils/launcher';
|
import {initLauncherHooks} from './utils/launcher';
|
||||||
import {setPersistor} from './utils/persistor';
|
import {setPersistor} from './utils/persistor';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
@@ -40,6 +41,7 @@ import {
|
|||||||
_setGlobalInteractionReporter,
|
_setGlobalInteractionReporter,
|
||||||
} from 'flipper-plugin';
|
} from 'flipper-plugin';
|
||||||
import isProduction from './utils/isProduction';
|
import isProduction from './utils/isProduction';
|
||||||
|
import ReleaseChannel from './ReleaseChannel';
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development' && os.platform() === 'darwin') {
|
if (process.env.NODE_ENV === 'development' && os.platform() === 'darwin') {
|
||||||
// By default Node.JS has its internal certificate storage and doesn't use
|
// By default Node.JS has its internal certificate storage and doesn't use
|
||||||
@@ -116,7 +118,10 @@ function init() {
|
|||||||
store,
|
store,
|
||||||
{name: 'loadTheme', fireImmediately: true, throttleMs: 500},
|
{name: 'loadTheme', fireImmediately: true, throttleMs: 500},
|
||||||
(state) => ({
|
(state) => ({
|
||||||
sandy: GK.get('flipper_sandy') && !state.settingsState.disableSandy,
|
sandy:
|
||||||
|
(GK.get('flipper_sandy') ||
|
||||||
|
appConfig.getReleaseChannel() === ReleaseChannel.INSIDERS) &&
|
||||||
|
!state.settingsState.disableSandy,
|
||||||
dark: state.settingsState.darkMode,
|
dark: state.settingsState.darkMode,
|
||||||
}),
|
}),
|
||||||
(theme) => {
|
(theme) => {
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import UpdateIndicator from '../chrome/UpdateIndicator';
|
|||||||
import {Version} from '../chrome/TitleBar';
|
import {Version} from '../chrome/TitleBar';
|
||||||
import {useStore} from '../utils/useStore';
|
import {useStore} from '../utils/useStore';
|
||||||
import {remote} from 'electron';
|
import {remote} from 'electron';
|
||||||
|
import config from '../fb-stubs/config';
|
||||||
|
import ReleaseChannel from '../ReleaseChannel';
|
||||||
|
|
||||||
const version = remote.app.getVersion();
|
const version = remote.app.getVersion();
|
||||||
|
|
||||||
@@ -54,7 +56,13 @@ export function TemporarilyTitlebar() {
|
|||||||
[Sandy] Flipper{' '}
|
[Sandy] Flipper{' '}
|
||||||
{!isProduction() && <NetworkGraph height={20} width={60} />}
|
{!isProduction() && <NetworkGraph height={20} width={60} />}
|
||||||
{!isProduction() && <FpsGraph height={20} width={60} />}
|
{!isProduction() && <FpsGraph height={20} width={60} />}
|
||||||
<Version>{version + (isProduction() ? '' : '-dev')}</Version>
|
<Version>
|
||||||
|
{version +
|
||||||
|
(isProduction() ? '' : '-dev') +
|
||||||
|
(config.getReleaseChannel() !== ReleaseChannel.STABLE
|
||||||
|
? `-${config.getReleaseChannel()}`
|
||||||
|
: '')}
|
||||||
|
</Version>
|
||||||
{isAutoUpdaterEnabled() ? (
|
{isAutoUpdaterEnabled() ? (
|
||||||
<AutoUpdateVersion version={version} />
|
<AutoUpdateVersion version={version} />
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {useStore} from '../../../app/src/utils/useStore';
|
import {useStore} from '../../../app/src/utils/useStore';
|
||||||
|
import config from '../fb-stubs/config';
|
||||||
import GK from '../fb-stubs/GK';
|
import GK from '../fb-stubs/GK';
|
||||||
|
import ReleaseChannel from '../ReleaseChannel';
|
||||||
/**
|
/**
|
||||||
* This hook returns whether dark mode is currently being used.
|
* This hook returns whether dark mode is currently being used.
|
||||||
* Generally should be avoided in favor of using the above theme object,
|
* Generally should be avoided in favor of using the above theme object,
|
||||||
@@ -17,7 +19,8 @@ import GK from '../fb-stubs/GK';
|
|||||||
export function useIsDarkMode(): boolean {
|
export function useIsDarkMode(): boolean {
|
||||||
return useStore(
|
return useStore(
|
||||||
(state) =>
|
(state) =>
|
||||||
GK.get('flipper_sandy') &&
|
(GK.get('flipper_sandy') ||
|
||||||
|
config.getReleaseChannel() === ReleaseChannel.INSIDERS) &&
|
||||||
!state.settingsState.disableSandy &&
|
!state.settingsState.disableSandy &&
|
||||||
state.settingsState.darkMode,
|
state.settingsState.darkMode,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -61,6 +61,11 @@ const argv = yargs
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
|
channel: {
|
||||||
|
description: 'Release channel for the build',
|
||||||
|
choices: ['stable', 'insiders'],
|
||||||
|
default: 'stable',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.help()
|
.help()
|
||||||
.strict()
|
.strict()
|
||||||
@@ -79,6 +84,12 @@ const argv = yargs
|
|||||||
})
|
})
|
||||||
.parse(process.argv.slice(1));
|
.parse(process.argv.slice(1));
|
||||||
|
|
||||||
|
if (isFB) {
|
||||||
|
process.env.FLIPPER_FB = 'true';
|
||||||
|
}
|
||||||
|
|
||||||
|
process.env.FLIPPER_RELEASE_CHANNEL = argv.channel;
|
||||||
|
|
||||||
async function generateManifest(versionNumber: string) {
|
async function generateManifest(versionNumber: string) {
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
path.join(distDir, 'manifest.json'),
|
path.join(distDir, 'manifest.json'),
|
||||||
@@ -93,6 +104,7 @@ async function modifyPackageManifest(
|
|||||||
buildFolder: string,
|
buildFolder: string,
|
||||||
versionNumber: string,
|
versionNumber: string,
|
||||||
hgRevision: string | null,
|
hgRevision: string | null,
|
||||||
|
channel: string,
|
||||||
) {
|
) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log('Creating package.json manifest');
|
console.log('Creating package.json manifest');
|
||||||
@@ -108,6 +120,7 @@ async function modifyPackageManifest(
|
|||||||
if (hgRevision != null) {
|
if (hgRevision != null) {
|
||||||
manifest.revision = hgRevision;
|
manifest.revision = hgRevision;
|
||||||
}
|
}
|
||||||
|
manifest.releaseChannel = channel;
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
path.join(buildFolder, 'package.json'),
|
path.join(buildFolder, 'package.json'),
|
||||||
JSON.stringify(manifest, null, ' '),
|
JSON.stringify(manifest, null, ' '),
|
||||||
@@ -244,9 +257,6 @@ function downloadIcons(buildFolder: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
if (isFB) {
|
|
||||||
process.env.FLIPPER_FB = 'true';
|
|
||||||
}
|
|
||||||
const dir = await buildFolder();
|
const dir = await buildFolder();
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log('Created build directory', dir);
|
console.log('Created build directory', dir);
|
||||||
@@ -258,7 +268,7 @@ function downloadIcons(buildFolder: string) {
|
|||||||
await compileRenderer(dir);
|
await compileRenderer(dir);
|
||||||
const versionNumber = getVersionNumber(argv.version);
|
const versionNumber = getVersionNumber(argv.version);
|
||||||
const hgRevision = await genMercurialRevision();
|
const hgRevision = await genMercurialRevision();
|
||||||
await modifyPackageManifest(dir, versionNumber, hgRevision);
|
await modifyPackageManifest(dir, versionNumber, hgRevision, argv.channel);
|
||||||
await fs.ensureDir(distDir);
|
await fs.ensureDir(distDir);
|
||||||
await generateManifest(versionNumber);
|
await generateManifest(versionNumber);
|
||||||
await buildDist(dir);
|
await buildDist(dir);
|
||||||
|
|||||||
@@ -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',
|
'[FB-internal only] Will yield `true` on any GK. Disabled by default. Setting env var FLIPPER_ENABLE_ALL_GKS is equivalent',
|
||||||
type: 'boolean',
|
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')
|
.version('DEV')
|
||||||
.help()
|
.help()
|
||||||
@@ -115,6 +120,10 @@ if (argv['enabled-plugins'] !== undefined) {
|
|||||||
process.env.FLIPPER_ENABLED_PLUGINS = argv['enabled-plugins'].join(',');
|
process.env.FLIPPER_ENABLED_PLUGINS = argv['enabled-plugins'].join(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argv.channel !== undefined) {
|
||||||
|
process.env.FLIPPER_RELEASE_CHANNEL = argv.channel;
|
||||||
|
}
|
||||||
|
|
||||||
function looksLikeDevServer(): boolean {
|
function looksLikeDevServer(): boolean {
|
||||||
const hn = hostname();
|
const hn = hostname();
|
||||||
if (/^devvm.*\.facebook\.com$/.test(hn)) {
|
if (/^devvm.*\.facebook\.com$/.test(hn)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user