How alire-project/alire works
Main project domains and modules
• Command‐line Interface (CLI): The “alr” components (located under src/alr) form the front end that users interact with. They parse user commands (like “alr build”, “alr printenv”, or “alr get”) and then drive the workflow.
• Core Dependency Management & Library Repository: The “alire” modules (under src/alire) include the engine for fetching, resolving, caching, and organizing Ada libraries. They employ TOML configuration files (alire.toml) both locally and from community indexes.
• Build Environment Integration: With provided GNAT (Ada 2012) project files (e.g., alr_env.gpr) and support scripts in the “dev” and “scripts” directories, the tool automates setting up the GPR_PROJECT_PATH and invoking gprbuild.
• Platform-Specific Adaptations: Directories like src/alire/os_* and src/alr/os_* indicate that the project contains OS-specific modules (for Linux, macOS, Windows, FreeBSD, OpenBSD) to manage platform variations and possibly trigger “sudo” installations for platform package managers.
• Auxiliary Components: Additional folders such as “deps”, “testsuite”, “doc”, “support”, and “templates” cover dependencies management, continuous integration tests, documentation, and installer or embedder support.
Out key interactions within the system
• The CLI module accepts user commands and delegates tasks to the Dependency Resolution Engine.
• The Dependency Resolver reads from configuration files (e.g., alire.toml) and interacts with the Community Index (which is maintained as local TOML files in the index) to determine which libraries (crates) need to be fetched or built.
• The Build Orchestrator sets up the environment (by configuring GPR_PROJECT_PATH) and calls the GNAT build tools (gprbuild) to compile projects and dependencies.
• The Platform Abstraction layer adjusts behavior according to ALIRE_OS, reading from OS-specific modules.
• The system may also call external package managers (with user authorization via sudo when required) to install certain platform packages.
Architectural patterns and design principles
• Modularity: Separate modules for CLI, dependency resolution, library management, and build orchestration.
• Layering: The architecture separates the user interface (CLI) from core business logic and from the build environment interface.
• Extensibility: The use of TOML metadata and separate modules for different OS platforms makes it easy to extend ALIRE to support new library formats or build workflows.
• Environment Isolation: Similar to Python’s virtualenv, ALIRE encapsulates dependencies via locally configured build environments.