コード例 #1
0
ファイル: BeatVerb.cs プロジェクト: Paul1nh0/Singularity
        public override IVerbWorker getWorker()
        {
            //-        "beat $BUILD_DEFS -out $out.tmp -in $in $incls"
            List <string> args = new List <string>();

            args.Add("-in");
            args.Add(beatobj.getRelativePath());

            IEnumerable <BuildObject> beatImports =
                BeatExtensions.getBeatFlavoredShallowIncludes(contextVerb, beatobj, BeatIncludes.ImportFilter.ForBeatOrBasm);

            foreach (BuildObject ifcObj in beatImports.Where(obj => !obj.Equals(beatobj)))
            {
                Util.Assert(!ifcObj.getRelativePath().Contains(".imp"));   //- Erk, don't feed imp files as includes!
                args.Add("-i");
                args.Add(ifcObj.getRelativePath());
            }
            args.AddRange(contextVerb.getPoundDefines().ToDefArgs());

            string dbgText = String.Format("rem verb {0}{1}",
                                           this, System.Environment.NewLine);

            return(new ProcessInvokeAsyncWorker(this,
                                                getBeatExecutable().getRelativePath(),
                                                args.ToArray(),
                                                ProcessInvoker.RcHandling.NONZERO_RC_IS_FAILURE,
                                                finalStdoutPath: outputFile().getFilesystemPath(),
                                                failureBase: getDiagnosticsBase(),
                                                dbgText: dbgText));
        }
コード例 #2
0
        public override BuildObject search(string basename, ModPart modPart)
        {
            // Kinda linear.
            ////Logger.WriteLine("Looking for " + basename);
            foreach (BuildObject obj in this.DafnyOutputs)
            {
                if (BeatExtensions.whichPart(obj) != modPart)
                {
                    continue;
                }

                ////Logger.WriteLine("  trying " + obj.getFileNameWithoutExtension() + " from " + obj);

                if (string.Equals(obj.getFileNameWithoutExtension(), basename, StringComparison.OrdinalIgnoreCase))
                {
                    if (this.assertSuspiciousDafnyImpls)
                    {
                        DafnyCCVerb.AssertSmellsImplementy(obj);
                    }

                    return(obj);
                }
            }

            return(null);
        }
コード例 #3
0
        public override IVerbWorker getWorker(WorkingDirectory workingDirectory)
        {
            // "beat $BUILD_DEFS -out $out.tmp -in $in $incls"
            List <string> args = new List <string>();

            args.Add("-in");
            args.Add(this.beatobj.getRelativePath());

            IEnumerable <BuildObject> beatImports =
                BeatExtensions.getBeatFlavoredShallowIncludes(this.contextVerb, this.beatobj, BeatIncludes.ImportFilter.ForBeatOrBasm);

            foreach (BuildObject ifcObj in beatImports.Where(obj => !obj.Equals(this.beatobj)))
            {
                Util.Assert(!ifcObj.getRelativePath().Contains(".imp"));   // Erk, don't feed imp files as includes!
                args.Add("-i");
                args.Add(ifcObj.getRelativePath());
            }

            args.AddRange(this.contextVerb.getPoundDefines().ToDefArgs());

            string dbgText = string.Format(
                "rem verb {0}{1}",
                this,
                System.Environment.NewLine);

            return(new ProcessInvokeAsyncWorker(
                       workingDirectory,
                       this,
                       this.getBeatExecutable().getRelativePath(),
                       args.ToArray(),
                       ProcessExitCodeHandling.NonzeroIsFailure,
                       captureStdout: this.outputFile(),
                       failureBase: getDiagnosticsBase(),
                       dbgText: dbgText));
        }
コード例 #4
0
        public BuildObject getMutualSummary()
        {
            // SymDiff files need to go into their own directory.
            BuildObject normalName      = BeatExtensions.makeOutputObject(basmInput, MUTUAL_SUMMARY_EXTN);
            BuildObject dirExtendedName = new BuildObject(Path.Combine(normalName.getDirPath(), dirName, normalName.getFileName()));

            return(dirExtendedName);
        }
コード例 #5
0
        public BuildObject getMutualSummary()
        {
            //- SymDiff files need to go into their own directory
            BuildObject normalName      = BeatExtensions.makeOutputObject(basmInput, MUTUAL_SUMMARY_EXTN);
            BuildObject dirExtendedName = new BuildObject(Path.Combine(normalName.getDirPath(), Util.mungeClean(getAbstractIdentifier().ToString()), normalName.getFileName()));

            return(dirExtendedName);
        }
コード例 #6
0
        public override IEnumerable <BuildObject> getDependencies(out DependencyDisposition ddisp)
        {
            OrderPreservingSet <BuildObject> deps = BeatExtensions.getBeatFlavoredShallowDependencies(
                this.contextVerb, this.beatobj, out ddisp, BeatIncludes.ImportFilter.ForBeatOrBasm);

            deps.Add(this.getBeatExecutable());
            return(deps);
        }
