pub struct Build { /* private fields */ }Expand description
The build of the markup of a crate; see the crate documentation.
Implementations§
Source§impl Build
impl Build
Sourcepub fn from_env() -> Self
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).
Sourcepub fn new(
manifest_dir: PathBuf,
out_dir: PathBuf,
package_name: &str,
dependencies: Vec<PathBuf>,
) -> Self
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.
Sourcepub fn type_system(self, type_system: TypeSystem) -> Self
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.
Sourcepub fn default_compile_bindings(self, value: bool) -> Self
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.
Sourcepub fn analyzer_config_files(self, files: &[&str]) -> Self
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.
Sourcepub fn warnings_as_errors(self, value: bool) -> Self
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.
Sourcepub fn export_metadata(self) -> Self
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.
Sourcepub fn source_root(self, file: &str) -> Self
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.
Sourcepub fn assembly(self, assembly: &'static MarkupAssembly) -> Self
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().
Sourcepub fn xaml_root(self, directory: &str) -> Self
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.
Sourcepub fn input(self, path: &str) -> Self
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.
Sourcepub fn embed_assets(self, directories: &[&str]) -> Self
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.
Sourcepub fn compile_xaml(self) -> Self
pub fn compile_xaml(self) -> Self
Compiles every .xaml file below the XAML root as the group
DEFAULT_MODULE.
Sourcepub fn compile_group(self, group: XamlGroup) -> Self
pub fn compile_group(self, group: XamlGroup) -> Self
Compiles a group of documents.
Sourcepub fn loader(self, path: &str) -> Self
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.
Sourcepub fn checked_in_metadata(self, path: &str) -> Self
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.
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> 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> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more