-
Notifications
You must be signed in to change notification settings - Fork 895
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into reword-website-section
- Loading branch information
Showing
16 changed files
with
282 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ src | |
npm-debug.log | ||
.gclient | ||
.sccache | ||
**.sw[po] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,63 @@ | ||
const config = require('../lib/config') | ||
const util = require('../lib/util') | ||
const path = require('path') | ||
const fs = require('fs-extra') | ||
|
||
const touchOverriddenFiles = (filter) => { | ||
console.log('touch original files overridden by chromium_src...') | ||
|
||
// Return true when original file of |file| should be touched. | ||
const applyFileFilter = (file) => { | ||
// Exclude test files | ||
if (file.indexOf('browsertest') > -1 || file.indexOf('unittest') > -1) { return false } | ||
|
||
// Only includes cc and h files. | ||
const ext = path.extname(file) | ||
if (ext !== '.cc' && ext !== '.h' && ext !== '.mm') { return false } | ||
|
||
// Touch all overridden files. | ||
if (filter === '*') { return true } | ||
|
||
return file.match(filter) | ||
} | ||
|
||
const walkSync = (dir, filelist = []) => { | ||
fs.readdirSync(dir).forEach(file => { | ||
if (fs.statSync(path.join(dir, file)).isDirectory()) { | ||
filelist = walkSync(path.join(dir, file), filelist) | ||
} else if (applyFileFilter(file)) { | ||
filelist = filelist.concat(path.join(dir, file)) | ||
} | ||
}) | ||
return filelist | ||
} | ||
|
||
const chromiumSrcDir = path.join(config.srcDir, 'brave', 'chromium_src') | ||
var sourceFiles = walkSync(chromiumSrcDir) | ||
|
||
// Touch original files by updating mtime. | ||
const chromiumSrcDirLen = chromiumSrcDir.length | ||
sourceFiles.forEach(file => { | ||
const targetOriginalFile = path.join(config.srcDir, file.slice(chromiumSrcDirLen)) | ||
const date = new Date() | ||
fs.utimesSync(targetOriginalFile, date, date) | ||
console.log(targetOriginalFile + ' is touched.') | ||
}) | ||
} | ||
|
||
const build = (buildConfig = config.defaultBuildConfig, options) => { | ||
config.buildConfig = buildConfig | ||
config.update(options) | ||
|
||
if (options.touch_overridden_files) { | ||
touchOverriddenFiles(options.touch_overridden_files) | ||
} | ||
|
||
if (!options.no_branding_update) { | ||
util.updateBranding() | ||
} | ||
|
||
util.buildMuon() | ||
util.buildTarget() | ||
} | ||
|
||
module.exports = build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
const config = require('../lib/config') | ||
const util = require('../lib/util') | ||
const {rebaseBraveStringFilesOnChromiumL10nFiles} = require('./l10nUtil') | ||
|
||
const chromiumRebaseL10n = (options) => { | ||
rebaseBraveStringFilesOnChromiumL10nFiles() | ||
} | ||
|
||
module.exports = chromiumRebaseL10n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,78 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
const path = require('path') | ||
const fs = require('fs') | ||
|
||
const srcDir = path.resolve(path.join(__dirname, '..', 'src')) | ||
|
||
// Brave string paths | ||
const braveStringsPath = path.resolve(path.join(srcDir, 'brave', 'app', 'brave_strings.grd')) | ||
const braveSettingsPartPath = path.resolve(path.join(srcDir, 'brave', 'app', 'settings_brave_strings.grdp')) | ||
const braveComponentsStringsPath = path.resolve(path.join(srcDir, 'brave', 'app', 'components_brave_strings.grd')) | ||
const braveExtensionMessagesPath = path.resolve(path.join(srcDir, 'brave', 'vendor', 'brave-extension', 'app', '_locales', 'en_US', 'messages.json')) | ||
const braveSpecificGeneratedResourcesPath = path.resolve(path.join(srcDir, 'brave', 'app', 'brave_generated_resources.grd')) | ||
const braveComponentsResourcesPath = path.resolve(path.join(srcDir, 'brave', 'components', 'resources', 'brave_components_resources.grd')) | ||
|
||
const braveGeneratedResourcesPath = path.resolve(path.join(srcDir, 'brave', 'app', 'generated_resources.grd')) | ||
const braveBookmarksPartPath = path.resolve(path.join(srcDir, 'brave', 'app', 'bookmarks_strings.grdp')) | ||
const braveMediaRouterPartPath = path.resolve(path.join(srcDir, 'brave', 'app', 'media_router_strings.grdp')) | ||
const braveSettingsStringsPartPath = path.resolve(path.join(srcDir, 'brave', 'app', 'settings_strings.grdp')) | ||
const braveMdExtensionsPartPath = path.resolve(path.join(srcDir, 'brave', 'app', 'md_extensions_strings.grdp')) | ||
|
||
const braveExtensionsResourcesPath = path.resolve(path.join(srcDir, 'brave', 'browser', 'resources', 'md_extensions', 'extensions_resources.grd')) | ||
const braveSettingsResourcesPath = path.resolve(path.join(srcDir, 'brave', 'browser', 'resources', 'settings', 'settings_resources.grd')) | ||
|
||
// Chromium string paths | ||
const chromiumStringsPath = path.resolve(path.join(srcDir, 'chrome', 'app', 'chromium_strings.grd')) | ||
const chroimumSettingsPartPath = path.resolve(path.join(srcDir, 'chrome', 'app', 'settings_chromium_strings.grdp')) | ||
const chromiumComponentsStringsPath = path.resolve(path.join(srcDir, 'components', 'components_chromium_strings.grd')) | ||
|
||
const chromiumGeneratedResourcesPath = path.resolve(path.join(srcDir, 'chrome', 'app', 'generated_resources.grd')) | ||
const chromiumBookmarksPartPath = path.resolve(path.join(srcDir, 'chrome', 'app', 'bookmarks_strings.grdp')) | ||
const chromiumMediaRouterPartPath = path.resolve(path.join(srcDir, 'chrome', 'app', 'media_router_strings.grdp')) | ||
const chromiumSettingsStringsPartPath = path.resolve(path.join(srcDir, 'chrome', 'app', 'settings_strings.grdp')) | ||
const chromiumMdExtensionsPartPath = path.resolve(path.join(srcDir, 'chrome', 'app', 'md_extensions_strings.grdp')) | ||
|
||
const chromiumExtensionsResourcesPath = path.resolve(path.join(srcDir, 'chrome', 'browser', 'resources', 'md_extensions', 'extensions_resources.grd')) | ||
const chromiumSettingsResourcesPath = path.resolve(path.join(srcDir, 'chrome', 'browser', 'resources', 'settings', 'settings_resources.grd')) | ||
|
||
module.exports.getSourceStringPaths = () => { | ||
return [ | ||
path.resolve(path.join(srcDir, 'brave', 'vendor', 'brave-extension', 'app', '_locales', 'en_US', 'messages.json')), | ||
path.resolve(path.join(srcDir, 'brave', 'app', 'brave_strings.grd')), | ||
path.resolve(path.join(srcDir, 'brave', 'app', 'components_brave_strings.grd')), | ||
path.resolve(path.join(srcDir, 'brave', 'components', 'resources', 'brave_components_resources.grd')) | ||
braveStringsPath, | ||
braveComponentsStringsPath, | ||
braveExtensionMessagesPath, | ||
braveSpecificGeneratedResourcesPath, | ||
braveComponentsResourcesPath, | ||
braveGeneratedResourcesPath, | ||
// No strings for now, uncomment if strings are added | ||
// path.resolve(path.join(srcDir, 'brave', 'browser', 'resources', 'brave_extension.grd')), | ||
// path.resolve(path.join(srcDir, 'brave', 'common', 'extensions', 'api', 'brave_api_resources.grd')), | ||
] | ||
|
||
} | ||
|
||
module.exports.rebaseBraveStringFilesOnChromiumL10nFiles = (path) => | ||
Object.entries({ | ||
[chromiumStringsPath]: braveStringsPath, | ||
[chroimumSettingsPartPath]: braveSettingsPartPath, | ||
[chromiumComponentsStringsPath]: braveComponentsStringsPath, | ||
[chromiumGeneratedResourcesPath]: braveGeneratedResourcesPath, | ||
[chromiumBookmarksPartPath]: braveBookmarksPartPath, | ||
[chromiumMediaRouterPartPath]: braveMediaRouterPartPath, | ||
[chromiumSettingsStringsPartPath]: braveSettingsStringsPartPath, | ||
[chromiumMdExtensionsPartPath]: braveMdExtensionsPartPath, | ||
[chromiumExtensionsResourcesPath]: braveExtensionsResourcesPath, | ||
[chromiumSettingsResourcesPath]: braveSettingsResourcesPath | ||
}).forEach(([sourcePath, destPath]) => | ||
fs.writeFileSync(destPath, | ||
fs.readFileSync(sourcePath, 'utf8') | ||
.replace('<structure name="IDR_MD_EXTENSIONS_SIDEBAR_HTML"', '<structure name="IDR_MD_EXTENSIONS_SIDEBAR_HTML" preprocess="true"') | ||
.replace('<structure name="IDR_SETTINGS_APPEARANCE_FONTS_PAGE_HTML"', '<structure name="IDR_SETTINGS_APPEARANCE_FONTS_PAGE_HTML" preprocess="true"') | ||
.replace('<structure name="IDR_SETTINGS_PASSWORDS_SECTION_HTML"', '<structure name="IDR_SETTINGS_PASSWORDS_SECTION_HTML" preprocess="true"') | ||
.replace(/settings_chromium_strings.grdp/g, 'settings_brave_strings.grdp') | ||
.replace(/The Chromium Authors/g, 'Brave Software Inc') | ||
.replace(/Google Chrome/g, 'Brave') | ||
.replace(/Chromium/g, 'Brave') | ||
.replace(/Chrome/g, 'Brave') | ||
.replace(/Google/g, 'Brave'), 'utf8')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.