コード例 #7
0
        BuildObject basmOutputForDafnyModule(string modulename, string extn)
        {
            bool isTrusted =
                (modulename.EndsWith("_" + DAFNY_S_SUFFIX) ||
                 modulename.Equals("Trusted")) &&
                BeatExtensions.whichPart(extn) == ModPart.Imp;

            return(new BuildObject(Path.Combine(getDestPath(), modulename + extn), isTrustedArg: isTrusted));
        }
コード例 #8
0
 public static BuildObject computeBasmInput(PoundDefines poundDefines, BuildObject upstreamObj)
 {
     if (BoogieAsmDepBase.isBasm(upstreamObj))
     {
         //- We'll be reading upstreamObj directly. Don't makeOutputObject,
         //- because it may well be a source file.
         return(upstreamObj);
     }
     return(BeatExtensions.makeLabeledOutputObject(upstreamObj, poundDefines.ToString(), BASM_EXTN));
 }
コード例 #9
0
ファイル: BeatVerb.cs プロジェクト: Paul1nh0/Singularity
        public Disposition complete(ProcessInvokeAsyncWorker worker)
        {
            if (worker.pinv.disposition is Fresh)
            {
                BeatExtensions.propagatePrivateImports(contextVerb, beatobj, outputFile());

                //- And then propagate the NuBuild annotations, too.
                AnnotationScanner.transferAnnotations(
                    beatobj, outputFile(), BoogieAsmDepBase.CommentSymbol);
            }

            return(worker.pinv.disposition);
        }
コード例 #10
0
        private static IEnumerable <BeatIncludes.LabeledInclude> getBeatFlavoredShallowIncludesLabeled(
            IContextGeneratingVerb contextVerb, BuildObject rootObj)
        {
            ContextContents context = (ContextContents)
                                      BuildEngine.theEngine.getNuObjContents().openVirtual(contextVerb.getContextOutput());
            BeatIncludes includes = new BeatIncludes(context.context);
            OrderPreservingSet <BeatIncludes.LabeledInclude> result = new OrderPreservingSet <BeatIncludes.LabeledInclude>(
                includes.getLabeledIncludes(rootObj));

            if (BeatExtensions.whichPart(rootObj) == ModPart.Imp)
            {
                BuildObject rootIfc = context.context.search(rootObj.getFileNameWithoutExtension(), ModPart.Ifc);
                result.Add(new BeatIncludes.LabeledInclude(BeatIncludes.ImportFilter.ForBeatOrBasm, rootIfc));
            }
            return(result);
        }
コード例 #11
0
        public Disposition Complete(WorkingDirectory workingDirectory, double cpuTimeSeconds, string stdout, string stderr, Disposition disposition)
        {
            if (disposition is Fresh)
            {
                BeatExtensions.propagatePrivateImports(workingDirectory, this.contextVerb, this.beatobj, this.outputFile());

                // And then propagate the NuBuild annotations, too.
                AnnotationScanner.transferAnnotations(
                    workingDirectory,
                    this.beatobj,
                    this.outputFile(),
                    BoogieAsmDepBase.CommentSymbol);
            }

            return(disposition);
        }
コード例 #12
0
        public override BuildObject outputFile()
        {
            if (buildSymDiffMutualSummary)
            {
                // SymDiff files need to go into their own directory
                BuildObject normalName = BeatExtensions.makeOutputObject(basmInput, SYMDIFF_EXTN);
                dirName = normalName.getFileName() + SYMDIFF_DIR_EXTN;
                BuildObject dirExtendedName = new BuildObject(Path.Combine(normalName.getDirPath(), dirName, normalName.getFileName()));

                return(dirExtendedName);
            }
            else
            {
                return(BeatExtensions.makeOutputObject(basmInput, BoogieVerb.BPL_EXTN));
            }
        }
コード例 #13
0
        public override BuildObject outputFile()
        {
            if (buildSymDiffMutualSummary)
            {
                //- SymDiff files need to go into their own directory
                BuildObject normalName = BeatExtensions.makeOutputObject(basmInput, SYMDIFF_EXTN);

                //- The following produces file names that are too long in the failures directory.
                //- The OS then truncates them, causing filename collisions.
                //-BuildObject dirExtendedName = new BuildObject(Path.Combine(normalName.getDirPath(), Util.mungeClean(getAbstractIdentifier()), normalName.getFileName()));
                //- Try naming the directory after the file instead
                BuildObject dirExtendedName = new BuildObject(Path.Combine(normalName.getDirPath(), normalName.getFileName() + SYMDIFF_DIR_EXTN, normalName.getFileName()));

                return(dirExtendedName);
            }
            else
            {
                return(BeatExtensions.makeOutputObject(basmInput, BoogieVerb.BPL_EXTN));
            }
        }
