bundle

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTarGz

func CreateTarGz(outputPath, srcDir string, filter func(relSlash string) bool) error

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

func MakePlatformFilter(platform string, languages []string) func(string) bool

MakePlatformFilter returns a filter function for CreateTarGz that excludes paths not belonging to the target platform.

func ResolveDeps

func ResolveDeps(workspacePacks, allPacks []*pack.Pack) error

ResolveDeps populates the Deps field on each workspace pack by looking up dependencies in the combined allPacks slice (workspace + bundle packs).

func ValidatePlatforms

func ValidatePlatforms(platforms []string) error

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:

  1. Extract the base bundle into a temp directory.
  2. Clear the bundle's qlpacks/ directory (a clean slate; stdlib deps are restored in step 6).
  3. 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`.
  4. Copy <tmp>/common-caches/packages/* into <qlpacksDir> so the bundle contains every resolved dependency.
  5. 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

type PackProcessor interface {
	Process(p *pack.Pack) error
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL