Skip to content

Commit

Permalink
Make feature cargo-cli the default
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Mar 12, 2024
1 parent a64d32e commit 01aa9ba
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 27 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
fail-fast: ${{ github.event_name == 'merge_group' }}
matrix:
environment: [ubuntu-latest, macos-latest, windows-latest]
package: [cargo-dylint, cargo-dylint-cli, examples, other]
package: [cargo-dylint, cargo-dylint-cargo-lib, examples, other]

runs-on: ${{ matrix.environment }}

Expand Down Expand Up @@ -159,13 +159,13 @@ jobs:
- name: Test
run: |
if [[ '${{ matrix.package }}' != 'other' ]]; then
if [[ '${{ matrix.package }}' == 'cargo-dylint-cli' ]]; then
cargo test -p cargo-dylint --no-default-features --features=cargo-cli -- --nocapture
if [[ '${{ matrix.package }}' == 'cargo-dylint-cargo-lib' ]]; then
cargo test -p cargo-dylint --no-default-features --features=cargo-lib -- --nocapture
else
cargo test -p '${{ matrix.package }}' --all-features -- --nocapture
cargo test -p '${{ matrix.package }}' -- --nocapture
fi
else
cargo test --workspace --exclude cargo-dylint --exclude examples --all-features -- --nocapture
cargo test --all-features --workspace --exclude cargo-dylint --exclude examples -- --nocapture
pushd driver
cargo test --all-features -- --nocapture
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Dylint

**News:** Dylint has a new, experimental method for downloading packages. Please consider trying it by installing `cargo-dylint` with the following command:
**News:** The `cargo`-cli-based package download method is now the default. If the new method causes you problems, please [open an issue]. If you prefer to use the old `cargo`-lib-based method, install `cargo-dylint` with the following command:

```sh
cargo install cargo-dylint --no-default-features --features=cargo-cli
cargo install cargo-dylint --no-default-features --features=cargo-lib
```

The new method requires fewer dependencies, which will make Dylint easier to maintain. Plus, it should install faster.

The original README follows.

---
Expand Down Expand Up @@ -232,6 +230,7 @@ Put another way, we strive to preserve Dylint's MSRV when releasing bug fixes, a
[glob]: https://docs.rs/glob/0.3.0/glob/struct.Pattern.html
[how Dylint works]: ./docs/how_dylint_works.md
[internal/src/examples.rs]: ./internal/src/examples.rs
[open an issue]: https://github.com/trailofbits/dylint/issues
[resources]: #resources
[rust-analyzer]: https://github.com/rust-analyzer/rust-analyzer
[toml table]: https://toml.io/en/v1.0.0#table
Expand Down
2 changes: 1 addition & 1 deletion cargo-dylint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dylint_internal = { version = "=2.6.1", path = "../internal", features = [
] }

[features]
default = ["cargo-lib"]
default = ["cargo-cli"]
cargo-cli = ["dylint/__cargo_cli"]
cargo-lib = ["dylint/__cargo_lib"]
__clap_headings = []
7 changes: 3 additions & 4 deletions cargo-dylint/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Dylint

**News:** Dylint has a new, experimental method for downloading packages. Please consider trying it by installing `cargo-dylint` with the following command:
**News:** The `cargo`-cli-based package download method is now the default. If the new method causes you problems, please [open an issue]. If you prefer to use the old `cargo`-lib-based method, install `cargo-dylint` with the following command:

```sh
cargo install cargo-dylint --no-default-features --features=cargo-cli
cargo install cargo-dylint --no-default-features --features=cargo-lib
```

The new method requires fewer dependencies, which will make Dylint easier to maintain. Plus, it should install faster.

The original README follows.

