Пример #1
0
 private CreateBinaryOptions SetOptions(CreateBinaryOptions options)
 {
     options.ModuleName ??= _codeGenerator.Module.Name;
     options.SolutionPath ??= BuildOutputPath(options);
     options.OutputPath ??= Environment.CurrentDirectory;
     return(options);
 }
Пример #2
0
        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
            }
        }
Пример #3
0
 private static string BuildOutputPath(CreateBinaryOptions options)
 {
     return(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                         "Oberon0", "MSIL",
                         GetFileHashPath(Directory.GetCurrentDirectory()), options.ModuleName !));
 }
Пример #4
0
        /// <inheritdoc />
        public bool GenerateBinary(CreateBinaryOptions options = null)
        {
            var binary = new CreateBinary(this, options);

            return(binary.Execute());
        }