Skip to content
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

Test the examples on Bazel's CI #193

Merged
merged 5 commits into from
Feb 12, 2019
Merged

Test the examples on Bazel's CI #193

merged 5 commits into from
Feb 12, 2019

Conversation

philwo
Copy link
Member

@philwo philwo commented Feb 12, 2019

No description provided.

@damienmg
Copy link
Collaborator

Here what I did to fix the tests on my machines (the bindgen tests doesn't pass because of some configuration issue):

$ git diff
diff --git a/examples/WORKSPACE b/examples/WORKSPACE
index 0603384..8c6a44a 100644
--- a/examples/WORKSPACE
+++ b/examples/WORKSPACE
@@ -1,26 +1,34 @@
 workspace(name = "examples")
 
-local_repository(name = "io_bazel_rules_rust", path = "..")
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+local_repository(
+    name = "io_bazel_rules_rust",
+    path = "..",
+)
 
 load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")
+
 rust_repositories()
 
 new_git_repository(
     name = "libc",
+    build_file = "libc.BUILD",
     remote = "https://github.com/rust-lang/libc",
     tag = "0.2.20",
-    build_file = "libc.BUILD",
 )
 
 load("@io_bazel_rules_rust//proto:repositories.bzl", "rust_proto_repositories")
+
 rust_proto_repositories()
 
 http_archive(
     name = "bazel_skylib",
-    url = "https://github.com/bazelbuild/bazel-skylib/archive/0.5.0.tar.gz",
-    sha256 = "b5f6abe419da897b7901f90cbab08af958b97a8f3575b0d3dd062ac7ce78541f",
-    strip_prefix = "bazel-skylib-0.5.0"
+    sha256 = "eb5c57e4c12e68c0c20bc774bfbc60a568e800d025557bc4ea022c6479acc867",
+    strip_prefix = "bazel-skylib-0.6.0",
+    url = "https://github.com/bazelbuild/bazel-skylib/archive/0.6.0.tar.gz",
 )
 
 load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version")
+
 bazel_version(name = "bazel_version")
diff --git a/examples/ffi/c_calling_rust/BUILD b/examples/ffi/c_calling_rust/BUILD
index 3c6367b..312a3e5 100644
--- a/examples/ffi/c_calling_rust/BUILD
+++ b/examples/ffi/c_calling_rust/BUILD
@@ -1,4 +1,4 @@
-load("@//rust:rust.bzl", "rust_binary", "rust_library", "rust_test")
+load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary", "rust_library", "rust_test")
 
 rust_library(
     name = "rusty",
diff --git a/examples/ffi/rust_calling_c/BUILD b/examples/ffi/rust_calling_c/BUILD
index eb49a4d..16ec03b 100644
--- a/examples/ffi/rust_calling_c/BUILD
+++ b/examples/ffi/rust_calling_c/BUILD
@@ -1,6 +1,6 @@
 package(default_visibility = ["//ffi/rust_calling_c:__subpackages__"])
 
-load("@//rust:rust.bzl", "rust_library", "rust_test", "rust_binary", "rust_doc")
+load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library", "rust_test", "rust_binary", "rust_doc")
 
 rust_library(
     name = "matrix",

So there is 2 more labels that are incorrect and skylib needs to be bumped. If you want I can push that on top of your PR or you can integrate the change yourself.

@philwo
Copy link
Member Author

philwo commented Feb 12, 2019

@damienmg Thanks for the patch! I'll integrate it and see that I can get the tests passing :)

@damienmg
Copy link
Collaborator

damienmg commented Feb 12, 2019 via email

@philwo
Copy link
Member Author

philwo commented Feb 12, 2019

I'm still fighting with the libc in my WORKSPACE that doesn't seem to work (even tried replacing the new_git_repository with an http_archive, but am getting the same error).

I tried to copy the libc.BUILD from the top-level workspace to the examples workspace, because it was missing there, but now I'm getting this:

ERROR: /Users/philwo/src/rules_rust/examples/ffi/rust_calling_c/BUILD:29:1: no such package '@libc//': Traceback (most recent call last):
	File "/private/var/tmp/_bazel_philwo/950140b41fdb1a69bb14157d1578bb2c/external/bazel_tools/tools/build_defs/repo/http.bzl", line 56
		workspace_and_buildfile(ctx)
	File "/private/var/tmp/_bazel_philwo/950140b41fdb1a69bb14157d1578bb2c/external/bazel_tools/tools/build_defs/repo/utils.bzl", line 62, in workspace_and_buildfile
		ctx.symlink(ctx.attr.build_file, "BUILD.bazel")
Not a regular file: /Users/philwo/src/rules_rust/examples/external/libc.BUILD and referenced by '//ffi/rust_calling_c:matrix_dynamically_linked'

Do you remember if you did something to make that work?

@damienmg damienmg merged commit e29cc33 into master Feb 12, 2019
@damienmg
Copy link
Collaborator

Thanks!

@philwo
Copy link
Member Author

philwo commented Feb 12, 2019

Yay, all green!

@damienmg Thanks for the hints. :)

@philwo philwo deleted the philwo-patch-1 branch February 12, 2019 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants