Struct Project

Source
pub struct Project { /* private fields */ }
Expand description

The Project contains the tasks, layout information, and other related objects that would help with project building.

The project itself should be able to provide all information required to build a project, but should not be the driver of the building itself. Instead, project visitors should be driven to create project files.

By default, projects are created in the current directory.

§Example

let mut task_provider = project.tasks().register_task::<Empty>("hello_world").expect("Couldn't create 'hello_task'");
task_provider.configure_with(|empty, _project| {
    empty.do_first(|_, _| {
        println!("Hello, World");
        Ok(())
    }).unwrap();
    Ok(())
}).unwrap();

Implementations§

Source§

impl Project

Source

pub fn new() -> Result<SharedProject, PayloadError<ProjectError>>

Create a new Project, with the current directory as the the directory to load

Source

pub fn in_dir( path: impl AsRef<Path>, ) -> Result<SharedProject, PayloadError<ProjectError>>

Creates an assemble project in a specified directory.

Source

pub fn with_id<I>(id: I) -> Result<SharedProject, PayloadError<ProjectError>>

Creates an assemble project in the current directory using an identifier

Source

pub fn in_dir_with_id<Id, P>( path: P, id: Id, ) -> Result<SharedProject, PayloadError<ProjectError>>

Creates an assemble project in a specified directory.

Source

pub fn in_dir_with_id_and_root<Id, P>( path: P, id: Id, root: Option<&SharedProject>, settings: Option<Weak<RwLock<RawRwLock, Settings>>>, ) -> Result<SharedProject, PayloadError<ProjectError>>

Creates an assemble project in a specified directory.

Source

pub fn id(&self) -> &ProjectId

Get the id of the project

Source

pub fn build_dir(&self) -> impl Provider<PathBuf> + Clone

Gets the directory where created files should be stored

Source

pub fn set_build_dir(&mut self, dir: &str)

Always set as relative to the project dir

Source

pub fn registered_tasks(&self) -> Vec<TaskId>

Gets a list of all tasks by TaskId

Source

pub fn file<T>( &self, any_value: T, ) -> Result<RegularFile, PayloadError<ProjectError>>
where T: AsRef<Path>,

Create files using some valid types

Allowed types:

  • &str
  • String
  • Path
  • Regular File
Source

pub fn visitor<R, V>(&self, visitor: &mut V) -> R
where V: VisitProject<R>,

Run a visitor on the project

Source

pub fn visitor_mut<R, V>(&mut self, visitor: &mut V) -> R
where V: VisitMutProject<R>,

Run a mutable visitor on the project

Source

pub fn project_dir(&self) -> PathBuf

The directory of the project

Source

pub fn root_dir(&self) -> PathBuf

The project directory for the root directory

Source

pub fn task_container(&self) -> &TaskContainer

Get access to the task container

Source

pub fn task_container_mut(&mut self) -> &mut TaskContainer

Get access to the task container

Source

pub fn variant( &self, variant: &str, ) -> Option<impl Provider<ConfigurableArtifact>>

Get an outgoing variant

Source

pub fn as_shared(&self) -> SharedProject

Gets the shared reference version of this project

Source

pub fn task_id_factory(&self) -> &TaskIdFactory

Gets the factory for generating task ids

Source

pub fn properties(&self) -> &HashMap<String, Option<String>>

Source

pub fn set_property(&mut self, key: String, value: impl Into<Option<String>>)

Source

pub fn get_property(&self, key: &str) -> Option<&Option<String>>

Source

pub fn has_property(&self, key: &str) -> bool

Source

pub fn subprojects(&self) -> Vec<&SharedProject>

Gets the subprojects for this project.

Source

pub fn default_tasks(&self) -> &Vec<TaskId>

Gets the default tasks for this project.

Default tasks are executed if no other tasks are provided.

Source

pub fn set_default_tasks<I>(&mut self, iter: I)
where I: IntoIterator<Item = TaskId>,

Set the default tasks for this project.

Source

pub fn registries_mut<F>( &mut self, configure: F, ) -> Result<(), PayloadError<ProjectError>>

apply a configuration function on the registries container

Source

pub fn registries<R, F>( &self, configure: F, ) -> Result<R, PayloadError<ProjectError>>

apply a function on the registries container

Source

pub fn configurations(&self) -> &ConfigurationHandler

Get the dependencies for this project

Source

pub fn configurations_mut(&mut self) -> &mut ConfigurationHandler

Get a mutable reference to the dependencies container for this project

Source

pub fn get_subproject<P>( &self, project: P, ) -> Result<&SharedProject, PayloadError<ProjectError>>
where P: AsRef<str>,

Source

pub fn subproject<F>( &mut self, name: &str, configure: F, ) -> Result<(), PayloadError<ProjectError>>

Create a sub project with a given name. The path used is the $PROJECT_DIR/name

Source

pub fn subproject_in<P, F>( &mut self, name: &str, path: P, configure: F, ) -> Result<(), PayloadError<ProjectError>>

