diff --git a/src/commands/build.ts b/src/commands/build.ts index c1b6c9d..cd97e7f 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -20,19 +20,22 @@ const platform: any = { const applyConfig = async (os: string, arch: string) => { log.info('Applying mozconfig...') - let commonConfig = readFileSync( - resolve(CONFIGS_DIR, 'common', 'mozconfig'), - 'utf-8' - ) - - commonConfig = stringTemplate(commonConfig, { + const templateOptions = { name: config.name, vendor: config.name, appId: config.appId, brandingDir: existsSync(join(ENGINE_DIR, 'branding', 'melon')) ? 'branding/melon' : 'branding/unofficial', - }) + binName: config.binaryName, + } + + let commonConfig = readFileSync( + resolve(CONFIGS_DIR, 'common', 'mozconfig'), + 'utf-8' + ) + + commonConfig = stringTemplate(commonConfig, templateOptions) const changesetPrefix = commonConfig .split('\n') @@ -53,11 +56,7 @@ const applyConfig = async (os: string, arch: string) => { 'utf-8' ) - osConfig = stringTemplate(osConfig, { - name: config.name, - vendor: config.name, - appId: config.appId, - }) + osConfig = stringTemplate(osConfig, templateOptions) // Allow a custom config to be placed in /mozconfig. This will not be committed // to origin @@ -65,11 +64,7 @@ const applyConfig = async (os: string, arch: string) => { ? readFileSync(join(process.cwd(), 'mozconfig')).toString() : '' - customConfig = stringTemplate(customConfig, { - name: config.name, - vendor: config.name, - appId: config.appId, - }) + customConfig = stringTemplate(customConfig, templateOptions) // TODO: Disable optimization when running artifact builds, as they are not compatible const internalConfig = `# Internally defined by melon\n${ @@ -110,13 +105,13 @@ const genericBuild = async (os: string, tier: string) => { `If you get any dependency errors, try running |${bin_name} bootstrap|.` ) - await dispatch( - `./mach`, - ['build', config.buildOptions.artifactBuilds ? 'faster' : ''].concat( - tier ? [tier] : [] - ), - ENGINE_DIR - ) + const buildOptions = ['build'] + + if (config.buildOptions.artifactBuilds) { + buildOptions.push('faster') + } + + await dispatch(`./mach`, buildOptions, ENGINE_DIR) } const parseDate = (d: number) => { diff --git a/src/commands/setupProject.ts b/src/commands/setupProject.ts index 5c6cb62..4bbc273 100644 --- a/src/commands/setupProject.ts +++ b/src/commands/setupProject.ts @@ -113,7 +113,7 @@ export async function setupProject(): Promise { }, ]) - const config: Config = { + const config: Partial = { name, vendor, appId, diff --git a/src/utils/config.ts b/src/utils/config.ts index 84ae4a0..6a91b2b 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -43,6 +43,7 @@ export interface Config { * e.g. co.dothq.melon */ appId: string + binaryName: string version: { /** * What branch of firefox you are forking. e.g. stable ('firefox'), dev ('firefox-dev') @@ -85,6 +86,7 @@ const defaultConfig: Config = { name: 'Unknown melon build', vendor: 'Unknown', appId: 'unknown.appid', + binaryName: 'firefox', version: { product: SupportedProducts.Firefox, displayVersion: '1.0.0', diff --git a/template/configs/common/mozconfig b/template/configs/common/mozconfig index 778880c..ad56476 100644 --- a/template/configs/common/mozconfig +++ b/template/configs/common/mozconfig @@ -2,11 +2,11 @@ ac_add_options --enable-update-channel=release ac_add_options --with-branding=${brandingDir} -ac_add_options --with-app-name=dot +ac_add_options --with-app-name=${binName} export MOZ_USER_DIR="${name}" export MOZ_APP_VENDOR="${vendor}" export MOZ_APP_BASENAME=Dot -export MOZ_APP_PROFILE=dot +export MOZ_APP_PROFILE=${binName} export MOZ_APP_DISPLAYNAME="${name}" export MOZ_BRANDING_DIRECTORY=${brandingDir} export MOZ_OFFICIAL_BRANDING_DIRECTORY=${brandingDir}