コード例 #14
0
        public override BuildObject search(string basename, ModPart modPart)
        {
            List <SourcePath> results = new List <SourcePath>();

            foreach (string extension in this.dstExtensions.Where(extn => BeatExtensions.whichPart(extn) == modPart))
            {
                string filename = basename + extension;
                foreach (DirectoryRecord directoryRecord in this.directories)
                {
                    if (directoryRecord.Contains(filename))
                    {
                        string proposed = Path.Combine(
                            BuildEngine.theEngine.getIronRoot(),
                            BuildEngine.theEngine.getSrcRoot(),
                            directoryRecord.directory,
                            basename + extension);
                        ////Logger.WriteLine("SourcePathIncludeContext Trying " + proposed);
                        ////Util.Assert(File.Exists(proposed));
                        results.Add(new SourcePath(proposed));
                    }
                }
            }

            if (results.Count() == 0)
            {
                return(null);
            }
            else if (results.Count() > 1)
            {
                throw new SourceConfigurationError(string.Format(
                                                       "Reference {0} matches {1} paths: {2}",
                                                       basename,
                                                       results.Count(),
                                                       string.Join(",", results)));
            }
            else
            {
                return(results.First());
            }
        }
コード例 #15
0
 public override BuildObject getOutputFile()
 {
     return BeatExtensions.makeOutputObject(bplInput, BPL_EXTN + VerificationResultVerb.VERIFICATION_RESULT_EXTN);
 }
コード例 #16
0
 protected TransitiveDepsVerb(BuildObject obj)
 {
     this.obj      = obj;
     this._depsObj = obj.makeVirtualObject(BeatExtensions.whichPart(obj).ExtnStr() + TDEP_EXTN);
 }
コード例 #17
0
            public BasmModuleAccumulator(IContextGeneratingVerb contextGenVerb, BuildObject upstreamObj, bool linkMode)
            {
                this._contextGenVerb = contextGenVerb;
                this._mutableVerbSet = new HashSet <IVerb>();
                //- NB preserve module definition-dependency order
                this._basmModules   = new OrderPreservingSet <BuildObject>();
                this._auxiliaryDeps = new HashSet <BuildObject>();
                _ddisp = DependencyDisposition.Complete;

                //-try
                //-{
                _mutableVerbSet.Add(contextGenVerb);
                _auxiliaryDeps.UnionWith(contextGenVerb.getOutputs());

                context = contextGenVerb.fetchIfAvailable(ref _ddisp);

                if (context != null)
                {
                    OrderPreservingSet <BuildObject> deps;
                    if (!linkMode)
                    {
                        deps = BeatExtensions.getBeatFlavoredShallowDependencies(
                            contextGenVerb, upstreamObj, out _ddisp, BeatIncludes.ImportFilter.ForBasmOnly);
                    }
                    else
                    {
                        deps = BeatExtensions.getBasmFlavoredTransitiveDependencies(contextGenVerb, upstreamObj, out _ddisp);
                        _mutableVerbSet.Add(BeatExtensions.getBasmFlavoredTransitiveDepVerb(_contextGenVerb, upstreamObj));
                    }
                    string  targetModName = upstreamObj.getFileNameWithoutExtension();
                    ModPart targetModPart = BeatExtensions.whichPart(upstreamObj);

                    //- NB security policy note: When verifying X.imp, we must be sure to supply X.ifc
                    //- to BoogieAsm, so that we know that we're actually verifying the promises
                    //- that other modules are relying on when they say "X" (which is how X got on
                    //- the verification obligation list). That property happens automatically here,
                    //- because we make a list of modules (ignoring ifc/imp part), such as {A,B,X},
                    //- and include *every* .ifc. If we're verifying X.imp, a conditional test
                    //- includes it at the time we consider module X.

                    foreach (BuildObject dep in deps)
                    {
                        string depExtn = dep.getExtension();
                        if (depExtn == null ||
                            depExtn.EndsWith(TransitiveDepsVerb.TDEP_EXTN) ||
                            depExtn.EndsWith(ContextGeneratingVerb.CONTEXT_EXTN))
                        {
                            _auxiliaryDeps.Add(dep);
                        }
                        else
                        {
                            Util.Assert(depExtn.Equals(BeatExtensions.BEATIFC_EXTN) ||
                                        depExtn.Equals(BeatExtensions.BEATIMP_EXTN) ||
                                        depExtn.Equals(BASMIFC_EXTN) ||
                                        depExtn.Equals(BASMIMP_EXTN)); //- Burned too many times by this silly filter-out strategy.
                            string  modName = dep.getFileNameWithoutExtension();
                            ModPart modPart = BeatExtensions.whichPart(dep);
                            getBasmModule(modName, ModPart.Ifc);
                            if ((dep.Equals(upstreamObj) && modPart == ModPart.Imp) || linkMode)
                            {
                                getBasmModule(modName, ModPart.Imp);
                            }
                        }
                    }
                }
                //-}
                //-catch (ObjNotReadyException)
                //-{
                //-
                //-    _ddisp = DependencyDisposition.Incomplete;
                //-}
                //-catch (ObjFailedException)
                //-{
                //-    _ddisp = DependencyDisposition.Failed;
                //-}
            }