|
| 1 | +--- |
| 2 | +title: 'About CodeQL code scanning for compiled languages' |
| 3 | +shortTitle: CodeQL for compiled languages |
| 4 | +intro: Understand how {% data variables.product.prodname_codeql %} analyzes compiled languages, the build options available, and learn how you can customize the database generation process if you need to. |
| 5 | +permissions: '{% data reusables.permissions.code-scanning-all-alerts %} if [advanced setup](/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/configuring-advanced-setup-for-code-scanning) is already enabled' |
| 6 | +product: '{% data reusables.gated-features.code-scanning %}' |
| 7 | +versions: |
| 8 | + fpt: '*' |
| 9 | + ghes: '*' |
| 10 | + ghec: '*' |
| 11 | +topics: |
| 12 | + - Code Security |
| 13 | + - Code scanning |
| 14 | + - CodeQL |
| 15 | + - C/C++ |
| 16 | + - C# |
| 17 | + - Java |
| 18 | + - Kotlin |
| 19 | +contentType: concepts |
| 20 | +--- |
| 21 | + |
| 22 | +## About the {% data variables.code-scanning.codeql_workflow %} and compiled languages |
| 23 | + |
| 24 | +{% data variables.product.prodname_code_scanning_caps %} works by running queries against one or more {% data variables.product.prodname_codeql %} databases. Each database contains a representation of the code in a single language in your repository. For the compiled languages {% data variables.code-scanning.compiled_languages %}, the process of populating this database often involves building the code and extracting data. |
| 25 | + |
| 26 | +When you enable {% data variables.product.prodname_code_scanning %}, both default and advanced setup generate a {% data variables.product.prodname_codeql %} database for analysis using the simplest method available. For {% data variables.code-scanning.no_build_support %}, the {% data variables.product.prodname_codeql %} database is generated directly from the codebase without requiring a build (`none` build mode). For other compiled languages, {% data variables.product.prodname_codeql %} builds the codebase using the `autobuild` build mode. Alternatively, you can use the `manual` build mode to specify explicit build commands to analyze only the files that are built by these custom commands. |
| 27 | + |
| 28 | +{% ifversion codeql-dependency-caching %} |
| 29 | + |
| 30 | +You can use dependency caching with {% data variables.product.prodname_codeql %} to store dependencies as a {% data variables.product.prodname_actions %} cache instead of downloading them from registries. See [About dependency caching for {% data variables.product.prodname_codeql %}](#about-dependency-caching-for-codeql) later in this article. |
| 31 | + |
| 32 | +{% endif %} |
| 33 | + |
| 34 | +## {% data variables.product.prodname_codeql %} build modes |
| 35 | + |
| 36 | +The {% data variables.product.prodname_codeql %} action supports three different build modes for compiled languages: |
| 37 | + |
| 38 | +* `none` - the {% data variables.product.prodname_codeql %} database is created directly from the codebase without building the codebase (supported for all interpreted languages, and additionally supported for {% data variables.code-scanning.no_build_support %}). |
| 39 | +* `autobuild` - {% data variables.product.prodname_codeql %} detects the most likely build method and uses this to attempt to build the codebase and create a database for analysis (supported for {% data variables.code-scanning.autobuild_support %}). |
| 40 | +* `manual` - you define the build steps to use for the codebase in the workflow (supported for {% data variables.code-scanning.manual_build_support %}). |
| 41 | + |
| 42 | +For language-specific `autobuild` behavior, runner requirements, and guidance for manual builds, see [AUTOTITLE](/code-security/reference/code-scanning/codeql/codeql-build-options-and-steps-for-compiled-languages). |
| 43 | + |
| 44 | +{% ifversion codeql-dependency-caching %} |
| 45 | + |
| 46 | +## About dependency caching for {% data variables.product.prodname_codeql %} |
| 47 | + |
| 48 | +You can use dependency caching with {% data variables.product.prodname_codeql %} to store dependencies as a {% data variables.product.prodname_actions %} cache instead of downloading them from registries. This reduces the risk of losing alerts when third party registries don't work well, and may result in a performance improvement for projects that have a large number of dependencies or work with slow registries. To read more about how caching dependencies can speed up workflows, see [AUTOTITLE](/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows). |
| 49 | + |
| 50 | +Dependency caching works with all build modes, and is supported by {% data variables.code-scanning.codeql_dependency_caching_languages %}. |
| 51 | + |
| 52 | +>[!NOTE] |
| 53 | +> Using dependency caching will store {% data variables.product.prodname_codeql %}-specific caches that will be subject to cache quotas for a repository. See [AUTOTITLE](/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy). |
| 54 | +
|
| 55 | +{% endif %} |
0 commit comments