Skip to content

Commit fabaade

Browse files
committed
Fix an issue with incorrect detecting of compatibility (LDF) between generic library and Arduino or ARM mbed frameworks
1 parent 7f69796 commit fabaade

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

HISTORY.rst

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ PlatformIO 3.0
1313
(`issue #1674 <https://github.com/platformio/platformio-core/issues/1674>`_)
1414
- CLion: Improved project portability using "${CMAKE_CURRENT_LIST_DIR}" instead of full path
1515

16+
* Fixed an issue with incorrect detecting of compatibility (LDF) between generic library and Arduino or ARM mbed frameworks
17+
1618
3.6.3 (2018-12-12)
1719
~~~~~~~~~~~~~~~~~~
1820

platformio/builder/tools/piolib.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import hashlib
2121
import os
22+
import re
2223
import sys
2324
from glob import glob
2425
from os.path import (basename, commonprefix, dirname, isdir, isfile, join,
@@ -64,6 +65,9 @@ def get_used_frameworks(env, path):
6465
if isfile(join(path, "module.json")):
6566
return ["mbed"]
6667

68+
include_re = re.compile(
69+
r'^#include\s+(<|")(Arduino|mbed)\.h(<|")', flags=re.MULTILINE)
70+
6771
# check source files
6872
for root, _, files in os.walk(path, followlinks=True):
6973
for fname in files:
@@ -72,9 +76,9 @@ def get_used_frameworks(env, path):
7276
continue
7377
with open(join(root, fname)) as f:
7478
content = f.read()
75-
if "Arduino.h" in content:
79+
if "Arduino.h" in content and include_re.search(content):
7680
return ["arduino"]
77-
elif "mbed.h" in content:
81+
elif "mbed.h" in content and include_re.search(content):
7882
return ["mbed"]
7983
return []
8084

0 commit comments

Comments
 (0)