-
Notifications
You must be signed in to change notification settings - Fork 7.1k
[Java] Build Java code with Bazel #4284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6ff919e
a396961
ce314ff
a1e7ea0
c39a75b
268e694
c63eb04
c2bc0d8
1b8a5a4
40c0b62
8eb90fa
bded0ae
0263855
a3ecbd7
470518b
2b69448
2aa6ceb
172e8cc
99eea65
1eec35f
e25e66e
3a2acd9
ec17991
fb93804
38f70ac
248cdef
7fbe6ac
13ece31
9b6f46d
a6cfd79
301eab5
5540b93
e745a05
a293816
e296c0b
27b9e97
f73ec2b
29ed8bb
50bb868
ed909b2
d4707f2
f1f6e21
0c79831
b64a029
ae02b6a
6236d59
91666b7
f9d3cc4
0a0c525
9006b29
2247b0b
29f45c8
a064c0a
70f8238
f432bb3
35a0be0
168a430
85641ae
12abf44
9f35289
bfe211d
ee495bb
43dfbcf
86b7de0
dcb1c21
b62e8c8
04397ea
61d0eb9
eaae232
5470647
621ad88
5b83532
af00ed9
87f183c
2d64515
755efc7
8674a68
84d5d31
2324c67
c9a6361
d644522
16d9dd6
82007d1
c4de040
fcdc856
3a1c838
a2bf5ce
2b3d922
cc5d784
36a20d6
575564d
9954544
fe54544
a11045f
c0276b4
5364ebe
90b94be
72fe9a5
cb4fc92
e0fa777
f9d371a
2435f51
f58b6a6
40ceb4e
c287290
d002e5b
c285710
326f5a2
5613347
723afbd
f9a1344
48030ad
520c40a
27150f3
3b900e5
5060a41
347b147
f0e3656
606a876
abccca9
b504a22
cd0f583
6477aca
60073ae
9d1fed2
c71acfe
330301b
28c9169
ba2b535
7943543
101fbd1
8c756d0
67b628f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # build config | ||
| build --compilation_mode=opt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,15 @@ | ||
| workspace(name = "com_github_ray_project_ray") | ||
|
|
||
| load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository") | ||
| load("//java:repo.bzl", "java_repositories") | ||
|
|
||
| java_repositories() | ||
|
|
||
| git_repository( | ||
| name = "com_github_checkstyle_java", | ||
| commit = "85f37871ca03b9d3fee63c69c8107f167e24e77b", | ||
| remote = "https://github.com/ruifangChen/checkstyle_java", | ||
| ) | ||
|
|
||
| git_repository( | ||
| name = "com_github_nelhage_rules_boost", | ||
|
|
@@ -38,8 +49,8 @@ new_git_repository( | |
| new_git_repository( | ||
| name = "plasma", | ||
| build_file = "@//bazel:BUILD.plasma", | ||
| commit = "6a27c660ea700febf6fd73b2e851ab96e9315134", | ||
| remote = "https://github.com/ray-project/arrow", | ||
| commit = "9c33e1aee98f96a82c6a0b6bb214df172a143fb1", | ||
| remote = "https://github.com/apache/arrow", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that #4385 is almost ready to merge now, I think it makes sense to wait for it, since then both the pyarrow wheels and the bazel sources will be in sync and we can avoid having a master with the leak. If we can get #4385 merged tomorrow let's wait for it and otherwise I'm happy to merge this PR first.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, let's wait till tomorrow then. |
||
| ) | ||
|
|
||
| new_git_repository( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,14 +121,15 @@ else | |
| $PYTHON_EXECUTABLE -m pip install \ | ||
| --target=$ROOT_DIR/python/ray/pyarrow_files pyarrow==0.12.0.RAY \ | ||
| --find-links https://s3-us-west-2.amazonaws.com/arrow-wheels/9357dc130789ee42f8181d8724bee1d5d1509060/index.html | ||
| bazel build //:ray_pkg -c opt --verbose_failures --action_env=PYTHON_BIN_PATH=$PYTHON_EXECUTABLE | ||
| # Copy files and keep them writeable. This is a workaround, as Bazel | ||
| # marks all generated files non-writeable. If we would just copy them | ||
| # over without adding write permission, the copy would fail the next time. | ||
| # TODO(pcm): It would be great to have a solution here that does not | ||
| # require us to copy the files. | ||
| find $ROOT_DIR/bazel-genfiles/ray_pkg/ -exec chmod +w {} \; | ||
| cp -r $ROOT_DIR/bazel-genfiles/ray_pkg/ray $ROOT_DIR/python || true | ||
|
|
||
| if [ "$RAY_BUILD_JAVA" == "YES" ]; then | ||
| bazel run //java:bazel_deps -- generate -r $ROOT_DIR -s java/third_party/workspace.bzl -d java/dependencies.yaml | ||
| bazel build //java:all --verbose_failures --action_env=PATH | ||
| fi | ||
|
|
||
| if [ "$RAY_BUILD_PYTHON" == "YES" ]; then | ||
| bazel build //:ray_pkg --verbose_failures --action_env=PYTHON_BIN_PATH=$PYTHON_EXECUTABLE | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the past I think we needed -c opt to be able to compile on mac (otherwise there was some clash with a macro names "DEBUG"), but not sure if that's still the case.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the clash is still there.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, let's revert this change, we should not assume people are modifying their We can also try to find another solution (e.g. remove the clash).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pcmoritz I didn't make myself clear. we added a project-local
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, great! |
||
| fi | ||
| fi | ||
|
|
||
| popd | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pcmoritz by setting
local = 1here, thisgenrulecan copy the files directly to the project dir. So we don't need to copy them inbulid.sh.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified that this can still work even if
bazel buildis called from a non-root dir.@alegithub111 nice fix!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, this is a great find :) I'm glad we can get rid of the copy and meddling with the permissions!