# Manual Analysis | Target | Kind | Purpose | |-----------------|--------|--------------------------------------------------------------------------| | `{name}` | `test` | Checks that the lock file is current and generates the `.lobster` output | | `{name}.update` | `run` | Runs the interactive analysis and refreshes the lock file | **Attributes** | Attribute | Required | Description | |----------------|----------|-----------------------------------------------------------------------| | `contexts` | ✓ | List of context-provider targets (`ManualAnalysisContextInfo`) | | `analysis` | ✓ | Label of the analysis YAML file | | `lock_file` | ✓ | Label of the lock file (workspace-relative, committed to VCS) | | `results_file` | ✓ | Label of the results JSON file (workspace-relative, committed to VCS) | The `contexts` attribute accepts **any** target that provides `ManualAnalysisContextInfo`. The two rules below are convenience examples. You can define additional project-specific context-provider rules as needed. ## Context Providers ### `manual_analysis_context_from_filegroup` The rule wraps an arbitrary `filegroup` (or any target with `DefaultInfo`) and exposes its files as `ManualAnalysisContextInfo`. ```starlark load("//manual_analysis:context_from_filegroup.bzl", "manual_analysis_context_from_filegroup") manual_analysis_context_from_filegroup( name = "my_context", filegroup = ":my_sources", ) ``` ### `manual_analysis_context_from_cc_library` The rule traverses a `cc_library` and all its transitive dependencies. It collects source and header files as well as selected build attributes (`copts`, `defines`, etc.) so that any change to the compilation units is reflected in the lock file. The compiled output is explicitly not captured to avoid lock file invalidation when the toolchain is modified. ```starlark load("//manual_analysis:context_from_cc_library.bzl", "manual_analysis_context_from_cc_library") manual_analysis_context_from_cc_library( name = "my_cc_context", library = ":my_library", ) ``` ### Custom context-provider rules If your project needs a different notion of context, define a custom rule that returns `ManualAnalysisContextInfo`. ```starlark load("//manual_analysis:manual_analysis.bzl", "ManualAnalysisContextInfo") def _my_context_impl(ctx): files = depset(ctx.files.srcs) return [ DefaultInfo(files = files), ManualAnalysisContextInfo( files = files, # Optional: serialized "