[project.py] Add bazel --batch option

When communication between the bazel server and client are blocked
by some (still under investigation [1]) security policy, the only
option is to build with the --batch option. Generating the Eclipse
project, though, was failing because there was no way to pass this
option to the script.

[1] https://github.com/bazelbuild/bazel/issues/3602

Change-Id: I4ae6fdb4df757cd5333e70c13cdded588ec8e194
This commit is contained in:
Hector Oswaldo Caballero 2018-01-08 21:54:03 -05:00
parent 345ac817f5
commit 309f0e0d79

View File

@ -51,10 +51,22 @@ opts.add_option('--plugins', help='create eclipse projects for plugins',
action='store_true')
opts.add_option('--name', help='name of the generated project',
action='store', default='gerrit', dest='project_name')
opts.add_option('-b', '--batch', action='store_true',
dest='batch', help='Bazel batch option')
args, _ = opts.parse_args()
batch_option = '--batch' if args.batch else None
def _build_bazel_cmd(*args):
cmd = ['bazel']
if batch_option:
cmd.append('--batch')
for arg in args:
cmd.append(arg)
return cmd
def retrieve_ext_location():
return check_output(['bazel', 'info', 'output_base']).strip()
return check_output(_build_bazel_cmd('info', 'output_base')).strip()
def gen_bazel_path():
bazel = check_output(['which', 'bazel']).strip()
@ -66,7 +78,7 @@ def _query_classpath(target):
deps = []
t = cp_targets[target]
try:
check_call(['bazel', 'build', t])
check_call(_build_bazel_cmd('build', t))
except CalledProcessError:
exit(1)
name = 'bazel-bin/tools/eclipse/' + t.split(':')[1] + '.runtime_classpath'
@ -277,7 +289,7 @@ try:
makedirs(path.join(ROOT, gwt_working_dir))
try:
check_call(['bazel', 'build', MAIN, GWT, '//java/org/eclipse/jgit:libEdit-src.jar'])
check_call(_build_bazel_cmd('build', MAIN, GWT, '//java/org/eclipse/jgit:libEdit-src.jar'))
except CalledProcessError:
exit(1)
except KeyboardInterrupt: