-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
commands.js
executable file
·156 lines (139 loc) · 7.07 KB
/
commands.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/* 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 program = require('commander');
const path = require('path')
const fs = require('fs-extra')
const config = require('../lib/config')
const util = require('../lib/util')
const build = require('../lib/build')
const versions = require('../lib/versions')
const start = require('../lib/start')
const updatePatches = require('./updatePatches')
const pullL10n = require('../lib/pullL10n')
const pushL10n = require('../lib/pushL10n')
const chromiumRebaseL10n = require('../lib/chromiumRebaseL10n')
const createDist = require('../lib/createDist')
const upload = require('../lib/upload')
const test = require('../lib/test')
const collect = (value, accumulator) => {
accumulator.push(value)
return accumulator
}
const parsedArgs = program.parseOptions(process.argv)
program
.version(process.env.npm_package_version)
program
.command('versions')
.action(versions)
program
.command('build')
.option('-C <build_dir>', 'build config (out/Debug, out/Release')
.option('--target_os <target_os>', 'target OS')
.option('--target_arch <target_arch>', 'target architecture', 'x64')
.option('--target_apk_base <target_apk_base>', 'target Android OS apk (classic, modern, mono)', 'classic')
.option('--android_override_version_name <android_override_version_name>', 'Android version number')
.option('--mac_signing_identifier <id>', 'The identifier to use for signing')
.option('--mac_signing_keychain <keychain>', 'The identifier to use for signing', 'login')
.option('--debug_build <debug_build>', 'keep debugging symbols')
.option('--official_build <official_build>', 'force official build settings')
.option('--brave_google_api_key <brave_google_api_key>')
.option('--brave_google_api_endpoint <brave_google_api_endpoint>')
.option('--brave_infura_project_id <brave_infura_project_id>')
.option('--channel <target_chanel>', 'target channel to build', /^(beta|dev|nightly|release)$/i, 'release')
.option('--ignore_compile_failure', 'Keep compiling regardless of error')
.option('--skip_signing', 'skip signing binaries')
.option('--xcode_gen <target>', 'Generate an Xcode workspace ("ios" or a list of semi-colon separated label patterns, run `gn help label_pattern` for more info.')
.option('--gn <arg>', 'Additional gn args, in the form <key>:<value>', collect, [])
.option('--ninja <opt>', 'Additional Ninja command-line options, in the form <key>:<value>', collect, [])
.arguments('[build_config]')
.action(build)
program
.command('create_dist')
.option('-C <build_dir>', 'build config (out/Debug, out/Release')
.option('--target_arch <target_arch>', 'target architecture', 'x64')
.option('--mac_signing_identifier <id>', 'The identifier to use for signing')
.option('--mac_installer_signing_identifier <id>', 'The identifier to use for signing the installer')
.option('--mac_signing_keychain <keychain>', 'The identifier to use for signing', 'login')
.option('--debug_build <debug_build>', 'keep debugging symbols')
.option('--official_build <official_build>', 'force official build settings')
.option('--brave_google_api_key <brave_google_api_key>')
.option('--brave_google_api_endpoint <brave_google_api_endpoint>')
.option('--brave_infura_project_id <brave_infura_project_id>')
.option('--channel <target_chanel>', 'target channel to build', /^(beta|dev|nightly|release)$/i, 'release')
.option('--build_omaha', 'build omaha stub/standalone installer')
.option('--tag_ap <ap>', 'ap for stub/standalone installer')
.option('--skip_signing', 'skip signing dmg/brave_installer.exe')
.option('--notarize', 'notarize the macOS app with Apple')
.arguments('[build_config]')
.action(createDist)
program
.command('upload')
.option('--target_arch <target_arch>', 'target architecture', 'x64')
.action(upload)
program
.command('start')
.allowUnknownOption(true)
.option('--v [log_level]', 'set log level to [log_level]', parseInt, '0')
.option('--vmodule [modules]', 'verbose log from specific modules')
.option('--user_data_dir_name [base_name]', 'set user data directory base name to [base_name]')
.option('--no_sandbox', 'disable the sandbox')
.option('--disable_brave_extension', 'disable loading the Brave extension')
.option('--disable_brave_rewards_extension', 'disable loading the Brave Rewards extension')
.option('--disable_pdfjs_extension', 'disable loading the PDFJS extension')
.option('--disable_webtorrent_extension', 'disable loading the WebTorrent extension')
.option('--ui_mode <ui_mode>', 'which built-in ui appearance mode to use', /^(dark|light)$/i)
.option('--show_component_extensions', 'show component extensions in chrome://extensions')
.option('--enable_brave_update', 'enable brave update')
.option('--channel <target_chanel>', 'target channel to start', /^(beta|dev|nightly|release)$/i, 'release')
.option('--official_build <official_build>', 'force official build settings')
// See https://github.com/brave/brave-browser/wiki/Rewards#flags for more information
.option('--rewards [options]', 'options for rewards')
.option('--brave_ads_testing', 'ads testing')
.option('--brave_ads_production', 'ads production')
.option('--brave_ads_staging', 'ads staging')
.option('--brave_ads_debug', 'ads debug')
.option('--single_process', 'use a single process')
.option('--network_log', 'log network activity to network_log.json')
.option('--output_path [pathname]', 'use the Brave binary located at [pathname]')
.arguments('[build_config]')
.action(start.bind(null, parsedArgs.unknown))
program
.command('pull_l10n')
.option('--extension <extension>', 'Scope this command to localize a Brave extension such as ethereum-remote-client')
.action(pullL10n)
program
.command('push_l10n')
.option('--extension <extension>', 'Scope this command to localize a Brave extension such as ethereum-remote-client')
.action(pushL10n)
program
.command('chromium_rebase_l10n')
.action(chromiumRebaseL10n)
program
.command('update_patches')
.action(updatePatches)
program
.command('cibuild')
.option('--target_arch <target_arch>', 'target architecture', 'x64')
.action((options) => {
options.official_build = true
build('Release', options)
})
program
.command('test <suite>')
.option('--v [log_level]', 'set log level to [log_level]', parseInt, '0')
.option('--filter <filter>', 'set test filter')
.option('--output <output>', 'set test output (results) file path')
.option('--disable_brave_extension', 'disable loading the Brave extension')
.option('--single_process', 'uses a single process to run tests to help with debugging')
.option('--test_launcher_jobs <test_launcher_jobs>', 'Number of jobs to launch')
.option('--target_os <target_os>', 'target OS')
.option('--target_arch <target_arch>', 'target architecture', 'x64')
.arguments('[build_config]')
.action(test)
program
.command('lint')
.option('--base <base branch>', 'set the destination branch for the PR')
.action(util.lint)
program
.parse(process.argv)