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

Improvements to better support cxx #2192

Merged
merged 5 commits into from
Oct 12, 2023
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
4 changes: 2 additions & 2 deletions crate_universe/private/crate.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def _annotation(
data = None,
data_glob = None,
deps = None,
extra_aliased_targets = {},
gen_binaries = [],
extra_aliased_targets = None,
gen_binaries = None,
disable_pipelining = False,
gen_build_script = None,
patch_args = None,
Expand Down
3 changes: 3 additions & 0 deletions crate_universe/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ pub struct AnnotationsProvidedByPackage {
pub gen_build_script: Option<bool>,
pub data: Option<BTreeSet<String>>,
pub data_glob: Option<BTreeSet<String>>,
pub deps: Option<BTreeSet<StringOrSelect>>,
pub compile_data: Option<BTreeSet<String>>,
pub compile_data_glob: Option<BTreeSet<String>>,
pub rustc_env: Option<BTreeMap<String, String>>,
Expand All @@ -387,6 +388,7 @@ impl CrateAnnotations {
gen_build_script,
data,
data_glob,
deps,
compile_data,
compile_data_glob,
rustc_env,
Expand Down Expand Up @@ -417,6 +419,7 @@ impl CrateAnnotations {
default(&mut self.gen_build_script, gen_build_script);
default(&mut self.data, data);
default(&mut self.data_glob, data_glob);
default(&mut self.deps, deps);
default(&mut self.compile_data, compile_data);
default(&mut self.compile_data_glob, compile_data_glob);
default(&mut self.rustc_env, rustc_env);
Expand Down
2 changes: 1 addition & 1 deletion crate_universe/src/metadata/metadata_annotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ impl Annotations {
// Mark that an annotation has been consumed
unused_extra_annotations.remove(id);

// Fitler out the annotation
// Filter out the annotation
extra
})
.cloned()
Expand Down
4 changes: 2 additions & 2 deletions docs/crate_universe.md
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,8 @@ A collection of extra attributes and settings for a particular crate
| <a id="crate.annotation-data"></a>data | A list of labels to add to a crate's <code>rust_library::data</code> attribute. | `None` |
| <a id="crate.annotation-data_glob"></a>data_glob | A list of glob patterns to add to a crate's <code>rust_library::data</code> attribute. | `None` |
| <a id="crate.annotation-deps"></a>deps | A list of labels to add to a crate's <code>rust_library::deps</code> attribute. | `None` |
| <a id="crate.annotation-extra_aliased_targets"></a>extra_aliased_targets | A list of targets to add to the generated aliases in the root crate_universe repository. | `{}` |
| <a id="crate.annotation-gen_binaries"></a>gen_binaries | As a list, the subset of the crate's bins that should get <code>rust_binary</code> targets produced. Or <code>True</code> to generate all, <code>False</code> to generate none. | `[]` |
| <a id="crate.annotation-extra_aliased_targets"></a>extra_aliased_targets | A list of targets to add to the generated aliases in the root crate_universe repository. | `None` |
| <a id="crate.annotation-gen_binaries"></a>gen_binaries | As a list, the subset of the crate's bins that should get <code>rust_binary</code> targets produced. Or <code>True</code> to generate all, <code>False</code> to generate none. | `None` |
| <a id="crate.annotation-disable_pipelining"></a>disable_pipelining | If True, disables pipelining for library targets for this crate. | `False` |
| <a id="crate.annotation-gen_build_script"></a>gen_build_script | An authorative flag to determine whether or not to produce <code>cargo_build_script</code> targets for the current crate. | `None` |
| <a id="crate.annotation-patch_args"></a>patch_args | The <code>patch_args</code> attribute of a Bazel repository rule. See [http_archive.patch_args](https://docs.bazel.build/versions/main/repo/http.html#http_archive-patch_args) | `None` |
Expand Down
8 changes: 8 additions & 0 deletions examples/crate_universe/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,14 @@ no_cargo_crate_repositories()

crates_repository(
name = "using_cxx",
annotations = {
"cxx": [
crate.annotation(
# Until https://github.com/dtolnay/cxx/pull/1257#issuecomment-1755816850 gets resolved.
deps = [":cxx_cc"],
),
],
},
cargo_lockfile = "//using_cxx:Cargo.Bazel.lock",
# `generator` is not necessary in official releases.
# See load satement for `cargo_bazel_bootstrap`.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion examples/crate_universe/using_cxx/cargo-bazel-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading