public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: adrian.freihofer@gmail.com
To: Enguerrand de Ribaucourt
	<enguerrand.de-ribaucourt@savoirfairelinux.com>,
	 openembedded-core@lists.openembedded.org
Subject: Re: [PATCH v2 5/5] devtool: code: Provide a generic C++ configuration
Date: Tue, 20 Feb 2024 10:20:52 +0100	[thread overview]
Message-ID: <0c41985baaadd58d4550bb03ccbba88ad2f410d2.camel@gmail.com> (raw)
In-Reply-To: <20240219165525.714512-6-enguerrand.de-ribaucourt@savoirfairelinux.com>

Hi Enguerrand

I would really like to stay on the path with tests. This patch changes
code which is covered by tests without tests. Lets develop the
autotools support as a separate patch series. 

There are three parts needed:
- Extend the cpp-example with autotools support (already on my branch)
- What your patch does
- Extend the oe-selftest suite to cover also the autotools support.

On Mon, 2024-02-19 at 17:55 +0100, Enguerrand de Ribaucourt wrote:
> By default, the cpptools VSCode extension will use the host's headers
> and flags for linting. This results in a lot of include errors and
> misleading definitions. Even though this generic configuration
> doesn't
> include all the depenendencies, it is a proper fallback for recipe
> classes we do not accurately cover, with at least the right sysroot.
> 
> Additionally, ide-sdk automatically detects and provides a
> launch.json
> configuration for autotools recipes so we should recommend the C++
> extensions for them.
> 
> Recipes which use C/C++ without a build system are not covered by
> this
> patch.
> 
> Signed-off-by: Enguerrand de Ribaucourt
> <enguerrand.de-ribaucourt@savoirfairelinux.com>
> ---
>  scripts/lib/devtool/ide_plugins/__init__.py |  3 +++
>  scripts/lib/devtool/ide_plugins/ide_code.py | 27 +++++++++++++------
> --
>  scripts/lib/devtool/ide_sdk.py              |  5 ++++
>  3 files changed, 25 insertions(+), 10 deletions(-)
> 
> diff --git a/scripts/lib/devtool/ide_plugins/__init__.py
> b/scripts/lib/devtool/ide_plugins/__init__.py
> index 3371b242640..59e90663908 100644
> --- a/scripts/lib/devtool/ide_plugins/__init__.py
> +++ b/scripts/lib/devtool/ide_plugins/__init__.py
> @@ -21,6 +21,7 @@ class BuildTool(Enum):
>      UNDEFINED = auto()
>      CMAKE = auto()
>      MESON = auto()
> +    AUTOTOOLS = auto()
>  
>      @property
>      def is_c_ccp(self):
> @@ -28,6 +29,8 @@ class BuildTool(Enum):
>              return True
>          if self is BuildTool.MESON:
>              return True
> +        if self is BuildTool.AUTOTOOLS:
> +            return True
>          return False
>  
>  
> diff --git a/scripts/lib/devtool/ide_plugins/ide_code.py
> b/scripts/lib/devtool/ide_plugins/ide_code.py
> index 7b683c74086..0942fde8196 100644
> --- a/scripts/lib/devtool/ide_plugins/ide_code.py
> +++ b/scripts/lib/devtool/ide_plugins/ide_code.py
> @@ -157,31 +157,35 @@ class IdeVSCode(IdeBase):
>          IdeBase.update_json_file(
>              self.dot_code_dir(modified_recipe), settings_file,
> settings_dict)
>  
> -    def __vscode_extensions_cmake(self, modified_recipe,
> recommendations):
> -        if modified_recipe.build_tool is not BuildTool.CMAKE:
> +    def __vscode_extensions_generic(self, modified_recipe,
> recommendations):
> +        if not modified_recipe.build_tool.is_c_ccp:
>              return
>          recommendations += [
> -            "twxs.cmake",
> -            "ms-vscode.cmake-tools",
>              "ms-vscode.cpptools",
>              "ms-vscode.cpptools-extension-pack",
>              "ms-vscode.cpptools-themes"
>          ]
>  
> +    def __vscode_extensions_cmake(self, modified_recipe,
> recommendations):
> +        if modified_recipe.build_tool is not BuildTool.CMAKE:
> +            return
> +        recommendations += [
> +            "twxs.cmake",
> +            "ms-vscode.cmake-tools"
> +        ]
> +
>      def __vscode_extensions_meson(self, modified_recipe,
> recommendations):
>          if modified_recipe.build_tool is not BuildTool.MESON:
>              return
>          recommendations += [
> -            'mesonbuild.mesonbuild',
> -            "ms-vscode.cpptools",
> -            "ms-vscode.cpptools-extension-pack",
> -            "ms-vscode.cpptools-themes"
> +            'mesonbuild.mesonbuild'
>          ]
>  
>      def vscode_extensions(self, modified_recipe):
>          recommendations = []
>          self.__vscode_extensions_cmake(modified_recipe,
> recommendations)
>          self.__vscode_extensions_meson(modified_recipe,
> recommendations)
> +        self.__vscode_extensions_generic(modified_recipe,
> recommendations)
>          extensions_file = 'extensions.json'
>          IdeBase.update_json_file(
>              self.dot_code_dir(modified_recipe), extensions_file,
> {"recommendations": recommendations})
> @@ -194,8 +198,11 @@ class IdeVSCode(IdeBase):
>              properties_dict["configurationProvider"] = "ms-
> vscode.cmake-tools"
>          elif modified_recipe.build_tool is BuildTool.MESON:
>              properties_dict["configurationProvider"] =
> "mesonbuild.mesonbuild"
> -        else:  # no C/C++ build
> -            return

