Skip to content

Commit

Permalink
Fill in all the edition attrs to make 'bazel build ...' succeed
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 11, 2022
1 parent fda6272 commit b47fd54
Show file tree
Hide file tree
Showing 43 changed files with 140 additions and 3 deletions.
1 change: 1 addition & 0 deletions cargo/bootstrap/BUILD.bazel
Expand Up @@ -14,6 +14,7 @@ rust_binary(
srcs = [
"bootstrap_installer.rs",
],
edition = "2018",
rustc_env = {
"RULES_RUST_CARGO_BOOTSTRAP_BINARY": "$(rootpath bootstrap_installer.rs)",
},
Expand Down
2 changes: 2 additions & 0 deletions crate_universe/BUILD.bazel
Expand Up @@ -66,6 +66,7 @@ rust_library(
include = ["src/**"],
exclude = ["src/**/*.rs"],
),
edition = "2018",
proc_macro_deps = all_crate_deps(proc_macro = True),
version = VERSION,
visibility = ["//visibility:public"],
Expand All @@ -75,6 +76,7 @@ rust_library(
rust_binary(
name = "cargo_bazel_bin",
srcs = ["src/main.rs"],
edition = "2018",
version = VERSION,
visibility = ["//visibility:public"],
deps = [":cargo_bazel"],
Expand Down
1 change: 1 addition & 0 deletions crate_universe/tools/cross_installer/BUILD.bazel
Expand Up @@ -16,6 +16,7 @@ rust_binary(
":cross",
"@rules_rust//rust/toolchain:current_exec_cargo_files",
],
edition = "2018",
proc_macro_deps = all_crate_deps(proc_macro = True),
rustc_env = {
"CARGO": "$(rootpath @rules_rust//rust/toolchain:current_exec_cargo_files)",
Expand Down
1 change: 1 addition & 0 deletions crate_universe/tools/urls_generator/BUILD.bazel
Expand Up @@ -22,6 +22,7 @@ rust_binary(
compile_data = [
"//crate_universe/private:urls.bzl",
],
edition = "2018",
proc_macro_deps = all_crate_deps(proc_macro = True),
rustc_env = {
"MODULE_ROOT_PATH": "$(rootpath //crate_universe/private:urls.bzl)",
Expand Down
2 changes: 2 additions & 0 deletions examples/crate_universe/multi_package/pkg_a/BUILD.bazel
Expand Up @@ -5,6 +5,7 @@ rust_library(
name = "pkg_a",
srcs = glob(["src/**/*.rs"]),
aliases = aliases(),
edition = "2018",
proc_macro_deps = all_crate_deps(proc_macro = True),
# TODO: There's an issue building OpenSSL on Windows in GitHub CI so for
# now all targets that depend on it are disabled
Expand All @@ -20,6 +21,7 @@ rust_test(
name = "unit_test",
aliases = aliases(),
crate = ":pkg_a",
edition = "2018",
proc_macro_deps = all_crate_deps(proc_macro_dev = True),
# TODO: There's an issue building OpenSSL on Windows in GitHub CI so for
# now all targets that depend on it are disabled
Expand Down
Expand Up @@ -5,6 +5,7 @@ rust_library(
name = "pkg_b",
srcs = glob(["src/**/*.rs"]),
aliases = aliases(),
edition = "2018",
proc_macro_deps = all_crate_deps(proc_macro = True),
# TODO: There's an issue building OpenSSL on Windows in GitHub CI so for
# now all targets that depend on it are disabled
Expand All @@ -20,6 +21,7 @@ rust_test(
name = "unit_test",
aliases = aliases(),
crate = ":pkg_b",
edition = "2018",
proc_macro_deps = all_crate_deps(proc_macro_dev = True),
# TODO: There's an issue building OpenSSL on Windows in GitHub CI so for
# now all targets that depend on it are disabled
Expand Down
4 changes: 4 additions & 0 deletions examples/ffi/rust_calling_c/BUILD.bazel
Expand Up @@ -8,6 +8,7 @@ rust_library(
"src/ffi.rs",
"src/matrix.rs",
],
edition = "2018",
deps = [
"//ffi/rust_calling_c/c:native_matrix",
"@libc",
Expand All @@ -17,6 +18,7 @@ rust_library(
rust_test(
name = "matrix_test",
crate = ":matrix",
edition = "2018",
)

rust_doc(
Expand All @@ -33,6 +35,7 @@ rust_library(
"src/matrix.rs",
],
crate_root = "src/matrix.rs",
edition = "2018",
target_compatible_with = select({
# TODO: Make this work on windows
"@platforms//os:windows": ["@platforms//:incompatible"],
Expand All @@ -47,6 +50,7 @@ rust_library(
rust_test(
name = "matrix_dylib_test",
crate = ":matrix_dynamically_linked",
edition = "2018",
target_compatible_with = select({
# TODO: This test requires --incompatible_macos_set_install_name and Bazel 4.2.0+
"@platforms//os:macos": ["@platforms//:incompatible"],
Expand Down
6 changes: 5 additions & 1 deletion proto/BUILD.bazel
Expand Up @@ -34,6 +34,7 @@ toolchain_type(name = "toolchain")
rust_binary(
name = "optional_output_wrapper",
srcs = ["optional_output_wrapper.rs"],
edition = "2018",
visibility = ["//visibility:public"],
)

Expand All @@ -43,7 +44,10 @@ toolchain(
toolchain_type = "@rules_rust//proto:toolchain",
)

rust_proto_toolchain(name = "default-proto-toolchain-impl")
rust_proto_toolchain(
name = "default-proto-toolchain-impl",
edition = "2018",
)

bzl_library(
name = "bzl_lib",
Expand Down
5 changes: 5 additions & 0 deletions test/build_env/BUILD.bazel
Expand Up @@ -10,11 +10,13 @@ rust_test(
name = "conflicting_deps_test",
srcs = ["tests/manifest_dir.rs"],
data = ["src/manifest_dir_file.txt"],
edition = "2018",
)

rust_test(
name = "arbitrary_env_test",
srcs = ["tests/arbitrary_env.rs"],
edition = "2018",
rustc_env = {
"USER_DEFINED_KEY": "USER_DEFINED_VALUE",
},
Expand All @@ -24,17 +26,20 @@ rust_test(
# Intentionally uses a mix of -s and _s because those normalisations are part of what is being tested.
name = "cargo_env-vars_test",
srcs = ["tests/cargo.rs"],
edition = "2018",
deps = [":cargo_build_script_env-vars_build_script"],
)

rust_test(
name = "cargo-env-vars-custom-crate-name-test",
srcs = ["tests/custom_crate_name.rs"],
crate_name = "custom_crate_name",
edition = "2018",
deps = [":cargo_build_script_env-vars_build_script"],
)

cargo_build_script(
name = "cargo_build_script_env-vars_build_script",
srcs = ["src/build.rs"],
edition = "2018",
)
2 changes: 2 additions & 0 deletions test/cargo_build_script/BUILD.bazel
Expand Up @@ -8,6 +8,7 @@ cargo_build_script(
name = "tools_exec_build_rs",
srcs = ["build.rs"],
build_script_env = {"TOOL": "$(execpath :tool)"},
edition = "2018",
# Add a flag to test that they're exposed to the build script
rustc_flags = ["--verbose"],
tools = [":tool"],
Expand All @@ -23,5 +24,6 @@ genrule(
rust_test(
name = "tools_exec",
srcs = ["tools_exec.rs"],
edition = "2018",
deps = [":tools_exec_build_rs"],
)
6 changes: 6 additions & 0 deletions test/chained_direct_deps/BUILD.bazel
Expand Up @@ -3,17 +3,20 @@ load("//rust:defs.bzl", "rust_doc_test", "rust_library", "rust_test")
rust_library(
name = "mod1",
srcs = ["mod1.rs"],
edition = "2018",
)

rust_library(
name = "mod2",
srcs = ["mod2.rs"],
edition = "2018",
deps = [":mod1"],
)

rust_library(
name = "mod3",
srcs = ["mod3.rs"],
edition = "2018",
deps = [
":mod1",
":mod2",
Expand All @@ -23,16 +26,19 @@ rust_library(
rust_test(
name = "mod1_test",
crate = ":mod1",
edition = "2018",
)

rust_test(
name = "mod2_test",
crate = ":mod2",
edition = "2018",
)

rust_test(
name = "mod3_test",
crate = ":mod3",
edition = "2018",
)

rust_doc_test(
Expand Down
2 changes: 2 additions & 0 deletions test/extra_exec_rustc_flags/BUILD.bazel
Expand Up @@ -14,6 +14,7 @@ package(default_visibility = ["//test:__subpackages__"])
rust_library(
name = "lib_do_not_build_directly",
srcs = ["lib.rs"],
edition = "2018",
tags = ["manual"],
)

Expand All @@ -36,6 +37,7 @@ with_exec_cfg(
rust_library(
name = "lib_no_exec",
srcs = ["lib_no_exec.rs"],
edition = "2018",
)

with_extra_exec_rustc_flags_cfg(
Expand Down
1 change: 1 addition & 0 deletions test/inline_test_with_deps/dep/BUILD.bazel
Expand Up @@ -5,4 +5,5 @@ package(default_visibility = ["//visibility:public"])
rust_library(
name = "dep",
srcs = ["src/lib.rs"],
edition = "2018",
)
1 change: 1 addition & 0 deletions test/inline_test_with_deps/test/BUILD.bazel
Expand Up @@ -11,5 +11,6 @@ rust_library(
rust_test(
name = "inline_test",
crate = ":inline",
edition = "2018",
deps = ["//test/inline_test_with_deps/dep"],
)
4 changes: 4 additions & 0 deletions test/out_dir_in_tests/BUILD.bazel
Expand Up @@ -4,19 +4,22 @@ load("//rust:defs.bzl", "rust_library", "rust_test", "rust_test_suite")
cargo_build_script(
name = "build_script",
srcs = ["build.rs"],
edition = "2018",
)

rust_library(
name = "demo_lib",
srcs = [
"src/lib.rs",
],
edition = "2018",
deps = [":build_script"],
)

rust_test(
name = "demo_lib_test",
crate = ":demo_lib",
edition = "2018",
)

rust_test_suite(
Expand All @@ -26,4 +29,5 @@ rust_test_suite(
# to the underlying rust_test rules. This will make OUT_DIR
# available when compiling integration tests.
crate = ":demo_lib",
edition = "2018",
)
6 changes: 6 additions & 0 deletions test/renamed_deps/BUILD.bazel
Expand Up @@ -3,11 +3,13 @@ load("//rust:defs.bzl", "rust_library", "rust_test")
rust_library(
name = "mod1",
srcs = ["mod1.rs"],
edition = "2018",
)

rust_library(
name = "mod2",
srcs = ["mod2.rs"],
edition = "2018",
deps = [":mod1"],
)

Expand All @@ -18,6 +20,7 @@ rust_library(
":mod1": "alias_a",
":mod2": "alias_b",
},
edition = "2018",
deps = [
":mod1",
":mod2",
Expand All @@ -27,11 +30,13 @@ rust_library(
rust_test(
name = "mod1_test",
crate = ":mod1",
edition = "2018",
)

rust_test(
name = "mod2_test",
crate = ":mod2",
edition = "2018",
)

rust_test(
Expand All @@ -41,4 +46,5 @@ rust_test(
":mod2": "alias_b",
},
crate = ":mod3",
edition = "2018",
)
2 changes: 2 additions & 0 deletions test/rust/BUILD.bazel
Expand Up @@ -8,10 +8,12 @@ rust_library(
"src/greeter.rs",
"src/lib.rs",
],
edition = "2018",
)

rust_binary(
name = "hello_world",
srcs = ["src/main.rs"],
edition = "2018",
deps = [":hello_lib"],
)
10 changes: 10 additions & 0 deletions test/rust_analyzer/aspect_traversal_test/BUILD.bazel
Expand Up @@ -4,6 +4,7 @@ load(":custom_alias.bzl", "custom_alias")
rust_library(
name = "mylib",
srcs = ["mylib.rs"],
edition = "2018",
proc_macro_deps = [":proc_macro_dep"],
deps = [
":alias_dep",
Expand All @@ -15,6 +16,7 @@ rust_library(
rust_library(
name = "lib_dep",
srcs = ["lib_dep.rs"],
edition = "2018",
)

alias(
Expand All @@ -25,12 +27,14 @@ alias(
rust_library(
name = "actual_dep",
srcs = ["actual_dep.rs"],
edition = "2018",
deps = [":dep_of_aliased_dep"],
)

rust_library(
name = "dep_of_aliased_dep",
srcs = ["dep_of_aliased_dep.rs"],
edition = "2018",
)

custom_alias(
Expand All @@ -41,34 +45,40 @@ custom_alias(
rust_library(
name = "custom_actual_dep",
srcs = ["custom_actual_dep.rs"],
edition = "2018",
deps = [":dep_of_custom_aliased_dep"],
)

rust_library(
name = "dep_of_custom_aliased_dep",
srcs = ["dep_of_custom_aliased_dep.rs"],
edition = "2018",
)

rust_proc_macro(
name = "proc_macro_dep",
srcs = ["proc_macro_dep.rs"],
edition = "2018",
)

rust_test(
name = "mylib_test",
crate = ":mylib",
edition = "2018",
proc_macro_deps = [":extra_proc_macro_dep"],
deps = [":extra_test_dep"],
)

rust_library(
name = "extra_test_dep",
srcs = ["extra_test_dep.rs"],
edition = "2018",
)

rust_proc_macro(
name = "extra_proc_macro_dep",
srcs = ["extra_proc_macro_dep.rs"],
edition = "2018",
)

rust_test(
Expand Down

0 comments on commit b47fd54

Please sign in to comment.