Files
sanspie 5eb1832907
ci-platforms / darwin amd64 smoke (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Failing after 15m28s
ci / release (push) Skipped
ci-platforms / windows amd64 smoke (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
ci / checks (push) Successful in 7m47s
Complete Stage 12 for v0.12.0
2026-11-05 11:46:53 +03:00

36 lines
1.1 KiB
Go

// Package material imports .aemat source documents into versioned binary AEMT artifacts.
package material
import (
"aego/asset"
"aego/asset/pipeline"
"aego/core/errs"
)
const Version = 2
type Importer struct{}
func New() *Importer { return &Importer{} }
func (*Importer) ID() string { return "material" }
func (*Importer) Version() int { return Version }
func (*Importer) Extensions() []string { return []string{".aemat"} }
func (*Importer) Defaults() pipeline.Settings { return pipeline.Settings{} }
func (*Importer) Import(ctx *pipeline.ImportContext) (*pipeline.Result, error) {
d, err := asset.ParseMaterial(ctx.Source, ctx.Path)
if err != nil {
return nil, errs.Wrap(err, errs.AssetImportFailed, "cannot read the material")
}
data := asset.EncodeMaterial(d)
if _, err := asset.DecodeMaterial(data, ctx.Path); err != nil {
return nil, errs.Wrap(err, errs.AssetImportFailed, "cannot prepare binary material")
}
return &pipeline.Result{
Kind: asset.ArtMaterial,
Deps: d.Deps(),
Artifacts: []pipeline.Produced{{Kind: asset.ArtMaterial, Data: data}},
}, nil
}