Struct cli_xtask::config::DistPackageConfigBuilder
source · 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("lib");
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", "lib")?;
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", "lib")?;
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("lib");
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 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> !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> 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>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§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 more§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