コード例 #1
0
ファイル: Program.cs プロジェクト: jango2015/Ironclad
        void parseArgs(string[] args)
        {
            this.args = args;
            argi = 0;
            while (argi < args.Count())
            {
                string next = takeArg("option or verb");    // Should always succeed due to while condition.
                if (next.StartsWith("-"))
                {
                    if (next.Equals("--ironRoot"))
                    {
                        if (this.ironRoot != null)
                        {
                            usage("ironRoot set after use");
                        }

                        this.ironRoot = takeArg("value for ironRoot");
                    }
                    else if (next.Equals("-j") || next.Equals("--jobs"))
                    {
                        this.jobParallelism = Int32.Parse(takeArg("value for jobs"));
                    }
                    else if (next.Equals("--localcache"))
                    {
                        BuildEngine.theEngine.setLocalCache(takeArg("path for localcache"));
                    }
                    else if (next.ToLower().Equals("--cloudcache"))
                    {
                        this.useCloudCache = true;
                    }
                    else if (next.ToLower().Equals("--no-cloudcache"))
                    {
                        this.useCloudCache = false;
                    }
                    else if (next.Equals("--cloudexecution"))
                    {
                        this.useCloudExecution = true;
                    }
                    else if (next.ToLower().Equals("--verify"))
                    {
                        this.verificationRequest.verifyMode = VerificationRequest.VerifyMode.Verify;
                    }
                    else if (next.ToLower().Equals("--no-verify"))
                    {
                        this.verificationRequest.verifyMode = VerificationRequest.VerifyMode.NoVerify;
                    }
                    else if (next.ToLower().Equals("--no-symdiff"))
                    {
                        this.verificationRequest.verifyMode = VerificationRequest.VerifyMode.NoSymDiff;
                    }
                    else if (next.ToLower().Equals("--verify-select"))
                    {
                        this.verificationRequest.verifyMode = VerificationRequest.VerifyMode.SelectiveVerify;
                        this.verificationRequest.selectiveVerifyModuleNames.Add(takeArg("filename for selective-verify"));
                    }
                    else if (next.ToLower().Equals("--html"))
                    {
                        this.html_output = takeArg("filename for html report");
                    }
                    else if (next.ToLower().Equals("--windows"))
                    {
                        this.target_platform = IroncladAppVerb.TARGET.WINDOWS;
                    }
                    else if (next.ToLower().Equals("--useframepointer"))
                    {
                        this.useFramePointer = DafnyCCVerb.FramePointerMode.UseFramePointer;
                    }
                    else if (next.ToLower().Equals("--debug"))
                    {
                        this.releaseBuild = false;
                    }
                    else
                    {
                        usage("unrecognized option " + next);
                    }
                }
                else
                {
                    string verb = next;
                    string target = takeArg("verb-target");

                    fixIronRoot();
                    if (verb.Equals("DafnyVerifyTree"))
                    {
                        verbs.Add(new VerificationResultSummaryVerb(new DafnyVerifyTreeVerb(conditionSourcePath(target))));
                    }
                    else if (verb.Equals("BatchDafny"))
                    {
                        if (!target.EndsWith(".batch"))
                        {
                            usage("Batching expects a .batch file containing a list of .dfy files");
                        }

                        verbs.Add(new VerificationResultSummaryVerb(new BatchVerifyVerb(conditionSourcePath(target), BatchVerifyVerb.BatchMode.DAFNY, this.verificationRequest, useFramePointer)));
                    }
                    else if (verb.Equals("BatchApps"))
                    {
                        if (!target.EndsWith(".batch"))
                        {
                            usage("Batching expects a .batch file containing a list of .dfy files");
                        }

                        verbs.Add(new VerificationResultSummaryVerb(new BatchVerifyVerb(conditionSourcePath(target), BatchVerifyVerb.BatchMode.APP, this.verificationRequest, useFramePointer)));
                    }
                    else if (verb.Equals("Beat"))
                    {
                        verbs.Add(new BeatVerb(BuildEngine.theEngine.getVerveContextVerb(PoundDefines.empty()), conditionSourcePath(target), appLabel: null));
                    }
                    else if (verb.Equals("Boogie"))
                    {
                        verbs.Add(new BoogieVerb(BuildEngine.theEngine.getVerveContextVerb(PoundDefines.empty()), conditionSourcePath(target), symdiff: this.verificationRequest.getSymDiffMode()));
                    }
                    else if (verb.Equals("IroncladApp"))
                    {
                        verbs.Add(new IroncladAppVerb(conditionSourcePath(target), target_platform, this.useFramePointer, this.verificationRequest));
                    }
                    else if (verb.Equals("IronfleetApp"))
                    {
                        verbs.Add(new IronfleetAppVerb(conditionSourcePath(target), this.verificationRequest, this.releaseBuild));
                    }
                    else if (verb.Equals("DafnyCompileOne"))
                    {
                        verbs.Add(new DafnyCompileOneVerb(conditionSourcePath(target)));
                    }
                    else if (verb.Equals("VSSolution"))
                    {
                        verbs.Add(new VSSolutionVerb(new SourcePath(target, SourcePath.SourceType.Tools)));
                    }
                    else if (verb.Equals("nmake"))
                    {
                        verbs.Add(new NmakeVerb(new SourcePath(target, SourcePath.SourceType.Tools)));
                    }
                    else if (verb.Equals("BootableApp"))
                    {
                        verbs.Add(new BootableAppVerb(conditionSourcePath(target), this.useFramePointer, this.verificationRequest));
                    }
                    else
                    {
                        usage("Unknown verb " + verb);
                    }
                }
            }

            fixIronRoot();
        }
