Skip to content

Commit

Permalink
Use compiler switches from Alire's configuration
Browse files Browse the repository at this point in the history
Signed-off-by: onox <denkpadje@gmail.com>
  • Loading branch information
onox committed Jul 30, 2022
1 parent 5fd9f67 commit 83ac169
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 168 deletions.
30 changes: 12 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
.PHONY: build fast debug clean prove tests coverage
.PHONY: build clean prove tests coverage

build:
cd json && alr build

fast:
cd json && alr build -- -XJSON_RUNTIME_CHECKS=none -XJSON_CONTRACTS=disabled

debug:
cd json && alr build -- -XJSON_BUILD_MODE=debug
cd json && alr build --validation

clean:
-gnatprove --clean -P json/json.gpr
-alr gnatprove --clean
cd json && alr clean
cd tests && alr clean
rm -rf json/build tests/build tests/cov tests/TEST-*.xml
rm -rf json/build tests/build tests/build/cov tests/TEST-*.xml

prove:
gnatprove -P json/json.gpr
alr gnatprove

tests:
cd tests && alr build -- -XJSON_BUILD_MODE=coverage
cd tests && alr build --development
cd tests && alr run -s

coverage:
mkdir -p tests/cov
lcov -q -c -d json/build/obj -d tests/build/obj -o tests/cov/unit.info
lcov -q -r tests/cov/unit.info */adainclude/* -o tests/cov/unit.info
lcov -q -r tests/cov/unit.info */tests/* -o tests/cov/unit.info
genhtml -q --ignore-errors source -o tests/cov/html tests/cov/unit.info
lcov -l tests/cov/unit.info
mkdir -p tests/build/cov
lcov -q -c -d json/build/obj -d tests/build/obj -o tests/build/cov/unit.info
lcov -q -r tests/build/cov/unit.info */adainclude/* -o tests/build/cov/unit.info
lcov -q -r tests/build/cov/unit.info */tests/* -o tests/build/cov/unit.info
genhtml -q --ignore-errors source -o tests/build/cov/html tests/build/cov/unit.info
lcov -l tests/build/cov/unit.info
5 changes: 3 additions & 2 deletions json/alire.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ authors = ["onox"]
maintainers = ["onox <denkpadje@gmail.com>"]
maintainers-logins = ["onox"]

[configuration]
disabled = true
[build-switches]
validation.compile_checks = "warnings"
"*".style_checks = ["-gnatygAO-Is"]
31 changes: 18 additions & 13 deletions json/json.gpr
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
with "json_config";
with "config/json_config";

project Json is
project JSON is

for Library_Name use "json";
for Library_Version use "5.0.0";
for Library_Name use "json-ada";
for Library_Version use Project'Library_Name & ".so." & Json_Config.Crate_Version;

for Source_Dirs use ("src");
for Create_Missing_Dirs use "True";

for Object_Dir use "build/obj";
for Source_Dirs use ("src");
for Object_Dir use "build/obj/" & Json_Config.Build_Profile;
for Library_Dir use "build/lib";

package Compiler extends JSON_Config.Compiler is
type Library_Type_Type is ("relocatable", "static", "static-pic");
Library_Type : Library_Type_Type :=
external ("JSON_LIBRARY_TYPE", external ("LIBRARY_TYPE", "static"));
for Library_Kind use Library_Type;

package Compiler is
for Default_Switches ("Ada") use Json_Config.Ada_Compiler_Switches & ("-gnatyM99");
for Local_Configuration_Pragmas use "gnat.adc";
end Compiler;

package Binder renames JSON_Config.Binder;

package Prove is
for Proof_Switches ("Ada") use ("--checks-as-errors", "--level=4", "--no-axiom-guard", "--mode=check", "--prover=all", "--cwe", "--pedantic", "-k", "-j0", "--output-header");
end Prove;
package Binder is
for Switches ("Ada") use ("-Es"); -- Symbolic traceback
end Binder;

end Json;
end JSON;
107 changes: 0 additions & 107 deletions json/json_config.gpr

This file was deleted.

13 changes: 2 additions & 11 deletions json/json_pretty_print.gpr
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
with "json_config";
with "json";
with "config/json_config";

project JSON_Pretty_Print is

for Create_Missing_Dirs use "True";

for Source_Dirs use ("src/tools");
for Object_Dir use "build/tools/obj";
for Object_Dir use "build/tools/obj/" & Json_Config.Build_Profile;
for Library_Dir use "build/tools/lib";

for Exec_Dir use "build/bin";
Expand All @@ -16,13 +16,4 @@ project JSON_Pretty_Print is
package Compiler renames JSON.Compiler;
package Binder renames JSON.Binder;

package Linker is
case JSON_Config.Build_Mode is
when "coverage" =>
for Switches ("Ada") use ("-lgcov");
when others =>
null;
end case;
end Linker;

end JSON_Pretty_Print;
7 changes: 4 additions & 3 deletions tests/alire.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ authors = ["onox"]
maintainers = ["onox <denkpadje@gmail.com>"]
maintainers-logins = ["onox"]

[configuration]
disabled = true

[[depends-on]]
aunit = "^21.0.0"
json = "^5.0.2"

[[pins]]
json = { path = "../json" }

[build-switches]
validation.compile_checks = "warnings"
"*".style_checks = ["-gnatygAO-Is"]
25 changes: 11 additions & 14 deletions tests/json_tests.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,33 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.

with "../json/json_config";
with "json";
with "aunit";
with "json";
with "config/json_tests_config";

project JSON_Tests is

for Create_Missing_Dirs use "True";

for Source_Dirs use ("src");

for Object_Dir use "build/obj";
for Library_Dir use "build/lib";
for Object_Dir use "build/obj/" & JSON_Tests_Config.Build_Profile;

for Exec_Dir use "build/bin";

for Main use ("test_bindings.adb");

package Binder renames JSON.Binder;

package Compiler extends JSON.Compiler is
package Compiler is
for Default_Switches ("Ada") use Json_Tests_Config.Ada_Compiler_Switches &
("-gnatyM99", "--coverage");
for Local_Configuration_Pragmas use "gnat.adc";
end Compiler;

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

package Linker is
case JSON_Config.Build_Mode is
when "coverage" =>
for Switches ("Ada") use ("-lgcov");
when others =>
null;
end case;
for Switches ("Ada") use ("-lgcov");
end Linker;

end JSON_Tests;

0 comments on commit 83ac169

Please sign in to comment.