Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alire.Crate.Configuration: disable style checks in generated code #1047

Merged
merged 1 commit into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/alire/alire-crate_configuration.adb
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ package body Alire.Crate_Configuration is
(File, "-- Configuration for " & (+Crate) & " generated by Alire");

TIO.Put_Line (File, "pragma Restrictions (No_Elaboration_Code);");
TIO.Put_Line (File, "pragma Style_Checks (Off);");
TIO.New_Line (File);
TIO.Put_Line (File, "package " & Crate_Mixed & "_Config is");
TIO.Put_Line (File, " pragma Pure;");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
with "config/hello_world_config.gpr";
project Hello_World is

for Source_Dirs use ("src/", "config/");
for Object_Dir use "obj/" & Hello_World_Config.Build_Profile;
for Create_Missing_Dirs use "True";
for Exec_Dir use "bin";
for Main use ("hello_world.adb");

package Compiler is
for Default_Switches ("Ada") use Hello_World_Config.Ada_Compiler_Switches;
end Compiler;

package Binder is
for Switches ("Ada") use ("-Es"); -- Symbolic traceback
end Binder;

package Install is
for Artifacts (".") use ("share");
end Install;

end Hello_World;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
with Ada.Text_IO;

with Hello_World_Config;

procedure Hello_World is
begin
Ada.Text_IO.Put_Line (Hello_World_Config.Crate_Version);
end Hello_World;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
description = "\"Hello, world!\" demonstration project"
name = "hello_world"
version = "0.1.0"
licenses = "GPL-3.0-only"
maintainers = ["[email protected]"]
maintainers-logins = ["mylogin"]
executables=['main']

[origin]
url = "file:../../../hello_src"

[configuration.variables]
test = { type = "Enum", values = ["This_Is_Too_Long", "And_Might_Trigger", "A_Style_Check_Error", "But_We_Disable_Them", "In_The_Generate_Code"], default = "This_Is_Too_Long"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = "1.1"
14 changes: 14 additions & 0 deletions testsuite/tests/crate_config/style_checks_off/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
Test that style checks are disabled in generated code
"""

from drivers.alr import run_alr

import os

# Get and check post fetch action
run_alr('get', 'hello_world')
os.chdir("hello_world_0.1.0_filesystem/")
run_alr('build', '--validation')

print('SUCCESS')
4 changes: 4 additions & 0 deletions testsuite/tests/crate_config/style_checks_off/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
driver: python-script
indexes:
my_index:
in_fixtures: false