mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Refactor PLATFORM and FRAMEWORK build variables with PIO prefix
This commit is contained in:
@ -34,8 +34,8 @@ commonvars.AddVariables(
|
||||
("EXTRA_SCRIPT",),
|
||||
("PIOENV",),
|
||||
("PIOTEST",),
|
||||
("PLATFORM",),
|
||||
("FRAMEWORK",),
|
||||
("PIOPLATFORM",),
|
||||
("PIOFRAMEWORK",),
|
||||
|
||||
# build options
|
||||
("BUILD_FLAGS",),
|
||||
|
@ -29,7 +29,7 @@ def initDevPlatform(name):
|
||||
|
||||
def DevPlatform(env):
|
||||
variables = {}
|
||||
for key in ("board", "framework"):
|
||||
for key in ("board", "pioframework"):
|
||||
if key not in env:
|
||||
continue
|
||||
variables[key] = env[key.upper()]
|
||||
|
@ -35,7 +35,7 @@ class LibBuilderFactory(object):
|
||||
clsname = "PlatformIOLibBuilder"
|
||||
else:
|
||||
env_frameworks = [
|
||||
f.lower().strip() for f in env.get("FRAMEWORK", "").split(",")]
|
||||
f.lower().strip() for f in env.get("PIOFRAMEWORK", "").split(",")]
|
||||
used_frameworks = LibBuilderFactory.get_used_frameworks(env, path)
|
||||
common_frameworks = set(env_frameworks) & set(used_frameworks)
|
||||
if common_frameworks:
|
||||
@ -328,7 +328,7 @@ def GetLibBuilders(env):
|
||||
items = []
|
||||
libs_dirs = []
|
||||
env_frameworks = [
|
||||
f.lower().strip() for f in env.get("FRAMEWORK", "").split(",")]
|
||||
f.lower().strip() for f in env.get("PIOFRAMEWORK", "").split(",")]
|
||||
|
||||
for key in ("LIB_EXTRA_DIRS", "LIBSOURCE_DIRS"):
|
||||
for d in env.get(key, []):
|
||||
|
@ -185,7 +185,7 @@ def DumpIDEData(env):
|
||||
defines.append(env_.subst(item).replace('\\"', '"'))
|
||||
|
||||
# special symbol for Atmel AVR MCU
|
||||
if env.subst("$PLATFORM") == "atmelavr":
|
||||
if env['PIOPLATFORM'] == "atmelavr":
|
||||
defines.append(
|
||||
"__AVR_%s__" % env.BoardConfig().get("build.mcu").upper()
|
||||
.replace("ATMEGA", "ATmega")
|
||||
|
@ -122,7 +122,7 @@ void output_complete(void)
|
||||
print("Warning: Could not remove temporary file '%s'. "
|
||||
"Please remove it manually." % file_)
|
||||
|
||||
framework = env.subst("$FRAMEWORK").lower()
|
||||
framework = env.subst("$PIOFRAMEWORK").lower()
|
||||
if framework not in FRAMEWORK_PARAMETERS:
|
||||
env.Exit(
|
||||
"Error: %s framework doesn't support testing feature!" % framework)
|
||||
|
@ -114,7 +114,7 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
||||
print env.subst("Manually specified: $UPLOAD_PORT")
|
||||
return
|
||||
|
||||
if env.subst("$FRAMEWORK") == "mbed":
|
||||
if env.subst("$PIOFRAMEWORK") == "mbed":
|
||||
env.Replace(UPLOAD_PORT=_look_for_mbed_disk())
|
||||
else:
|
||||
if (system() == "Linux" and
|
||||
|
@ -53,9 +53,9 @@ def BuildProgram(env):
|
||||
# apply user flags
|
||||
env.ProcessFlags(env.get("BUILD_FLAGS"))
|
||||
|
||||
if env.get("FRAMEWORK"):
|
||||
if env.get("PIOFRAMEWORK"):
|
||||
env.BuildFrameworks([
|
||||
f.lower().strip() for f in env.get("FRAMEWORK", "").split(",")])
|
||||
f.lower().strip() for f in env['PIOFRAMEWORK'].split(",")])
|
||||
|
||||
# restore PIO macros if it was deleted by framework
|
||||
_append_pio_macros()
|
||||
|
@ -97,6 +97,11 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
|
||||
|
||||
class EnvironmentProcessor(object):
|
||||
|
||||
REMAPED_OPTIONS = {
|
||||
"FRAMEWORK": "PIOFRAMEWORK",
|
||||
"PLATFORM": "PIOPLATFORM"
|
||||
}
|
||||
|
||||
RENAMED_OPTIONS = {
|
||||
"INSTALL_LIBS": "LIB_INSTALL",
|
||||
"IGNORE_LIBS": "LIB_IGNORE",
|
||||
@ -158,6 +163,8 @@ class EnvironmentProcessor(object):
|
||||
if self.upload_port:
|
||||
variables['upload_port'] = self.upload_port
|
||||
for k, v in self.options.items():
|
||||
if k.upper() in self.REMAPED_OPTIONS:
|
||||
k = self.REMAPED_OPTIONS[k.upper()]
|
||||
k = k.lower()
|
||||
if k == "targets" or (k == "upload_port" and self.upload_port):
|
||||
continue
|
||||
|
@ -440,7 +440,7 @@ class PlatformBase(PlatformPackagesMixin, PlatformRunMixin):
|
||||
|
||||
def configure_default_packages(self, variables, targets):
|
||||
# enbale used frameworks
|
||||
for framework in variables.get("framework", "").split(","):
|
||||
for framework in variables.get("pioframework", "").split(","):
|
||||
if not self.frameworks:
|
||||
continue
|
||||
framework = framework.lower().strip()
|
||||
|
Reference in New Issue
Block a user