Hi Adrian,

I started to work on codium ide plugin.
I have tested it with cmake projects and it works as expected.
Then I have tried devtool fallback projects (like u-boot) and I have a problem 
that devtool does the project build without me inserting bear tool command.
I use bear tool for clangd indexing.
When I try to run a build task that has already bear tool command inserted in 
tasks.json (because of the ide_codium.py), the indexation doesn't work because 
the build isn't run (its already cached).
I can get around ti by calling clean task or by calling devtool ide-sdk with 
--skip-bitbake flag.
I didn't like this extra step so I tried to do some hacking in ide_sdk.py.
I know that ide_sdk.py should be IDE agnostic and not have "if codium" 
statements, but I just wanted to do some quick and dirty work to achieve the 
necessary index functionality.
I have managed to get the indexation working because of the bear tool command 
insertion in bb_cmd variable, but do_package task breaks.
If I remove all the code related to the "if codium", the do_package finishes 
successfully.
Can you give me some inputs where my hacking code is breaking the do_package 
task?
In attachment is my current work in progress patch and the do_package log.

Best regards,
Karlo Strize
diff --git a/oe-init-build-env b/oe-init-build-env
index 82382f2..79075d2 100755
--- a/oe-init-build-env
+++ b/oe-init-build-env
@@ -48,8 +48,8 @@ export OEROOT
     return 1
 }
 
-# Generate an initial configuration for VSCode and the yocto-bitbake plugin.
-if command -v code > /dev/null && [ ! -d "$OEROOT/.vscode" ]; then
+# Generate an initial configuration for VSCode or VSCodium and the yocto-bitbake plugin.
+if command -v code > /dev/null || command -v codium > /dev/null && [ ! -d "$OEROOT/.vscode" ]; then
     oe-setup-vscode "$OEROOT" "$BUILDDIR"
 fi
 
diff --git a/scripts/lib/devtool/ide_plugins/ide_code.py b/scripts/lib/devtool/ide_plugins/ide_code.py
index a62b932..69d1754 100644
--- a/scripts/lib/devtool/ide_plugins/ide_code.py
+++ b/scripts/lib/devtool/ide_plugins/ide_code.py
@@ -3,7 +3,7 @@
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
-"""Devtool ide-sdk IDE plugin for VSCode and VSCodium"""
+"""Devtool ide-sdk IDE plugin for VSCode"""
 
 import json
 import logging
diff --git a/scripts/lib/devtool/ide_sdk.py b/scripts/lib/devtool/ide_sdk.py
index 2f6edde..08da286 100755
--- a/scripts/lib/devtool/ide_sdk.py
+++ b/scripts/lib/devtool/ide_sdk.py
@@ -918,17 +918,30 @@ def ide_setup(args, config, basepath, workspace):
         tinfoil.shutdown()
 
     if not args.skip_bitbake:
-        bb_cmd = 'bitbake '
+        bb_cmd = ""
+        codium_error = False
+        if args.ide == "codium":
+            if len(recipes_modified_names) == 1:
+                bb_cmd += "cd %s && bear " % (recipes_modified[0].srctree)
+            else:
+                logger.error("Multiple recipes detected! VSCodium setup currently only supports one recipe at a time.")
+                codium_error = True
+        bb_cmd += "bitbake "
         if args.bitbake_k:
             bb_cmd += "-k "
         bb_cmd_early = bb_cmd + ' '.join(bootstrap_tasks)
+        if (args.ide == "codium") and (codium_error == False):
+            bb_cmd_early += " && cd -"
         exec_build_env_command(
             config.init_path, basepath, bb_cmd_early, watch=True)
         if bootstrap_tasks_late:
             bb_cmd_late = bb_cmd + ' '.join(bootstrap_tasks_late)
+            if (args.ide == "codium") and (codium_error == False):
+                bb_cmd_early += " && cd -"
             exec_build_env_command(
                 config.init_path, basepath, bb_cmd_late, watch=True)
 
+
     for recipe_image in recipes_images:
         if (recipe_image.gdbserver_missing):
             logger.warning(

Attachment: log.do_package.284706
Description: Binary data

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#64203): https://lists.yoctoproject.org/g/yocto/message/64203
Mute This Topic: https://lists.yoctoproject.org/mt/109085158/21656
Mute #github:https://lists.yoctoproject.org/g/yocto/mutehashtag/github
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to