private CreateBinaryOptions SetOptions(CreateBinaryOptions options) { options.ModuleName ??= _codeGenerator.Module.Name; options.SolutionPath ??= BuildOutputPath(options); options.OutputPath ??= Environment.CurrentDirectory; return(options); }
public CreateBinary([JetBrains.Annotations.NotNull] ICodeGenerator codeGenerator, CreateBinaryOptions options = null) { MSBuildLocator.RegisterDefaults(); _codeGenerator = codeGenerator ?? throw new ArgumentNullException(nameof(codeGenerator)); _options = SetOptions(options ?? new CreateBinaryOptions()); if (!Directory.Exists(_options.OutputPath)) { #pragma warning disable S3928 // Parameter names used into ArgumentException constructors should match an existing one throw new ArgumentException("Output path does not exist", nameof(options.OutputPath)); #pragma warning restore S3928 // Parameter names used into ArgumentException constructors should match an existing one } }
private static string BuildOutputPath(CreateBinaryOptions options) { return(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Oberon0", "MSIL", GetFileHashPath(Directory.GetCurrentDirectory()), options.ModuleName !)); }
/// <inheritdoc /> public bool GenerateBinary(CreateBinaryOptions options = null) { var binary = new CreateBinary(this, options); return(binary.Execute()); }