예제 #1
0
        // Invariant: input is an absolute path, free of ..s, lowercased, with
        // normalized path separators.
        // Based on suggestions in http://stackoverflow.com/questions/1214513/normalize-directory-names-in-c-sharp.
        private string normalizePath(string requestPath, bool presumedDirectory)
        {
            string lowerPath = requestPath.ToLower(CultureInfo.InvariantCulture);

            if (this.cache.ContainsKey(lowerPath))
            {
                return(this.cache[lowerPath]);
            }

            string rc = PathNormalizer.normalizePath_nocache(requestPath, presumedDirectory);

            this.cache[lowerPath] = rc;
            return(rc);
        }
예제 #2
0
 BuildEngine()
 {
     pathNormalizer = new PathNormalizer();
     _hasher        = new Hasher();
     nuObjContents  = new NuObjContents(_hasher);
 }
예제 #3
0
 public BuildEngine()
 {
     this.pathNormalizer = new PathNormalizer();
     this.hasher         = new Hasher();
 }
예제 #4
0
 public static string dbg_normalizePath_nocache(string requestPath, bool presumedDirectory)
 {
     return(PathNormalizer.normalizePath_nocache(requestPath, presumedDirectory));
 }
예제 #5
0
 public BuildEngine()
 {
     this.pathNormalizer = new PathNormalizer();
     this.hasher = new Hasher();
 }
예제 #6
0
        Disposition recordResult(IVerb verb, Disposition executionDisposition)
        {
            //- record how each output appeared.

            List <BuildObjectValuePointer> outputs    = new List <BuildObjectValuePointer>();
            List <string>             missingOutputs  = new List <string>();
            IEnumerable <BuildObject> expectedOutputs = verb.getOutputs();

            if (executionDisposition is Failed)
            {
                expectedOutputs = expectedOutputs.Concat(verb.getFailureOutputs());
            }
            bool hasVirtualOutputs = false;

            foreach (BuildObject outobj in expectedOutputs)
            {
                if (!(outobj is VirtualBuildObject))
                {
                    if (File.Exists(outobj.getFilesystemPath()))
                    {
                        //- Try to catch accidental case mismatches that would burn us when we
                        //- try to fetch the file back in.
                        string fsname = PathNormalizer.dbg_normalizePath_nocache(outobj.getFilesystemPath(), false);
                        Util.Assert(Path.GetFileName(fsname).Equals(outobj.getFileName()));

                        outputs.Add(resultCache.storeObject(outobj));
                    }
                    else
                    {
                        missingOutputs.Add(String.Format("Missing expected output {0}", outobj.getRelativePath()));
                    }
                }
                else
                {
                    hasVirtualOutputs = true;
                    if (nuObjContents.getDisposition(outobj) is Fresh)
                    {
                        //- nothing to cache; virtual objects only survive in nuObjContents, the in-process cache
                    }
                    else
                    {
                        missingOutputs.Add(String.Format("Missing expected virtual {0}", outobj.getRelativePath()));
                    }
                }
            }
            if (!(executionDisposition is Failed) && missingOutputs.Count() > 0)
            {
                executionDisposition = new Failed(missingOutputs);
            }
            ResultSummaryRecord summary = new ResultSummaryRecord(verb, executionDisposition, outputs);
            string inputHash            = computeInputHash(verb, true);

            Util.Assert(inputHash != null);
            if (!hasVirtualOutputs)
            {
                resultCache.storeResult(inputHash, summary);
            }
            else
            {
                Say("Not caching verb persistently: " + verb);
            }

            verbIsComplete(verb, executionDisposition, BlessingRequest.Bless);
            return(executionDisposition);
        }