Move Generation Destinations
This commit is contained in:
@@ -467,11 +467,13 @@ func compileReferencedScripts(p *project.Project) ([]erf.Resource, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tmpDir, err := os.MkdirTemp("", "sow-script-compile-*")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("create script compiler temp dir: %w", err)
|
||||
cacheDir := compiledScriptCacheDir(p)
|
||||
if err := os.RemoveAll(cacheDir); err != nil {
|
||||
return nil, fmt.Errorf("clear script compiler cache dir: %w", err)
|
||||
}
|
||||
if err := os.MkdirAll(cacheDir, 0o755); err != nil {
|
||||
return nil, fmt.Errorf("create script compiler cache dir: %w", err)
|
||||
}
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
resources := make([]erf.Resource, 0, len(referenced))
|
||||
scriptsDir := filepath.Join(p.SourceDir(), "scripts")
|
||||
@@ -480,7 +482,7 @@ func compileReferencedScripts(p *project.Project) ([]erf.Resource, error) {
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
outputPath := filepath.Join(tmpDir, resref+".ncs")
|
||||
outputPath := filepath.Join(cacheDir, resref+".ncs")
|
||||
cmd := exec.Command(compiler, "--dirs", scriptsDir, "-o", outputPath, sourcePath)
|
||||
cmd.Env = compilerEnv
|
||||
output, err := cmd.CombinedOutput()
|
||||
@@ -501,6 +503,10 @@ func compileReferencedScripts(p *project.Project) ([]erf.Resource, error) {
|
||||
return resources, nil
|
||||
}
|
||||
|
||||
func compiledScriptCacheDir(p *project.Project) string {
|
||||
return filepath.Join(p.Root, ".cache", "ncs")
|
||||
}
|
||||
|
||||
func referencedScriptResrefs(p *project.Project) ([]string, error) {
|
||||
referenced := map[string]struct{}{}
|
||||
for _, rel := range p.Inventory.SourceFiles {
|
||||
|
||||
Reference in New Issue
Block a user