Skip to content

Commit

Permalink
Merge changes since rc2 into 1.1 branch for rc3
Browse files Browse the repository at this point in the history
Merge changes since rc2 into 1.1 branch for rc3
  • Loading branch information
mosteo authored Sep 10, 2021
2 parents c7730fc + 4e8cc07 commit 38b9c92
Show file tree
Hide file tree
Showing 22 changed files with 200 additions and 111 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: alr-bin-linux.zip
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-bin-linux.zip
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-bin-x86_64-linux.zip
asset_content_type: application/zip

############
Expand Down Expand Up @@ -124,5 +124,5 @@ jobs:
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: alr.AppImage
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}.AppImage
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-x86_64.AppImage
asset_content_type: application/x-elf
2 changes: 1 addition & 1 deletion .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,5 @@ jobs:
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: alr-bin-macos.zip
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-bin-macos.zip
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-bin-x86_64-macos.zip
asset_content_type: application/zip
4 changes: 2 additions & 2 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: scripts/installer/alire-install.exe
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-installer-windows.exe
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-installer-x86_64-windows.exe
asset_content_type: application/vnd.microsoft.portable-executable

- name: Package binaries
Expand All @@ -140,5 +140,5 @@ jobs:
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: alr-bin-windows.zip
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-bin-windows.zip
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-bin-x86_64-windows.zip
asset_content_type: application/zip
8 changes: 4 additions & 4 deletions src/alire/alire-shared.adb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ package body Alire.Shared is
-- Share --
-----------

procedure Share (Release : Releases.Release)
procedure Share (Release : Releases.Release;
Location : Any_Path := Install_Path)
is
Already_Installed : Boolean := False;

Expand Down Expand Up @@ -155,8 +156,7 @@ package body Alire.Shared is
end if;

-- See if it can be skipped

if Available.Contains (Release) then
if Location = Install_Path and then Available.Contains (Release) then
Trace.Detail ("Skipping installation of already available release: "
& Release.Milestone.TTY_Image);
return;
Expand All @@ -165,7 +165,7 @@ package body Alire.Shared is
-- Deploy at the install location

Release.Deploy (Env => Root.Platform_Properties,
Parent_Folder => Install_Path,
Parent_Folder => Location,
Was_There => Already_Installed,
Perform_Actions => True,
Create_Manifest => True,
Expand Down
5 changes: 3 additions & 2 deletions src/alire/alire-shared.ads
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ package Alire.Shared is
function Install_Path return Any_Path;
-- Returns the base folder in which all shared releases live

procedure Share (Release : Releases.Release);
-- Deploy a release in the shared location for the configuration
procedure Share (Release : Releases.Release;
Location : Any_Path := Install_Path);
-- Deploy a release in the specified location

procedure Remove
(Release : Releases.Release;
Expand Down
3 changes: 2 additions & 1 deletion src/alire/alire-version.ads
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package Alire.Version with Preelaborate is

Current : constant String := "1.1.0-rc2";
Current : constant String := "1.1.0-rc3";
-- 1.1.0-rc3: toolchain with multiple switches, minor fixes
-- 1.1.0-rc2: toolchain non-interactive, lockfile under alire
-- 1.1.0-rc1: crate config, toolchains, manifest pins
-- 1.1.0-dev: begin post-1.0 changes
Expand Down
2 changes: 1 addition & 1 deletion src/alr/alr-commands-init.adb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ package body Alr.Commands.Init is
Put_Line (" when ""enabled"" => null;");
Put_Line (" when others =>");
Put_Line (" Runtime_Checks_Switches :=");
Put_Line (" (""-gnatp""); -- Supress checks");
Put_Line (" (""-gnatp""); -- Suppress checks");
Put_Line (" end case;");
Put_New_Line;
Put_Line (" Style_Checks_Switches := ();");
Expand Down
76 changes: 44 additions & 32 deletions src/alr/alr-commands-toolchain.adb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

with GNAT.Strings; use GNAT.Strings;

with AAA.Table_IO;

with Alire.Config.Edit;
Expand Down Expand Up @@ -37,7 +40,13 @@ package body Alr.Commands.Toolchain is
Cmd.Install'Access,
Switch => "-i",
Long_Switch => "--install",
Help => "Install a toolchain component");
Help => "Install one or more toolchain component");