else return is still required.

Adrian


> +        elif modified_recipe.build_tool.is_c_ccp:
> +            # Provide a generic linting configuration
> +            # We provide a C++ configuration with the proper sysroot
> +            properties_dict["compilerPath"] =
> os.path.join(modified_recipe.staging_bindir_toolchain,
> modified_recipe.cxx.split()[0])
> +            properties_dict["compilerArgs"] =
> modified_recipe.cxx.split()[1:]
>  
>          properties_dicts = {
>              "configurations": [
> diff --git a/scripts/lib/devtool/ide_sdk.py
> b/scripts/lib/devtool/ide_sdk.py
> index f292edbe25c..6313daa8700 100755
> --- a/scripts/lib/devtool/ide_sdk.py
> +++ b/scripts/lib/devtool/ide_sdk.py
> @@ -345,6 +345,7 @@ class RecipeModified:
>          self.base_libdir = recipe_d.getVar('base_libdir')
>          self.bblayers = recipe_d.getVar('BBLAYERS').split()
>          self.bpn = recipe_d.getVar('BPN')
> +        self.cxx = recipe_d.getVar('CXX')
>          self.d = recipe_d.getVar('D')
>          self.fakerootcmd = recipe_d.getVar('FAKEROOTCMD')
>          self.fakerootenv = recipe_d.getVar('FAKEROOTENV')
> @@ -361,6 +362,8 @@ class RecipeModified:
>              recipe_d.getVar('RECIPE_SYSROOT'))
>          self.recipe_sysroot_native = os.path.realpath(
>              recipe_d.getVar('RECIPE_SYSROOT_NATIVE'))
> +        self.staging_bindir_toolchain = os.path.realpath(
> +            recipe_d.getVar('STAGING_BINDIR_TOOLCHAIN'))
>          self.staging_incdir = os.path.realpath(
>              recipe_d.getVar('STAGING_INCDIR'))
>          self.strip_cmd = recipe_d.getVar('STRIP')
> @@ -380,6 +383,8 @@ class RecipeModified:
>              self.extra_oemeson = recipe_d.getVar('EXTRA_OEMESON')
>              self.meson_cross_file =
> recipe_d.getVar('MESON_CROSS_FILE')
>              self.build_tool = BuildTool.MESON
> +        elif bb.data.inherits_class('autotools', recipe_d):
> +            self.build_tool = BuildTool.AUTOTOOLS
>  
>          # Recipe ID is the identifier for IDE config sections
>          self.recipe_id = self.bpn + "-" + self.package_arch


  reply	other threads:[~2024-02-20  9:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 16:55 [PATCH v2 0/5] devtool: ide: Improve VSCode support Enguerrand de Ribaucourt
2024-02-19 16:55 ` [PATCH v2 1/5] devtool: ide_sdk: Use bitbake's python3 for generated scripts Enguerrand de Ribaucourt
2024-02-20  9:03   ` adrian.freihofer
2024-02-19 16:55 ` [PATCH v2 2/5] devtool: code: Add source mapping for debug source files Enguerrand de Ribaucourt
2024-02-20  9:01   ` adrian.freihofer
2024-02-21 14:12     ` Enguerrand de Ribaucourt
2024-02-21 14:56       ` Enguerrand de Ribaucourt
2024-02-22 13:00         ` adrian.freihofer
2024-02-22 15:51           ` Enguerrand de Ribaucourt
2024-02-25 20:52             ` adrian.freihofer
2024-02-19 16:55 ` [PATCH v2 3/5] devtool: ide: vscode: Configure read-only files Enguerrand de Ribaucourt
2024-02-20  9:05   ` adrian.freihofer
2024-02-19 16:55 ` [PATCH v2 4/5] meson: use absolute cross-compiler paths Enguerrand de Ribaucourt
2024-02-20 12:54   ` [OE-core] " Richard Purdie
2024-02-19 16:55 ` [PATCH v2 5/5] devtool: code: Provide a generic C++ configuration Enguerrand de Ribaucourt
2024-02-20  9:20   ` adrian.freihofer [this message]
2024-02-20  9:27     ` Enguerrand de Ribaucourt

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=0c41985baaadd58d4550bb03ccbba88ad2f410d2.camel@gmail.com \
    --to=adrian.freihofer@gmail.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