dap: add debug adapter implementation
Adds a simple implementation of the debug adapter that supports the very basics of a debug adapter. It supports the launch request, the configuration done request, the creation of threads, stopping, resuming, and disconnecting from server. It does not support custom breakpoints, stack traces, or variable inspection yet. These are planned to be added in the future. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
+13
-2
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/docker/buildx/util/ioset"
|
||||
"github.com/docker/buildx/util/progress"
|
||||
"github.com/google/shlex"
|
||||
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
||||
gateway "github.com/moby/buildkit/frontend/gateway/client"
|
||||
"github.com/moby/buildkit/identity"
|
||||
"github.com/moby/buildkit/solver/errdefs"
|
||||
@@ -56,7 +57,7 @@ func (m *Monitor) Handler() build.Handler {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Monitor) Evaluate(ctx context.Context, c gateway.Client, res *gateway.Result) error {
|
||||
func (m *Monitor) Evaluate(ctx context.Context, _ string, c gateway.Client, res *gateway.Result) error {
|
||||
buildErr := res.EachRef(func(ref gateway.Reference) error {
|
||||
return ref.Evaluate(ctx)
|
||||
})
|
||||
@@ -70,7 +71,17 @@ func (m *Monitor) Evaluate(ctx context.Context, c gateway.Client, res *gateway.R
|
||||
logrus.Warnf("failed to print error information: %v", err)
|
||||
}
|
||||
|
||||
rCtx := build.NewResultHandle(ctx, c, res, buildErr)
|
||||
ps, err := exptypes.ParsePlatforms(res.Metadata)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ref, ok := res.FindRef(ps.Platforms[0].ID)
|
||||
if !ok {
|
||||
return errors.Errorf("no reference found for %s", ps.Platforms[0].ID)
|
||||
}
|
||||
|
||||
rCtx := build.NewResultHandle(ctx, c, ref, res.Metadata, buildErr)
|
||||
if monitorErr := m.Run(ctx, rCtx); monitorErr != nil {
|
||||
if errors.Is(monitorErr, build.ErrRestart) {
|
||||
return build.ErrRestart
|
||||
|
||||
Reference in New Issue
Block a user