Snap for 11938003 from 6b1e8f0178
to 24Q3-release
Change-Id: I22904dcad489f93cce8b150f8043272c066bb6e5
This commit is contained in:
commit
67b7f16add
3 changed files with 16 additions and 17 deletions
|
@ -20,7 +20,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
|
@ -64,7 +63,7 @@ func RunBlueprint(args Args, stopBefore StopBefore, ctx *blueprint.Context, conf
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.Cpuprofile != "" {
|
if args.Cpuprofile != "" {
|
||||||
f, err := os.Create(joinPath(ctx.SrcDir(), args.Cpuprofile))
|
f, err := os.Create(blueprint.JoinPath(ctx.SrcDir(), args.Cpuprofile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error opening cpuprofile: %s", err)
|
return nil, fmt.Errorf("error opening cpuprofile: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -74,7 +73,7 @@ func RunBlueprint(args Args, stopBefore StopBefore, ctx *blueprint.Context, conf
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.TraceFile != "" {
|
if args.TraceFile != "" {
|
||||||
f, err := os.Create(joinPath(ctx.SrcDir(), args.TraceFile))
|
f, err := os.Create(blueprint.JoinPath(ctx.SrcDir(), args.TraceFile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error opening trace: %s", err)
|
return nil, fmt.Errorf("error opening trace: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -159,12 +158,12 @@ func RunBlueprint(args Args, stopBefore StopBefore, ctx *blueprint.Context, conf
|
||||||
ctx.BeginEvent("write_files")
|
ctx.BeginEvent("write_files")
|
||||||
defer ctx.EndEvent("write_files")
|
defer ctx.EndEvent("write_files")
|
||||||
if args.EmptyNinjaFile {
|
if args.EmptyNinjaFile {
|
||||||
if err := os.WriteFile(joinPath(ctx.SrcDir(), args.OutFile), []byte(nil), blueprint.OutFilePermissions); err != nil {
|
if err := os.WriteFile(blueprint.JoinPath(ctx.SrcDir(), args.OutFile), []byte(nil), blueprint.OutFilePermissions); err != nil {
|
||||||
return nil, fmt.Errorf("error writing empty Ninja file: %s", err)
|
return nil, fmt.Errorf("error writing empty Ninja file: %s", err)
|
||||||
}
|
}
|
||||||
out = io.Discard.(blueprint.StringWriterWriter)
|
out = io.Discard.(blueprint.StringWriterWriter)
|
||||||
} else {
|
} else {
|
||||||
f, err := os.OpenFile(joinPath(ctx.SrcDir(), args.OutFile), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, blueprint.OutFilePermissions)
|
f, err := os.OpenFile(blueprint.JoinPath(ctx.SrcDir(), args.OutFile), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, blueprint.OutFilePermissions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error opening Ninja file: %s", err)
|
return nil, fmt.Errorf("error opening Ninja file: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -195,7 +194,7 @@ func RunBlueprint(args Args, stopBefore StopBefore, ctx *blueprint.Context, conf
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.Memprofile != "" {
|
if args.Memprofile != "" {
|
||||||
f, err := os.Create(joinPath(ctx.SrcDir(), args.Memprofile))
|
f, err := os.Create(blueprint.JoinPath(ctx.SrcDir(), args.Memprofile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error opening memprofile: %s", err)
|
return nil, fmt.Errorf("error opening memprofile: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -223,10 +222,3 @@ func fatalErrors(errs []error) error {
|
||||||
|
|
||||||
return errors.New("fatal errors encountered")
|
return errors.New("fatal errors encountered")
|
||||||
}
|
}
|
||||||
|
|
||||||
func joinPath(base, path string) string {
|
|
||||||
if filepath.IsAbs(path) {
|
|
||||||
return path
|
|
||||||
}
|
|
||||||
return filepath.Join(base, path)
|
|
||||||
}
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ func (s *GlobSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
|
||||||
// We don't need to write the depfile because we're guaranteed that ninja
|
// We don't need to write the depfile because we're guaranteed that ninja
|
||||||
// will run the command at least once (to record it into the ninja_log), so
|
// will run the command at least once (to record it into the ninja_log), so
|
||||||
// the depfile will be loaded from that execution.
|
// the depfile will be loaded from that execution.
|
||||||
absoluteFileListFile := joinPath(s.SrcDir, fileListFile)
|
absoluteFileListFile := blueprint.JoinPath(s.SrcDir, fileListFile)
|
||||||
err := pathtools.WriteFileIfChanged(absoluteFileListFile, globs.FileList(), 0666)
|
err := pathtools.WriteFileIfChanged(absoluteFileListFile, globs.FileList(), 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Errorf("error writing %s: %s", fileListFile, err))
|
panic(fmt.Errorf("error writing %s: %s", fileListFile, err))
|
||||||
|
@ -217,7 +217,7 @@ func WriteBuildGlobsNinjaFile(glob *GlobSingleton, config interface{}) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
const outFilePermissions = 0666
|
const outFilePermissions = 0666
|
||||||
err := ioutil.WriteFile(joinPath(glob.SrcDir, glob.GlobFile), buffer, outFilePermissions)
|
err := ioutil.WriteFile(blueprint.JoinPath(glob.SrcDir, glob.GlobFile), buffer, outFilePermissions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error writing %s: %s", glob.GlobFile, err)
|
return fmt.Errorf("error writing %s: %s", glob.GlobFile, err)
|
||||||
}
|
}
|
||||||
|
|
11
context.go
11
context.go
|
@ -4544,9 +4544,9 @@ func (c *Context) writeAllModuleActions(nw *ninjaWriter, shardNinja bool, ninjaF
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(file string, batchModules []*moduleInfo) {
|
go func(file string, batchModules []*moduleInfo) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
f, err := os.OpenFile(filepath.Join(c.SrcDir(), file), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, OutFilePermissions)
|
f, err := os.OpenFile(JoinPath(c.SrcDir(), file), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, OutFilePermissions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errorCh <- fmt.Errorf("error opening Ninja file: %s", err)
|
errorCh <- fmt.Errorf("error opening Ninja file shard: %s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
|
@ -5259,3 +5259,10 @@ func (pi *PackageIncludes) matchesIncludeTags(ctx *Context) (bool, error) {
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func JoinPath(base, path string) string {
|
||||||
|
if filepath.IsAbs(path) {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
return filepath.Join(base, path)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue