1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
//
// SPDX-License-Identifier: MPL-2.0
//! Proc-macro for embedding licensing information about a crate.
//!
//! It also exposes its internal functions that allow
//! either collecting licensing information at runtime (with [`collect()`]),
//! when in the directory of the manifest,
//! or collecting licensing information from a specific manifest file (with
//! [`collect_from_manifest`]).
//!
//! However, the recommended way to use this crate is the macro [`collect!`]:
//!
//! ```rust
//! # #[cfg(feature = "macros")]
//! # {
//! let licensing = embed_licensing::collect!();
//!
//! for package in licensing.packages {
//! if let embed_licensing::CrateLicense::SpdxExpression(expr) = package.license {
//! println!("{} {} ({})", package.name, package.version, expr);
//! } else {
//! println!("{} {} uses custom license", package.name, package.version);
//! }
//! }
//! # }
//! ```
pub use ;
/// Collect licensing information at build-time.
///
/// It takes the same arguments as [`CollectConfig`].
/// Please see the examples for the format.
///
/// # Examples
///
/// ```
/// # #[macro_use] extern crate embed_licensing_macros;
/// # use embed_licensing_core::*;
/// collect!(); // collect only normal dependencies
/// collect!(build); // collect normal and build dependencies
/// collect!(dev); // collect normal and (direct) development dependencies
/// collect!(build, dev); // collect normal, build and (direct) development dependencies
///
/// collect!(build = true); // boolean arguments can also be explicitly set to true
/// collect!(build = false); // … or to false (which is the default for `build`)
///
/// collect!(platform(any)); // collect dependencies regardless of platform
/// // only collect dependencies corresponding to the specified platform
/// collect!(platform(static(target = "aarch64-apple-darwin", cfg(target_os = "macos", target_family = "unix", unix))));
/// #[cfg(feature = "current_platform")]
/// collect!(platform(current)); // collect dependencies for current platform
/// ```
pub use collect;