コード例 #2
0
        void parseArgs(string[] args)
        {
            this.args = args;
            argi      = 0;
            while (argi < args.Count())
            {
                string next = takeArg("option or verb");    // Should always succeed due to while condition.
                if (next.StartsWith("-"))
                {
                    if (next.Equals("--ironRoot"))
                    {
                        if (this.ironRoot != null)
                        {
                            usage("ironRoot set after use");
                        }

                        this.ironRoot = takeArg("value for ironRoot");
                    }
                    else if (next.Equals("-j") || next.Equals("--jobs"))
                    {
                        this.jobParallelism = Int32.Parse(takeArg("value for jobs"));
                    }
                    else if (next.Equals("--localcache"))
                    {
                        BuildEngine.theEngine.setLocalCache(takeArg("path for localcache"));
                    }
                    else if (next.ToLower().Equals("--cloudcache"))
                    {
                        this.useCloudCache = true;
                    }
                    else if (next.ToLower().Equals("--no-cloudcache"))
                    {
                        this.useCloudCache = false;
                    }
                    else if (next.Equals("--cloudexecution"))
                    {
                        this.useCloudExecution = true;
                    }
                    else if (next.ToLower().Equals("--verify"))
                    {
                        this.verificationRequest.verifyMode = VerificationRequest.VerifyMode.Verify;
                    }
                    else if (next.ToLower().Equals("--no-verify"))
                    {
                        this.verificationRequest.verifyMode = VerificationRequest.VerifyMode.NoVerify;
                    }
                    else if (next.ToLower().Equals("--no-symdiff"))
                    {
                        this.verificationRequest.verifyMode = VerificationRequest.VerifyMode.NoSymDiff;
                    }
                    else if (next.ToLower().Equals("--verify-select"))
                    {
                        this.verificationRequest.verifyMode = VerificationRequest.VerifyMode.SelectiveVerify;
                        this.verificationRequest.selectiveVerifyModuleNames.Add(takeArg("filename for selective-verify"));
                    }
                    else if (next.ToLower().Equals("--html"))
                    {
                        this.html_output = takeArg("filename for html report");
                    }
                    else if (next.ToLower().Equals("--windows"))
                    {
                        this.target_platform = IroncladAppVerb.TARGET.WINDOWS;
                    }
                    else if (next.ToLower().Equals("--useframepointer"))
                    {
                        this.useFramePointer = DafnyCCVerb.FramePointerMode.UseFramePointer;
                    }
                    else if (next.ToLower().Equals("--debug"))
                    {
                        this.releaseBuild = false;
                    }
                    else
                    {
                        usage("unrecognized option " + next);
                    }
                }
                else
                {
                    string verb   = next;
                    string target = takeArg("verb-target");

                    fixIronRoot();
                    if (verb.Equals("DafnyVerifyTree"))
                    {
                        verbs.Add(new VerificationResultSummaryVerb(new DafnyVerifyTreeVerb(conditionSourcePath(target))));
                    }
                    else if (verb.Equals("BatchDafny"))
                    {
                        if (!target.EndsWith(".batch"))
                        {
                            usage("Batching expects a .batch file containing a list of .dfy files");
                        }

                        verbs.Add(new VerificationResultSummaryVerb(new BatchVerifyVerb(conditionSourcePath(target), BatchVerifyVerb.BatchMode.DAFNY, this.verificationRequest, useFramePointer)));
                    }
                    else if (verb.Equals("BatchApps"))
                    {
                        if (!target.EndsWith(".batch"))
                        {
                            usage("Batching expects a .batch file containing a list of .dfy files");
                        }

                        verbs.Add(new VerificationResultSummaryVerb(new BatchVerifyVerb(conditionSourcePath(target), BatchVerifyVerb.BatchMode.APP, this.verificationRequest, useFramePointer)));
                    }
                    else if (verb.Equals("Beat"))
                    {
                        verbs.Add(new BeatVerb(BuildEngine.theEngine.getVerveContextVerb(PoundDefines.empty()), conditionSourcePath(target), appLabel: null));
                    }
                    else if (verb.Equals("Boogie"))
                    {
                        verbs.Add(new BoogieVerb(BuildEngine.theEngine.getVerveContextVerb(PoundDefines.empty()), conditionSourcePath(target), symdiff: this.verificationRequest.getSymDiffMode()));
                    }
                    else if (verb.Equals("IroncladApp"))
                    {
                        verbs.Add(new IroncladAppVerb(conditionSourcePath(target), target_platform, this.useFramePointer, this.verificationRequest));
                    }
                    else if (verb.Equals("IronfleetApp"))
                    {
                        verbs.Add(new IronfleetAppVerb(conditionSourcePath(target), this.verificationRequest, this.releaseBuild));
                    }
                    else if (verb.Equals("DafnyCompileOne"))
                    {
                        verbs.Add(new DafnyCompileOneVerb(conditionSourcePath(target)));
                    }
                    else if (verb.Equals("VSSolution"))
                    {
                        verbs.Add(new VSSolutionVerb(new SourcePath(target, SourcePath.SourceType.Tools)));
                    }
                    else if (verb.Equals("nmake"))
                    {
                        verbs.Add(new NmakeVerb(new SourcePath(target, SourcePath.SourceType.Tools)));
                    }
                    else if (verb.Equals("BootableApp"))
                    {
                        verbs.Add(new BootableAppVerb(conditionSourcePath(target), this.useFramePointer, this.verificationRequest));
                    }
                    else
                    {
                        usage("Unknown verb " + verb);
                    }
                }
            }

            fixIronRoot();
        }