Define_Switch
(Config,
Cmd.Install_Dir'Access,
Long_Switch => "--install-dir=",
Help => "Toolchain component(s) installation directory");

Define_Switch
(Config,
Expand All @@ -58,7 +67,7 @@ package body Alr.Commands.Toolchain is
Cmd.Uninstall'Access,
Switch => "-u",
Long_Switch => "--uninstall",
Help => "Uninstall a toolchain component");
Help => "Uninstall one or more toolchain component");
end Setup_Switches;

-------------
Expand Down Expand Up @@ -102,7 +111,11 @@ package body Alr.Commands.Toolchain is

-- And perform the actual installation

Shared.Share (Rel);
if Cmd.Install_Dir.all /= "" then
Shared.Share (Rel, Cmd.Install_Dir.all);
else
Shared.Share (Rel);
end if;

if Set_As_Default then
Alire.Toolchains.Set_As_Default
Expand Down Expand Up @@ -236,45 +249,47 @@ package body Alr.Commands.Toolchain is
-- Validation

if Alire.Utils.Count_True
((Cmd.Disable, Cmd.Install, Cmd.S_Select, Cmd.Uninstall)) > 1
((Cmd.Install, Cmd.S_Select, Cmd.Uninstall)) > 1
then
Reportaise_Wrong_Arguments
("The provided switches cannot be used simultaneously");
end if;

if Args.Count > 1 then
Reportaise_Wrong_Arguments
("One crate with optional version expected: crate[version set]");
end if;

if (Cmd.Install or Cmd.Uninstall) and then Args.Count /= 1 then
if (Cmd.Install or Cmd.Uninstall) and then Args.Is_Empty then
Reportaise_Wrong_Arguments ("No release specified");
end if;

if Args.Count = 1 and then
if not Args.Is_Empty and then
not (Cmd.Install or Cmd.Uninstall or Cmd.S_Select)
then
Reportaise_Wrong_Arguments
("Specify the action to perform with the crate");
end if;

if Cmd.S_Select and then Args.Count > 1 then
Reportaise_Wrong_Arguments
("Toolchain installation accepts at most one argument");
end if;

if Cmd.Local and then not (Cmd.S_Select or else Cmd.Disable) then
Reportaise_Wrong_Arguments
("--local requires --select or --disable-assistant");
end if;

if Cmd.Disable and then Args.Count /= 0 then
if Cmd.Install_Dir.all /= "" and then not Cmd.Install then
Reportaise_Wrong_Arguments
("Disabling the assistant does not admit any extra arguments");
("--install-dir is only compatible with --install action");
end if;

-- Dispatch to subcommands

if Cmd.Disable then
Alire.Toolchains.Set_Automatic_Assistant (False,
(if Cmd.Local
then Alire.Config.Local
else Alire.Config.Global));
Alire.Put_Info
("Assistant disabled in "
& TTY.Emph (if Cmd.Local then "local" else "global")
& " configuration.");

end if;

if Cmd.S_Select then

Cmd.Requires_Full_Index;
Expand All @@ -288,28 +303,25 @@ package body Alr.Commands.Toolchain is
then Alire.Config.Local
else Alire.Config.Global);
else
Install (Cmd, Args (1), Set_As_Default => True);
for Elt of Args loop
Install (Cmd, Elt, Set_As_Default => True);
end loop;
end if;

elsif Cmd.Uninstall then
Uninstall (Cmd, Args (1));
for Elt of Args loop
Uninstall (Cmd, Elt);
end loop;

elsif Cmd.Install then
Install (Cmd, Args (1), Set_As_Default => False);
for Elt of Args loop
Install (Cmd, Elt, Set_As_Default => False);
end loop;

elsif Cmd.Disable then
Alire.Toolchains.Set_Automatic_Assistant (False,
(if Cmd.Local
then Alire.Config.Local
else Alire.Config.Global));
Alire.Put_Info
("Assistant disabled in "
& TTY.Emph (if Cmd.Local then "local" else "global")
& " configuration.");
elsif not Cmd.Disable then

else
-- When no command is specified, print the list
Cmd.List;

end if;

