Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bkchr/proc-macro-crate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3.1
Choose a base ref
...
head repository: bkchr/proc-macro-crate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.0.0
Choose a head ref
  • 2 commits
  • 10 files changed
  • 2 contributors

Commits on Oct 3, 2023

  1. Release 2.0.0

    - This pull request fixes workspace inheriting: #34
    - Introduces a `rustfmt` check and configuration
    - Bumps MSRV to `1.66.0` and introduces a check for it in CI
    - Removes `once_cell` as it isn't required anymore
    - Bumps all the deps
    bkchr committed Oct 3, 2023
    Copy the full SHA
    39a7c18 View commit details
  2. Merge pull request #39 from bkchr/bkchr-2.0.0

    Release 2.0.0
    bkchr authored Oct 3, 2023
    Copy the full SHA
    cc100ed View commit details
30 changes: 28 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -15,6 +15,32 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@1.60.0
- uses: dtolnay/rust-toolchain@stable
- run: cargo test --all

msrv:
name: "Check MSRV: 1.66.0"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.66.0 # MSRV
- uses: Swatinem/rust-cache@v2
- name: Default features
run: cargo test --all
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
23 changes: 23 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Basic
edition = "2021"
max_width = 100
use_small_heuristics = "Max"
# Imports
imports_granularity = "Crate"
reorder_imports = true
# Consistency
newline_style = "Unix"
# Misc
chain_width = 80
spaces_around_ranges = false
binop_separator = "Back"
reorder_impl_items = false
match_arm_leading_pipes = "Preserve"
match_arm_blocks = false
match_block_trailing_comma = true
trailing_comma = "Vertical"
trailing_semicolon = false
use_field_init_shorthand = true
# Format comments
comment_width = 100
wrap_comments = true
13 changes: 6 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "proc-macro-crate"
version = "1.3.1"
version = "2.0.0"
authors = ["Bastian Köcher <git@kchr.de>"]
edition = "2021"
categories = ["development-tools::procedural-macro-helpers"]
@@ -12,13 +12,12 @@ description = """
Replacement for crate (macro_rules keyword) in proc-macros
"""
readme = "./README.md"
rust-version = "1.60.0"
rust-version = "1.66.0"

[dependencies]
toml_edit = "0.19"
once_cell = "1.13.0"
toml_edit = "0.20.2"

[dev-dependencies]
quote = "1.0.7"
syn = "1.0.33"
proc-macro2 = "1.0.18"
quote = "1.0.33"
syn = "2.0.37"
proc-macro2 = "1.0.67"
239 changes: 174 additions & 65 deletions src/lib.rs

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions tests/workspace_deps.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use std::{path::PathBuf, process::Command};

#[test]
fn workspace_deps_working() {
let manifest_dir =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/workspace_deps/Cargo.toml");

assert!(Command::new("cargo")
.arg("build")
.arg("--all")
.arg(format!("--manifest-path={}", manifest_dir.display()))
.spawn()
.unwrap()
.wait()
.unwrap()
.success());
}
8 changes: 8 additions & 0 deletions tests/workspace_deps/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[workspace]
members = ["my-cool-dep", "test-crate"]
resolver = "2"


[workspace.dependencies]
my-cool-dep = { package = "my-cool-dep-real-name", path = "my-cool-dep" }
proc-macro-crate = { path = "../.." }
10 changes: 10 additions & 0 deletions tests/workspace_deps/my-cool-dep/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "my-cool-dep-real-name"
version = "0.1.0"
edition = "2021"

[lib]
proc-macro = true

[dependencies]
proc-macro-crate = { workspace = true }
11 changes: 11 additions & 0 deletions tests/workspace_deps/my-cool-dep/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use proc_macro::TokenStream;

#[proc_macro]
pub fn do_something(input: TokenStream) -> TokenStream {
let found_crate =
proc_macro_crate::crate_name("my-cool-dep-real-name").expect("Couldn't find the crate");

assert_eq!(proc_macro_crate::FoundCrate::Name("my_cool_dep".into()), found_crate);

input
}
7 changes: 7 additions & 0 deletions tests/workspace_deps/test-crate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "test-crate"
version = "0.1.0"
edition = "2021"

[dependencies]
my-cool-dep = { workspace = true }
3 changes: 3 additions & 0 deletions tests/workspace_deps/test-crate/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn use_it() {
my_cool_dep::do_something!()
}