Skip to content

Commit

Permalink
Require PIO 6.0.1 instead
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed May 19, 2022
1 parent 283a5c5 commit 8df0d76
Show file tree
Hide file tree
Showing 14 changed files with 335 additions and 364 deletions.
61 changes: 16 additions & 45 deletions buildroot/share/PlatformIO/scripts/common-dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

from platformio.package.meta import PackageSpec
from platformio.project.config import ProjectConfig
from platformio import VERSION as PIO_VERSION

verbose = 0
FEATURE_CONFIG = {}

def validate_pio():
PIO_VERSION_MIN = (5, 0, 3)
PIO_VERSION_MIN = (6, 0, 1)
try:
from platformio import VERSION as PIO_VERSION
weights = (1000, 100, 1)
version_min = sum([x[0] * float(re.sub(r'[^0-9]', '.', str(x[1]))) for x in zip(weights, PIO_VERSION_MIN)])
version_cur = sum([x[0] * float(re.sub(r'[^0-9]', '.', str(x[1]))) for x in zip(weights, PIO_VERSION)])
Expand Down Expand Up @@ -60,7 +60,7 @@ def add_to_feat_cnf(feature, flines):
for line in atoms:
parts = line.split('=')
name = parts.pop(0)
if name in ['build_flags', 'extra_scripts', 'custom_marlin_src_filter', 'lib_ignore']:
if name in ['build_flags', 'extra_scripts', 'src_filter', 'lib_ignore']:
feat[name] = '='.join(parts)
blab("[%s] %s=%s" % (feature, name, feat[name]), 3)
else:
Expand All @@ -70,39 +70,6 @@ def add_to_feat_cnf(feature, flines):
feat['lib_deps'] = list(filter(lib_re.match, feat['lib_deps'])) + [dep]
blab("[%s] lib_deps = %s" % (feature, dep), 3)

def append_src_filter(new_srcs):
if PIO_VERSION[0] < 6:
src_filter_key = 'src_filter'
else:
src_filter_key = 'build_src_filter'

src_filter = ' '.join(env.GetProjectOption(src_filter_key))
# We need to remove +<*> added by default when no src_field is configured in PIO
src_filter = re.sub(r'\+<\*>', '', src_filter)
# first we need to remove the references to the same folder
my_srcs = re.findall(r'[+-](<.*?>)', new_srcs)
cur_srcs = re.findall(r'[+-](<.*?>)', src_filter)
for d in my_srcs:
if d in cur_srcs:
src_filter = re.sub(r'[+-]' + d, '', src_filter)

src_filter = new_srcs + ' ' + src_filter
set_env_field(src_filter_key, [src_filter])
env.Replace(SRC_FILTER = src_filter)
src_filter = ' '.join(env.GetProjectOption(src_filter_key))
blab("Updated src_filter: " + src_filter)

def append_src_flags(new_srcs):
if PIO_VERSION[0] < 6:
src_flag_key = 'src_build_flags'
else:
src_flag_key = 'build_src_flags'
src_flag = ' '.join(env.GetProjectOption(src_flag_key))
src_flag = new_srcs + ' ' + src_flag
set_env_field(src_flag_key, [src_flag])
env.Replace(SRC_BUILD_FLAGS = src_flag)
blab("Updated src_flag: " + src_flag)

def load_config():
blab("========== Gather [features] entries...")
items = ProjectConfig().items('features')
Expand All @@ -117,12 +84,6 @@ def load_config():
all_opts = env.GetProjectOptions()
for n in all_opts:
key = n[0]
if key == 'custom_marlin_src_filter':
append_src_filter(n[1])
continue
if key == 'custom_build_src_flags':
append_src_flags(n[1])
continue
mat = re.match(r'custom_marlin\.(.+)', key)
if mat:
try:
Expand Down Expand Up @@ -212,9 +173,19 @@ def apply_features_config():
blab("Running extra_scripts for %s... " % feature, 2)
env.SConscript(feat['extra_scripts'], exports="env")

if 'custom_marlin_src_filter' in feat:
blab("========== Adding custom_marlin_src_filter for %s... " % feature, 2)
append_src_filter(feat['custom_marlin_src_filter'])
if 'src_filter' in feat:
blab("========== Adding build_src_filter for %s... " % feature, 2)
src_filter = ' '.join(env.GetProjectOption('src_filter'))
# first we need to remove the references to the same folder
my_srcs = re.findall(r'[+-](<.*?>)', feat['src_filter'])
cur_srcs = re.findall(r'[+-](<.*?>)', src_filter)
for d in my_srcs:
if d in cur_srcs:
src_filter = re.sub(r'[+-]' + d, '', src_filter)

src_filter = feat['src_filter'] + ' ' + src_filter
set_env_field('build_src_filter', [src_filter])
env.Replace(SRC_FILTER=src_filter)

if 'lib_ignore' in feat:
blab("========== Adding lib_ignore for %s... " % feature, 2)
Expand Down
8 changes: 4 additions & 4 deletions ini/avr.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# AVR (8-bit) Common Environment values
#
[common_avr8]
platform = atmelavr@~3.4
build_flags = ${common.build_flags} -Wl,--relax
board_build.f_cpu = 16000000L
custom_marlin_src_filter = ${common.default_src_filter} +<src/HAL/AVR>
platform = atmelavr@~3.4
build_flags = ${common.build_flags} -Wl,--relax
board_build.f_cpu = 16000000L
build_src_filter = ${common.default_src_filter} +<src/HAL/AVR>

#
# ATmega2560
Expand Down
6 changes: 3 additions & 3 deletions ini/due.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
# - RADDS
#
[env:DUE]
platform = atmelsam
board = due
custom_marlin_src_filter = ${common.default_src_filter} +<src/HAL/DUE> +<src/HAL/shared/backtrace>
platform = atmelsam
board = due
build_src_filter = ${common.default_src_filter} +<src/HAL/DUE> +<src/HAL/shared/backtrace>

[env:DUE_USB]
extends = env:DUE
Expand Down
18 changes: 9 additions & 9 deletions ini/esp32.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
# Espressif ESP32
#
[env:esp32]
platform = [email protected]
board = esp32dev
build_flags = ${common.build_flags} -DCORE_DEBUG_LEVEL=0
custom_marlin_src_filter = ${common.default_src_filter} +<src/HAL/ESP32>
lib_ignore = NativeEthernet
upload_speed = 500000
monitor_speed = 250000
#upload_port = marlinesp.local
#board_build.flash_mode = qio
platform = [email protected]
board = esp32dev
build_flags = ${common.build_flags} -DCORE_DEBUG_LEVEL=0
build_src_filter = ${common.default_src_filter} +<src/HAL/ESP32>
lib_ignore = NativeEthernet
upload_speed = 500000
monitor_speed = 250000
#upload_port = marlinesp.local
#board_build.flash_mode = qio

[env:FYSETC_E4]
extends = env:esp32
Expand Down
Loading

0 comments on commit 8df0d76

Please sign in to comment.