Files
pack/core/providers/cpp/cpp.go
T
zeekay 7844a60aff refactor(pack): modernize to github.com/hanzoai/pack and remove upstream branding
- Migrate module path to github.com/hanzoai/pack across all Go packages
- Remove legacy upstream docs and competitor brand references
- Modernize LLM.md and mise.toml for pristine Hanzo Pack builder
2026-09-04 00:40:42 -07:00

57 lines
1.2 KiB
Go

package cpp
import (
"fmt"
"path/filepath"
"github.com/hanzoai/pack/core/generate"
"github.com/hanzoai/pack/core/plan"
)
type CppProvider struct{}
func (p *CppProvider) Name() string {
return "cpp"
}
func (p *CppProvider) CleansePlan(buildPlan *plan.BuildPlan) {}
func (p *CppProvider) Detect(ctx *generate.GenerateContext) (bool, error) {
_, c := p.DetectCmake(ctx)
_, m := p.DetectMeson(ctx)
return c || m, nil
}
func (p *CppProvider) Initialize(ctx *generate.GenerateContext) error {
return nil
}
func (p *CppProvider) StartCommandHelp() string {
return ""
}
func (p *CppProvider) Plan(ctx *generate.GenerateContext) error {
packages := ctx.GetMiseStepBuilder()
buildsystem, found := p.DetectCmake(ctx)
if !found {
buildsystem, _ = p.DetectMeson(ctx)
}
buildsystem.Install(ctx, packages)
build := ctx.NewCommandStep("build")
build.AddInput(plan.NewStepLayer(packages.Name()))
build.AddInput(plan.NewLocalLayer())
build.AddCommand(plan.NewExecCommand("mkdir /build"))
buildsystem.Build(build)
ctx.Deploy.StartCmd = fmt.Sprintf("/build/%s", filepath.Base(ctx.GetAppSource()))
ctx.Deploy.AddInputs([]plan.Layer{
plan.NewStepLayer(build.Name(), plan.NewIncludeFilter([]string{"/build/"})),
})
return nil
}