exception
Expand Down
24 changes: 14 additions & 10 deletions src/alr/alr-commands-toolchain.ads
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
with AAA.Strings;

private with GNAT.Strings;

package Alr.Commands.Toolchain is

-- Installation of binary toolchain crates into the ${ALR_CONFIG}/cache
Expand Down Expand Up @@ -32,12 +34,13 @@ package Alr.Commands.Toolchain is
& "select the default toolchain for this configuration. "
& "Adding --local will instead make the selection apply "
& "only to the workspace (overridding a possible "
& "configuration-wide selection). Giving a release argument will "
& "skip the assistant and set the release as the default.")
& "configuration-wide selection). Giving one or more releases"
& " argument will skip the assistant and set the release as the"
& " default.")
.New_Line
.Append
("Specify --install/--uninstall and a crate name with optional "
& "version set to make available or remove a tool.")
("Specify --install/--uninstall and one or more crates name with"
& " optional version set to make available or remove a tool.")
.New_Line
.Append
("Run `" & TTY.Terminal ("alr help toolchains") & "` for further "
Expand All @@ -56,16 +59,17 @@ package Alr.Commands.Toolchain is
overriding
function Usage_Custom_Parameters (Cmd : Command) return String
is ("[-u|--uninstall] [-i|--install crate[version set]] |"
& " --select [--local] [release]");
& " --select [--local] [releases] [--disable-assistant]");

private

type Command is new Commands.Command with record
Disable : aliased Boolean := False;
Install : aliased Boolean := False;
Local : aliased Boolean := False;
S_Select : aliased Boolean := False;
Uninstall : aliased Boolean := False;
Disable : aliased Boolean := False;
Install : aliased Boolean := False;
Install_Dir : aliased GNAT.Strings.String_Access := null;
Local : aliased Boolean := False;
S_Select : aliased Boolean := False;
Uninstall : aliased Boolean := False;
end record;

end Alr.Commands.Toolchain;
1 change: 1 addition & 0 deletions src/alr/alr-commands.adb
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ package body Alr.Commands is

if No_TTY then
CLIC.TTY.Force_Disable_TTY;
Trace.Is_TTY := False;
end if;

if Platform.Operating_System not in Alire.Platforms.Windows and then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
description = "Fake GNAT native crate"
name = "gnat_native"
version = "1.0.0"
version = "7777.0.0"
maintainers = ["[email protected]"]
maintainers-logins = ["mylogin"]
provides = ["gnat=1.0"]
provides = ["gnat=7777.0"]

# Test dynamic expression, but for all OSes
[origin."case(os)"."..."]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
description = "Fake GNAT native crate"
name = "gnat_native"
version = "2.0.0"
version = "8888.0.0"
maintainers = ["[email protected]"]
maintainers-logins = ["mylogin"]
provides = ["gnat=2.0"]
provides = ["gnat=8888.0"]

# Test dynamic expression, but for all OSes
[origin."case(os)"."..."]
Expand Down
7 changes: 4 additions & 3 deletions testsuite/tests/solver/compiler-installed/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
p.out)

# Capture version
version = re.search("[0-9.]+", p.out, re.MULTILINE).group()
version = re.search("gnat_external ([0-9.]+)", p.out, re.MULTILINE).group(1)

print(version)
# When no compiler is selected, since the external one is available, it should
# be used before offering to download a new compiler.

Expand Down Expand Up @@ -50,7 +51,7 @@

run_alr("toolchain", "--install", "gnat_native")
run_alr("update")
match_solution("gnat=2.0.0 (gnat_native) (installed)", escape=True)
match_solution("gnat=8888.0.0 (gnat_native) (installed)", escape=True)

# If we remove the version exclusion, the external compiler will still be
# preferred as there is no selected compiler yet.
Expand All @@ -61,7 +62,7 @@

# But, if the user selects a compiler as preferred, it will be used first

run_alr("config", "--set", "toolchain.use.gnat", "gnat_cross_2=1.0.0")
run_alr("config", "--set", "toolchain.use.gnat", "gnat_cross_2=7777.0.0")
run_alr("update")
match_solution("gnat=1.0.0 (gnat_cross_2) (installed)", escape=True)

Expand Down
Loading

0 comments on commit 38b9c92

Please sign in to comment.