---
Expand Down Expand Up @@ -232,6 +230,7 @@ Put another way, we strive to preserve Dylint's MSRV when releasing bug fixes, a
[glob]: https://docs.rs/glob/0.3.0/glob/struct.Pattern.html
[how Dylint works]: ../docs/how_dylint_works.md
[internal/src/examples.rs]: ../internal/src/examples.rs
[open an issue]: https://github.com/trailofbits/dylint/issues
[resources]: #resources
[rust-analyzer]: https://github.com/rust-analyzer/rust-analyzer
[toml table]: https://toml.io/en/v1.0.0#table
Expand Down
7 changes: 5 additions & 2 deletions dylint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ dylint_internal = { version = "=2.6.1", path = "../internal", features = [

[features]
default = []
library_packages = ["__cargo_lib"]
library_packages = ["__cargo_cli"]
package_options = [
"heck",
"if_chain",
Expand Down Expand Up @@ -94,5 +94,8 @@ __cargo_lib = [
"toml",
]

# smoelius: When both `__cargo_cli` and `__cargo_lib` are enabled, we treat it as though
# `--features=cargo-lib` was passed but the user forgot to pass `--no-default-features`. This
# approach causes `fs_extra` to look like an unused dependency.
[package.metadata.cargo-udeps.ignore]
normal = ["cargo", "cargo-util", "curl-sys"]
normal = ["fs_extra"]
7 changes: 3 additions & 4 deletions dylint/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Dylint

**News:** Dylint has a new, experimental method for downloading packages. Please consider trying it by installing `cargo-dylint` with the following command:
**News:** The `cargo`-cli-based package download method is now the default. If the new method causes you problems, please [open an issue]. If you prefer to use the old `cargo`-lib-based method, install `cargo-dylint` with the following command:

```sh
cargo install cargo-dylint --no-default-features --features=cargo-cli
cargo install cargo-dylint --no-default-features --features=cargo-lib
```

The new method requires fewer dependencies, which will make Dylint easier to maintain. Plus, it should install faster.

The original README follows.

---
Expand Down Expand Up @@ -232,6 +230,7 @@ Put another way, we strive to preserve Dylint's MSRV when releasing bug fixes, a
[glob]: https://docs.rs/glob/0.3.0/glob/struct.Pattern.html
[how Dylint works]: ../docs/how_dylint_works.md
[internal/src/examples.rs]: ../internal/src/examples.rs
[open an issue]: https://github.com/trailofbits/dylint/issues
[resources]: #resources
[rust-analyzer]: https://github.com/rust-analyzer/rust-analyzer
[toml table]: https://toml.io/en/v1.0.0#table
Expand Down
2 changes: 1 addition & 1 deletion dylint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::{
type Object = serde_json::Map<String, serde_json::Value>;

// smoelius: See note in dylint/src/metadata/mod.rs.
#[cfg(all(not(feature = "__cargo_cli"), feature = "__cargo_lib"))]
#[cfg(feature = "__cargo_lib")]
pub(crate) use cargo::{core, sources, util};

pub mod driver_builder;
Expand Down
1 change: 1 addition & 0 deletions dylint/src/library_packages/cargo_lib/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#![allow(clippy::single_char_pattern)]
#![allow(clippy::too_many_lines)]
#![allow(clippy::uninlined_format_args)]
#![allow(clippy::use_self)]
#![cfg_attr(dylint_lib = "general", allow(non_local_effect_before_error_return))]
#![cfg_attr(
dylint_lib = "inconsistent_qualification",
Expand Down
12 changes: 6 additions & 6 deletions dylint/src/library_packages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use once_cell::sync::OnceCell;
use serde::{de::IntoDeserializer, Deserialize};
use std::path::{Path, PathBuf};

// smoelius: If both `__cargo_cli` and `__cargo_lib` are enabled, assume the user built with
// `--features=cargo-cli` and forgot `--no-default-features`.
#[cfg(all(not(feature = "__cargo_cli"), feature = "__cargo_lib"))]
#[path = "cargo_lib/mod.rs"]
// smoelius: If both `__cargo_cli` and `__cargo_lib` are enabled, assume the user built
// `cargo-dylint` with `--features=cargo-lib` and forgot `--no-default-features`.
#[cfg(all(feature = "__cargo_cli", not(feature = "__cargo_lib")))]
#[path = "cargo_cli/mod.rs"]
mod impl_;

#[cfg(feature = "__cargo_cli")]
#[path = "cargo_cli/mod.rs"]
#[cfg(feature = "__cargo_lib")]
#[path = "cargo_lib/mod.rs"]
mod impl_;

use impl_::{dependency_source_id_and_root, Config, DetailedTomlDependency, PackageId, SourceId};
Expand Down

0 comments on commit 01aa9ba

Please sign in to comment.