VS Code Autotools IntegrationIMPORTANT: This pre-release expires This extension enables VS Code to interact with projects using the GNU Autotools build system:
First Look - Autotools panelRelease planThe extension contains free and paid () features. Pre-releases are intended for evaluation and expire about 1 month after availability. Their purpose is:
When a pre-release expires, you can update to the current pre-release, or install a non-pre-release version. Pre-releases allow full use of all features, free and paid. General releases allow access to community features freely. Professional users can unlock the time-saving features by purchasing a subscription at https://autotools.mergesium.com Getting startedAn autotools project has the following basic stages: boostrapping, configuration, build, test. The extension is aware of the current step, and can run the steps as needed semi-automatically, leaving you to focus on meaningful activities - navigate the source, build it, test it, debug it. Basic familiarity with autotools projects is implied. Often projects have pre-requisites, like installing dependencies, making configuration choices or running specific bootstrapping commands before the first build. For those cases, the various steps can be run or repeated manually, using palette commands. Commands available in the project context menu (right-click project/folder name in Autotools panel):
Bootstrapping, out-of-tree vs in-tree build configurationsWhen editing an autotools project for the first time, the extension will offer to bootstrap it if necessary; bootstrapping can also be done manually from the command palette using the "Autotools: Bootstrap" command. Auto-bootstrapping is controlled by the setting Bootstrapping creates the Once bootstrapped, configurations can be created using the palette using "Autotools: Create new configuration" command. This opens the workspace JSON settings, where configurations can be added as follows:
The The
If no configurations exist, a "Default" configuration is assumed, with GNU Autotools support out-of-tree builds by default. Nothing needs to be done, other than correct use of the
Here is a typical project set up for out-of-tree building: Note If no configurations are found in the workspace settings, and the project is already configured in-tree, the extension will work correctly, but it won't be possible to create alternate configurations. You can remove the in-tree configuration by running ConfigurationConfiguration creates Makefiles that implement the recipes/compiler invocations needed to compile the project. They are created from the The extension automatically runs the configure script whenever the relevant The Makefiles are also automatically updated if the source tree is versioned (eg, with git) and it is switched to a different branch. It should not be necesary to manually configure a build directory, other than changing the The palette command "Autotools: Update Makefiles and Headers" can be used to re-generate the Makefiles and configuration header files if they've been manually editted. This will revert them to the auto-generated state. It is equivalent to running BuildingBuilding runs the command It is possible to add extra arguments to the make command line using the TestingTesting runs the command The tests included in The available tests are displayed in both the Testing panel and the Autotools panel, with slightly different controls and status (eg, XPASS and XFAIL results, Live-testing, link to KB), as the built-in Testing UI is not able to fully support autotools's test features. Test EnvironmentsAutotools supports running the defined test suite with customized environments (ie, the For example, if the project is an autonomous driving robot, the test suite might include tests for operating vehicle controls, navigation, collision avoidance. The test environments might be "Ford-Model-A", "Modern-Sub-Compact", "Modern-Minivan", "Minivan-in-Snow", "Sub-Compact-at-night", "SUV-in-heavy-rain", etc. The same functionality (operating, navigation, safety) can then be tested in a variety of simulated vehicle contexts. Environments are defined in Example: given the following settings, each test will find the environment variables
A more compact example:
The values may include spaces and punctuation as needed, and should be escaped only for json purposes. The extension will correctly escape for shell purposes when passing them to The test environment set in this way must not include "SECRETS", and is thus able to be safely committed in SCMs (and should be). Secrets, where needed, must be supplied directly through the environment via Note: Test-environments require Makefile.in files generated by automake 1.12 or later, as it makes use of custom test drivers introduced at that version. ( Test gridThere is a new Test Explorer context command, "Project Test Summary", which generates a report on the test suite in markdown table format, ready to be cut-pasted into emails, issue reports, etc. The example table below was pasted from a sample project:
The generated report includes the build configuration, as well as the definition of the test environments linked in the heading, such that co-workers can duplicate the results easily, in the same build configuration and test environment. Multiple Test Suite supportThere may be multiple directories with Two kinds of test reports can be generated:
Test environments defined in In the following example, the
In the example above, all tests suites have a Generic environment, where neither the When multiple test environments are configured, they appear on the Test Explorer as Run Profiles and Debug Profiles: Unexpected test-result waivers (XFAIL_TESTS)The automake test infrastructure supports The Autotools Integration can specify the
The interpretation of this configuration is as follows: the functions tested in When the project is ready for release, there should be no unexpected tests remaining, thus no Releasing with failing testsIt may happen that a project must be released with failing tests. For example, if a long standing bug is newly identified but cannot be fixed before the next release. In this case, a regression test is written when the bug is confirmed, but it is not possible to fix it in the current release cycle. The software must be released with 'errata' or In this case, the Build ConfigurationA build configuration is the set of arguments given to the autotools A project can have one or more build configurations, each in a separate directory. The built-in capability of autotools to configure a project out-of-tree is leveraged. Contributed commands:
Build-related featuresImporting IntelliSense configThe extension extracts the exact compilation arguments for each source code file and relays these arguments to IntelliSense. In turn, IntelliSense builds and maintains a database of indentifiers which is used to drive syntax highlighting and also code completion. When selecting a different build configuration, IntelliSense is re-configured to reflect it, so that the syntax highlighting seen in the editor accurately corresponds to the The extension eliminates the need to manually configure intellisense with include paths, compiler version/flavour, C/C++ standard applicable, or defines. Generate build tasksEach target that can be built, be it a program or a shared library, is associated with an automatically generated build task, which appears in the Command Pallette under the "Run Task..."/"Build Tasks" menu. This enables:
In very large projects, it may be beneficial to focus on a small part of a project, and the build task allow you to surgically control the build, without resorting to running 'make ...' in a terminal. Navigating compile problemsBuilding the project using the auto-generated build tasks allows compilation warnings and errors to be captured, and the offending line of source code to be located and opened with a single click in the "Problems" panel. This powerful built-in feature of vscode would not be available if the project were built by running make in a terminal window. Navigation ShortcutsWhen a build or test is selected in the Autotools panel, the source files that are in the dependency tree for that target are highlighted in the File explorer and the editor tabs, and a new Context Menu command is available on the editor tabs, "Close Irrelevant Files". This command closes all editor tabs that are not relevant to the selected target. The relevant files are badged as sources 🏹, intermediary files 🧩, or build goals 🎯: The relevant sources are highlighted in the file explorer, as shown below. The file explorer also gets a new context menu command, "Find dependent targets", which does the reverse, ie, find which targets depend on a selected source file. Build DiagnosticsSometimes the build specification (
Common symptoms:
These are common issues, often with well understood reasons, but the maintainers don't have the autotools expertise to diagnose or fix them. The extension detects many such conditions and provides links to specific documentation that explains and guides to a solution. Build diagnostics are output in the "Autotools" section of the "OUTPUT" tab, and when a specific problem is identified, a deep link to the knowledge base is given, eg. https://autotools.mergesium.com/kb/acme-project?v=2.1.0#overrides-check-target - which are human readable, and also takes you to specific info about the error (overriding check target in this case), the project and its version. If no info specific to the given project exist, you'll find relevant, but general info about the error, as well as links to file pre-filled bug reports if appropriate. The "relevant" badges of the Navigation Shortcuts will often highlight that some part of the project relies unnecesarily on irrelevant sources or header files, giving you feedback on how includes can be trimmed. Including all headers in all sources is easy, but does come at the cost of slower builds. At this time, a small list of conditions is detected, but it will grow with future releases. Testing featuresThe extension implements automake's standard parallel test suite infrastructure interface. If your project follows the automake documentation on writing and running tests, they are seamlessly discovered and used directly from vscode. Importing test suitesThe extension allows vscode's built-in Testing UI to discover test suites declared with the autotools testing infrastructure (ie, declared with the The extension reads the test results generated by automake's test infrastructure and populates the Testing UI, such that the UI always displays an up-to-date view of latest results. Using filesystem watchers the extension is able to update the UI as tests run. Also see the related vscode documentation on Python testing. This extension brings the same UI functionality to autotools projects. Generated test tasksWhen you use the automake The test tasks allow: * creating Compound Tasks * keybinding frequently used test suites. * One-click access to each test's output file (log file) Debugging testsTests can be debugged with a single click. The extension is a If multiple environments are set as Debugged tests run in the same environment as automake's Whether the test runs directly or under the debugger, it is provided the same environment. Additionally, tests that rely on built shared libraries likely use libtool to manage running and debugging the project in its uninstalled test. This ensures that the Note The extension currently supports only the Parallel Test Harness, but the "older (and discouraged)" harness will be supported in a future version, for compatibility with legacy autotools projects. Test Framework debugging supportThe following test-framework-specific support is implemented, to make debugging more fluent: Google Test
Check
Additional test suite support can be added by opening an issue. Live TestingYou can select one test suite to be the "Live test suite" (⚡). This test suite will be updated, rather than run in full, whenever all editor tabs are saved. If you're editing multiple files, the update starts when the last unsaved file is saved, and the results are updated in both the Test Explorer and the Autotools Tests panel. The Live Testing suite runs in the currently selected test environment. This mode is expecially suited for running unit tests suites, which are typically small, targeted at a single function, and are very fast to build and run. You can continue making changes to the sources even as the tests run. Here is an example live testing session: In this example:
IntelliSense data providersIntelliSense allows the data provider to be configured using the Telemetry and qualityWith your approval, the autotools extension collects anonymous usage data and error traces and sends them to Mergesium servers to help improve our products and services.
Read our privacy statement to learn more.
This extension respects the Pre-releases require telemetry to be enabled. Telemetry is optional in general releases, but greatly appreciated, as it allows Mergesium to continuously improve quality of the extension and your experience in future versions. Issues found by in this way are tagged The traces and errors reported by telemetry should not be seen as a substitute for issue reports. They are useful to detect wide-spread bugs or errors, but don't have enough resolution to detect isolated problems. If we knew what code paths are subject to failure, we'd fix them rather than instrument them with telemetry. Your feedback is invaluable in helping us understand bugs. Please do submit bug reports, especially if the knowledge base contains nothing related to your project; in that case you are very likely the first person to encounter the bug you're seeing. Knowledge baseBased on submitted issue reports, we compile a knowledge base and publish it at https://autotools.mergesium.com/kb; It can be accessed with the "Autotools: Go to Knowledge Base" command. Projects which have any issues reported have their own KB page (ex. GNU Make's page) The KB is intended to be the front line of support if a project does not function correctly in Autotools Integration. Many autotools projects make use of various customizations and hooks which prevent the extension from providing a turn-key experience. For instance, GNU Make itself requires a one-time TODO list at this pre-release:
|