From 79f70c991807786242176db18c14f4c49cecb513 Mon Sep 17 00:00:00 2001 From: Simon Hong Date: Tue, 26 Jun 2018 09:20:30 +0900 Subject: [PATCH] Copying our pre-generated midl to overwrite installed upstream midl files Chromium compares pre-installed midl files and generated midl files from IDL file during the build to check integrity. In our case, generated files during the build time and pre-installed upstream files(in src/third_party/win_build_outout/midl/google_update) are different because we use different IDL file (src/brave/chromium_src/google_update/google_update_idl.idl) for google update. To pass this integrity check in the build phase, we should copy our pre-installed files to overwrite upstream files. Also, these files should not be the target of update_patches command. --- lib/updatePatches.js | 2 +- lib/util.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/updatePatches.js b/lib/updatePatches.js index 47e905fb6084..5b01a0fb3916 100644 --- a/lib/updatePatches.js +++ b/lib/updatePatches.js @@ -16,7 +16,7 @@ const updatePatches = (options) => { let modifiedDiff = util.run('git', modifiedDiffArgs, runOptions) let moddedFileList = modifiedDiff.stdout.toString() .split('\n') - .filter(s => s.length > 0 && !s.endsWith('.xtb') && !s.endsWith('.png')) + .filter(s => s.length > 0 && !s.endsWith('.xtb') && !s.endsWith('.png') && !s.includes('google_update_idl')) let n = moddedFileList.length diff --git a/lib/util.js b/lib/util.js index e46600311c5b..5d1faedec0d1 100644 --- a/lib/util.js +++ b/lib/util.js @@ -77,9 +77,23 @@ const util = { fs.copySync(path.join(braveAppDir, 'strings'), path.join(chromeComponentsDir, 'strings')) }, + // Chromium compares pre-installed midl files and generated midl files from IDL during the build to check integrity. + // Generated files during the build time and upstream pre-installed files are different because we use different IDL file. + // So, we should copy our pre-installed files to overwrite upstream pre-installed files. + // After checking, pre-installed files are copied to gen dir and they are used to compile. + // So, this copying in every build doesn't affect compile performance. + updateOmahaMidlFiles: () => { + console.log('update omaha midl files...') + const srcDir = path.join(config.projects['brave-core'].dir, 'win_build_output', 'midl', 'google_update') + const dstDir = path.join(config.srcDir, 'third_party', 'win_build_output', 'midl', 'google_update') + fs.copySync(srcDir, dstDir) + }, + buildTarget: (options = config.defaultOptions) => { console.log('building ' + config.buildTarget + '...') + util.updateOmahaMidlFiles() + const args = util.buildArgsToString(config.buildArgs()) util.run('gn', ['gen', config.outputDir, '--args="' + args + '"'], options) util.run('ninja', ['-C', config.outputDir, config.buildTarget], options)