Provide helpful errors when bucklets are missing
Based on experience, most users clone without --recursive, and don't
know to look for submodules when something fails. This causes the
first "buck build" to fail with a cryptic error:
[+] PARSING BUILD FILES...0.0s
Traceback (most recent call last):
File ".../buck-out/tmp/buck_run.TJfecZrGH8/buck3109317914122554851.py", line 1205, in <module>
main()
File ".../buck-out/tmp/buck_run.TJfecZrGH8/buck3109317914122554851.py", line 588, in main
buildFileProcessor.process(build_file.rstrip())
File ".../buck-out/tmp/buck_run.TJfecZrGH8/buck3109317914122554851.py", line 487, in process
build_env['BUILD_FILE_SYMBOL_TABLE'])
File "..././BUCK", line 2, in <module>
include_defs('//bucklets/maven_package.bucklet')
File ".../buck-out/tmp/buck_run.TJfecZrGH8/buck3109317914122554851.py", line 85, in invoke
return self.func(*args, **updated_kwargs)
File ".../buck-out/tmp/buck_run.TJfecZrGH8/buck3109317914122554851.py", line 403, in include_defs
execfile(include_file, build_env['BUILD_FILE_SYMBOL_TABLE'])
IOError: [Errno 2] No such file or directory: '.../bucklets/maven_package.bucklet'
BUILD FAILED: Parse error for BUCK file ./BUCK: End of input at line 1 column 1
Instead, provide a wrapper around include_defs specifically for
bucklets, which checks that the bucklets directory exists and is
non-empty. If it is empty, buck fails with a more useful error:
[+] PARSING BUILD FILES...0.2s
Bucklets directory is empty: .../gitiles/bucklets
Run `git submodule init`
BUILD FAILED: Parse error for BUCK file ./BUCK: End of input at line 1 column 1
The unfortunate chicken-and-egg problem with this approach is this
common functionality cannot live in the bucklets repo itself.
Change-Id: I767f582f8978075355203af126d253dfc28ea8cd
10 files changed