mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 10:37:13 +02:00
Custom platform_packages per a build environment with an option to override default // Resolve #1367
This commit is contained in:
@ -34,6 +34,7 @@ PlatformIO 4.0
|
|||||||
|
|
||||||
- Switched to workspace ``.pio/build`` folder for build artifacts instead of ``.pioenvs``
|
- Switched to workspace ``.pio/build`` folder for build artifacts instead of ``.pioenvs``
|
||||||
- Switch between `Build Configurations <http://docs.platformio.org/page/projectconf/build_configurations.html>`__ (``release`` and ``debug``) with a new project configuration option `build_type <http://docs.platformio.org/page/projectconf/section_env_build.html#build-type>`__
|
- Switch between `Build Configurations <http://docs.platformio.org/page/projectconf/build_configurations.html>`__ (``release`` and ``debug``) with a new project configuration option `build_type <http://docs.platformio.org/page/projectconf/section_env_build.html#build-type>`__
|
||||||
|
- Custom `platform_packages <http://docs.platformio.org/page/projectconf/section_env_general.html#platform>`__ per a build environment with an option to override default (`issue #1367 <https://github.com/platformio/platformio-core/issues/1367>`_)
|
||||||
- Print platform package details, such as version, VSC source and commit (`issue #2155 <https://github.com/platformio/platformio-core/issues/2155>`_)
|
- Print platform package details, such as version, VSC source and commit (`issue #2155 <https://github.com/platformio/platformio-core/issues/2155>`_)
|
||||||
- Override default `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__ with a custom using ``-c, --project-conf`` option for `platformio run <http://docs.platformio.org/page/userguide/cmd_run.html>`__, `platformio debug <http://docs.platformio.org/page/userguide/cmd_debug.html>`__, or `platformio test <http://docs.platformio.org/page/userguide/cmd_test.html>`__ commands (`issue #1913 <https://github.com/platformio/platformio-core/issues/1913>`_)
|
- Override default `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__ with a custom using ``-c, --project-conf`` option for `platformio run <http://docs.platformio.org/page/userguide/cmd_run.html>`__, `platformio debug <http://docs.platformio.org/page/userguide/cmd_debug.html>`__, or `platformio test <http://docs.platformio.org/page/userguide/cmd_test.html>`__ commands (`issue #1913 <https://github.com/platformio/platformio-core/issues/1913>`_)
|
||||||
- Override default development platform upload command with a custom `upload_command <http://docs.platformio.org/page/projectconf/section_env_upload.html#upload-command>`__ (`issue #2599 <https://github.com/platformio/platformio-core/issues/2599>`_)
|
- Override default development platform upload command with a custom `upload_command <http://docs.platformio.org/page/projectconf/section_env_upload.html#upload-command>`__ (`issue #2599 <https://github.com/platformio/platformio-core/issues/2599>`_)
|
||||||
|
2
docs
2
docs
Submodule docs updated: 66e4193767...7ea74ad006
@ -29,22 +29,18 @@ from platformio.project.config import ProjectOptions
|
|||||||
|
|
||||||
|
|
||||||
@util.memoized()
|
@util.memoized()
|
||||||
def initPioPlatform(name):
|
|
||||||
return PlatformFactory.newPlatform(name)
|
|
||||||
|
|
||||||
|
|
||||||
def PioPlatform(env):
|
def PioPlatform(env):
|
||||||
variables = env.GetProjectOptions(as_dict=True)
|
variables = env.GetProjectOptions(as_dict=True)
|
||||||
if "framework" in variables:
|
if "framework" in variables:
|
||||||
# support PIO Core 3.0 dev/platforms
|
# support PIO Core 3.0 dev/platforms
|
||||||
variables['pioframework'] = variables['framework']
|
variables['pioframework'] = variables['framework']
|
||||||
p = initPioPlatform(env['PLATFORM_MANIFEST'])
|
p = PlatformFactory.newPlatform(env['PLATFORM_MANIFEST'])
|
||||||
p.configure_default_packages(variables, COMMAND_LINE_TARGETS)
|
p.configure_default_packages(variables, COMMAND_LINE_TARGETS)
|
||||||
return p
|
return p
|
||||||
|
|
||||||
|
|
||||||
def BoardConfig(env, board=None):
|
def BoardConfig(env, board=None):
|
||||||
p = initPioPlatform(env['PLATFORM_MANIFEST'])
|
p = env.PioPlatform()
|
||||||
try:
|
try:
|
||||||
board = board or env.get("BOARD")
|
board = board or env.get("BOARD")
|
||||||
assert board, "BoardConfig: Board is not defined"
|
assert board, "BoardConfig: Board is not defined"
|
||||||
|
@ -490,16 +490,17 @@ class PlatformBase( # pylint: disable=too-many-public-methods
|
|||||||
_BOARDS_CACHE = {}
|
_BOARDS_CACHE = {}
|
||||||
|
|
||||||
def __init__(self, manifest_path):
|
def __init__(self, manifest_path):
|
||||||
self._BOARDS_CACHE = {}
|
|
||||||
self.manifest_path = manifest_path
|
self.manifest_path = manifest_path
|
||||||
|
self.silent = False
|
||||||
|
self.verbose = False
|
||||||
|
|
||||||
|
self._BOARDS_CACHE = {}
|
||||||
self._manifest = util.load_json(manifest_path)
|
self._manifest = util.load_json(manifest_path)
|
||||||
|
self._custom_packages = None
|
||||||
|
|
||||||
self.pm = PackageManager(get_project_packages_dir(),
|
self.pm = PackageManager(get_project_packages_dir(),
|
||||||
self.package_repositories)
|
self.package_repositories)
|
||||||
|
|
||||||
self.silent = False
|
|
||||||
self.verbose = False
|
|
||||||
|
|
||||||
# if self.engines and "platformio" in self.engines:
|
# if self.engines and "platformio" in self.engines:
|
||||||
# if self.PIO_VERSION not in semantic_version.Spec(
|
# if self.PIO_VERSION not in semantic_version.Spec(
|
||||||
# self.engines['platformio']):
|
# self.engines['platformio']):
|
||||||
@ -560,9 +561,20 @@ class PlatformBase( # pylint: disable=too-many-public-methods
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def packages(self):
|
def packages(self):
|
||||||
if "packages" not in self._manifest:
|
packages = self._manifest.get("packages", {})
|
||||||
self._manifest['packages'] = {}
|
for item in (self._custom_packages or []):
|
||||||
return self._manifest['packages']
|
name = item
|
||||||
|
version = "*"
|
||||||
|
if "@" in item:
|
||||||
|
name, version = item.split("@", 2)
|
||||||
|
name = name.strip()
|
||||||
|
if name not in packages:
|
||||||
|
packages[name] = {}
|
||||||
|
packages[name].update({
|
||||||
|
"version": version.strip(),
|
||||||
|
"optional": False
|
||||||
|
})
|
||||||
|
return packages
|
||||||
|
|
||||||
def get_dir(self):
|
def get_dir(self):
|
||||||
return dirname(self.manifest_path)
|
return dirname(self.manifest_path)
|
||||||
@ -626,6 +638,9 @@ class PlatformBase( # pylint: disable=too-many-public-methods
|
|||||||
return self.packages[name].get("type")
|
return self.packages[name].get("type")
|
||||||
|
|
||||||
def configure_default_packages(self, options, targets):
|
def configure_default_packages(self, options, targets):
|
||||||
|
# override user custom packages
|
||||||
|
self._custom_packages = options.get("platform_packages")
|
||||||
|
|
||||||
# enable used frameworks
|
# enable used frameworks
|
||||||
for framework in options.get("framework", []):
|
for framework in options.get("framework", []):
|
||||||
if not self.frameworks:
|
if not self.frameworks:
|
||||||
|
@ -91,9 +91,9 @@ ProjectOptions = OrderedDict([
|
|||||||
|
|
||||||
# Generic
|
# Generic
|
||||||
ConfigEnvOption(name="platform", buildenvvar="PIOPLATFORM"),
|
ConfigEnvOption(name="platform", buildenvvar="PIOPLATFORM"),
|
||||||
|
ConfigEnvOption(name="platform_packages", multiple=True),
|
||||||
ConfigEnvOption(
|
ConfigEnvOption(
|
||||||
name="framework", multiple=True, buildenvvar="PIOFRAMEWORK"),
|
name="framework", multiple=True, buildenvvar="PIOFRAMEWORK"),
|
||||||
ConfigEnvOption(name="targets", multiple=True),
|
|
||||||
|
|
||||||
# Board
|
# Board
|
||||||
ConfigEnvOption(name="board", buildenvvar="BOARD"),
|
ConfigEnvOption(name="board", buildenvvar="BOARD"),
|
||||||
@ -129,6 +129,7 @@ ProjectOptions = OrderedDict([
|
|||||||
multiple=True,
|
multiple=True,
|
||||||
sysenvvar="PLATFORMIO_SRC_FILTER",
|
sysenvvar="PLATFORMIO_SRC_FILTER",
|
||||||
buildenvvar="SRC_FILTER"),
|
buildenvvar="SRC_FILTER"),
|
||||||
|
ConfigEnvOption(name="targets", multiple=True),
|
||||||
|
|
||||||
# Upload
|
# Upload
|
||||||
ConfigEnvOption(name="upload_port",
|
ConfigEnvOption(name="upload_port",
|
||||||
|
Reference in New Issue
Block a user