Exemple #1
0
        public override IVerbWorker getWorker(WorkingDirectory workingDirectory)
        {
            // First expand our Dafny source file to inline all its includes.
            this.expandedSource = this.input.getNewSourcePath("ExpandedSource.dfy");
            DafnyIncludes dafnyIncludes = new DafnyIncludes();

            dafnyIncludes.ExpandDafny(workingDirectory, this.input, this.expandedSource);

            // Call Dafny.exe to compile Dafny source to CSharp target.
            var args = new[] { "/noVerify", "/spillTargetCode:1", "/compile:2", "/ironDafny", this.expandedSource.getRelativePath() };

            Console.WriteLine("expanded source: " + this.expandedSource.getRelativePath());
            ////Logger.WriteLine("arguments: " + String.Join(" ", args));
            return
                (new ProcessInvokeAsyncWorker(
                     workingDirectory,
                     this,
                     DafnyExecutableDependencies.getDafnyExecutable().getRelativePath(),
                     args,
                     ProcessExitCodeHandling.NonzeroIsFailure,
                     getDiagnosticsBase(),
                     returnStandardOut: true,   // REVIEW: Doesn't appear to be needed.
                     returnStandardError: true, // REVIEW: Doesn't appear to be needed.
                     allowCloudExecution: true));
        }
Exemple #2
0
        public override IVerbWorker getWorker(WorkingDirectory workingDirectory)
        {
            bool          nonLinear = this.getOutputFile().ToString().Contains("nonlinear");
            List <string> arguments = new List <string>();

            if (!nonLinear)
            {
                arguments.Add("/noNLarith");
            }
            arguments.Add("/allowGlobals");
            arguments.Add("/z3opt:nlsat.randomize=false");
            arguments.Add("/z3opt:pi.warnings=true");
            arguments.Add("/proverWarnings:1");
            arguments.Add("/compile:0");
            arguments.Add("/timeLimit:60");
            arguments.Add("/noCheating:1");
            arguments.Add("/autoTriggers:1");
            arguments.Add("/ironDafny");
            foreach (string[] ann in new AnnotationScanner(this.dfysource).getAnnotations(ADDDAFNYFLAG_LABEL))
            {
                if (ann.Length != 2)
                {
                    throw new SourceConfigurationError("Expected exactly 1 argument to " + ADDDAFNYFLAG_LABEL);
                }

                arguments.Add(ann[1]);
            }

            arguments.Add(this.dfysource.getRelativePath());
            Logger.WriteLine("arguments: " + string.Join(" ", arguments));

            return(new ProcessInvokeAsyncWorker(
                       workingDirectory,
                       this,
                       DafnyExecutableDependencies.getDafnyExecutable().getRelativePath(),
                       arguments.ToArray(),
                       ProcessExitCodeHandling.NonzeroIsOkay,
                       getDiagnosticsBase(),
                       returnStandardOut: true,
                       returnStandardError: true,
                       allowCloudExecution: true));
        }
        public override IVerbWorker getWorker(WorkingDirectory workingDirectory)
        {
            List <string> arguments = new List <string>();

            arguments.Add("/noNLarith");
            arguments.Add("/allowGlobals");
            arguments.Add("/dafnycc");
            arguments.Add("/z3opt:ARITH_RANDOM_SEED=1");
            arguments.Add("/z3opt:NL_ARITH=false");
            arguments.Add("/compile:0");
            arguments.Add("/timeLimit:30");
            arguments.Add("/noCheating:1");

            foreach (string[] ann in new AnnotationScanner(this.dfysource).getAnnotations(ADDDAFNYFLAG_LABEL))
            {
                if (ann.Length != 2)
                {
                    throw new SourceConfigurationError("Expected exactly 1 argument to " + ADDDAFNYFLAG_LABEL);
                }
                if (ann[1].StartsWith("/z3opt:NL_ARITH=true"))
                {
                    arguments.Remove("/noNLarith");
                }

                arguments.Add(ann[1]);
            }

            arguments.Add(this.dfysource.getRelativePath());
            Logger.WriteLine("arguments: " + string.Join(" ", arguments));

            return(new ProcessInvokeAsyncWorker(
                       workingDirectory,
                       this,
                       DafnyExecutableDependencies.getDafnyExecutable().getRelativePath(),
                       arguments.ToArray(),
                       ProcessExitCodeHandling.NonzeroIsOkay,
                       getDiagnosticsBase(),
                       returnStandardOut: true,
                       returnStandardError: true,
                       allowCloudExecution: true));
        }