Documentation
¶
Index ¶
- func CreateTarGz(outputPath, srcDir string, filter func(relSlash string) bool) error
- func MakePlatformFilter(platform string, languages []string) func(string) bool
- func ResolveDeps(workspacePacks, allPacks []*pack.Pack) error
- func ValidatePlatforms(platforms []string) error
- type CreateOptions
- type CustomBundle
- type PackProcessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTarGz ¶
CreateTarGz creates a .tar.gz archive from srcDir, storing entries under the archive root name "codeql". The filter function receives a slash-separated path relative to srcDir and returns false to exclude that entry (and, for directories, their entire subtree).
func MakePlatformFilter ¶
MakePlatformFilter returns a filter function for CreateTarGz that excludes paths not belonging to the target platform.
func ResolveDeps ¶
ResolveDeps populates the Deps field on each workspace pack by looking up dependencies in the combined allPacks slice (workspace + bundle packs).
func ValidatePlatforms ¶
ValidatePlatforms checks that each platform is one of linux64/osx64/win64.
Types ¶
type CreateOptions ¶
type CreateOptions struct {
// BundlePath is the path to the base CodeQL bundle archive (.tar.gz).
BundlePath string
// WorkspaceDir is the CodeQL workspace containing the packs to add.
WorkspaceDir string
// Packs is the list of pack names to include (e.g. "foo/cpp-customizations").
Packs []string
// OutputPath is where the resulting bundle archive is written.
// If Platforms is non-empty, this is treated as a directory; otherwise as a file path.
OutputPath string
// Platforms restricts output to specific platforms ("linux64", "osx64", "win64").
// Empty means a single platform-agnostic bundle.
Platforms []string
// NoPrecompile skips pre-compilation when bundling packs.
NoPrecompile bool
// Minimal creates a minimal bundle with only the selected packs and no additional
// dependencies. Currently a no-op; reserved for future use.
Minimal bool
}
CreateOptions controls how the custom bundle is built.
func NewCreateOptions ¶
func NewCreateOptions(base, bundlePath string, noPrecompile, minimal bool, platforms []string) (*CreateOptions, error)
func (*CreateOptions) Validate ¶
func (o *CreateOptions) Validate() error
Validate checks that required fields are set and values are well-formed.
type CustomBundle ¶
type CustomBundle struct {
// contains filtered or unexported fields
}
func NewCustomBundle ¶
func NewCustomBundle(opts *CreateOptions) (*CustomBundle, error)
func (*CustomBundle) Create ¶
func (ctx *CustomBundle) Create() error
Create builds a custom CodeQL bundle by extending the base bundle with the configured workspace packs. The flow is:
- Extract the base bundle into a temp directory.
- Clear the bundle's qlpacks/ directory (a clean slate; stdlib deps are restored in step 6).
- For each workspace pack, copy it under <tmp>/temp and run `codeql pack install --common-caches=<tmp>/common-caches` then `codeql pack create --output=<qlpacksDir> --common-caches=<tmp>/common-caches`.
- Copy <tmp>/common-caches/packages/* into <qlpacksDir> so the bundle contains every resolved dependency.
- Repack the modified bundle, either as a single archive or one per requested platform.
Only QueryPack workspace packs are processed in full. Customization and Library packs are skipped with a warning (future work).
type PackProcessor ¶
PackProcessor encapsulates the build-time handling of a single workspace pack while assembling a custom CodeQL bundle. Each pack kind has its own implementation, selected once at pack-discovery time so the orchestrator loop in CustomBundle.Create can call Process without further dispatch.