move submodules to brave-core
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[submodule "vendor/depot_tools"]
|
||||
path = vendor/depot_tools
|
||||
url = https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
@@ -15,6 +15,7 @@ deps = {
|
||||
"vendor/bat-native-tweetnacl": "https://github.com/brave-intl/bat-native-tweetnacl.git@800f9d40b7409239ff192e0be634764e747c7a75",
|
||||
"vendor/bat-native-usermodel": "https://github.com/brave-intl/bat-native-usermodel.git@02b8c81c94072c67fe00108feb90786e088d4d26",
|
||||
"vendor/challenge_bypass_ristretto_ffi": "https://github.com/brave-intl/challenge-bypass-ristretto-ffi.git@c396fb4eb9e9bf63b89ae5a0ec0b5f201d43c7c5",
|
||||
"vendor/gn-project-generators": "https://github.com/brave/gn-project-generators.git@b76e14b162aa0ce40f11920ec94bfc12da29e5d0",
|
||||
}
|
||||
|
||||
hooks = [
|
||||
|
||||
@@ -68,7 +68,6 @@ const Config = function () {
|
||||
this.buildTarget = 'brave'
|
||||
this.rootDir = rootDir
|
||||
this.scriptDir = path.join(this.rootDir, 'scripts')
|
||||
this.depotToolsDir = path.join(this.rootDir, 'vendor', 'depot_tools')
|
||||
this.srcDir = path.join(this.rootDir, 'src')
|
||||
this.chromeVersion = this.getProjectVersion('chrome')
|
||||
this.chromiumRepo = getNPMConfig(['projects', 'chrome', 'repository', 'url'])
|
||||
@@ -76,6 +75,7 @@ const Config = function () {
|
||||
this.braveCoreRepo = getNPMConfig(['projects', 'brave-core', 'repository', 'url'])
|
||||
this.buildToolsDir = path.join(this.srcDir, 'build')
|
||||
this.resourcesDir = path.join(this.rootDir, 'resources')
|
||||
this.depotToolsDir = path.join(this.braveCoreDir, 'vendor', 'depot_tools')
|
||||
this.defaultGClientFile = path.join(this.rootDir, '.gclient')
|
||||
this.gClientFile = process.env.BRAVE_GCLIENT_FILE || this.defaultGClientFile
|
||||
this.gClientVerbose = getNPMConfig(['gclient_verbose']) || false
|
||||
|
||||
@@ -533,7 +533,7 @@ const util = {
|
||||
console.log('generating Xcode workspace for "' + config.xcode_gen_target + '"...')
|
||||
|
||||
const args = util.buildArgsToString(config.buildArgs())
|
||||
const genScript = path.join(config.rootDir, 'vendor', 'gn-project-generators', 'xcode.py')
|
||||
const genScript = path.join(config.braveCoreDir, 'vendor', 'gn-project-generators', 'xcode.py')
|
||||
|
||||
const genArgs = [
|
||||
'gen', config.outputDir + "_Xcode",
|
||||
@@ -558,52 +558,6 @@ const util = {
|
||||
'--base_branch=' + options.base], cmd_options)
|
||||
},
|
||||
|
||||
fixDepotTools: (options = {}) => {
|
||||
if (process.platform !== 'win32') {
|
||||
util.run('git', ['-C', config.depotToolsDir, 'clean', '-fxd'], options)
|
||||
util.run('git', ['-C', config.depotToolsDir, 'reset', '--hard', 'HEAD'], options)
|
||||
return
|
||||
}
|
||||
// On Windows:
|
||||
// When depot_tools are already installed they redirect git to their own
|
||||
// version which resides in a bootstrap-*_bin directory. So when we try to
|
||||
// do git clean -fxd we fail because the git executable is in use in that
|
||||
// directory. Get around that by using regular git.
|
||||
let git_exes = util.run('where', ['git'], {shell: true})
|
||||
let git_exe = '"' + git_exes.stdout.toString().split(os.EOL)[0] + '"'
|
||||
if (git_exe === '""') git_exe = 'git'
|
||||
util.run(git_exe, ['-C', config.depotToolsDir, 'clean', '-fxd'], options)
|
||||
util.run(git_exe, ['-C', config.depotToolsDir, 'reset', '--hard', 'HEAD'], options)
|
||||
|
||||
// Get around the error in updating depot_tools on windows due to pylint.bat
|
||||
// file transitioning from untracked to a committed file. When
|
||||
// update_depot_tools script tries to use git rebase it errors out. This is
|
||||
// already fixed upstream, but we need a workaround for
|
||||
// now. See https://bugs.chromium.org/p/chromium/issues/detail?id=996359
|
||||
// The commit id in git merge-base command below is when pylint.bat was
|
||||
// added to git.
|
||||
let cmd_options = Object.assign({}, options)
|
||||
cmd_options.continueOnFail = true
|
||||
let is_fixed = util.run('git',
|
||||
['-C', config.depotToolsDir, 'merge-base', '--is-ancestor', '53297790de09e48c91678367b48528afbc9f71c1', 'HEAD'], cmd_options)
|
||||
// If merge-base succeeds the exit code is 0.
|
||||
if (!is_fixed.status) return
|
||||
console.log("Manually updating depot_tools as a workaround for https://crbug.com/996359")
|
||||
util.run('git', ['-C', config.depotToolsDir, 'fetch', 'origin'], options)
|
||||
util.run('git', ['-C', config.depotToolsDir, 'checkout', 'origin/master'], options)
|
||||
util.run('git', ['-C', config.depotToolsDir, 'reset', '--hard', 'origin/master'], options)
|
||||
},
|
||||
|
||||
submoduleSync: (options = {}) => {
|
||||
Log.progress('Updating submodules...')
|
||||
if (!options.cwd) options.cwd = config.rootDir // default cwd `./src` may not exist yet
|
||||
options = mergeWithDefault(options)
|
||||
util.run('git', ['submodule', 'sync'], options)
|
||||
util.run('git', ['submodule', 'update', '--init', '--recursive'], options)
|
||||
util.fixDepotTools(options)
|
||||
Log.progress('Done updating submodules...')
|
||||
},
|
||||
|
||||
shouldUpdateChromium: (chromiumRef = config.getProjectRef('chrome')) => {
|
||||
const headSHA = util.runGit(config.srcDir, ['rev-parse', 'HEAD'], true)
|
||||
const targetSHA = util.runGit(config.srcDir, ['rev-parse', chromiumRef], true)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// 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 fs = require('fs')
|
||||
const program = require('commander')
|
||||
const config = require('../lib/config')
|
||||
const util = require('../lib/util')
|
||||
@@ -18,12 +19,53 @@ program
|
||||
.option('--target_os <target_os>', 'target OS')
|
||||
.option('--target_arch <target_arch>', 'target architecture')
|
||||
.option('--target_apk_base <target_apk_base>', 'target Android OS apk (classic, modern, mono)')
|
||||
.option('--submodule_sync', 'run submodule sync')
|
||||
.option('--init', 'initialize all dependencies')
|
||||
.option('--all', 'This flag is deprecated and no longer has any effect')
|
||||
.option('--force', 'force reset all projects to origin/ref')
|
||||
.option('--create', 'create a new branch if needed for [ref]')
|
||||
|
||||
const installDepotTools = (options = config.defaultOptions) => {
|
||||
options.cwd = config.braveCoreDir
|
||||
|
||||
util.run('git', ['submodule', 'sync'], options)
|
||||
util.run('git', ['submodule', 'update', '--init', '--recursive'], options)
|
||||
|
||||
// fixup depot tools after update
|
||||
if (process.platform !== 'win32') {
|
||||
util.run('git', ['-C', config.depotToolsDir, 'clean', '-fxd'], options)
|
||||
util.run('git', ['-C', config.depotToolsDir, 'reset', '--hard', 'HEAD'], options)
|
||||
return
|
||||
}
|
||||
// On Windows:
|
||||
// When depot_tools are already installed they redirect git to their own
|
||||
// version which resides in a bootstrap-*_bin directory. So when we try to
|
||||
// do git clean -fxd we fail because the git executable is in use in that
|
||||
// directory. Get around that by using regular git.
|
||||
let git_exes = util.run('where', ['git'], {shell: true})
|
||||
let git_exe = '"' + git_exes.stdout.toString().split(os.EOL)[0] + '"'
|
||||
if (git_exe === '""') git_exe = 'git'
|
||||
util.run(git_exe, ['-C', config.depotToolsDir, 'clean', '-fxd'], options)
|
||||
util.run(git_exe, ['-C', config.depotToolsDir, 'reset', '--hard', 'HEAD'], options)
|
||||
|
||||
// Get around the error in updating depot_tools on windows due to pylint.bat
|
||||
// file transitioning from untracked to a committed file. When
|
||||
// update_depot_tools script tries to use git rebase it errors out. This is
|
||||
// already fixed upstream, but we need a workaround for
|
||||
// now. See https://bugs.chromium.org/p/chromium/issues/detail?id=996359
|
||||
// The commit id in git merge-base command below is when pylint.bat was
|
||||
// added to git.
|
||||
let cmd_options = Object.assign({}, options)
|
||||
cmd_options.continueOnFail = true
|
||||
let is_fixed = util.run('git',
|
||||
['-C', config.depotToolsDir, 'merge-base', '--is-ancestor', '53297790de09e48c91678367b48528afbc9f71c1', 'HEAD'], cmd_options)
|
||||
// If merge-base succeeds the exit code is 0.
|
||||
if (!is_fixed.status) return
|
||||
console.log("Manually updating depot_tools as a workaround for https://crbug.com/996359")
|
||||
util.run('git', ['-C', config.depotToolsDir, 'fetch', 'origin'], options)
|
||||
util.run('git', ['-C', config.depotToolsDir, 'checkout', 'origin/master'], options)
|
||||
util.run('git', ['-C', config.depotToolsDir, 'reset', '--hard', 'origin/master'], options)
|
||||
}
|
||||
|
||||
async function RunCommand () {
|
||||
program.parse(process.argv)
|
||||
config.update(program)
|
||||
@@ -32,8 +74,10 @@ async function RunCommand () {
|
||||
Log.warn('--all, --run_hooks and --run_sync are deprecated. Will behave as if flag was not passed. Please update your command to `npm run sync` in the future.')
|
||||
}
|
||||
|
||||
if (program.init || program.submodule_sync) {
|
||||
util.submoduleSync()
|
||||
if (program.init || !fs.existsSync(config.depotTooldDir)) {
|
||||
Log.progress('Updating submodules...')
|
||||
installDepotTools()
|
||||
Log.progress('Done updating submodules...')
|
||||
}
|
||||
|
||||
if (program.init) {
|
||||
|
||||
+1
Submodule vendor/depot_tools added at 343f63643b
Reference in New Issue
Block a user