Skip to main content

Build

Struct Build 

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

The build of the markup of a crate; see the crate documentation.

Implementations§

Source§

impl Build

Source

pub fn from_env() -> Self

The build of the crate whose build script is running: CARGO_MANIFEST_DIR, OUT_DIR, CARGO_PKG_NAME, and the .xamlmeta of every direct dependency (DEP_<CRATE>_XAML_XAMLMETA), in the order of the names of the variables.

§Panics

Panics outside a build script (a variable Cargo sets is missing).

Source

pub fn new( manifest_dir: PathBuf, out_dir: PathBuf, package_name: &str, dependencies: Vec<PathBuf>, ) -> Self

The build of the package package_name in manifest_dir, writing below out_dir, with the .xamlmeta files of its direct dependencies.

Source

pub fn type_system(self, type_system: TypeSystem) -> Self

The type system the documents are compiled against; TypeSystem::Runtime without the call.

With TypeSystem::Model the build scans the sources of the crate (as export_metadata does, and writes the model the same way), reads the models of the crates it depends on from their .xamlmeta, and compiles every group against the type system over those models. The build script registers nothing and needs no assembly: the assembly is the MarkupAssembly the sources state. A document the models cannot answer a question of the emitter for is an error of the build that names the document and the question; it is never compiled from a guess.

Source

pub fn default_compile_bindings(self, value: bool) -> Self

Whether {Binding} is a compiled binding in a document that does not say otherwise (x:CompileBindings): the DefaultCompileBindings of upstream’s build task. Not without the call.

Source

pub fn analyzer_config_files(self, files: &[&str]) -> Self

The EditorConfig files of the build, relative to the crate directory (the AnalyzerConfigFiles of upstream’s build task): an entry ferro_xaml_diagnostic.<code>.severity = <severity> states the severity a diagnostic of the markup compiler with that code is reported with (error, warning, default; anything else silences it). A file that does not exist is skipped; the build runs again when one changes.

Source

pub fn warnings_as_errors(self, value: bool) -> Self

Reports every warning of the markup compiler as an error of the build (the TreatWarningsAsErrors upstream leaves to the build system), after the severities of the EditorConfig files: a warning a file silences stays silent. Every document is still compiled before the build fails.

Source

pub fn export_metadata(self) -> Self

Scans the sources of the crate and writes its type model into its .xamlmeta (format 2: the model next to the compiled documents), which the crates that depend on this one read as they read its documents (xaml.md 9.6.3). The scan reads the models of the dependencies of the crate first, so that what the crate names of theirs is resolved (ScanOptions::dependencies).

The sources are read as files: nothing of the crate is linked, and a crate that only exports its model needs no assembly (the scan reads the MarkupAssembly the sources state; a crate without one is the assembly named after the crate). What the scanner cannot read of a declaration is a cargo::warning= line and does not fail the build.

Source

pub fn source_root(self, file: &str) -> Self

The root file of the sources of the crate, relative to the crate directory, for export_metadata. Without the call: src/lib.rs, else lib.rs, else src/main.rs.

Source

pub fn assembly(self, assembly: &'static MarkupAssembly) -> Self

The assembly of the crate: its name is the host of the URIs of its documents and assets, and its metadata the default of CreateSourceInfo. The same value the crate registers in its register_types().

Source

pub fn xaml_root(self, directory: &str) -> Self

The directory, relative to the crate directory, below which the documents of a group without stated documents are found. The crate directory by default.

Source

pub fn input(self, path: &str) -> Self

A file, relative to the crate directory, the build reads through the build script (a file the script includes): the build runs again when it changes.

Source

pub fn embed_assets(self, directories: &[&str]) -> Self

Embeds every file below the directories (relative to the crate directory) as an asset of the crate, by its path below the crate directory, except the documents the build compiles.

Source

pub fn compile_xaml(self) -> Self

Compiles every .xaml file below the XAML root as the group DEFAULT_MODULE.

Source

pub fn compile_group(self, group: XamlGroup) -> Self

Compiles a group of documents.

Source

pub fn loader(self, path: &str) -> Self

The loader table of a checked-in generated file of the crate, by the path of its try_load (crate::compiled_main_window::try_load): the table of the crate asks it first, in the order of the calls.

Source

pub fn checked_in_metadata(self, path: &str) -> Self

The .xamlmeta of a checked-in generated file of the crate, relative to the crate directory: its documents are added to the .xamlmeta of the crate.

Source

pub fn run(self)

Runs the build and prints its lines for Cargo. On an error every error is printed and the process exits with a failure.

Source

pub fn execute(self) -> Outcome

Runs the build and returns what run prints.

Auto Trait Implementations§

§

impl Freeze for Build

§

impl RefUnwindSafe for Build

§

impl Send for Build

§

impl Sync for Build

§

impl Unpin for Build

§

impl UnsafeUnpin for Build

§

impl UnwindSafe for Build

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<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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.