forked from platformio/platformio-core
Rename "AddSystemTarget" to "AddPlatformTarget"
This commit is contained in:
@ -47,21 +47,21 @@ def PioClean(env, clean_dir):
|
|||||||
env.Exit(0)
|
env.Exit(0)
|
||||||
|
|
||||||
|
|
||||||
def _add_pio_target( # pylint: disable=too-many-arguments
|
def AddTarget( # pylint: disable=too-many-arguments
|
||||||
env,
|
env,
|
||||||
scope,
|
|
||||||
name,
|
name,
|
||||||
dependencies,
|
dependencies,
|
||||||
actions,
|
actions,
|
||||||
title=None,
|
title=None,
|
||||||
description=None,
|
description=None,
|
||||||
|
group="Generic",
|
||||||
always_build=True,
|
always_build=True,
|
||||||
):
|
):
|
||||||
if "__PIO_TARGETS" not in env:
|
if "__PIO_TARGETS" not in env:
|
||||||
env["__PIO_TARGETS"] = {}
|
env["__PIO_TARGETS"] = {}
|
||||||
assert name not in env["__PIO_TARGETS"]
|
assert name not in env["__PIO_TARGETS"]
|
||||||
env["__PIO_TARGETS"][name] = dict(
|
env["__PIO_TARGETS"][name] = dict(
|
||||||
name=name, scope=scope, title=title, description=description
|
name=name, title=title, description=description, group=group
|
||||||
)
|
)
|
||||||
target = env.Alias(name, dependencies, actions)
|
target = env.Alias(name, dependencies, actions)
|
||||||
if always_build:
|
if always_build:
|
||||||
@ -69,29 +69,28 @@ def _add_pio_target( # pylint: disable=too-many-arguments
|
|||||||
return target
|
return target
|
||||||
|
|
||||||
|
|
||||||
def AddSystemTarget(env, *args, **kwargs):
|
def AddPlatformTarget(env, *args, **kwargs):
|
||||||
return _add_pio_target(env, "system", *args, **kwargs)
|
return env.AddTarget(group="Platform", *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def AddCustomTarget(env, *args, **kwargs):
|
def AddCustomTarget(env, *args, **kwargs):
|
||||||
return _add_pio_target(env, "custom", *args, **kwargs)
|
return env.AddTarget(group="Custom", *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def DumpTargets(env):
|
def DumpTargets(env):
|
||||||
targets = env.get("__PIO_TARGETS") or {}
|
targets = env.get("__PIO_TARGETS") or {}
|
||||||
# pre-fill default system targets
|
# pre-fill default targets if embedded dev-platform
|
||||||
if (
|
if env.PioPlatform().is_embedded() and not any(
|
||||||
not any(t["scope"] == "system" for t in targets.values())
|
t["group"] == "Platform" for t in targets.values()
|
||||||
and env.PioPlatform().is_embedded()
|
|
||||||
):
|
):
|
||||||
targets["upload"] = dict(name="upload", scope="system", title="Upload")
|
targets["upload"] = dict(name="upload", group="Platform", title="Upload")
|
||||||
targets["compiledb"] = dict(
|
targets["compiledb"] = dict(
|
||||||
name="compiledb",
|
name="compiledb",
|
||||||
scope="system",
|
|
||||||
title="Compilation database",
|
title="Compilation database",
|
||||||
description="Generate compilation database `compile_commands.json`",
|
description="Generate compilation database `compile_commands.json`",
|
||||||
|
group="Advanced",
|
||||||
)
|
)
|
||||||
targets["clean"] = dict(name="clean", scope="system", title="Clean")
|
targets["clean"] = dict(name="clean", title="Clean", group="Generic")
|
||||||
return list(targets.values())
|
return list(targets.values())
|
||||||
|
|
||||||
|
|
||||||
@ -102,7 +101,8 @@ def exists(_):
|
|||||||
def generate(env):
|
def generate(env):
|
||||||
env.AddMethod(VerboseAction)
|
env.AddMethod(VerboseAction)
|
||||||
env.AddMethod(PioClean)
|
env.AddMethod(PioClean)
|
||||||
env.AddMethod(AddSystemTarget)
|
env.AddMethod(AddTarget)
|
||||||
|
env.AddMethod(AddPlatformTarget)
|
||||||
env.AddMethod(AddCustomTarget)
|
env.AddMethod(AddCustomTarget)
|
||||||
env.AddMethod(DumpTargets)
|
env.AddMethod(DumpTargets)
|
||||||
return env
|
return env
|
||||||
|
Reference in New Issue
Block a user