From: "adrian.freihofer@gmail.com" <adrian.freihofer@gmail.com>
To: enguerrand.de-ribaucourt@savoirfairelinux.com,
openembedded-core@lists.openembedded.org
Cc: Adrian Freihofer <adrian.freihofer@siemens.com>
Subject: Re: [OE-core] [PATCH 11/20] devtool: ide-sdk: add Cargo build task
Date: Thu, 29 Oct 2026 00:04:42 +0100 [thread overview]
Message-ID: <782f1ca2cfbf97e432b79c6aa468acc2095a87e7.camel@gmail.com> (raw)
In-Reply-To: <20261026-devtool-ide-sdk-cargo-v1-11-d4504e124d07@savoirfairelinux.com>
On Mon, 2026-10-26 at 09:55 +0100, Enguerrand de Ribaucourt via
lists.openembedded.org wrote:
> Generate a Cargo build task that uses the exported recipe config and
> build
> flags. Run it in the recipe source tree with only the SDK PATH so
> Cargo
> uses the cross environment captured for the recipe.
>
> AI-Generated: Uses GitHub Copilot
> Signed-off-by: Enguerrand de Ribaucourt
> <enguerrand.de-ribaucourt@savoirfairelinux.com>
> ---
> meta/lib/oeqa/selftest/cases/devtool.py | 37
> +++++++++++++++++++++++++++++
> scripts/lib/devtool/ide_plugins/ide_code.py | 25 +++++++++++++++++++
> 2 files changed, 62 insertions(+)
>
> diff --git a/meta/lib/oeqa/selftest/cases/devtool.py
> b/meta/lib/oeqa/selftest/cases/devtool.py
> index 990a3060aa..bd0bfb06ec 100644
> --- a/meta/lib/oeqa/selftest/cases/devtool.py
> +++ b/meta/lib/oeqa/selftest/cases/devtool.py
> @@ -4390,6 +4390,43 @@ class
> DevtoolIdeSdkRustTests(DevtoolIdeSdkTests):
> self.assertIn('rust-lang.rust-analyzer',
> extensions['recommendations'])
> self.assertIn('ms-vscode.cpptools',
> extensions['recommendations'])
>
> + def test_code_cargo_build_task(self):
> + recipe_name = "cargo-example"
> + self._check_workspace()
> + self._write_bb_config()
> + tempdir = self._devtool_ide_sdk_recipe(recipe_name,
> "Cargo.toml", None)
> + runCmd('devtool ide-sdk %s oe-selftest-image --ide=code '
> + '--target root@localhost --no-host-check' %
> recipe_name,
> + output_log=self._cmd_logger)
> +
> + with open(os.path.join(tempdir, '.vscode', 'tasks.json')) as
> tasks_file:
> + tasks = json.load(tasks_file)['tasks']
> + build_task = next(task for task in tasks
> + if task['label'].startswith('cargo build
> '))
> + cargo_config = os.path.join(
> + self.workspacedir, 'ide-sdk', recipe_name, 'cargo-
> config.toml')
> + self.assertEqual(build_task['command'], get_bb_var('CARGO',
> recipe_name))
> + self.assertEqual(
> + build_task['args'][:3], ['--config', cargo_config,
> 'build'])
> + self.assertIn('--features', build_task['args'])
> + self.assertIn('ide-sdk-selftest', build_task['args'])
> + self.assertEqual(set(build_task['options']['env']),
> {'PATH'})
> +
> + build_env = os.environ.copy()
> + build_env.update(build_task['options']['env'])
> + result = subprocess.run(
> + [build_task['command']] + build_task['args'],
> + cwd=build_task['options']['cwd'], env=build_env,
> + stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
> + universal_newlines=True)
> + self.assertEqual(result.returncode, 0, result.stdout)
> +
> + install_task = next(
> + task for task in tasks
> + if task['label'].startswith('install && deploy-target
> '))
> + self.assertEqual(install_task['dependsOn'],
> [build_task['label']])
> +
> +
> class DevtoolIdeSdkKernelTests(DevtoolIdeSdkTests):
>
> @OETestTag("runqemu")
> diff --git a/scripts/lib/devtool/ide_plugins/ide_code.py
> b/scripts/lib/devtool/ide_plugins/ide_code.py
> index 80314bfb89..089016c639 100644
> --- a/scripts/lib/devtool/ide_plugins/ide_code.py
> +++ b/scripts/lib/devtool/ide_plugins/ide_code.py
> @@ -8,6 +8,7 @@
> import json
> import logging
> import os
> +import shlex
> import shutil
> import shlex
Duplicate.
> from devtool.ide_plugins import BuildTool, IdeBase, GdbCrossConfig,
> DebuggerServerModes, LldbServerConfig, get_devtool_deploy_opts,
> resolve_deploy_target
> @@ -852,6 +853,28 @@ class IdeVSCode(IdeBase):
> IdeBase.update_json_file(
> self.dot_code_dir(modified_recipe), tasks_file,
> tasks_dict)
>
> + def vscode_tasks_cargo(self, args, image_recipe,
> modified_recipe):
> + build_task_name = "cargo build %s" %
> modified_recipe.recipe_id_pretty
> + cargo_config = modified_recipe.cargo_config_path
> + build_task = {
> + "label": build_task_name,
> + "type": "shell",
> + "command": modified_recipe.cargo,
> + "args": ["--config", cargo_config, "build"] +
> + shlex.split(modified_recipe.cargo_build_flags)
> +
> +
> shlex.split(modified_recipe.cargo_packageconfig_confargs),
> + "options": {
> + "cwd": modified_recipe.real_srctree,
> + "env": {"PATH": modified_recipe.path},
> + },
> + "group": {
> + "kind": "build",
> + "isDefault": True
> + },
> + "problemMatcher": []
Problem matcher. The build task has "problemMatcher": [], so compiler
errors never reach the Problems panel. Should this be "$rustc" ?
Regards,
Adrian
> + }
> + self.vscode_tasks_binary(args, image_recipe,
> modified_recipe, build_task)
> +
> def vscode_tasks_fallback(self, args, image_recipe,
> modified_recipe):
> oe_init_dir = modified_recipe.oe_init_dir
> oe_init = ". %s %s > /dev/null && " %
> (modified_recipe.oe_init_build_env, modified_recipe.topdir)
> @@ -990,6 +1013,8 @@ class IdeVSCode(IdeBase):
> self.vscode_tasks_binary(args, image_recipe,
> modified_recipe)
> elif modified_recipe.build_tool == BuildTool.KERNEL_MODULE:
> self.vscode_tasks_kernel_module(args, image_recipe,
> modified_recipe)
> + elif modified_recipe.build_tool == BuildTool.CARGO:
> + self.vscode_tasks_cargo(args, image_recipe,
> modified_recipe)
> else:
> self.vscode_tasks_fallback(args, image_recipe,
> modified_recipe)
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#248649):
> https://lists.openembedded.org/g/openembedded-core/message/248649
> Mute This Topic: https://lists.openembedded.org/mt/121938792/4454582
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe:
> https://lists.openembedded.org/g/openembedded-core/unsub [
> adrian.freihofer@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2026-10-28 23:04 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 8:55 [PATCH 00/20] devtool: ide-sdk: add support for Rust recipes Enguerrand de Ribaucourt
2026-10-26 8:55 ` [PATCH 01/20] cargo-example: add minimal selftest fixture Enguerrand de Ribaucourt
2026-10-26 8:55 ` [PATCH 02/20] devtool: ide-sdk: capture Cargo cross environment Enguerrand de Ribaucourt
2026-10-26 8:55 ` [PATCH 03/20] devtool: ide-sdk: export recipe Cargo configuration Enguerrand de Ribaucourt
2026-10-28 22:40 ` [OE-core] " adrian.freihofer
2026-10-26 8:55 ` [PATCH 04/20] devtool: ide-sdk: recommend Rust Analyzer for Cargo Enguerrand de Ribaucourt
2026-10-28 22:48 ` [OE-core] " adrian.freihofer
2026-10-26 8:55 ` [PATCH 05/20] devtool: ide-sdk: configure " Enguerrand de Ribaucourt
2026-10-26 8:55 ` [PATCH 06/20] devtool: ide-sdk: share IntelliSense architecture mapping Enguerrand de Ribaucourt
2026-10-26 8:55 ` [PATCH 07/20] devtool: ide-sdk: configure Cargo C++ IntelliSense Enguerrand de Ribaucourt
2026-10-28 22:59 ` [OE-core] " adrian.freihofer
2026-10-26 8:55 ` [PATCH 08/20] devtool: ide-sdk: generalize binary install task name Enguerrand de Ribaucourt
2026-10-26 8:55 ` [PATCH 09/20] devtool: ide-sdk: extract install task definition Enguerrand de Ribaucourt
2026-10-26 8:55 ` [PATCH 10/20] devtool: ide-sdk: order install after optional build task Enguerrand de Ribaucourt
2026-10-28 23:01 ` [OE-core] " adrian.freihofer
2026-10-26 8:55 ` [PATCH 11/20] devtool: ide-sdk: add Cargo " Enguerrand de Ribaucourt
2026-10-28 23:04 ` adrian.freihofer [this message]
2026-10-26 8:55 ` [PATCH 12/20] devtool: ide-sdk: enforce LLDB for Cargo Enguerrand de Ribaucourt
2026-10-28 23:08 ` [OE-core] " adrian.freihofer
2026-10-26 8:55 ` [PATCH 13/20] devtool: ide-sdk: parse Rust debug path remaps Enguerrand de Ribaucourt
2026-10-28 23:16 ` [OE-core] " adrian.freihofer
2026-10-26 8:55 ` [PATCH 14/20] devtool: ide-sdk: remap Cargo sources for BitBake builds Enguerrand de Ribaucourt
2026-10-28 23:28 ` [OE-core] " adrian.freihofer
2026-10-26 8:55 ` [PATCH 15/20] devtool: ide-sdk: map Cargo workspace sources for LLDB Enguerrand de Ribaucourt
2026-10-26 8:55 ` [PATCH 16/20] devtool: ide-sdk: map libstd-rs sources to Rust SDK Enguerrand de Ribaucourt
2026-10-28 23:23 ` [OE-core] " adrian.freihofer
2026-10-26 8:55 ` [PATCH 17/20] oeqa/selftest: share source breakpoint lookup Enguerrand de Ribaucourt
2026-10-26 8:55 ` [PATCH 18/20] oeqa/selftest: run IDE tasks with configured environment Enguerrand de Ribaucourt
2026-10-26 8:55 ` [PATCH 19/20] oeqa/selftest: debug Cargo example over QEMU slirp Enguerrand de Ribaucourt
2026-10-26 8:55 ` [PATCH 20/20] oeqa/selftest: verify Cargo rebuild and redeploy Enguerrand de Ribaucourt
2026-10-28 23:30 ` [OE-core] [PATCH 00/20] devtool: ide-sdk: add support for Rust recipes adrian.freihofer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=782f1ca2cfbf97e432b79c6aa468acc2095a87e7.camel@gmail.com \
--to=adrian.freihofer@gmail.com \
--cc=adrian.freihofer@siemens.com \
--cc=enguerrand.de-ribaucourt@savoirfairelinux.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox