11#include "fruit/fruit.h"
12#include "gsl/pointers"
81 struct ProviderChain {
82 std::vector<std::unique_ptr<ConfigProvider>> providers;
83 gsl::not_null<YamlFileProvider *> yaml_provider;
86 [[nodiscard]]
static ProviderChain make_provider_chain(
100 std::vector<std::unique_ptr<ConfigProvider>> providers{};
101 providers.push_back(std::make_unique<CliOptionProvider>(cli_storage));
106 std::make_unique<HeaderDefineProvider>(
108 providers.push_back(std::make_unique<DefaultProvider>());
149 DiagnosticTagFilter warning_filter{std::move(warnings_exclude).value(), std::move(warnings_include).value()};
150 DiagnosticTagFilter remark_filter{std::move(remarks_exclude).value(), std::move(remarks_include).value()};
155 diag = std::make_unique<FilteredUserDiagnostics>(
173 ProviderChain provider_chain;
179 std::unique_ptr<FilteredUserDiagnostics>
diag;
#define PT_TRY_ASSIGN_PASS_ERR(var, expr, return_type)
Unwraps a ChainableResult, passing through the error chain with an empty FormattableError when types ...
Generates C header code for tileset animations.
Parses C code to extract tileset animation parameters using callback chain discovery.
Parses and writes animation configuration JSON files (anim.json).
ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_remarks_include(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_warnings_exclude(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_warnings_include(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< std::vector< std::string > > > diagnostic_remarks_exclude(ConfigScopeType type, const std::string &scope) const
A TilePrinter implementation that generates ASCII art tiles with formatting based on the provided Tex...
A service that loads metatile attributes from a CSV file.
A result type that maintains a chainable sequence of errors for debugging and error reporting.
Regex-based include/exclude filter for diagnostic tags.
Appends INCBIN declarations for Porytiles-managed tileset assets.
An implementation of FilePaletteLoader that loads palettes from JASC-PAL (Paintshop Pro) palette file...
An implementation of FilePaletteSaver that saves palettes to JASC-PAL (Paintshop Pro) palette files.
A Config implementation that lazily pulls a config value by consulting multiple priority-ordered back...
An image loader that reads PNG files to create an Image with an index pixel type.
An image saver that saves PNG files from an Image with an index pixel type.
An image loader that reads PNG files to create an Image with an Rgba32 pixel type.
An image saver that saves PNG files from an Image with an Rgba32 pixel type.
Pokeemerald project filesystem-based implementation of ArtifactChecksumProvider.
Manages Porytiles-owned tilesets via TilesetManifest JSON files.
Modifies tileset_anims.c to include Porytiles-managed animation code headers.
Provides a pokeemerald project filesystem-based implementation for TilesetArtifactKeyProvider.
Provides a filesystem-based implementation for TilesetArtifactReader.
Provides a filesystem-based implementation for TilesetArtifactWriter.
Concrete implementation of UserDiagnostics that outputs structured messages to stderr,...
static const Style bold
Bold text formatting.
Abstract base class for applying text styling with context-aware formatting.
Bootstrap class so every tileset command can share common config and diagnostic setup.
TilesetCommandEnv & operator=(const TilesetCommandEnv &)=delete
fruit::Injector< TextFormatter > injector
TilesetCommandEnv(std::filesystem::path root, const CliOptionStorage &cli_storage)
TilesetCommandEnv & operator=(TilesetCommandEnv &&)=delete
std::filesystem::path project_root
std::unique_ptr< FilteredUserDiagnostics > diag
ChainableResult< void > initialize(const std::string &tileset_name)
Runs the fallible half of env setup: YAML validation and the diagnostic filter construction.
StderrStyledUserDiagnostics stderr_diag
TilesetCommandEnv(TilesetCommandEnv &&)=delete
TilesetCommandEnv(const TilesetCommandEnv &)=delete
TextFormatter * text_formatter
gsl::not_null< YamlFileProvider * > yaml_provider
The schema-driven service graph shared by the compile, create, import, and decompile commands.
std::unique_ptr< TilePrinter > tile_printer
AttributesCsvLoader attributes_csv_loader
ProjectArtifactChecksumProvider checksum_provider
ProjectTilesetMetadataProvider metadata_provider
AnimCodeParser anim_code_parser
TilesetCommandServices(TilesetCommandServices &&)=delete
JascPaletteLoader jasc_loader
IncbinDeclarationAppender incbin_appender
PngRgbaImageSaver png_rgba_saver
JascPaletteSaver jasc_saver
PngRgbaImageLoader png_rgba_loader
ProjectPorytilesTilesetManager tileset_manager
TilesetCommandServices & operator=(const TilesetCommandServices &)=delete
TilesetCommandServices & operator=(TilesetCommandServices &&)=delete
PngIndexedImageSaver png_indexed_saver
std::unique_ptr< PalettePrinter > palette_printer
ProjectTilesetAnimsModifier tileset_anims_modifier
ProjectTilesetArtifactReader artifact_reader
AnimJsonParser anim_json_parser
TilesetCommandServices(TilesetCommandEnv &env, ResolvedAttributeContext context)
ProjectTilesetMetadataWriter metadata_writer
ProjectTilesetArtifactWriter artifact_writer
TilesetCommandServices(const TilesetCommandServices &)=delete
AnimCodeGenerator anim_code_generator
PngIndexedImageLoader png_indexed_loader
ProjectTilesetArtifactKeyProvider key_provider
LoadedMetatileAttributeSchema resolved
ProjectLayoutMetadataProvider layout_metadata_provider
Service that compiles a Tileset (primary or secondary).
Repository interface for the Tileset aggregate root.
A ConfigProvider implementation that reads configuration values from multiple YAML files with priorit...
std::size_t resolve_terminal_width(int fd, std::size_t fallback=80)
Resolves the column width to use for wrapping diagnostic output on fd.
std::map< std::string, std::unique_ptr< EnumMapProvider >, std::less<> > ProviderMap
Maps schema field names to the provider that names that field's values.
ChainableResult< ResolvedAttributeContext > resolve_attribute_context(TilesetCommandEnv &env, const std::string &tileset_name)
Resolves the invocation's metatile attribute schema and builds the provider map for its fields.
@ tileset
Configuration scoped to a specific tileset.
ProviderMap build_provider_map(const std::filesystem::path &project_root, const Schema &schema, gsl::not_null< const TextFormatter * > format, gsl::not_null< const UserDiagnostics * > diag)
Builds a header provider for every provider-backed field in a schema.
Storage struct for CLI option values.
The invocation's resolved attribute schema and provider map, produced before the service graph.
LoadedMetatileAttributeSchema resolved