Create a sub project with a given name at a path.

Source

pub fn root_project(&self) -> SharedProject

Gets the root project of this project.

Source

pub fn parent_project(&self) -> Option<SharedProject>

Gets the parent project of this project, if it exists

Source

pub fn variants(&self) -> &VariantHandler

The variants of this project

Source

pub fn variants_mut(&mut self) -> &mut VariantHandler

The mutable variants of this project

Trait Implementations§

Source§

impl CreateProjectDependencies for Project

Source§

fn project<S>(&self, path: S) -> ProjectDependency
where S: AsRef<str>,

Creates an inter-project dependency with the default configuration
Source§

fn project_with<P, C>(&self, path: P, config: C) -> ProjectDependency
where P: AsRef<str>, C: AsRef<str>,

Creates an inter-project dependency with a given configuration
Source§

impl Debug for Project

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for Project

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Drop for Project

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl ExtensionAware for Project

Source§

fn extensions(&self) -> &ExtensionContainer

Gets the extension container
Source§

fn extensions_mut(&mut self) -> &mut ExtensionContainer

Gets a mutable reference to the extension container
Source§

fn extension<E>(&self) -> Result<&E, PayloadError<ProjectError>>
where E: Extension,

If a single extension is registered with a given type, a reference to that value is returned as Some(_)
Source§

fn extension_mut<E>(&mut self) -> Result<&mut E, PayloadError<ProjectError>>
where E: Extension,

If a single extension is registered with a given type, a mutable reference to that value is returned as Some(_)
Source§

impl GetProjectId for Project

Source§

fn project_id(&self) -> ProjectId

Source§

fn parent_id(&self) -> Option<ProjectId>

Source§

fn root_id(&self) -> ProjectId

Source§

fn is_root(&self) -> bool

Get whether this project is a root
Source§

impl Plugin<Project> for BasePlugin

Source§

fn apply_to( &self, project: &mut Project, ) -> Result<(), PayloadError<ProjectError>>

Apply the plugin
Source§

fn plugin_id(&self) -> &str

The id of the plugin. A plugin of a certain ID can only added once
Source§

impl Plugin<Project> for Plugin

Source§

fn apply_to(&self, _project: &mut Project) -> ProjectResult

Apply the plugin
Source§

fn plugin_id(&self) -> &str

The id of the plugin. A plugin of a certain ID can only added once
Source§

impl Plugin<Project> for ProjectDependencyPlugin

Source§

fn apply_to( &self, project: &mut Project, ) -> Result<(), PayloadError<ProjectError>>

Apply the plugin
Source§

fn plugin_id(&self) -> &str

The id of the plugin. A plugin of a certain ID can only added once
Source§

impl PluginAware for Project

Source§

fn plugin_manager(&self) -> &PluginManager<Project>

Gets a reference to the plugin manager for this value.
Source§

fn plugin_manager_mut(&mut self) -> &mut PluginManager<Project>

Gets a mutable reference to the plugin manager for this value.
Source§

fn apply_plugin<P>(&mut self) -> Result<(), PayloadError<ProjectError>>
where P: Plugin<Self>,

Apply a plugin to this.
Source§

impl ProjectExec for Project

Source§

fn exec<E>(&self, spec: E) -> ProjectResult<ExecHandle>
where E: Into<ExecSpec>,

Execute something that can be made into an ExecSpec
Source§

fn exec_with<F>(&self, config: F) -> ProjectResult<ExecResult>
where F: FnOnce(&mut ExecSpecBuilder),

Automatically executes a spec and logs output streams
Source§

fn builder(&self) -> ExecSpecBuilder

Create a new builder
Source§

impl ProjectResourceExt for Project

Source§

fn get_resource<R>( &self, resource: R, ) -> Result<Box<dyn Artifact>, PayloadError<InvalidResourceLocation>>

Try to get a resource from a project.
Source§

impl SettingsAware for Project

Source§

fn with_settings<F, R>(&self, func: F) -> R
where F: FnOnce(&Settings) -> R,

Source§

fn with_settings_mut<F, R>(&mut self, func: F) -> R
where F: FnOnce(&mut Settings) -> R,

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<S> AssembleAware for S
where S: SettingsAware,

Source§

fn with_assemble<F, R>(&self, func: F) -> R
where F: FnOnce(&Assemble) -> R,

Get the assemble instance this value is aware of.
Source§

fn with_assemble_mut<F, R>(&mut self, func: F) -> R
where F: FnOnce(&mut Assemble) -> R,

Get the assemble instance this value is aware of as a mutable reference
Source§

fn start_parameter(&self) -> StartParameter

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InstanceOf for T
where T: Any + ?Sized,

Source§

fn instance_of<T>(&self) -> bool
where T: Any + ?Sized,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoNamed for T

Source§

fn named<S>(self, name: S) -> Named<Self>
where S: AsRef<str>,

Add a name to this object
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<E> Extension for E
where E: 'static + Send + Sync,

Source§

impl<T> MaybeSendSync for T