Added alire.toml so alr can build/edit itself (#575)
* Added alire.toml so alr can build/edit itself
Also bumped the patch number, as code changes from now own should appear in a
future release, and 0.7-dev means pre-0.7 according to semantic versioning.
Fabien Chouteau [Wed, 4 Nov 2020 20:32:52 +0000 (21:32 +0100)]
Alire.Environment: load env context from the platform (#608)
* Alire.Environment: sort env list for predictable output
* Alire.Environment: load env context from the platform
For the moment this is only used on Windows for msys2. Before this patch the msys2 env was not included in `alr print` which means that the context was not complete.
* Alr.Platforms.Windows: do not install msys2 if pacman already in PATH
This makes alr usable when the user is already in an msys2 context.
And it alse makes possible to have an alire package in msys2.
Avoid unneeded requests to approve changes after editing the manifest (#591)
* Avoid unneeded requests to update when no changes
Changes in solutions were being spuriously detected, in situations in which
there were no changes. Also, when manual changes didn't affect dependencies,
the situation was not corrected either by manual update or automatic check.
Fabien Chouteau [Wed, 28 Oct 2020 19:27:46 +0000 (20:27 +0100)]
Alr.Commands.Init: warnings instead of fails for existing files (#599)
To make this command more usable when converting an existing Ada project
to Alire, existing source or gpr files are now reported as a warning
instead of an error.
Publish: Detect missing manifest in remote sources (#595)
This could escape our checks when the alire.toml file was in .gitignore, for
example, so we didn't detect the discrepancy between local and remote sources.
Use GitHub API for basic checks/info during publishing (#554)
* Use GitHub API for basic checks/info during publish
* Code review fix
* Fix: new config values unavailable during same run
New config entries were stored on disk but not added to the memory map. As the
Config.Set subprogram isn't aware of the level of configuration being set,
there is no direct way to both store to disk and to memory; instead the
solution is that the configuration is reloaded every time. This is a bit of
overkill and a candidate for later optimization.
Alire.Utils.User_Input: add function to query user's name, email and GitHub login (#461)
* Alire.Utils.User_Input: add function to query user's name, email and github login
* Break circular elaboration issue
Since Config uses Utils.User_Input indirectly via Deplyers.System, a
possibility is to move new User_Input functions that need Config into a new
package.
Co-authored-by: Alejandro R. Mosteo <amosteo@unizar.es>
It seems GNAT's Normalize_Arguments does its own escaping, so we do not need to
do it ourselves. Also, the test checks that indeed the `alire` folder is
excluded when tar'ing manually.
For fetching from github, it is safe to do this transformation, whereas users
working with the repo may find more convenient the use of private git@ URLs.
* Detect github URLs missing a trailing ".git"
* Testsuite: more cases for git remotes
* Allow controlling the git@ -> https:// transformation
* Generalize checks beyond github
* Unit test for Alire.VCSs.Git.Transform_To_Public
Use local repository as reference for publishing (#519)
* Publish using local repo and revision as reference
We still require the remote is ready (in essence, that the local repo is not
ahead of the remote), but now it is simply a matter of issuing `alr publish` or
`alr publish <commit|tag|branch>`, and the corresponding commit will be used.
* Refactor long function name to more sensible one
* Fix comments due to bad refactoring
* Test for publishing from inside a repo
* Fixes uncovered by testsuite
Adding defaults for <URL> <commit> complicates things somewhat as we use local
paths for testing that would otherwise be rejected, so a few corner cases have
to be explicitly considered now.
The extra indirection level was not required, as os.walk already gives us the
proper paths we need. This wasn't detected until we tried to build an unzipped
release zipped by ourselves.
After fixing the manifest file name to `alire.toml`, there is no possible
confusion with other toml files in the same directory, so we can explicitly
give .toml extension to config files.
Move out a possible upstream-provided manifest (#487)
When doing `alr get` we want to use the index-provided manifest for
reproducibility. So, an eventual upstream manifest provided with the sources is
renamed with an extra ".upstream" coda.
In most cases, the Root has to be valid so it can be used. This patch moves the
Is_Valid code smell to a separate child type (Alire.Roots.Optional.Root) that
can be used in the few cases where all the root states have to be treated
separately.
This is done by using newline characters to insert a new error prefix. A couple
of new facilities to encourage splitting of long errors are defined:
Errors.Wrap and Errors.Set (Wrapping_Message, Wrapped_Exception)
* Rename Last_Chance_Handler to Alr.Last_Chance_...
To avoid possible conflicts with other libraries and follow the naming of
other packages.
* Append new dependencies to the end of the manifest
* Conservative removal of dependencies in `alr with`
This action will also not touch lines that aren't involved in the deletion.
Only a simple dependency, and trivially empty [[depends-on]] array entries will
be removed. As an improvement over the previous situation, dynamic expressions
will not preclude using `alr with` for static dependencies, leaving the dynamic
ones untouched.
* Use lexicographical order for printing dependencies
This was happening before by chance in several tests. The `alr with` changes
have surfaced that the order on file is kept in tree; while this has no
secondary effects, for presentation to the user is better to be always
consistent. Solutions already use ordered sets, so for lists within conditional
trees we do the same (only for presentation).
Move origin information to its own top-level table (#480)
* Script to patch manifest with separate origin table
A self-contained origin table is cleaner and allow each origin kind to have its
own fields without polluting the rest of the properties top-level table
* Alire:Index: bump expected index version
* Load/Save new [origin] table
* Testsuite: migrated indexes to new [origin] format
* Migrate testsuite indexes to new split manifests
* Alire.Index: update community version
* Refactor Alr.OS_Lib.Traverse_Folder into Alire
As Alire.Directories.Traverse_Tree
* Alire.TOML_Index: traverse new folder structure
Also adapt the checks to the new structure, and double-check that the file name
matches the manifest contents (name, version).
* Refactor Crate internals for new flat manifests
Since now each release is truly independent, crates need not to store the
common information as previously. This is done now only for external
definitions in a narrower scope.
Several loading functions can also be streamlined since now it's simpler to get
a proper complete release without requiring its enclosing crate.
The bulk of the refactoring emanates from merging Alire.Crates.With_Releases
into simply Alire.Crates, and repurposing the Alire.Crates.Sections enum.
* Use new [[depends-on]] dependencies
Nothing outwards has changed yet; the manifest is still entirely machine
generated. This commit only changes the table [depends-on] into an array of
[[depends-on]] tables.
* Testsuite fixes for new format
Fixes in code detected by the testsuite, and small changes in output due to
code refactorings.
Script to migrate indexes to per-release files (#478)
* Ignore JetBrains IDE config folders and virtualenvs
* s/libhello/li (index subfolder improper name)
* Fix invalid semantic version in some test crates
s/_/-/, turns out only hyphens are allowed in the pre-release portion.
* Script to split crate files into releases
It applies the foreseeable needed transformations: one release per file, one
file for external definitions; dependencies moved to an array; added name and
version keys.
Update automatically after manual manifest edition or missing dependency detection (#472)
* Remove redundant parameter in Alire.Workspace
Environment can now be retrieved from Alire.Roots.Root.
* New Alire.Roots.Sync_Solution_And_Deps
This procedure verifies that the lockfile is not older than the manifest, and
that all dependencies in the solution exist on disk. Otherwise, dependencies
are redeployed.
* Refactor/cleanup paths from Alire.Paths
The dependency path is always used in the context of an Alire.Roots.Root, so it
is more meaningful being defined there.
Also removed the cache path that wasn't used anywhere.
* Checks against reexporting the same environment
* Refactor Alr.Commands.Requires_Full_Index into Alire
This way, the index loading can be triggered by logic in Alire that absolutely
requires the index to be loaded.
* Do not auto update before `alr update`
* Refactor Confirm_Solution_Changes into Alire
From Alr.Commands.User_Input into Alire.Utils.User_Input.
* Tests for the new sync features
- Test that a manually modified manifest results in an autosync
- Test that missing dependencies in the cache are redeployed
Alr.Commands.Init: add library type handling in generated project (#470)
type Library_Type_Type is ("relocatable", "static", "static-pic");
Library_Type : Library_Type_Type :=
external ("XXX_LIBRARY_TYPE",
external ("LIBRARY_TYPE", "static"));
for Library_Kind use Library_Type;
New `alr with --versions` for version-related info of dependencies (#464)
* New `alr with --versions` for version-related info
This new version focuses on showing: which constraints were found for each
dependency, which version was used to fulfill them, and what's the latest
existing version for a crate (hence pointing to possible wanted updates).
Move ASCII graph to `--graph` switch, and add a `--tree` alternative & fallback (#465)
* New `alr with --tree`, `alr show --tree` switch
Prints dependency graph in tree form, as an alternative to the ascii-art plots
that 1) not always will be available, depending in libgraph-easy-perl and 2)
quickly become big and broken.
* Move ASCII graph to dedicated --graph switch
Previously, it was always attempted to be shown with `--solve`, which could be
an unnecessary pollution for an otherwise useful command.