SecDevOps.comSecDevOps.com
Gnome Foundry Is a New ‘IDE in a Box’ for Linux

Gnome Foundry Is a New ‘IDE in a Box’ for Linux

The New Stack(2 weeks ago)Updated 2 weeks ago

Gnome Builder has been around for a long, long time. If you’ve never experienced Builder, I will say that it’s a general-purpose IDE for the Gnome platform and was created primarily for developing...

Gnome Builder has been around for a long, long time. If you’ve never experienced Builder, I will say that it’s a general-purpose IDE for the Gnome platform and was created primarily for developing Gnome applications. Gnome Builder includes plenty of features to make it a worthwhile IDE for developers, including syntax highlighting for most popular languages, side-by-side code editors, multimonitor support, code overview mini-map, integrations (such as with Git, Autotools, Cargo, Maven, and more), Clang and Python-based auto-completion, integrated software profiler and debugger, and much more. But the developers of Gnome Builder aren’t satisfied with what they have and are now developing something new called Gnome Foundry, a set of additional, modular developer tools that can be run from the command line. Gnome Foundry isn’t a new IDE, but rather an opportunity to bring many of the automatic features found in Builder to the command line interface (CLI). Why? Linux users are often fond of the command line and see it as a more efficient tool than many GUI apps. What’s in the Box? The amount of tooling that will be included with Gnome Foundry is impressive, such as: Language Servers astro-ls bash blueprint clangd elixir glsl gopls intelephense jdtls jedi lua mesonlsp pyrefly python-lsp-server ruff rust-analyzer serve-d sourcekit ts/js vala vhdl zls Build Systems Autotools BuildStream CMake Cargo Dub Go Gradle Make Maven Meson Npm PHPize Waf Container Systems Flatpak JHBuild Podman Distrobox Toolbx Host (via sandbox escapes) None (current environment) Each Foundry project will use BuildConfig and Flatpak manifests as its configuration format. Using Foundry Using the foundry command is actually quite easy. Imagine you have your project in the folder my_project. If you change into that folder (housing all of your dev files for the project), you would then initialize the project with: foundry init Most Gnome projects include a Flatpak manifest, and Foundry uses that to discover various necessary information about the project. That discovery command looks like this: foundry build The build command can be run from within any subdirectory of your project because it will automatically scan upward to find the .foundry folder that contains the project state. Once the project is built, you can run it with: foundry run The run command sets up the necessary Flatpak pipelines, as well as the necessary auxiliary tooling for the app. You can even pull the necessary project dependency updates with the command: foundry dependencies update There are plenty more actions you can take with Foundry — such as inspecting the build pipeline, invalidating all pipeline stages and forcing a purge for a clean build. There’s also the ability to run a specific command instead of a default program, which makes it possible to do things like testing a runtime instead of a build environment. This can be done with a command like: <span style="font-weight: 400;">foundry run -- gtk4-demo</span> Keep in mind that dependencies are not updated automatically. The reason for this is so that every developer isn’t connecting to the build server at once, for every build request. To open a sub-shell with the project’s environment sourced, issue the command: <span style="font-weight: 400;">foundry enter</span> There are plenty more actions you can take with Foundry (such as inspecting the build pipeline, invalidating all pipeline stages, and forcing a purge for a clean build. Here is a list of some of the more important Gnome Foundry commands that can be used: foundry build — Compiles your project. foundry run — Builds (if needed) and runs the project. foundry enter — Opens a sub-shell with the project’s environment preconfigured. foundry –help — Displays the Foundry help information. foundry settings — View and change project settings. foundry lsp — Manage language server for integration with other editors. foundry install-docs — Install documentation for various Gnome versions. foundry run –flatpak — Runs your application as a Flatpak app. foundry run –device=<device> — Runs your application on a specified device, such as a phone or a tablet. foundry shell — Runs a shell within the build pipeline. foundry purge — Removes all build artifacts to force a clean build. foundry inspect — Inspect the build pipeline. foundry doc <GtkWidget> — Finds documentation for a specific GtkWidget You can also work with multiple build configurations on a project and switch between them. That workflow might look something like this: <span style="font-weight: 400;">foundry config add --flatpak org.gnome.Builder.Devel.json </span><span style="font-weight: 400;">foundry config switch org.gnome.Builder.Devel.json</span> Integration Through Language Server Protocol With the help of its Language Server Protocol (LSP) support, Foundry can be integrated into other code editors. The —format=json flag can be used with many commands for easy parsing. As far as support, LSP can work with several languages. Here’s a list of languages and the associated servers supported by Gnome Foundry: Astro: astro-ls Bash: bash-language-server Blueprint: blueprint C, C++: clangd D: serve-d Elixir: elixir-ls GLSL: glsl-language-server Go: gopls Java: jdtls JavaScript/TypeScript: ts-language-server Lua: lua-language-server Meson: mesonlsp PHP: intelephense Python: python-lsp-server, ruff, and jedi-language-server Rust: rust-analyzer Swift: sourcekit-lsp Vala/Genie: vala-language-server VHDL: vhdl-language-server Zig: zls For example, if you wanted to use Gnome Foundry with Python, the command would be: <i><span style="font-weight: 400;">foundry lsp run python3</span></i> Note: If you need to specify a particular server, you would use the command foundry lsp prefer. When managing different servers with Foundry, keep the following in mind: Foundry uses GtkSourceView language identifiers to recognize the language of a project. The foundry lsp command has a built-in tool to help you choose the best server. Instead of manually managing several different servers for a single language, you can use a command like foundry lsp run python3 to start a specific server. By using foundry lsp prefer <server>, you can set which language server will be used for a particular language, which allows you to define the server to be launched when you run foundry lsp run. Foundry handles the complexities of running language servers, including supporting cross-container execution, which allows you to use a language server from within a Flatpak environment. This can be used even if the server itself is not directly available within that container. You can read about all of the tooling features for Foundry here. And that’s the gist of Foundry. Hopefully, in the future, the developers will make this considerably easier to install, but given it’s in the early stages, it’s understandable why it’s so challenging. The post Gnome Foundry Is a New ‘IDE in a Box’ for Linux appeared first on The New Stack.

Source: This article was originally published on The New Stack

Read full article on source →

Related Articles