forked from platformio/platformio-core
Added support for Arduino's library.properties `depends` field // Resolve #2781
This commit is contained in:
@@ -40,6 +40,11 @@ def test_library_json_parser():
|
||||
"flags": ["-DHELLO"]
|
||||
},
|
||||
"examples": ["examples/*/*.pde"],
|
||||
"dependencies": {
|
||||
"deps1": "1.2.0",
|
||||
"deps2": "https://github.com/username/package.git",
|
||||
"@owner/deps3": "^2.1.3"
|
||||
},
|
||||
"customField": "Custom Value"
|
||||
}
|
||||
"""
|
||||
@@ -57,6 +62,11 @@ def test_library_json_parser():
|
||||
"keywords": ["kw1", "kw2", "kw3"],
|
||||
"homepage": "http://old.url.format",
|
||||
"build": {"flags": ["-DHELLO"]},
|
||||
"dependencies": [
|
||||
{"name": "deps1", "version": "1.2.0"},
|
||||
{"name": "deps2", "version": "https://github.com/username/package.git"},
|
||||
{"name": "@owner/deps3", "version": "^2.1.3"},
|
||||
],
|
||||
"customField": "Custom Value",
|
||||
},
|
||||
)
|
||||
@@ -68,7 +78,12 @@ def test_library_json_parser():
|
||||
"platforms": "atmelavr",
|
||||
"export": {
|
||||
"exclude": "audio_samples"
|
||||
}
|
||||
},
|
||||
"dependencies": [
|
||||
{"name": "deps1", "version": "1.0.0"},
|
||||
{"name": "@owner/deps2", "version": "1.0.0", "frameworks": "arduino, espidf"},
|
||||
{"name": "deps3", "version": "1.0.0", "platforms": ["ststm32", "sifive"]}
|
||||
]
|
||||
}
|
||||
"""
|
||||
mp = parser.LibraryJsonManifestParser(contents)
|
||||
@@ -79,9 +94,26 @@ def test_library_json_parser():
|
||||
"frameworks": ["arduino"],
|
||||
"export": {"exclude": ["audio_samples"]},
|
||||
"platforms": ["atmelavr"],
|
||||
"dependencies": [
|
||||
{"name": "deps1", "version": "1.0.0"},
|
||||
{
|
||||
"name": "@owner/deps2",
|
||||
"version": "1.0.0",
|
||||
"frameworks": ["arduino", "espidf"],
|
||||
},
|
||||
{
|
||||
"name": "deps3",
|
||||
"version": "1.0.0",
|
||||
"platforms": ["ststm32", "sifive"],
|
||||
},
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
# broken dependencies
|
||||
with pytest.raises(parser.ManifestParserError):
|
||||
mp = parser.LibraryJsonManifestParser({"dependencies": ["deps1", "deps2"]})
|
||||
|
||||
|
||||
def test_module_json_parser():
|
||||
contents = """
|
||||
@@ -137,6 +169,7 @@ version=1.2.3
|
||||
author=SomeAuthor <info AT author.com>
|
||||
sentence=This is Arduino library
|
||||
customField=Custom Value
|
||||
depends=First Library (=2.0.0), Second Library (>=1.2.0), Third
|
||||
"""
|
||||
mp = parser.LibraryPropertiesManifestParser(contents)
|
||||
assert not jsondiff.diff(
|
||||
@@ -154,6 +187,20 @@ customField=Custom Value
|
||||
"authors": [{"email": "info@author.com", "name": "SomeAuthor"}],
|
||||
"keywords": ["uncategorized"],
|
||||
"customField": "Custom Value",
|
||||
"depends": "First Library (=2.0.0), Second Library (>=1.2.0), Third",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "First Library",
|
||||
"version": "=2.0.0",
|
||||
"frameworks": ["arduino"],
|
||||
},
|
||||
{
|
||||
"name": "Second Library",
|
||||
"version": ">=1.2.0",
|
||||
"frameworks": ["arduino"],
|
||||
},
|
||||
{"name": "Third", "frameworks": ["arduino"]},
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
@@ -244,6 +291,11 @@ def test_library_json_schema():
|
||||
"base": "examples/JsonHttpClient",
|
||||
"files": ["JsonHttpClient.ino"]
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
{"name": "deps1", "version": "1.0.0"},
|
||||
{"name": "@owner/deps2", "version": "1.0.0", "frameworks": "arduino"},
|
||||
{"name": "deps3", "version": "1.0.0", "platforms": ["ststm32", "sifive"]}
|
||||
]
|
||||
}
|
||||
"""
|
||||
@@ -289,6 +341,15 @@ def test_library_json_schema():
|
||||
"files": ["JsonHttpClient.ino"],
|
||||
},
|
||||
],
|
||||
"dependencies": [
|
||||
{"name": "deps1", "version": "1.0.0"},
|
||||
{"name": "@owner/deps2", "version": "1.0.0", "frameworks": ["arduino"]},
|
||||
{
|
||||
"name": "deps3",
|
||||
"version": "1.0.0",
|
||||
"platforms": ["ststm32", "sifive"],
|
||||
},
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
@@ -304,6 +365,7 @@ paragraph=Supported display controller: SSD1306, SSD1309, SSD1322, SSD1325
|
||||
category=Display
|
||||
url=https://github.com/olikraus/u8glib
|
||||
architectures=avr,sam
|
||||
depends=First Library (=2.0.0), Second Library (>=1.2.0), Third
|
||||
"""
|
||||
raw_data = parser.ManifestParserFactory.new(
|
||||
contents, parser.ManifestFileType.LIBRARY_PROPERTIES
|
||||
@@ -333,6 +395,19 @@ architectures=avr,sam
|
||||
],
|
||||
"keywords": ["display"],
|
||||
"name": "U8glib",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "First Library",
|
||||
"version": "=2.0.0",
|
||||
"frameworks": ["arduino"],
|
||||
},
|
||||
{
|
||||
"name": "Second Library",
|
||||
"version": ">=1.2.0",
|
||||
"frameworks": ["arduino"],
|
||||
},
|
||||
{"name": "Third", "frameworks": ["arduino"]},
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
@@ -436,11 +511,6 @@ def test_platform_json_schema():
|
||||
"optional": true,
|
||||
"version": "~4.2.0"
|
||||
},
|
||||
"framework-simba": {
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
"version": ">=7.0.0"
|
||||
},
|
||||
"tool-avrdude": {
|
||||
"type": "uploader",
|
||||
"optional": true,
|
||||
@@ -475,6 +545,11 @@ def test_platform_json_schema():
|
||||
},
|
||||
"frameworks": sorted(["arduino", "simba"]),
|
||||
"version": "1.15.0",
|
||||
"dependencies": [
|
||||
{"name": "toolchain-atmelavr", "version": "~1.50400.0"},
|
||||
{"name": "framework-arduinoavr", "version": "~4.2.0"},
|
||||
{"name": "tool-avrdude", "version": "~1.60300.0"},
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user