Skip to content

frontend: add build-time source filters#1061

Open
cpuguy83 wants to merge 1 commit into
project-dalec:mainfrom
cpuguy83:global_source_excludes
Open

frontend: add build-time source filters#1061
cpuguy83 wants to merge 1 commit into
project-dalec:mainfrom
cpuguy83:global_source_excludes

Conversation

@cpuguy83
Copy link
Copy Markdown
Collaborator

Add a source-options context that can provide a YAML source filter
config at build time. The config currently supports global_excludes
which can be used to filter out paths from all sources.

Copilot AI review requested due to automatic review settings May 14, 2026 21:11
@cpuguy83 cpuguy83 force-pushed the global_source_excludes branch from a2ba2aa to 8b69774 Compare May 14, 2026 21:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds build-time source filtering support via a YAML config supplied through a build context, so package/source generation can exclude globally configured paths without changing the Dalec spec.

Changes:

  • Adds SourceFilterConfig, build args, frontend loading, and source/generator filtering hooks.
  • Propagates filter metadata into RPM spec generation and source docs.
  • Adds unit/integration coverage and user documentation for source filter behavior.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
website/docs/sources.md Documents build-time source filter configuration and Buildx usage.
test/source_test.go Adds integration tests for debug source and gomod filtering.
targets/windows/handle_zip.go Adjusts Windows binary build source options around filtering.
spec_test.go Tests YAML decoding and emptiness checks for filter config.
source.go Adds filter plumbing to source fetch options and source docs.
source_test.go Adds unit tests for source filter LLB behavior.
source_inline.go Adjusts inline directory include/exclude paths when renamed.
source_filter.go Introduces source filter config, constants, and LLB filter helpers.
packaging/linux/rpm/template.go Emits source filter documentation and pip source entries in RPM specs.
packaging/linux/rpm/template_test.go Updates RPM source expectations and filter documentation tests.
packaging/linux/rpm/buildroot.go Passes source filter config into RPM spec generation.
load.go Marks source filter build args as known arguments.
generator_pip.go Applies filters to generated pip dependency cache.
generator_gomod.go Applies filters to generated gomod dependency cache.
generator_cargohome.go Applies filters to generated Cargo dependency cache.
frontend/request.go Loads source filter config from a build context.
frontend/gateway.go Wires cached source filter loading into frontend source options.
frontend/debug/handle_sources.go Passes progress options while preparing debug sources.
Comments suppressed due to low confidence (1)

packaging/linux/rpm/template.go:386

  • Filter patterns are written directly into the generated RPM spec comment. If a pattern contains a newline, only the first line is prefixed with #, so the remaining text can become active spec content; comment each line (as Sources does when scanning src.Doc) or sanitize newlines before writing.
	}

	if len(keys) > 0 {
		b.WriteString("\n")

Comment thread generator_gomod.go
Comment thread frontend/request.go Outdated
Comment thread frontend/request.go Outdated
Comment thread targets/windows/handle_zip.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Comment thread targets/windows/handle_zip.go Outdated
Add a source-options context that can provide a YAML source filter
config at build time. The config currently supports global_excludes
which can be used to filter out paths from all sources.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83 cpuguy83 force-pushed the global_source_excludes branch from 7df6aad to efcebc9 Compare May 14, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants