Skip to content
This repository was archived by the owner on Aug 11, 2023. It is now read-only.

Commit cc8f806

Browse files
authored
Add Bazel build files for the tutorial (#269)
This also allows other Bazel projects to include rosjava_core as an external repository, as instructed in README.md. This uses https://github.com/johnynek/bazel-deps to describe the Maven dependencies. As a result, 3rdparty/ contains autogenerated files, and the other files contain a hand-written description of the BUILD.
1 parent 8861658 commit cc8f806

File tree

25 files changed

+515
-1
lines changed

25 files changed

+515
-1
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ bin
88
.settings
99
*.iml
1010
.idea
11-
11+
bazel-*

3rdparty/BUILD

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
java_library(
3+
name = "jsr305",
4+
exports = [
5+
"//external:jar/com/google/code/findbugs/jsr305"
6+
],
7+
visibility = [
8+
"//visibility:public"
9+
]
10+
)
11+
12+

3rdparty/jvm/com/google/guava/BUILD

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
java_library(
3+
name = "guava",
4+
exports = [
5+
"//external:jar/com/google/guava/guava"
6+
],
7+
runtime_deps = [
8+
"//3rdparty/jvm/com/google/code/findbugs:jsr305"
9+
],
10+
visibility = [
11+
"//visibility:public"
12+
]
13+
)
14+
15+

3rdparty/jvm/commons_pool/BUILD

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
java_library(
3+
name = "commons_pool",
4+
exports = [
5+
"//external:jar/commons_pool/commons_pool"
6+
],
7+
visibility = [
8+
"//visibility:public"
9+
]
10+
)
11+
12+

3rdparty/jvm/dnsjava/BUILD

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
java_library(
3+
name = "dnsjava",
4+
exports = [
5+
"//external:jar/dnsjava/dnsjava"
6+
],
7+
runtime_deps = [
8+
"//3rdparty/jvm/junit:junit"
9+
],
10+
visibility = [
11+
"//visibility:public"
12+
]
13+
)
14+
15+

3rdparty/jvm/io/netty/BUILD

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
java_library(
3+
name = "netty",
4+
exports = [
5+
"//external:jar/io/netty/netty"
6+
],
7+
visibility = [
8+
"//visibility:public"
9+
]
10+
)
11+
12+

3rdparty/jvm/junit/BUILD

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
java_library(
3+
name = "junit",
4+
exports = [
5+
"//external:jar/junit/junit"
6+
],
7+
visibility = [
8+
"//visibility:public"
9+
]
10+
)
11+
12+

3rdparty/jvm/org/apache/commons/BUILD

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
java_library(
3+
name = "com_springsource_org_apache_commons_codec",
4+
exports = [
5+
"//external:jar/org/apache/commons/com_springsource_org_apache_commons_codec"
6+
],
7+
visibility = [
8+
"//visibility:public"
9+
]
10+
)
11+
12+
13+
14+
java_library(
15+
name = "com_springsource_org_apache_commons_httpclient",
16+
exports = [
17+
"//external:jar/org/apache/commons/com_springsource_org_apache_commons_httpclient"
18+
],
19+
runtime_deps = [
20+
":com_springsource_org_apache_commons_codec",
21+
":com_springsource_org_apache_commons_logging"
22+
],
23+
visibility = [
24+
"//visibility:public"
25+
]
26+
)
27+
28+
29+
30+
java_library(
31+
name = "com_springsource_org_apache_commons_io",
32+
exports = [
33+
"//external:jar/org/apache/commons/com_springsource_org_apache_commons_io"
34+
],
35+
visibility = [
36+
"//visibility:public"
37+
]
38+
)
39+
40+
41+
42+
java_library(
43+
name = "com_springsource_org_apache_commons_lang",
44+
exports = [
45+
"//external:jar/org/apache/commons/com_springsource_org_apache_commons_lang"
46+
],
47+
visibility = [
48+
"//visibility:public"
49+
]
50+
)
51+
52+
53+
54+
java_library(
55+
name = "com_springsource_org_apache_commons_logging",
56+
exports = [
57+
"//external:jar/org/apache/commons/com_springsource_org_apache_commons_logging"
58+
],
59+
visibility = [
60+
"//visibility:public"
61+
]
62+
)
63+
64+
65+
66+
java_library(
67+
name = "com_springsource_org_apache_commons_net",
68+
exports = [
69+
"//external:jar/org/apache/commons/com_springsource_org_apache_commons_net"
70+
],
71+
visibility = [
72+
"//visibility:public"
73+
]
74+
)
75+
76+
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
java_library(
3+
name = "ws_commons_util",
4+
exports = [
5+
"//external:jar/org/apache/ws/commons/ws_commons_util"
6+
],
7+
runtime_deps = [
8+
"//3rdparty/jvm/junit:junit",
9+
"//3rdparty/jvm/xml_apis:xml_apis"
10+
],
11+
visibility = [
12+
"//visibility:public"
13+
]
14+
)
15+
16+

3rdparty/jvm/org/mockito/BUILD

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
java_library(
3+
name = "mockito_all",
4+
exports = [
5+
"//external:jar/org/mockito/mockito_all"
6+
],
7+
visibility = [
8+
"//visibility:public"
9+
]
10+
)
11+
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
java_library(
3+
name = "gradle_plugins",
4+
exports = [
5+
"//external:jar/org/ros/rosjava_bootstrap/gradle_plugins"
6+
],
7+
visibility = [
8+
"//visibility:public"
9+
]
10+
)
11+
12+
13+
14+
java_library(
15+
name = "message_generation",
16+
exports = [
17+
"//external:jar/org/ros/rosjava_bootstrap/message_generation"
18+
],
19+
runtime_deps = [
20+
"//3rdparty/jvm/com/google/guava:guava",
21+
"//3rdparty/jvm/commons_pool:commons_pool",
22+
"//3rdparty/jvm/io/netty:netty",
23+
"//3rdparty/jvm/org/apache/commons:com_springsource_org_apache_commons_codec",
24+
"//3rdparty/jvm/org/apache/commons:com_springsource_org_apache_commons_io",
25+
"//3rdparty/jvm/org/apache/commons:com_springsource_org_apache_commons_lang",
26+
":gradle_plugins"
27+
],
28+
visibility = [
29+
"//visibility:public"
30+
]
31+
)
32+
33+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
java_library(
3+
name = "rosgraph_msgs",
4+
exports = [
5+
"//external:jar/org/ros/rosjava_messages/rosgraph_msgs"
6+
],
7+
runtime_deps = [
8+
"//3rdparty/jvm/org/ros/rosjava_bootstrap:message_generation",
9+
":std_msgs"
10+
],
11+
visibility = [
12+
"//visibility:public"
13+
]
14+
)
15+
16+
17+
18+
java_library(
19+
name = "std_msgs",
20+
exports = [
21+
"//external:jar/org/ros/rosjava_messages/std_msgs"
22+
],
23+
runtime_deps = [
24+
"//3rdparty/jvm/org/ros/rosjava_bootstrap:message_generation"
25+
],
26+
visibility = [
27+
"//visibility:public"
28+
]
29+
)
30+
31+

3rdparty/jvm/xml_apis/BUILD

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
java_library(
3+
name = "xml_apis",
4+
exports = [
5+
"//external:jar/xml_apis/xml_apis"
6+
],
7+
visibility = [
8+
"//visibility:public"
9+
]
10+
)
11+
12+

3rdparty/workspace.bzl

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Do not edit. bazel-deps autogenerates this file from dependencies.yaml.
2+
3+
def declare_maven(hash):
4+
native.maven_jar(
5+
name = hash["name"],
6+
artifact = hash["artifact"],
7+
sha1 = hash["sha1"],
8+
repository = hash["repository"]
9+
)
10+
native.bind(
11+
name = hash["bind"],
12+
actual = hash["actual"]
13+
)
14+
15+
def maven_dependencies(callback = declare_maven):
16+
callback({"artifact": "com.google.code.findbugs:jsr305:1.3.9", "lang": "java", "sha1": "40719ea6961c0cb6afaeb6a921eaa1f6afd4cfdf", "repository": "https://jcenter.bintray.com/", "name": "com_google_code_findbugs_jsr305", "actual": "@com_google_code_findbugs_jsr305//jar", "bind": "jar/com/google/code/findbugs/jsr305"})
17+
callback({"artifact": "com.google.guava:guava:12.0", "lang": "java", "sha1": "5bc66dd95b79db1e437eb08adba124a3e4088dc0", "repository": "https://jcenter.bintray.com/", "name": "com_google_guava_guava", "actual": "@com_google_guava_guava//jar", "bind": "jar/com/google/guava/guava"})
18+
callback({"artifact": "commons-pool:commons-pool:1.6", "lang": "java", "sha1": "4572d589699f09d866a226a14b7f4323c6d8f040", "repository": "https://jcenter.bintray.com/", "name": "commons_pool_commons_pool", "actual": "@commons_pool_commons_pool//jar", "bind": "jar/commons_pool/commons_pool"})
19+
callback({"artifact": "dnsjava:dnsjava:2.1.1", "lang": "java", "sha1": "5708df81cf6dbff545695f0be6380b7bbc85accc", "repository": "https://jcenter.bintray.com/", "name": "dnsjava_dnsjava", "actual": "@dnsjava_dnsjava//jar", "bind": "jar/dnsjava/dnsjava"})
20+
callback({"artifact": "io.netty:netty:3.5.13.Final", "lang": "java", "sha1": "389edea561995909d5df3e70fb2c49954ac79a54", "repository": "https://jcenter.bintray.com/", "name": "io_netty_netty", "actual": "@io_netty_netty//jar", "bind": "jar/io/netty/netty"})
21+
# duplicates in junit:junit fixed to 4.8.2
22+
# - org.apache.ws.commons:ws-commons-util:1.0.1 wanted version 3.8.1
23+
# - dnsjava:dnsjava:2.1.1 wanted version 3.8.2
24+
callback({"artifact": "junit:junit:4.8.2", "lang": "java", "sha1": "c94f54227b08100974c36170dcb53329435fe5ad", "repository": "https://jcenter.bintray.com/", "name": "junit_junit", "actual": "@junit_junit//jar", "bind": "jar/junit/junit"})
25+
callback({"artifact": "org.apache.commons:com.springsource.org.apache.commons.codec:1.3.0", "lang": "java", "sha1": "f8690570eb0913d750262bb4223eed30b0d619ed", "repository": "https://jcenter.bintray.com/", "name": "org_apache_commons_com_springsource_org_apache_commons_codec", "actual": "@org_apache_commons_com_springsource_org_apache_commons_codec//jar", "bind": "jar/org/apache/commons/com_springsource_org_apache_commons_codec"})
26+
callback({"artifact": "org.apache.commons:com.springsource.org.apache.commons.httpclient:3.1.0", "lang": "java", "sha1": "c493a925a091ac3d8f449d9265fe12482dabb2a7", "repository": "https://jcenter.bintray.com/", "name": "org_apache_commons_com_springsource_org_apache_commons_httpclient", "actual": "@org_apache_commons_com_springsource_org_apache_commons_httpclient//jar", "bind": "jar/org/apache/commons/com_springsource_org_apache_commons_httpclient"})
27+
callback({"artifact": "org.apache.commons:com.springsource.org.apache.commons.io:1.4.0", "lang": "java", "sha1": "51097cd000ec88214ff181c9f059947de1cf4a35", "repository": "https://jcenter.bintray.com/", "name": "org_apache_commons_com_springsource_org_apache_commons_io", "actual": "@org_apache_commons_com_springsource_org_apache_commons_io//jar", "bind": "jar/org/apache/commons/com_springsource_org_apache_commons_io"})
28+
callback({"artifact": "org.apache.commons:com.springsource.org.apache.commons.lang:2.4.0", "lang": "java", "sha1": "686e3713650c8e3a5d98723b4d3e239586bf9822", "repository": "https://jcenter.bintray.com/", "name": "org_apache_commons_com_springsource_org_apache_commons_lang", "actual": "@org_apache_commons_com_springsource_org_apache_commons_lang//jar", "bind": "jar/org/apache/commons/com_springsource_org_apache_commons_lang"})
29+
callback({"artifact": "org.apache.commons:com.springsource.org.apache.commons.logging:1.1.1", "lang": "java", "sha1": "7657caf2c78e1d79c74d36f2ae128a115f7cc180", "repository": "https://jcenter.bintray.com/", "name": "org_apache_commons_com_springsource_org_apache_commons_logging", "actual": "@org_apache_commons_com_springsource_org_apache_commons_logging//jar", "bind": "jar/org/apache/commons/com_springsource_org_apache_commons_logging"})
30+
callback({"artifact": "org.apache.commons:com.springsource.org.apache.commons.net:2.0.0", "lang": "java", "sha1": "03e78766072ff5a5cf3f5431d973c430c94ec612", "repository": "https://jcenter.bintray.com/", "name": "org_apache_commons_com_springsource_org_apache_commons_net", "actual": "@org_apache_commons_com_springsource_org_apache_commons_net//jar", "bind": "jar/org/apache/commons/com_springsource_org_apache_commons_net"})
31+
callback({"artifact": "org.apache.ws.commons:ws-commons-util:1.0.1", "lang": "java", "sha1": "126e80ff798fece634bc94e61f8be8a8da00be60", "repository": "https://jcenter.bintray.com/", "name": "org_apache_ws_commons_ws_commons_util", "actual": "@org_apache_ws_commons_ws_commons_util//jar", "bind": "jar/org/apache/ws/commons/ws_commons_util"})
32+
callback({"artifact": "org.mockito:mockito-all:1.8.5", "lang": "java", "sha1": "a927d8ae3b8d22eb745a74f94e59ce3882f2b524", "repository": "https://jcenter.bintray.com/", "name": "org_mockito_mockito_all", "actual": "@org_mockito_mockito_all//jar", "bind": "jar/org/mockito/mockito_all"})
33+
callback({"artifact": "org.ros.rosjava_bootstrap:gradle_plugins:0.3.0", "lang": "java", "sha1": "9915d897f3b5049e99b268068978a1bca0ae7b5d", "repository": "https://github.com/rosjava/rosjava_mvn_repo/raw/master", "name": "org_ros_rosjava_bootstrap_gradle_plugins", "actual": "@org_ros_rosjava_bootstrap_gradle_plugins//jar", "bind": "jar/org/ros/rosjava_bootstrap/gradle_plugins"})
34+
callback({"artifact": "org.ros.rosjava_bootstrap:message_generation:0.3.0", "lang": "java", "sha1": "5141e448f0ea6a2d6f539219d4fc9b296ff07ca4", "repository": "https://github.com/rosjava/rosjava_mvn_repo/raw/master", "name": "org_ros_rosjava_bootstrap_message_generation", "actual": "@org_ros_rosjava_bootstrap_message_generation//jar", "bind": "jar/org/ros/rosjava_bootstrap/message_generation"})
35+
callback({"artifact": "org.ros.rosjava_messages:rosgraph_msgs:1.11.2", "lang": "java", "sha1": "adb731dd5181976b23c217872f61c724a3af70fe", "repository": "https://github.com/rosjava/rosjava_mvn_repo/raw/master", "name": "org_ros_rosjava_messages_rosgraph_msgs", "actual": "@org_ros_rosjava_messages_rosgraph_msgs//jar", "bind": "jar/org/ros/rosjava_messages/rosgraph_msgs"})
36+
callback({"artifact": "org.ros.rosjava_messages:std_msgs:0.5.11", "lang": "java", "sha1": "a0191f0506dfecfc471eb199a119691717801c0e", "repository": "https://github.com/rosjava/rosjava_mvn_repo/raw/master", "name": "org_ros_rosjava_messages_std_msgs", "actual": "@org_ros_rosjava_messages_std_msgs//jar", "bind": "jar/org/ros/rosjava_messages/std_msgs"})
37+
callback({"artifact": "xml-apis:xml-apis:1.0.b2", "lang": "java", "sha1": "3136ca936f64c9d68529f048c2618bd356bf85c9", "repository": "https://jcenter.bintray.com/", "name": "xml_apis_xml_apis", "actual": "@xml_apis_xml_apis//jar", "bind": "jar/xml_apis/xml_apis"})

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,44 @@ code. The CLA protects you and us.
6060
Follow either of the two links above to access the appropriate CLA and
6161
instructions for how to sign and return it. Damon will respond on either github
6262
or email to confirm.
63+
64+
### Building with Bazel ###
65+
66+
To build this project with Bazel, simply run:
67+
68+
```
69+
bazel build //...
70+
```
71+
72+
To depend on `rosjava_core` from another project, you'll need to use
73+
[bazel-deps](https://github.com/johnynek/bazel-deps).
74+
75+
1. Start by copying (or merging) [dependencies.yaml][dependencies.yaml] in to
76+
your project.
77+
1. Follow the instructions in that file to generate the BUILD files inside your
78+
project.
79+
1. Add the following lines to your WORKSPACE file:
80+
81+
```
82+
load("//3rdparty:workspace.bzl", "maven_dependencies")
83+
84+
maven_dependencies()
85+
86+
git_repository(
87+
name = "com_github_rosjava_rosjava_core",
88+
commit = "{insert commit SHA for HEAD}",
89+
remote = "https://github.com/rosjava/rosjava_core.git",
90+
)
91+
92+
load("@com_github_rosjava_rosjava_core//bazel:repositories.bzl", "rosjava_repositories")
93+
94+
rosjava_repositories()
95+
```
96+
97+
*You may want to use `http_archive` instead of `git_repository` for the reasons
98+
described in the [Bazel docs][git-repository-docs].*
99+
100+
[git-repository-docs]: https://docs.bazel.build/versions/master/be/workspace.html#git_repository
101+
102+
You can now depend on rosjava targets (eg
103+
`@com_github_rosjava_rosjava_core//rosjava`) as required by your application.

WORKSPACE

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
workspace(name = "com_github_rosjava_rosjava_core")
2+
3+
load("//3rdparty:workspace.bzl", "maven_dependencies")
4+
5+
maven_dependencies()
6+
7+
load("//bazel:repositories.bzl", "rosjava_repositories")
8+
9+
rosjava_repositories()

apache_xmlrpc_client/BUILD.bazel

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
java_library(
2+
name = "apache_xmlrpc_client",
3+
srcs = glob([
4+
"src/main/**/*.java",
5+
]),
6+
resources = glob([
7+
"src/main/resources/**",
8+
]),
9+
visibility = ["//visibility:public"],
10+
deps = [
11+
"//3rdparty/jvm/org/apache/commons:com_springsource_org_apache_commons_httpclient",
12+
"//3rdparty/jvm/org/apache/ws/commons:ws_commons_util",
13+
"//apache_xmlrpc_common",
14+
],
15+
)

apache_xmlrpc_common/BUILD.bazel

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
java_library(
2+
name = "apache_xmlrpc_common",
3+
srcs = glob([
4+
"src/main/**/*.java",
5+
]),
6+
visibility = ["//visibility:public"],
7+
deps = [
8+
"//3rdparty/jvm/org/apache/commons:com_springsource_org_apache_commons_httpclient",
9+
"//3rdparty/jvm/org/apache/ws/commons:ws_commons_util",
10+
],
11+
)

0 commit comments

Comments
 (0)