|
@@ -47,22 +47,25 @@ def get_all_known_libs():
|
47
|
47
|
|
48
|
48
|
def get_all_env_libs():
|
49
|
49
|
env_libs = []
|
50
|
|
- lib_deps = env.GetProjectOption("lib_deps")
|
|
50
|
+ lib_deps = env.GetProjectOption('lib_deps')
|
51
|
51
|
for dep in lib_deps:
|
52
|
52
|
name, _, _ = PackageManager.parse_pkg_uri(dep)
|
53
|
53
|
env_libs.append(name)
|
54
|
54
|
return env_libs
|
55
|
55
|
|
|
56
|
+def set_env_field(field, value):
|
|
57
|
+ proj = env.GetProjectConfig()
|
|
58
|
+ proj.set("env:" + env['PIOENV'], field, value)
|
|
59
|
+
|
56
|
60
|
# All unused libs should be ignored so that if a library
|
57
|
61
|
# exists in .pio/lib_deps it will not break compilation.
|
58
|
62
|
def force_ignore_unused_libs():
|
59
|
63
|
env_libs = get_all_env_libs()
|
60
|
64
|
known_libs = get_all_known_libs()
|
61
|
65
|
diff = (list(set(known_libs) - set(env_libs)))
|
62
|
|
- lib_ignore = env.GetProjectOption("lib_ignore") + diff
|
|
66
|
+ lib_ignore = env.GetProjectOption('lib_ignore') + diff
|
63
|
67
|
print("Ignoring libs:", lib_ignore)
|
64
|
|
- proj = env.GetProjectConfig()
|
65
|
|
- proj.set("env:" + env["PIOENV"], "lib_ignore", lib_ignore)
|
|
68
|
+ set_env_field('lib_ignore', lib_ignore)
|
66
|
69
|
|
67
|
70
|
def install_features_dependencies():
|
68
|
71
|
load_config()
|
|
@@ -80,14 +83,14 @@ def install_features_dependencies():
|
80
|
83
|
deps_to_add[name] = dep
|
81
|
84
|
|
82
|
85
|
# Does the env already have the dependency?
|
83
|
|
- deps = env.GetProjectOption("lib_deps")
|
|
86
|
+ deps = env.GetProjectOption('lib_deps')
|
84
|
87
|
for dep in deps:
|
85
|
88
|
name, _, _ = PackageManager.parse_pkg_uri(dep)
|
86
|
89
|
if name in deps_to_add:
|
87
|
90
|
del deps_to_add[name]
|
88
|
91
|
|
89
|
92
|
# Are there any libraries that should be ignored?
|
90
|
|
- lib_ignore = env.GetProjectOption("lib_ignore")
|
|
93
|
+ lib_ignore = env.GetProjectOption('lib_ignore')
|
91
|
94
|
for dep in deps:
|
92
|
95
|
name, _, _ = PackageManager.parse_pkg_uri(dep)
|
93
|
96
|
if name in deps_to_add:
|
|
@@ -96,8 +99,7 @@ def install_features_dependencies():
|
96
|
99
|
# Is there anything left?
|
97
|
100
|
if len(deps_to_add) > 0:
|
98
|
101
|
# Only add the missing dependencies
|
99
|
|
- proj = env.GetProjectConfig()
|
100
|
|
- proj.set("env:" + env["PIOENV"], "lib_deps", deps + list(deps_to_add.values()))
|
|
102
|
+ set_env_field('lib_deps', deps + list(deps_to_add.values()))
|
101
|
103
|
|
102
|
104
|
if 'extra_scripts' in FEATURE_DEPENDENCIES[feature]:
|
103
|
105
|
print("Executing extra_scripts for %s... " % feature)
|
|
@@ -105,8 +107,7 @@ def install_features_dependencies():
|
105
|
107
|
|
106
|
108
|
if 'src_filter' in FEATURE_DEPENDENCIES[feature]:
|
107
|
109
|
print("Adding src_filter for %s... " % feature)
|
108
|
|
- proj = env.GetProjectConfig()
|
109
|
|
- src_filter = ' '.join(env.GetProjectOption("src_filter"))
|
|
110
|
+ src_filter = ' '.join(env.GetProjectOption('src_filter'))
|
110
|
111
|
# first we need to remove the references to the same folder
|
111
|
112
|
my_srcs = re.findall( r'[+-](<.*?>)', FEATURE_DEPENDENCIES[feature]['src_filter'])
|
112
|
113
|
cur_srcs = re.findall( r'[+-](<.*?>)', src_filter)
|
|
@@ -115,19 +116,18 @@ def install_features_dependencies():
|
115
|
116
|
src_filter = re.sub(r'[+-]' + d, '', src_filter)
|
116
|
117
|
|
117
|
118
|
src_filter = FEATURE_DEPENDENCIES[feature]['src_filter'] + ' ' + src_filter
|
118
|
|
- proj.set("env:" + env["PIOENV"], "src_filter", [src_filter])
|
|
119
|
+ set_env_field('src_filter', [src_filter])
|
119
|
120
|
env.Replace(SRC_FILTER=src_filter)
|
120
|
121
|
|
121
|
122
|
if 'lib_ignore' in FEATURE_DEPENDENCIES[feature]:
|
122
|
123
|
print("Ignoring libs for %s... " % feature)
|
123
|
|
- lib_ignore = env.GetProjectOption("lib_ignore") + [FEATURE_DEPENDENCIES[feature]['lib_ignore']]
|
124
|
|
- proj = env.GetProjectConfig()
|
125
|
|
- proj.set("env:" + env["PIOENV"], "lib_ignore", lib_ignore)
|
|
124
|
+ lib_ignore = env.GetProjectOption('lib_ignore') + [FEATURE_DEPENDENCIES[feature]['lib_ignore']]
|
|
125
|
+ set_env_field('lib_ignore', lib_ignore)
|
126
|
126
|
|
127
|
127
|
#
|
128
|
128
|
# Find a compiler, considering the OS
|
129
|
129
|
#
|
130
|
|
-ENV_BUILD_PATH = os.path.join(env.Dictionary("PROJECT_BUILD_DIR"), env["PIOENV"])
|
|
130
|
+ENV_BUILD_PATH = os.path.join(env.Dictionary('PROJECT_BUILD_DIR'), env['PIOENV'])
|
131
|
131
|
GCC_PATH_CACHE = os.path.join(ENV_BUILD_PATH, ".gcc_path")
|
132
|
132
|
def search_compiler():
|
133
|
133
|
if os.path.exists(GCC_PATH_CACHE):
|