Fabien Chouteau [Tue, 3 Aug 2021 15:39:38 +0000 (17:39 +0200)]
Alr.Commands.Init: change defaults for init project to release mode (#777)
I first decided to make the default better for developers (to catch as many errors as possible), but they end up in release crates which means that the performance is bad as well as the compatibility between compiler versions.
This patch set the defaults to max performance and compatibility.
This system is clearly not very user friendly, maybe we have too many options here.
Profiles like in Cargo could be better.
Deploy dependencies atomically and related cleanup subcommand (#768)
* Use a temporary to fetch & deploy releases
This is done to avoid an interrupted download (for example with Ctrl-C) to
mistake our deployer, which considers an existing directory as a successfully
deployed dependency.
* Cmd.Clean: implement --temp option
To remove any dangling temporaries
* Improve clean --cache to avoid useless downloads
Fix corner case when pinning to a not available version (#767)
* Less confusing user feedback for existing pin
* Typo in comment
* Fix for corner case in which no solution was found
The solution is impossible, but still an incomplete solution should be
returned. In essence, when the user requested an impossible situation by
applying a pin to a non-existent version for a crate already in the
dependencies, the solver reused the old version assuming it would succeed,
which was not the case if the pin is impossible.
* Better pin info separation
* Extra test case for pinning to unavailable version
Minor testsuite tweak for a change in logging format
* Added new-format pins to alire.toml for self-build
* Allow selective update of pins as for regular deps
* Local pins work with new manifest syntax
* Fixed bug in which version pins were not used
* Make version explicit key in user pin
* Fix bug about confirming empty updates
* Roots: Conflated dep updating into single Sync
We had two confusing Update_Dependencies and Update_And_Deploy_Dependencies
that were in practice doing almost the same. There is now a single
Sync_Dependencies.
* Disable tests that rely on `alr pin`
For now, these cannot work as we are going to remove the ability to edit pins
via `alr with`/`alr pin`. This functionality could be reintroduced at a later
time.
* More tests temporarily disabled
Most of those should be reimplemented in their manual edition alternative
* Disable code for pin edition in command-line
* Changes to allow pins to non-dependencies
This is purely for user comfort and will probably result in dependencies having
to be added at publish time. However, if we manage to restore command-line
pinning, we can remove that pain by adding missing dependencies at that time.
* Tests in tests/pin using new pins
Some tests are not easily portable without support from `alr with --use`. Since
that should be easy to implement later, they are disabled for now and will be
enabled in a subsequent patch.
* Documentation on new pins
* Fix for testcase on Windows using path separators
* Spelling fixes, and exclude lockfiles from check
* New test for various invalid pin entries in manifest
Also the required code changes to pass the test
* Fixes from code self-review
* Fixes suggested during code review
* Fix for missed update when there is no lockfile
We were creating an empty lockfile, which was newer than the manifest, and thus
not triggering the expected automatic update.
* Test to check pins are applied with no prior lockfile
This was a bug detected and corrected in the previous commit
* Fix timestamps compare when mixing G.OS_Lib/A.Dirs
* Update pins for self-build
* Disable self-build, that uses CE2021
It cannot succeed until the patches in this very PR are merged, as it is
attempting to build the old code with the new compiler in the setup-alire
action.
Synchronize alire metadata and git submodules (#720)
* Sync submodules and alire metadata
* Reenable self-build in all platforms
* Feedback about build
* Disable macOS
Somehow apt-get ends being called. To be diagnosed.
* Fix environment settings in manifest
This should fix the problem with the macOS build
* Identified and fixed issue with macOS build
The problem is that the native package in the lockfile was being blindly used.
This is a further hint that lockfiles require work to work better
cross-platform.
* Fix issue with indirect dependencies in test
The self-build test has uncovered an issue already reported, and this commit
also fixes minor differences in output for linked dependencies, depending on
whether they contain alire metadata or not (the same information can be
presented regardless)
Also, disabled version printing on setup-alire, and moved here
Simon Wright [Mon, 10 May 2021 13:36:14 +0000 (14:36 +0100)]
Workround for issue #729 (#731)
Updated rules in 3.10.2 and 6.4.1(6) caused the use of
Constant_Reference, which takes the Container as an aliased parameter,
to trip over its use on a container passed as an un-aliased parameter.
* src/alire/alire-conditional_trees.ads (Root): replace
Constant_Reference by Element.
* src/alire/alire-dependencies-states.adb ("="): likewise.
* src/alire/alire-conditional_trees.adb (To_YAML (1)): likewise.
(Image_One_Line): likewise.
(Iterate): replace Constant_Reference.Element.all by just Element.
* Ensure pinned dirs use portable paths when relative
* Adjustments in testsuite for new relative links
* Recursively add links when linking crates
* Compound relative paths when adding links
* Restore inadvertently removed comment
* Relax too restrictive checks
In the case of linked releases, it doesn't matter if these contain expressions
as we don't write them to disk. As for the spurious warning during loading of
links, we may be transitively loading and the assumption on the current
directory is faulty in that case. The check must be performed elsewhere.
* Buildable with the new design, still unimplemented
Only stub bodies
* New expression loader complete, pending ptypes
* Renamed packages Pseudotypes.* to Expressions.*
* Alire.Expressions.* implementation complete
* All functionality complete, tests missing
* System externals now reuse dynamic loaders
* Fixes found by the testsuite, and output tweaks
There is a functional difference that affects the output for some tests:
before, all enum cases received a value, even if it came from an "others"
clause. This meant that all cases were explicitly listed. Now, the "others" is
stored as is, and the output reproduces the contents of the TOML structure. A
few tests had to be adjusted for this.
* Fixes found testing the current stable index
* Remove obsolete documentation
* Implement and test 'x|y' expressions
* Improve output of `alr show` for system packages
* Fixes found during self-review: comments, dead code
Remove Alire.Requisites and Alire.Boolean_Trees (#701)
* Availability as conditional tree
* Refactor up to Alire.Releases
* It builds for all of Alire.*
* It completely builds
* Testsuite passing, minor cosmetic fixes
There is a minor improvement for trees in which a vector with a single value is
promoted to the single value itself. As vectors are delimited by '(' ')', there
are a few test outputs that required eliminating these former extra
parentheses.
* Dead code removal related to old Ada index
* Case exprs excised from Requisites
This allows more dead code removal and some further internal simplifications.
* Removed Requisites and all related dead code
No longer needed, Requisites were useful in the old index for general
expressions, but not anymore in our case-restricted index. Some quite obscure
portions of Alire code can be thus removed.
Cache lockfiles, remove Root global, and related refactorings (#690)
* Changes up to Alire.Roots
* Finished migrating from Workspace
* Root is stored in Alr.Commands.Command for reuse
This way the global Root is no longer reloaded many times, and modifications
are properly encapsulated via the Alire.Roots.Root type. This removes one of
the outstanding code smells in Alire.
* Speed-ups related to lockfile checks
There were a number of overkill checks that furthermore were expensive, loading
the lockfile many times. This became quite noticeable for large lockfiles (once
there is a decent number of dependencies).
* Minor tweaks to comments
* Tweaks after merging from master
Two big PRs were merged from upstream that created some friction with these
changes, requiring minor tweaks.
* Temporarily disable `alr build` CI check
To allow merging with changes in dependencies, temporarily disable the
aforementioned check.
Fabien Chouteau [Wed, 3 Mar 2021 15:18:34 +0000 (07:18 -0800)]
Start support for crate configuration (#673)
This is the possibility for crates to define configuration variables
that will then generate Ada, C, or GPR files based on the values set by
depending crates.
For embedded projects where compile optimization and static memory usage
are important, it is possible to define sizes of cache buffers or
maximum amount of some resources.
It allows to enable or disable features at compile time, such as debug
logging.
Automatically narrow down dependencies given as "any" (#675)
* Implement narrowing down of new "any" dependencies
Instead of adding just a foo* dependency, check how it was solved and use that
version to add a more precise (and usually wanted) dependency; e.g., foo^1.2,
foo~0.1
* Fix case of dependency removal
* New test and fixed other tests to new behavior
Many tests explicitly check the added dependencies, so this is extra assurance
about this change.
Fabien Chouteau [Tue, 2 Feb 2021 17:42:05 +0000 (18:42 +0100)]
alr-platforms-windows.adb: msys2 install command line changed (#677)
https://github.com/msys2/msys2-installer/pull/20 changed the name of the argument for installation prefix of the msys2 installer.
All previous versions are impacted and won't be able to install msys2 at the correct location.
This flag filters out packages installed indirectly (as dependencies), causing
our detection of such a package to fail. -Q by design already only works on
installed packages, so that's all we need.
The addition of more enum values to support other distributions is a
breaking change. This raises the question of whether we should simply drop
unknown enum values, as this could well work. But then, using an improper value
would silently fail. Perhaps the warning could be disabled for normal use and
re-enabled for publish?
Separate workflow to test unsupported package manager platform (#623)
* Workflow to test with unsupported package manager
* Add config option to disable distro detection
With test
* Fixes for circular elaboration
* Fix test for slight change in behavior
Before the last changes to break circularities, we tried to load the manifest
as part of the config loading process. Now we are satisfied with finding a
properly named file at the expected place. This causes one test to not detect
invalid TOML, since the manifest contents aren't really needed for the test.
Solver: Speed-up for impossible dependencies (#620)
* Solver: Speed-up for impossible dependencies
Whenever a solution is incomplete we keep looking for solutions. But if the
reason for incompleteness is an impossible request (non-existent crate or
version), this resulted on finding all combinations for the rest of crates that
do have satisfiable dependencies.
With this patch, impossible situations are considered part of the "complete"
solution (as there cannot be a more complete one), which allows the solver to
use complete the search much more quickly, as no pointless attempts for more
solutions are made.
* Fixes for problems caught by the test suite
The optimization was too aggressive, as it took place before detecting
externals. Also, it should only apply to direct unavoidable dependencies, as
indirect impossibilities can be avoided by other solutions.
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.