From b7c29f98817a2efe26b8a120802250c5bc4f26e3 Mon Sep 17 00:00:00 2001 From: chrishaw Date: Wed, 11 Mar 2015 16:36:04 -0700 Subject: Add DafnyOptions.txt, and have the Dafny Visual Studio extension read command-line options from DafnyOptions.txt during initialization. DafnyOptions.txt gets built into the VSIX file and is installed as part of the Dafny Visual Studio extension. --- Source/DafnyExtension/DafnyDriver.cs | 20 +++++++++++++++++++- Source/DafnyExtension/DafnyExtension.csproj | 7 +++++++ Source/DafnyExtension/DafnyOptions.txt | 3 +++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 Source/DafnyExtension/DafnyOptions.txt (limited to 'Source/DafnyExtension') diff --git a/Source/DafnyExtension/DafnyDriver.cs b/Source/DafnyExtension/DafnyDriver.cs index 5dd6d8ab..5b8cc943 100644 --- a/Source/DafnyExtension/DafnyDriver.cs +++ b/Source/DafnyExtension/DafnyDriver.cs @@ -41,7 +41,25 @@ namespace DafnyLanguage options.VcsCores = Math.Max(1, System.Environment.ProcessorCount - 1); options.ModelViewFile = "-"; Dafny.DafnyOptions.Install(options); - options.ApplyDefaultOptions(); + + // Read additional options from DafnyOptions.txt + string codebase = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); + string optionsFilePath = Path.Combine(codebase, "DafnyOptions.txt"); + if (File.Exists(optionsFilePath)) { + var optionsReader = new StreamReader(new FileStream(optionsFilePath, FileMode.Open, FileAccess.Read)); + List args = new List(); + while (true) { + string line = optionsReader.ReadLine(); + if (line == null) break; + line = line.Trim(); + if (line.Length == 0 || line.StartsWith("//")) continue; + args.Add(line); + } + optionsReader.Close(); + CommandLineOptions.Clo.Parse(args.ToArray()); + } else { + options.ApplyDefaultOptions(); + } ExecutionEngine.printer = new DummyPrinter(); ExecutionEngine.errorInformationFactory = new DafnyErrorInformationFactory(); diff --git a/Source/DafnyExtension/DafnyExtension.csproj b/Source/DafnyExtension/DafnyExtension.csproj index 05bcc503..843c1528 100644 --- a/Source/DafnyExtension/DafnyExtension.csproj +++ b/Source/DafnyExtension/DafnyExtension.csproj @@ -116,6 +116,7 @@ ..\..\..\boogie\Binaries\Provers.SMTLib.dll + ..\..\..\boogie\Binaries\VCExpr.dll @@ -183,6 +184,9 @@ + + true + true @@ -220,6 +224,9 @@ false + + + true diff --git a/Source/DafnyExtension/DafnyOptions.txt b/Source/DafnyExtension/DafnyOptions.txt new file mode 100644 index 00000000..e19fe525 --- /dev/null +++ b/Source/DafnyExtension/DafnyOptions.txt @@ -0,0 +1,3 @@ +// DafnyLanguageService.vsix copies this file to the Dafny Visual Studio Extension directory +// Each line contains one command-line argument to the Dafny Visual Studio Extension +// Blank lines and lines beginning with "//" are ignored -- cgit v1.2.3