project.py: Add support for bazel wrapper bazelisk
Add --bazel option to allow to pass bazelisk. The default value for bazel executable is not changed and is still bazel. Change-Id: I1bc744b741d04f609c2e8b1c3d9144f820cd4f17
This commit is contained in:
@@ -51,13 +51,16 @@ opts.add_option('--plugins', help='create eclipse projects for plugins',
|
|||||||
action='store_true')
|
action='store_true')
|
||||||
opts.add_option('--name', help='name of the generated project',
|
opts.add_option('--name', help='name of the generated project',
|
||||||
action='store', default='gerrit', dest='project_name')
|
action='store', default='gerrit', dest='project_name')
|
||||||
|
opts.add_option('--bazel', help='name of the bazel executable',
|
||||||
|
action='store', default='bazel', dest='bazel_exe')
|
||||||
|
|
||||||
args, _ = opts.parse_args()
|
args, _ = opts.parse_args()
|
||||||
|
|
||||||
def retrieve_ext_location():
|
def retrieve_ext_location():
|
||||||
return check_output(['bazel', 'info', 'output_base']).strip()
|
return check_output([args.bazel_exe, 'info', 'output_base']).strip()
|
||||||
|
|
||||||
def gen_bazel_path():
|
def gen_bazel_path():
|
||||||
bazel = check_output(['which', 'bazel']).strip().decode('UTF-8')
|
bazel = check_output(['which', args.bazel_exe]).strip().decode('UTF-8')
|
||||||
with open(path.join(ROOT, ".bazel_path"), 'w') as fd:
|
with open(path.join(ROOT, ".bazel_path"), 'w') as fd:
|
||||||
fd.write("bazel=%s\n" % bazel)
|
fd.write("bazel=%s\n" % bazel)
|
||||||
fd.write("PATH=%s\n" % environ["PATH"])
|
fd.write("PATH=%s\n" % environ["PATH"])
|
||||||
@@ -66,7 +69,7 @@ def _query_classpath(target):
|
|||||||
deps = []
|
deps = []
|
||||||
t = cp_targets[target]
|
t = cp_targets[target]
|
||||||
try:
|
try:
|
||||||
check_call(['bazel', 'build', t])
|
check_call([args.bazel_exe, 'build', t])
|
||||||
except CalledProcessError:
|
except CalledProcessError:
|
||||||
exit(1)
|
exit(1)
|
||||||
name = 'bazel-bin/tools/eclipse/' + t.split(':')[1] + '.runtime_classpath'
|
name = 'bazel-bin/tools/eclipse/' + t.split(':')[1] + '.runtime_classpath'
|
||||||
@@ -276,7 +279,7 @@ try:
|
|||||||
makedirs(path.join(ROOT, gwt_working_dir))
|
makedirs(path.join(ROOT, gwt_working_dir))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
check_call(['bazel', 'build', MAIN, GWT, '//gerrit-patch-jgit:libEdit-src.jar'])
|
check_call([args.bazel_exe, 'build', MAIN, GWT, '//gerrit-patch-jgit:libEdit-src.jar'])
|
||||||
except CalledProcessError:
|
except CalledProcessError:
|
||||||
exit(1)
|
exit(1)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
Reference in New Issue
Block a user