summaryrefslogtreecommitdiff
path: root/Source/DafnyDriver
diff options
context:
space:
mode:
authorGravatar Michael Lowell Roberts <mirobert@microsoft.com>2015-06-16 15:02:55 -0700
committerGravatar Michael Lowell Roberts <mirobert@microsoft.com>2015-06-16 15:02:55 -0700
commit379f88f77fbb86a4be9eac6825c7a9c1aabb2316 (patch)
treed4097db5792746da75aa7271b6b4bc72f773d6d8 /Source/DafnyDriver
parent838c51d897d9daec2ee7b50a40b78c96cbfbf605 (diff)
System.Collections.Immutable.dll is now stored in the Binaries directory and copied to the output directory when the /optimize flag is used.
Diffstat (limited to 'Source/DafnyDriver')
-rw-r--r--Source/DafnyDriver/DafnyDriver.cs18
1 files changed, 15 insertions, 3 deletions
diff --git a/Source/DafnyDriver/DafnyDriver.cs b/Source/DafnyDriver/DafnyDriver.cs
index cf464754..ce4d726f 100644
--- a/Source/DafnyDriver/DafnyDriver.cs
+++ b/Source/DafnyDriver/DafnyDriver.cs
@@ -349,10 +349,13 @@ namespace Microsoft.Dafny
cp.ReferencedAssemblies.Add("System.Core.dll");
cp.ReferencedAssemblies.Add("System.dll");
+ var libPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar;
+ var immutableDllFileName = "System.Collections.Immutable.dll";
+ var immutableDllPath = libPath + immutableDllFileName;
+
if (DafnyOptions.O.Optimize) {
- var libPath = Path.GetDirectoryName(dafnyProgramName);
- cp.CompilerOptions += string.Format(" /optimize /define:DAFNY_USE_SYSTEM_COLLECTIONS_IMMUTABLE /lib:{0}", libPath);
- cp.ReferencedAssemblies.Add("System.Collections.Immutable.dll");
+ cp.CompilerOptions += " /optimize /define:DAFNY_USE_SYSTEM_COLLECTIONS_IMMUTABLE";
+ cp.ReferencedAssemblies.Add(immutableDllPath);
cp.ReferencedAssemblies.Add("System.Runtime.dll");
}
@@ -375,6 +378,15 @@ namespace Microsoft.Dafny
}
} else if (cr.Errors.Count == 0) {
outputWriter.WriteLine("Compiled assembly into {0}", assemblyName);
+ if (DafnyOptions.O.Optimize) {
+ var outputDir = Path.GetDirectoryName(dafnyProgramName);
+ if (string.IsNullOrWhiteSpace(outputDir)) {
+ outputDir = ".";
+ }
+ var destPath = outputDir + Path.DirectorySeparatorChar + immutableDllFileName;
+ File.Copy(immutableDllPath, destPath, true);
+ outputWriter.WriteLine("Copied /optimize dependency {0} to {1}", immutableDllFileName, outputDir);
+ }
} else {
outputWriter.WriteLine("Errors compiling program into {0}", assemblyName);
foreach (var ce in cr.Errors) {