终于 TMD 编译出来了,记录一下,方便后人:)
按照如下顺序操作,一定要按顺序:
git clone
https://gerrit.googlesource.com/plugins/events-logcd events-log
git checkout stable-2.12
git clone
https://gerrit.googlesource.com/bucklets~/buck/bin/buck build plugin
这样就好了,bucklets 要在 events-log 目录下,建立软链接 build 会报错:
BUILD FAILED: Target //bucklets/tools:download_file contains input files under a path which contains a symbolic link ({bucklets=/home/gerrit2/gerrit_src/bucklets}). To resolve this, use separate rules and declare dependencies instead of using symbolic links.
If the symlink points to a read-only filesystem, you can specify it in the project.read_only_paths .buckconfig setting. Buck will assume files under that path will never change.
This error happened while trying to get dependency '//bucklets/tools:download_file' of target '//lib:gson__download_bin'
删掉软链接也会报错:
BUILD FAILED: Buck wasn't able to parse /home/gerrit2/gerrit_src/events-log/BUCK:
IOError: [Errno 2] No such file or directory: '/home/gerrit2/gerrit_src/events-log/bucklets/gerrit_plugin.bucklet'
Call stack:
File "/root/buck/python-dsl/buck_parser/
buck.py", line 1188, in process_with_diagnostics
diagnostics=diagnostics)
File "/root/buck/python-dsl/buck_parser/
buck.py", line 1079, in process
os.path.join(self._project_root, path))
File "/root/buck/python-dsl/buck_parser/
buck.py", line 1073, in _process_build_file
return self._process(build_env, path, is_implicit_include=False)
File "/root/buck/python-dsl/buck_parser/
buck.py", line 1033, in _process
exec(code, module.__dict__)
File "/home/gerrit2/gerrit_src/events-log/BUCK", line 1
include_defs('//bucklets/gerrit_plugin.bucklet')
File "/root/buck/python-dsl/buck_parser/
buck.py", line 807, in _include_defs
inner_env, mod = self._process_include(path, is_implicit_include)
File "/root/buck/python-dsl/buck_parser/
buck.py", line 1047, in _process_include
return self._process(build_env, path, is_implicit_include=is_implicit_include)
File "/root/buck/python-dsl/buck_parser/
buck.py", line 1022, in _process
with open(path, 'r') as f:
TMD 最后我把 bucklets 目录放到 events-log 目录下,完美编译出来了
如果报错:
BUILD FAILED: //:events-log__plugin failed:
javac -source 7 -target 7 -sourcepath -g -proc:none -d /home/gerrit2/gerrit_src/events-log/buck-out/bin/lib__events-log__plugin__classes -classpath /home/gerrit2/gerrit_src/events-log/buck-out/gen/lib/__gson__/gson-2.3.1.jar:/home/gerrit2/gerrit_src/events-log/buck-out/gen/lib/commons/__dbcp__/commons-dbcp-1.4.jar:/home/gerrit2/gerrit_src/events-log/buck-out/gen/lib/commons/__pool__/commons-pool-1.5.5.jar:/home/gerrit2/gerrit_src/events-log/buck-out/gen/lib/gerrit/__plugin-api__/gerrit-plugin-api-2.12.jar @
buck-out/gen/__events-log__plugin__srcs
No system compiler found. Did you install the JRE instead of the JDK?
那么重新设置一下 java 编译器 使用命令“ update-alternatives --config java ”