vendor: update buildkit to v0.19.0-rc1

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2025-01-14 14:20:26 -08:00
parent 630066bfc5
commit 44fa243d58
1910 changed files with 95196 additions and 50438 deletions

View File

@ -112,10 +112,15 @@ func (d *DirectiveParser) ParseAll(data []byte) ([]*Directive, error) {
// This allows for a flexible range of input formats, and appropriate syntax
// selection.
func DetectSyntax(dt []byte) (string, string, []Range, bool) {
return ParseDirective(keySyntax, dt)
return parseDirective(keySyntax, dt, true)
}
func ParseDirective(key string, dt []byte) (string, string, []Range, bool) {
return parseDirective(key, dt, false)
}
func parseDirective(key string, dt []byte, anyFormat bool) (string, string, []Range, bool) {
dt = discardBOM(dt)
dt, hadShebang, err := discardShebang(dt)
if err != nil {
return "", "", nil, false
@ -131,6 +136,10 @@ func ParseDirective(key string, dt []byte) (string, string, []Range, bool) {
return syntax, cmdline, loc, true
}
if !anyFormat {
return "", "", nil, false
}
// use directive with different comment prefix, and search for //key=
directiveParser = DirectiveParser{line: line}
directiveParser.setComment("//")
@ -171,3 +180,7 @@ func discardShebang(dt []byte) ([]byte, bool, error) {
}
return dt, false, nil
}
func discardBOM(dt []byte) []byte {
return bytes.TrimPrefix(dt, []byte{0xEF, 0xBB, 0xBF})
}