Skip to content

Commit 55c7bf6

Browse files
committed
Add check_library_manager_compliance
1 parent d6db379 commit 55c7bf6

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ script:
128128

129129
- check_keywords_txt "${SKETCHBOOK_FOLDER}/libraries/NewPing"
130130

131+
- check_library_manager_compliance "${SKETCHBOOK_FOLDER}/libraries/NewPing"
132+
131133
# Test library installed from .zip with rename
132134
# Test library installed from .zip with dot in the folder name
133135
# Test board from hardware package manually installed from compressed file download

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ Check [library.properties](https://github.com/arduino/Arduino/wiki/Arduino-IDE-1
125125
Check [keywords.txt](https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#keywords) files for errors.
126126
- Parameter: **searchPath** - Path containing keywords.txt files. The path will be searched recursively and all keywords.txt files found under it will be checked.
127127

128+
##### `check_library_manager_compliance libraryPath'
129+
Make some additional checks for compliance with the requirements for adding a library to the [Library Manager index](https://github.com/arduino/Arduino/wiki/Library-Manager-FAQ). This function should be used in combination with `check_library_structure' and 'check_library_properties' to ensure full compliance with the requirements.
130+
- Parameter: **libraryPath** - Path of the library to check.
131+
128132
##### `build_sketch sketchPath boardID allowFail IDEversion`
129133
##### `build_sketch sketchPath boardID allowFail [IDEversionList]`
130134
##### `build_sketch sketchPath boardID allowFail startIDEversion endIDEversion`

arduino-ci-script.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,41 @@ function check_keywords_txt()
17251725
}
17261726

17271727

1728+
# https://github.com/arduino/Arduino/wiki/Library-Manager-FAQ#how-is-the-library-list-generated
1729+
function check_library_manager_compliance()
1730+
{
1731+
local -r libraryPath="$1"
1732+
# Replace backslashes with slashes
1733+
local -r libraryPathWithSlashes="${libraryPath//\\//}"
1734+
# Remove trailing slash
1735+
local -r normalizedLibraryPath="${libraryPathWithSlashes%/}"
1736+
1737+
# Check whether folder exists
1738+
if [[ ! -d "$normalizedLibraryPath" ]]; then
1739+
echo "ERROR: Specified folder: $libraryPath doesn't exist."
1740+
return 1
1741+
fi
1742+
1743+
# Check for .exe files
1744+
if [[ $(find "$normalizedLibraryPath" -type f -name '*.exe') ]]; then
1745+
echo "ERROR: .exe file found."
1746+
return 2
1747+
fi
1748+
1749+
# Check for .development file
1750+
if [[ $(find "$normalizedLibraryPath" -type f -name '.development') ]]; then
1751+
echo "ERROR: .development file found."
1752+
return 3
1753+
fi
1754+
1755+
# Check for .development file
1756+
if [[ $(find "$normalizedLibraryPath" -type l) ]]; then
1757+
echo "ERROR: Symlink found."
1758+
return 4
1759+
fi
1760+
}
1761+
1762+
17281763
# Set default verbosity (must be called after the function definitions
17291764
set_script_verbosity 0
17301765

0 commit comments

Comments
 (0)