Beispiel #1
0
        public override IEnumerable <BuildObject> getDependencies(out DependencyDisposition ddisp)
        {
            if (this.dependencies == null)
            {
                DependencyDisposition dd;
                var dependencies = new List <BuildObject>();

                // This method's implementation is dependent upon transitiveDepsVerb being the only element of verbs.
                Trace.Assert(this.verbs.Length == 1 && this.verbs[0] is DafnyTransitiveDepsVerb);
                dependencies.AddRange(this.transitiveDepsVerb.getAvailableDeps(out dd));
                dependencies.AddRange(DafnyExecutableDependencies.getDafnyExecutableDependencies());
                if (dd != DependencyDisposition.Complete)
                {
                    ddisp = dd;

                    // Dependency resolution isn't complete yet and we don't want to cache the incomplete list.
                    return(dependencies);
                }

                this.dependencies = dependencies;
            }

            Trace.Assert(this.dependencies != null);
            ddisp = DependencyDisposition.Complete;
            return(this.dependencies);
        }
Beispiel #2
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));
        }
        public override IEnumerable <BuildObject> getDependencies(out DependencyDisposition ddisp)
        {
            TransitiveDepsVerb    depsVerb = this.getTransitiveDepsVerb();
            HashSet <BuildObject> result   = depsVerb.getAvailableDeps(out ddisp);

            result.UnionWith(DafnyExecutableDependencies.getDafnyExecutableDependencies());
            return(result);
        }
Beispiel #4
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));
        }