pub struct DistPackageConfigBuilder<'a> { /* private fields */ }
Expand description
Configures and constructs DistPackageConfig
.
This struct is build from DistConfigBuilder
.
§Examples
Creates DistConfigBuilder
and
DistPackageConfigBuilder
from the workspace root package:
use cli_xtask::{config::DistConfigBuilder, workspace};
let workspace = workspace::current();
let (dist_config, pkg_config) = DistConfigBuilder::from_root_package(workspace)?;
Creates DistConfigBuilder
and
DistPackageConfigBuilder
from the name of package:
use cli_xtask::{config::DistConfigBuilder, workspace};
let workspace = workspace::current();
let package = workspace.workspace_packages()[0];
let (dist_config, pkg_config) = DistConfigBuilder::from_package_name(workspace, &package.name)?;
Creates DistPackageConfigBuilder
from the name of package and
DistConfigBuilder
:
use cli_xtask::{config::DistConfigBuilder, workspace};
let workspace = workspace::current();
let package = workspace.workspace_packages()[0];
let dist_config = DistConfigBuilder::new("app-dist", workspace);
let pkg_config = dist_config.package_by_name(&package.name)?.build()?;
Implementations§
Source§impl<'a> DistPackageConfigBuilder<'a>
impl<'a> DistPackageConfigBuilder<'a>
Sourcepub fn all_binaries(&self) -> Vec<DistTargetConfigBuilder<'a>>
pub fn all_binaries(&self) -> Vec<DistTargetConfigBuilder<'a>>
Creates new DistTargetConfigBuilder
s from all binary targets of the
package.
§Errors
Returns an error if the DistTargetConfig
cannot be built.
§Examples
use cli_xtask::{
config::{DistConfigBuilder, DistTargetConfigBuilder},
workspace, Result,
};
let workspace = workspace::current();
let (dist_config, pkg_config) = DistConfigBuilder::from_package_name(workspace, "xtask")?;
let target_builders = pkg_config.all_binaries();
let targets = target_builders
.into_iter()
.map(DistTargetConfigBuilder::build)
.collect::<Result<Vec<_>>>()?;
let pkg_config = pkg_config.targets(targets).build()?;
let dist_config = dist_config.package(pkg_config).build()?;
let target = &dist_config.packages()[0].targets()[0];
assert_eq!(target.name(), "xtask");
Sourcepub fn all_targets(&self, kind: &str) -> Vec<DistTargetConfigBuilder<'a>>
pub fn all_targets(&self, kind: &str) -> Vec<DistTargetConfigBuilder<'a>>
Creates new DistTargetConfigBuilder
s from given kind of targets in the
package.
§Errors
Returns an error if the DistTargetConfig
cannot be built.
§Examples
use cli_xtask::{
config::{DistConfigBuilder, DistTargetConfigBuilder},
workspace, Result,
};
let workspace = workspace::current();
let (dist_config, pkg_config) = DistConfigBuilder::from_package_name(workspace, "cli-xtask")?;
let target_builders = pkg_config.all_targets("bin");
let targets = target_builders
.into_iter()
.map(DistTargetConfigBuilder::build)
.collect::<Result<Vec<_>>>()?;
let pkg_config = pkg_config.targets(targets).build()?;
let dist_config = dist_config.package(pkg_config).build()?;
let target = &dist_config.packages()[0].targets()[0];
assert_eq!(target.name(), "cli-xtask");
Sourcepub fn binary_by_name(&self, name: &str) -> Result<DistTargetConfigBuilder<'a>>
pub fn binary_by_name(&self, name: &str) -> Result<DistTargetConfigBuilder<'a>>
Create a new DistTargetConfigBuilder
from the name of the binary
target.
§Errors
Returns an error if the binary target with the given name is not found.
§Examples
use cli_xtask::{
clap::CommandFactory,
config::{DistConfigBuilder, DistTargetConfigBuilder},
workspace, Result,
};
let workspace = workspace::current();
let (dist_config, pkg_config) = DistConfigBuilder::from_package_name(workspace, "xtask")?;
let target_builder = pkg_config.binary_by_name("xtask")?;
let target = target_builder.build()?;
let pkg_config = pkg_config.target(target).build()?;
let dist_config = dist_config.package(pkg_config).build()?;
let target = &dist_config.packages()[0].targets()[0];
assert_eq!(target.name(), "xtask");
Sourcepub fn target_by_name(
&self,
name: &str,
kind: &str,
) -> Result<DistTargetConfigBuilder<'a>>
pub fn target_by_name( &self, name: &str, kind: &str, ) -> Result<DistTargetConfigBuilder<'a>>
Create a new DistTargetConfigBuilder
from the name and kind of the
target.
§Errors
Returns an error if the target with the given name and kind is not found.
§Examples
use cli_xtask::{
clap::CommandFactory,
config::{DistConfigBuilder, DistTargetConfigBuilder},
workspace, Result,
};
let workspace = workspace::current();
let (dist_config, pkg_config) = DistConfigBuilder::from_package_name(workspace, "cli-xtask")?;
let target_builder = pkg_config.target_by_name("cli-xtask", "bin")?;
let target = target_builder.build()?;
let pkg_config = pkg_config.target(target).build()?;
let dist_config = dist_config.package(pkg_config).build()?;
let target = &dist_config.packages()[0].targets()[0];
assert_eq!(target.name(), "cli-xtask");
Sourcepub fn target(self, target: DistTargetConfig<'a>) -> Self
pub fn target(self, target: DistTargetConfig<'a>) -> Self
Add a target of the package to the list of targets to be distributed.
§Examples
use cli_xtask::{
clap::CommandFactory,
config::{DistConfigBuilder, DistTargetConfigBuilder},
workspace, Result,
};
let workspace = workspace::current();
let (dist_config, pkg_config) = DistConfigBuilder::from_package_name(workspace, "cli-xtask")?;
let target_builder = pkg_config.target_by_name("cli-xtask", "bin")?;
let target = target_builder.build()?;
let pkg_config = pkg_config.target(target).build()?;
let dist_config = dist_config.package(pkg_config).build()?;
let target = &dist_config.packages()[0].targets()[0];
assert_eq!(target.name(), "cli-xtask");
Sourcepub fn targets(
self,
targets: impl IntoIterator<Item = DistTargetConfig<'a>>,
) -> Self
pub fn targets( self, targets: impl IntoIterator<Item = DistTargetConfig<'a>>, ) -> Self
Add a targets of the package to the list of targets to be distributed.
§Examples
use cli_xtask::{
config::{DistConfigBuilder, DistTargetConfigBuilder},
workspace, Result,
};
let workspace = workspace::current();
let (dist_config, pkg_config) = DistConfigBuilder::from_package_name(workspace, "cli-xtask")?;
let target_builders = pkg_config.all_targets("bin");
let targets = target_builders
.into_iter()
.map(DistTargetConfigBuilder::build)
.collect::<Result<Vec<_>>>()?;
let pkg_config = pkg_config.targets(targets).build()?;
let dist_config = dist_config.package(pkg_config).build()?;
let target = &dist_config.packages()[0].targets()[0];
assert_eq!(target.name(), "cli-xtask");
Sourcepub fn cargo_build_options(
self,
options: impl IntoIterator<Item = impl Into<String>>,
) -> Self
Available on crate feature subcommand-dist-build-bin
only.
pub fn cargo_build_options( self, options: impl IntoIterator<Item = impl Into<String>>, ) -> Self
subcommand-dist-build-bin
only.Adds cargo build options to be used when building the package.
§Examples
use cli_xtask::{config::DistConfigBuilder, workspace};
let workspace = workspace::current();
let (dist_config, pkg_config) = DistConfigBuilder::from_root_package(workspace)?;
let pkg_config = pkg_config.cargo_build_options(["--features", "feature-a"]);
Sourcepub fn license_files(self, files: impl IntoIterator<Item = Utf8PathBuf>) -> Self
Available on crate feature subcommand-dist-build-license
only.
pub fn license_files(self, files: impl IntoIterator<Item = Utf8PathBuf>) -> Self
subcommand-dist-build-license
only.Adds a package license files to the list of files to be distributed.
If the given path is a relative path, it is resolved against the package root direcotry.
§Examples
use cli_xtask::{config::DistConfigBuilder, workspace};
let workspace = workspace::current();
let (dist_config, pkg_config) = DistConfigBuilder::from_root_package(workspace)?;
let pkg_config = pkg_config.license_files(
["LICENSE-MIT", "LICENSE-APACHE"]
.into_iter()
.map(Into::into),
);
Sourcepub fn documents(self, files: impl IntoIterator<Item = Utf8PathBuf>) -> Self
Available on crate feature subcommand-dist-build-doc
only.
pub fn documents(self, files: impl IntoIterator<Item = Utf8PathBuf>) -> Self
subcommand-dist-build-doc
only.Adds a package documentation files to the list of files to be distributed.
If the given path is a relative path, it is resolved against the package root direcotry.
§Examples
use cli_xtask::{config::DistConfigBuilder, workspace};
let workspace = workspace::current();
let (dist_config, pkg_config) = DistConfigBuilder::from_root_package(workspace)?;
let pkg_config = pkg_config.documents(["CHANGELOG.md"].into_iter().map(Into::into));
Sourcepub fn build(self) -> Result<DistPackageConfig<'a>>
pub fn build(self) -> Result<DistPackageConfig<'a>>
Builds a DistPackageConfig
from the current configuration.
§Errors
Returns an error if the DistPackageConfig
cannot be built.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for DistPackageConfigBuilder<'a>
impl<'a> !RefUnwindSafe for DistPackageConfigBuilder<'a>
impl<'a> Send for DistPackageConfigBuilder<'a>
impl<'a> Sync for DistPackageConfigBuilder<'a>
impl<'a> Unpin for DistPackageConfigBuilder<'a>
impl<'a> !UnwindSafe for DistPackageConfigBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more