Skip to content

Commit d8a0a0b

Browse files
committed
Scan library.properties as part of CI - depends and includes
1 parent 5550e43 commit d8a0a0b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1919
- `CIConfig.is_default` to detect when the default configuration is used
2020
- `ArduinoBackend.boards_installed?` to detect whether a board family (or package, like `arduino:avr`) is installed
2121
- `ArduinoBackend.library_available?` to detect whether the library manager knows of a library
22+
- Sanity checks for `library.properties` `includes=` and `depends=` entries
2223

2324
### Changed
2425
- Rubocop expected syntax downgraded from ruby 2.6 to 2.5

exe/arduino_ci.rb

+19
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,23 @@ def choose_platform_set(config, reason, desired_platforms, library_properties)
354354
end
355355
end
356356

357+
# tests of sane library.properties values
358+
def perform_property_tests(cpp_library)
359+
props = cpp_library.library_properties
360+
361+
props.depends&.each do |l|
362+
assure("library.properties 'depends=' entry '#{l}' exists") { @backend.library_available?(l) }
363+
end
364+
365+
headers = cpp_library.header_files.map { |f| f.relative_path_from(cpp_library.path) }
366+
props.includes&.map(&Pathname::method(:new))&.each do |f|
367+
assure("library.properties 'includes=' entry '#{f}' exists") do
368+
headers.include?(f) || headers.map { |h| h.relative_path_from("src") }.include?(f)
369+
end
370+
end
371+
372+
end
373+
357374
# Unit test procedure
358375
def perform_unit_tests(cpp_library, file_config)
359376
if @cli_options[:skip_unittests]
@@ -488,6 +505,8 @@ def perform_example_compilation_tests(cpp_library, config)
488505
end
489506
end
490507

508+
perform_property_tests(cpp_library) if cpp_library.library_properties?
509+
491510
install_arduino_library_dependencies(
492511
cpp_library.arduino_library_dependencies,
493512
"<#{ArduinoCI::CppLibrary::LIBRARY_PROPERTIES_FILE}>"

0 commit comments

Comments
 (0)