public BatchVerifyVerb(SourcePath batch_file, BatchMode mode, VerificationRequest verificationRequest, DafnyCCVerb.FramePointerMode useFramePointer) { this.mode = mode; this.producers = new HashSet<IObligationsProducer>(); foreach (string line in File.ReadAllLines(batch_file.getFilesystemPath())) { if (line[0] == '#') { continue; } SourcePath src = new SourcePath(line); switch (mode) { case BatchMode.DAFNY: if (verificationRequest.verifyMode != VerificationRequest.VerifyMode.Verify) { throw new UserError("BatchVerify DAFNY only supports full verification (but maybe we should add selective?)"); } this.producers.Add(new DafnyVerifyTreeVerb(src)); break; case BatchMode.APP: this.producers.Add(new IroncladAppVerb(src, IroncladAppVerb.TARGET.BARE_METAL, useFramePointer, verificationRequest)); break; default: throw new Exception("Unknown batch file type"); } } string parameters = mode.ToString() + "," + verificationRequest.ToString(); outputObject = batch_file.makeLabeledOutputObject(parameters, BATCH_EXTN + VerificationObligationList.VOL_EXTN); abstractId = new AbstractId(this.GetType().Name, version, batch_file.ToString(), concrete:parameters); }
private void _parse() { _dependencies.Add(_solutionFile); using (StreamReader stream = new StreamReader(_solutionFile.getFilesystemPath())) { Regex regex = new Regex(@"Project\([\S]+\)[\s]+=[\s]+([^$]*)", RegexOptions.IgnoreCase); string line; while ((line = stream.ReadLine()) != null) { MatchCollection matches = regex.Matches(line); if (matches.Count > 0) { SourcePath projFile = _solutionFile.getNewSourcePath(matches[0].Groups[1].Value.Split("\", ".ToCharArray())[5]); //- Console.WriteLine(String.Format("Found project file {0}", projFile.getFilesystemPath())); VSProjectParser proj = new VSProjectParser(projFile); _dependencies.AddRange(proj.getDependencies()); _outputs.AddRange(proj.getOutputs()); } } stream.Close(); } }
public override IVerbWorker getWorker() { List <string> args = new List <String>(); args.Add(String.Format("/p:OutDir={0}", _outputPath)); args.Add(_solutionFile.getFilesystemPath()); return(new ProcessInvokeAsyncWorker(this, "c:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe", args.ToArray(), ProcessInvoker.RcHandling.NONZERO_RC_IS_FAILURE, failureBase: getDiagnosticsBase(), allowAbsoluteExe: true, allowAbsoluteArgs: true )); }
public override IVerbWorker getWorker() { string linker = @"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\link.exe"; string vc_lib_dir = @"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib"; string sdk_dir = @"C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86"; string kernel_lib = @"C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\kernel32.Lib"; string standalone_support_lib = getStandaloneLib().getRelativePath(); SourcePath zero1 = new SourcePath("tools/scripts/zero.obj", SourcePath.SourceType.sourceTypeTools); SourcePath zero2 = new SourcePath("tools/scripts/zero2.obj", SourcePath.SourceType.sourceTypeTools); //- TODO: Fail more gracefully? Or better yet, move these into iron/tools if (!Directory.Exists(vc_lib_dir)) { throw new FileNotFoundException("Missing Visual C++ library directory: " + vc_lib_dir); } if (!Directory.Exists(sdk_dir) || !File.Exists(kernel_lib)) { throw new FileNotFoundException("Missing Windows SDK libraries: " + sdk_dir + ", " + kernel_lib + @". Try installing the Windows SDK from: \\research\Root\Products\Developers\Windows Driver Kit 8.1"); } //- TODO: Unpack/generate these automatically if (!File.Exists(zero1.getFilesystemPath()) || !File.Exists(zero2.getFilesystemPath())) { throw new FileNotFoundException("Missing object files of zeroes: " + zero1 + ", " + zero2 + ". Try running: tools/scripts/build-standalone-init.sh"); } List <string> args = new List <string>() { "/DEBUG", "/subsystem:console", "/LARGEADDRESSAWARE", "/fixed" }; args.Add(objFile.getRelativePath()); args.Add(zero1.getRelativePath()); args.Add(zero2.getRelativePath()); args.Add(standalone_support_lib); args.Add(@"""" + kernel_lib + @""""); args.Add("\"/libpath:" + vc_lib_dir + '"'); args.Add("\"/libpath:" + sdk_dir + '"'); args.Add("/out:" + outputObject.getRelativePath()); args.Add("/entry:" + entryPoint); args.Add("/base:" + baseAddr); args.Add("/PDB:" + getPdb()); return(new ProcessInvokeAsyncWorker(this, linker, args.ToArray(), ProcessInvoker.RcHandling.NONZERO_RC_IS_FAILURE, getDiagnosticsBase(), allowAbsoluteExe: true, allowAbsoluteArgs: true)); }
public void _parseCustomManifest(SourcePath basePath) { SourcePath manifest = basePath.getNewSourcePath("nubuild-manifest.txt"); _dependencies.Add(manifest); using (StreamReader stream = new StreamReader(manifest.getFilesystemPath())) { string origline; while ((origline = stream.ReadLine()) != null) { string line = origline.Trim(); if (line.Length == 0) { continue; } if (line.Substring(0, 1) == "#") { continue; } string[] parts = line.Split(); if (parts.Length != 2) { throw new UserError(String.Format("{0}: badly formed manifest line {1}", manifest.getFilesystemPath(), origline)); } if ("output".Equals(parts[0])) { _outputs.Add(new BuildObject(Path.Combine(basePath.getDirPath(), parts[1]))); } else if ("dependency".Equals(parts[0])) { _dependencies.Add(basePath.getNewSourcePath(parts[1])); } } } }
public override IVerbWorker getWorker() { List <string> args = new List <String>(); args.Add(String.Format("OBJ={0}\\obj", _outputPath)); args.Add(String.Format("BIN={0}", _outputPath)); args.Add("-f"); args.Add(_makefile.getFilesystemPath()); return(new ProcessInvokeAsyncWorker(this, "c:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/nmake.exe", args.ToArray(), ProcessInvoker.RcHandling.NONZERO_RC_IS_FAILURE, workingDir: _makefile.getFilesystemDirPath(), failureBase: getDiagnosticsBase(), allowAbsoluteExe: true, allowAbsoluteArgs: true )); }
private void _parse() { _dependencies.Add(_projectFile); using (XmlTextReader reader = new XmlTextReader(_projectFile.getFilesystemPath())) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (String.Compare(reader.Name, "Compile") == 0) { _dependencies.Add(_projectFile.getNewSourcePath(reader.GetAttribute("Include"))); } else if (String.Compare(reader.Name, "PropertyGroup") == 0) { _parseOutput(reader); } } } reader.Close(); } if (_outputType != null && _assemblyName != null) //- && _outputPath != null) { string path = Path.Combine(_projectFile.getDirPath(), String.Format("{0}.{1}", _assemblyName, outputTypeToExtension(_outputType))); //-Console.WriteLine("{0}: generating {1}", _projectFile.getRelativePath(), path); _outputs.Add(new BuildObject(path)); } else { throw new UserError(String.Format("Project {0} doesn't seem to have output specification in the expected format", _projectFile.getRelativePath())); } }
public override IVerbWorker getWorker() { //- Mimic this line from src/Checked/Nucleus/Main/build.ps1: //- _cat -out $OBJ\EntryCP_i.bpl -in $OBJ\MainCP_i.bpl,$SPEC_OBJ\EntryCP_i.bpl //- TODO eliminate this special-case workaround. try { //- This is the trusted bit, creating the stitched ifc file. //-IEnumerable<string> ifcImports = extractImportStatements(dafnyMainIfcInput); string[] mainLines = File.ReadAllLines(mainBeatVerb.getOutputs().First().getFilesystemPath()); string[] entryLines = File.ReadAllLines(genericStitch.getFilesystemPath()); int sentinel_index = Array.IndexOf(entryLines, SENTINEL_APP_SPECIFIC_GOES_HERE); if (sentinel_index < 0) { throw new UserError("Sentinel string missing in " + genericStitch); } IEnumerable <string> entryPrologue = entryLines.Take(sentinel_index + 1); IEnumerable <string> entryEpilogue = entryLines.Skip(sentinel_index + 1); string[] appSpecificLines = File.ReadAllLines(appSpecificStitch.getFilesystemPath()); //-File.WriteAllLines(getIfcOutput().getFilesystemPath(), ifcImports.Concat(mainLines.Concat(entryLines))); File.WriteAllLines(getIfcOutput().getFilesystemPath(), mainLines.Concat(entryPrologue).Concat(appSpecificLines).Concat(entryEpilogue)); //- Here's some (at least untrusted) workaround, snarfing and repurposing the //- import list from dafny_Main_i up to Entry.imp. IEnumerable <string> impImports = extractImportStatements(dafnyMainImpInput); string[] intext = File.ReadAllLines(entryImpInput.getFilesystemPath()); File.WriteAllLines(getEntryImpOutput().getFilesystemPath(), impImports.Concat(intext)); return(new VerbSyncWorker(new Fresh())); } catch (IOException ex) { return(new VerbSyncWorker(new Failed(ex.ToString()))); } }