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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default_targets: &default_targets
- "@examples//..."
# Bindgen currently only has a working toolchain for 18.04
- "-@examples//ffi/rust_calling_c/simple/..."
platforms:
tasks:
ubuntu1404:
build_targets: *default_targets
test_targets: *default_targets
Expand Down Expand Up @@ -43,3 +43,9 @@ platforms:
- "-@examples//hello_lib:hello_lib_doc_test"
- "-//tools/runfiles:runfiles_doc_test"
- "-@examples//ffi/rust_calling_c/simple/..."
examples:
name: Examples
platform: ubuntu1804
working_directory: examples
test_targets:
- //...
Empty file added examples/BUILD
Empty file.
36 changes: 28 additions & 8 deletions examples/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@
workspace(name = "examples")

local_repository(name = "io_bazel_rules_rust", path = "..")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
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(
http_archive(
name = "libc",
remote = "https://github.com/rust-lang/libc",
tag = "0.2.20",
build_file = "libc.BUILD",
build_file = "@//:libc.BUILD",
sha256 = "1ac4c2ac6ed5a8fb9020c166bc63316205f1dc78d4b964ad31f4f21eb73f0c6d",
strip_prefix = "libc-0.2.20",
urls = [
"https://mirror.bazel.build/github.com/rust-lang/libc/archive/0.2.20.zip",
"https://github.com/rust-lang/libc/archive/0.2.20.zip",
],
)

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",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/archive/0.6.0.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/archive/0.6.0.tar.gz",
],
)

load("@io_bazel_rules_rust//bindgen:repositories.bzl", "rust_bindgen_repositories")

rust_bindgen_repositories()

load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version")

bazel_version(name = "bazel_version")
2 changes: 1 addition & 1 deletion examples/ffi/c_calling_rust/BUILD
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion examples/ffi/rust_calling_c/BUILD
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 7 additions & 0 deletions examples/libc.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library")

rust_library(
name = "libc",
srcs = glob(["src/**/*.rs"]),
visibility = ["//visibility:public"],
)