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