Build
struct · ferroui-build · v0.5.0
struct Build
The build of the markup of a crate; see the crate documentation.
Members
from_envnewfull_themestheme_rootshot_reload_manifesttype_systemdefault_compile_bindingsanalyzer_config_fileswarnings_as_errorsexport_metadatasource_rootassemblyxaml_rootinputembed_assetscompile_xamlcompile_grouploaderchecked_in_metadatarunexecute
from_env
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).
new
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.
full_themes
fn full_themes(self: Self, value: bool) -> Self
Whether the base crate has full-themes in this build (FULL_THEMES_VARIABLE, which
from_env reads): a crate whose compiled markup has units is then built
with the cfg FULL_THEMES_CFG, and an application that trims its themes keeps every
unit (#568, step 3).
theme_roots
fn theme_roots(self: Self, names: &[&str]) -> Self
Roots of the themes the application trims, beside its documents and the theme-roots of
its manifest (#568, step 3): units by the path of their document, types or keys. Nothing
when the manifest turns the trimming off ([package.metadata.ferroui] theme-trimming = false).
hot_reload_manifest
fn hot_reload_manifest(self: Self, enabled: bool) -> Self
Emits source metadata when enabled and the target has debug assertions enabled.
Cargo 1.93 and later state the target profile configuration; with older Cargo the
root of the profile (PROFILE, else OPT_LEVEL) decides, and an explicit
-C debug-assertions rustflag wins on every version. The build fails when the
configuration cannot be determined.
type_system
fn type_system(self: 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.
default_compile_bindings
fn default_compile_bindings(self: 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. Compiled
bindings are the default without the call (#603). The manifest of the crate has the last
word: [package.metadata.ferroui] compile-bindings = false (or true) overrides the call,
as the project property overrides the default of upstream's build task.
analyzer_config_files
fn analyzer_config_files(self: 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.
warnings_as_errors
fn warnings_as_errors(self: 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.
export_metadata
fn export_metadata(self: 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_root
fn source_root(self: 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.
assembly
fn assembly(self: 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().
xaml_root
fn xaml_root(self: 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.
input
fn input(self: 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.
embed_assets
fn embed_assets(self: 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.
compile_xaml
fn compile_xaml(self: Self) -> Self
Compiles every .xaml file below the XAML root as the group
DEFAULT_MODULE.
compile_group
fn compile_group(self: Self, group: XamlGroup) -> Self
Compiles a group of documents.
loader
fn loader(self: 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.
checked_in_metadata
fn checked_in_metadata(self: 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.
run
fn run(self: Self)
Runs the build and prints its lines for Cargo. On an error every error is printed and the process exits with a failure.
execute
fn execute(self: Self) -> Outcome
Runs the build and returns what run prints.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyClassDefaultsErasedDestructorIntoEither
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.