Dev Testing + AutoGen Activation
This commit is contained in:
@@ -23,14 +23,15 @@ import (
|
||||
)
|
||||
|
||||
type BuildResult struct {
|
||||
ModulePath string
|
||||
HAKPaths []string
|
||||
Manifest string
|
||||
Resources int
|
||||
HAKAssets int
|
||||
TopPackageHAK string
|
||||
TopPackageTLK string
|
||||
TopPackageFiles int
|
||||
ModulePath string
|
||||
HAKPaths []string
|
||||
Manifest string
|
||||
AutogenManifestPaths []string
|
||||
Resources int
|
||||
HAKAssets int
|
||||
TopPackageHAK string
|
||||
TopPackageTLK string
|
||||
TopPackageFiles int
|
||||
}
|
||||
|
||||
type BuildManifest struct {
|
||||
@@ -195,6 +196,10 @@ func planOrBuildHAKs(p *project.Project, progress ProgressFunc, writeArchives bo
|
||||
if err != nil {
|
||||
return BuildResult{}, err
|
||||
}
|
||||
autogenManifests, err := topdata.ProduceAutogenManifests(p)
|
||||
if err != nil {
|
||||
return BuildResult{}, err
|
||||
}
|
||||
var previousManifest *BuildManifest
|
||||
if sourceManifest == nil || writeArchives {
|
||||
previousManifest, err = loadPreviousBuildManifest(p.HAKManifestPath())
|
||||
@@ -204,6 +209,12 @@ func planOrBuildHAKs(p *project.Project, progress ProgressFunc, writeArchives bo
|
||||
}
|
||||
|
||||
result := BuildResult{HAKAssets: len(assetResources)}
|
||||
if err := writeAutogenManifestOutputs(progress, autogenManifests); err != nil {
|
||||
return BuildResult{}, err
|
||||
}
|
||||
for _, manifest := range autogenManifests {
|
||||
result.AutogenManifestPaths = append(result.AutogenManifestPaths, manifest.OutputPath)
|
||||
}
|
||||
if len(assetResources) == 0 {
|
||||
progressf(progress, "Cleaning previous generated HAKs...")
|
||||
if err := cleanupGeneratedHAKs(p); err != nil {
|
||||
@@ -318,6 +329,22 @@ func planOrBuildHAKs(p *project.Project, progress ProgressFunc, writeArchives bo
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func writeAutogenManifestOutputs(progress ProgressFunc, manifests []topdata.ProducedAutogenManifest) error {
|
||||
if len(manifests) == 0 {
|
||||
return nil
|
||||
}
|
||||
for _, manifest := range manifests {
|
||||
progressf(progress, fmt.Sprintf("Writing autogen manifest %s...", filepath.Base(manifest.OutputPath)))
|
||||
if err := os.MkdirAll(filepath.Dir(manifest.OutputPath), 0o755); err != nil {
|
||||
return fmt.Errorf("create autogen manifest dir: %w", err)
|
||||
}
|
||||
if err := os.WriteFile(manifest.OutputPath, manifest.Payload, 0o644); err != nil {
|
||||
return fmt.Errorf("write autogen manifest %s: %w", manifest.AssetName, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func filterHAKChunksByName(chunks []hakChunk, archiveNames []string) ([]hakChunk, error) {
|
||||
if len(archiveNames) == 0 {
|
||||
return chunks, nil
|
||||
|
||||
Reference in New Issue
Block a user