コード例 #1
0
        private void LoadTestBuildProperties(
            IValueTable testTable,
            BuildArguments arguments)
        {
            if (testTable.TryGetValue("Source", out var sourceValue))
            {
                arguments.SourceFiles = sourceValue.AsList().Select(value => new Path(value.AsString())).ToList();
            }
            else
            {
                throw new InvalidOperationException("No Test Source Files");
            }

            // Combine the include paths from the recipe and the system
            if (testTable.TryGetValue("IncludePaths", out var includePathsValue))
            {
                arguments.IncludeDirectories = CombineUnique(
                    arguments.IncludeDirectories,
                    includePathsValue.AsList().Select(value => new Path(value.AsString())));
            }

            if (testTable.TryGetValue("PlatformLibraries", out var platformLibrariesValue))
            {
                arguments.PlatformLinkDependencies = CombineUnique(
                    arguments.PlatformLinkDependencies,
                    platformLibrariesValue.AsList().Select(value => new Path(value.AsString())));
            }

            arguments.TargetName = "TestHarness";
            arguments.TargetType = BuildTargetType.Executable;
        }
コード例 #2
0
ファイル: BuildCommand.cs プロジェクト: Azure/bicep
        public async Task <int> RunAsync(BuildArguments args)
        {
            var inputPath = PathHelper.ResolvePath(args.InputFile);

            if (invocationContext.EmitterSettings.EnableSymbolicNames)
            {
                logger.LogWarning(CliResources.SymbolicNamesDisclaimerMessage);
            }

            if (invocationContext.Features.ResourceTypedParamsAndOutputsEnabled)
            {
                logger.LogWarning(CliResources.ResourceTypesDisclaimerMessage);
            }

            if (!IsBicepFile(inputPath))
            {
                logger.LogError(CliResources.UnrecognizedFileExtensionMessage, inputPath);
                return(1);
            }

            var compilation = await compilationService.CompileAsync(inputPath, args.NoRestore);

            if (diagnosticLogger.ErrorCount < 1)
            {
                if (args.OutputToStdOut)
                {
                    writer.ToStdout(compilation);
                }
                else
                {
コード例 #3
0
        public static void Build(BuildArguments arguments)
        {
            _api = new YuGiOhWikiaApi.YuGiOhWikiaApi();
            _duelLinksMetaApi = new DuelLinksMetaApi();

            Logger.Info("initializing skill list");
            InitializeSkillList();
            Logger.Info("writing skills into database");
            WriteSkillsToDatabase(
                Path.Combine(arguments.DatabasePath, arguments.DatabaseName));

            Logger.Info("initializing card list");
            InitializeCardLists();
            Logger.Info("initializing booster list");
            InitializeBoosterList();

            Task.WaitAll(
                Task.Factory.StartNew(ProcessCards),
                Task.Factory.StartNew(ProcessBoosters));

            Logger.Info("writing cards into database");
            WriteCardsToDatabase(
                Path.Combine(arguments.DatabasePath, arguments.DatabaseName));
            Logger.Info("writing booster into database");
            WriteBoostersToDatabase(
                Path.Combine(arguments.DatabasePath, arguments.DatabaseName));
            Logger.Info("writing boostercards into database");
            WriteBoosterCardsToDatabase(
                Path.Combine(arguments.DatabasePath, arguments.DatabaseName));
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: wpouseele/bicep
        private int Build(ILogger logger, BuildArguments arguments)
        {
            var diagnosticLogger = new BicepDiagnosticLogger(logger);
            var bicepPath        = PathHelper.ResolvePath(arguments.InputFile);

            if (arguments.OutputToStdOut)
            {
                BuildToStdout(diagnosticLogger, bicepPath);
            }
            else if (arguments.OutputDir is not null)
            {
                var outputDir = PathHelper.ResolvePath(arguments.OutputDir);
                if (!Directory.Exists(outputDir))
                {
                    throw new CommandLineException($"The specified output directory \"{outputDir}\" does not exist.");
                }

                var outputPath = Path.Combine(outputDir, Path.GetFileName(bicepPath));

                BuildToFile(diagnosticLogger, bicepPath, PathHelper.GetDefaultOutputPath(outputPath));
            }
            else if (arguments.OutputFile is not null)
            {
                BuildToFile(diagnosticLogger, bicepPath, arguments.OutputFile);
            }
            else
            {
                BuildToFile(diagnosticLogger, bicepPath, PathHelper.GetDefaultOutputPath(bicepPath));
            }

            // return non-zero exit code on errors
            return(diagnosticLogger.HasLoggedErrors ? 1 : 0);
        }
コード例 #5
0
        void LoadDependencyBuildInput(
            IValueTable sharedBuildTable,
            BuildArguments arguments)
        {
            // Load the runtime dependencies
            if (sharedBuildTable.TryGetValue("RuntimeDependencies", out var runtimeDependenciesValue))
            {
                arguments.RuntimeDependencies = CombineUnique(
                    arguments.RuntimeDependencies,
                    runtimeDependenciesValue.AsList().Select(value => new Path(value.AsString())));
            }

            // Load the link dependencies
            if (sharedBuildTable.TryGetValue("LinkDependencies", out var linkDependenciesValue))
            {
                arguments.LinkDependencies = CombineUnique(
                    arguments.LinkDependencies,
                    linkDependenciesValue.AsList().Select(value => new Path(value.AsString())));
            }

            // Load the module references
            if (sharedBuildTable.TryGetValue("ModuleDependencies", out var moduleDependenciesValue))
            {
                arguments.ModuleDependencies = CombineUnique(
                    arguments.ModuleDependencies,
                    moduleDependenciesValue.AsList().Select(value => new Path(value.AsString())));
            }
        }
コード例 #6
0
        public void Build(string WorkingFolder)
        {
            var buildArguments = new BuildArguments(
                WorkingFolder,
                string.IsNullOrWhiteSpace(ProjectPath) ? null : ProjectPath,
                string.IsNullOrWhiteSpace(OutputFolder) ? null : OutputFolder,
                string.IsNullOrWhiteSpace(ProtectionLevel) ? null : ProtectionLevel,
                string.IsNullOrWhiteSpace(Password) ? null : Password,
                string.IsNullOrWhiteSpace(NewPassword) ? null : NewPassword,
                string.IsNullOrWhiteSpace(Configuration) ? null : Configuration,
                string.IsNullOrWhiteSpace(ReleaseNotes) ? null : ReleaseNotes,
                Parameters.OfType <DictionaryEntry>().ToDictionary(e => e.Key as string, e => e.Value as string)
                );

            _builder = _builder ?? new Builder();

            try
            {
                _builder.Build(buildArguments);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw;
            }
        }
コード例 #7
0
    static void WriteArguments(StreamWriter writer, BuildArguments buildArguments)
    {
        var argumentsWithTarget = buildArguments("tempFile", "targetFile");

        writer.WriteLine($@"
 * Example arguments: `{argumentsWithTarget}`");
    }
コード例 #8
0
ファイル: JsBuilder.cs プロジェクト: modo-lv/Forkdown
 /// <inheritdoc cref="JsBuilder"/>
 public JsBuilder(BuildArguments args, ILogger <JsBuilder> logger)
 {
     _args    = args;
     _logger  = logger;
     _inPath  = Program.InPath.Combine("js");
     _outPath = _args.ProjectRoot.Combine(Program.OutFolder);
 }
コード例 #9
0
        public void Pass_ProcessRecord()
        {
            // Setup
            var projectPath           = Fakes.RandomString();
            var workingFolder         = Fakes.RandomString();
            var protectionLevelString = new[] { nameof(ProtectionLevel.EncryptAllWithPassword), nameof(ProtectionLevel.EncryptSensitiveWithPassword) }[Fakes.RandomInt(0, 199) / 200];
            var configuration         = Fakes.RandomString();
            var password     = Fakes.RandomString();
            var newPassword  = Fakes.RandomString();
            var outputFolder = Fakes.RandomString();
            var releaseNotes = Fakes.RandomString();

            var parametersCount = Fakes.RandomInt(1, 10);
            var parameters      = new Dictionary <string, string>();

            for (var i = 0; i < parametersCount; i++)
            {
                parameters.Add(Fakes.RandomString(), Fakes.RandomString());
            }

            BuildArguments buildArguments = null;

            _builder.Setup(b => b.Build(It.IsAny <IBuildArguments>())).Callback((IBuildArguments ba) => { buildArguments = ba as BuildArguments; });

            // Execute
            var powershellCmd = new SsisBuildPowershell
            {
                ProtectionLevel = protectionLevelString,
                Configuration   = configuration,
                NewPassword     = newPassword,
                OutputFolder    = outputFolder,
                Parameters      = new Hashtable(parameters),
                Password        = password,
                ProjectPath     = projectPath,
                ReleaseNotes    = releaseNotes
            };

            powershellCmd.ProcessRecordInternal(_builder.Object, workingFolder);

            // Assert
            Assert.NotNull(buildArguments);
            Assert.Equal(projectPath, buildArguments.ProjectPath);
            Assert.Equal(workingFolder, buildArguments.WorkingFolder);
            Assert.Equal(protectionLevelString, buildArguments.ProtectionLevel);
            Assert.Equal(configuration, buildArguments.Configuration);
            Assert.Equal(password, buildArguments.Password);
            Assert.Equal(newPassword, buildArguments.NewPassword);
            Assert.Equal(outputFolder, buildArguments.OutputFolder);
            Assert.Equal(releaseNotes, buildArguments.ReleaseNotes);

            Assert.NotNull(buildArguments.Parameters);
            Assert.Equal(parametersCount, buildArguments.Parameters.Count);

            foreach (var parameter in parameters)
            {
                Assert.True(buildArguments.Parameters.ContainsKey(parameter.Key));
                Assert.Equal(parameter.Value, buildArguments.Parameters[parameter.Key]);
            }
        }
コード例 #10
0
ファイル: OsSettings.cs プロジェクト: VerifyTests/DiffEngine
 public OsSettings(
     BuildArguments targetLeftArguments,
     BuildArguments targetRightArguments,
     params string[] exePaths)
 {
     TargetLeftArguments  = targetLeftArguments;
     TargetRightArguments = targetRightArguments;
     ExePaths             = exePaths;
 }
コード例 #11
0
 public OsSettings(
     BuildArguments arguments,
     params string[] exePaths)
 {
     Guard.AgainstNull(arguments, nameof(arguments));
     Guard.AgainstNull(exePaths, nameof(exePaths));
     Arguments = arguments;
     ExePaths  = exePaths;
 }
コード例 #12
0
        private void LoadBuildProperties(
            IValueTable buildTable,
            BuildArguments arguments)
        {
            arguments.LanguageStandard = (LanguageStandard)
                                         buildTable["LanguageStandard"].AsInteger();
            arguments.SourceRootDirectory = new Path(buildTable["SourceRootDirectory"].AsString());
            arguments.TargetRootDirectory = new Path(buildTable["TargetRootDirectory"].AsString());
            arguments.ObjectDirectory     = new Path(buildTable["ObjectDirectory"].AsString());
            arguments.BinaryDirectory     = new Path(buildTable["BinaryDirectory"].AsString());

            if (buildTable.TryGetValue("IncludeDirectories", out var includeDirectoriesValue))
            {
                arguments.IncludeDirectories = includeDirectoriesValue.AsList().Select(value => new Path(value.AsString())).ToList();
            }

            if (buildTable.TryGetValue("PlatformLibraries", out var platformLibrariesValue))
            {
                arguments.PlatformLinkDependencies = platformLibrariesValue.AsList().Select(value => new Path(value.AsString())).ToList();
            }

            if (buildTable.TryGetValue("LinkLibraries", out var linkLibrariesValue))
            {
                arguments.LinkDependencies = linkLibrariesValue.AsList().Select(value => new Path(value.AsString())).ToList();
            }

            if (buildTable.TryGetValue("LibraryPaths", out var libraryPathsValue))
            {
                arguments.LibraryPaths = libraryPathsValue.AsList().Select(value => new Path(value.AsString())).ToList();
            }

            if (buildTable.TryGetValue("PreprocessorDefinitions", out var preprocessorDefinitionsValue))
            {
                arguments.PreprocessorDefinitions = preprocessorDefinitionsValue.AsList().Select(value => value.AsString()).ToList();
            }

            if (buildTable.TryGetValue("OptimizationLevel", out var optimizationLevelValue))
            {
                arguments.OptimizationLevel = (BuildOptimizationLevel)
                                              optimizationLevelValue.AsInteger();
            }
            else
            {
                arguments.OptimizationLevel = BuildOptimizationLevel.None;
            }

            if (buildTable.TryGetValue("GenerateSourceDebugInfo", out var generateSourceDebugInfoValue))
            {
                arguments.GenerateSourceDebugInfo = generateSourceDebugInfoValue.AsBoolean();
            }
            else
            {
                arguments.GenerateSourceDebugInfo = false;
            }
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: CitadelCore/Hyperpack
        private static async Task <int> Build(BuildArguments args)
        {
            var pack = await LoadPack(args.PackDirectory);

            if (pack == null)
            {
                return(1);
            }

            return(await pack.Build() ? 0 : 1);
        }
コード例 #14
0
        public void Fail_Execute_ProjectFileNotFoundException()
        {
            // Setup
            var buildArguments = new BuildArguments(_workingFolder, null, null, null, null, null, Fakes.RandomString(), null, null);
            var logger         = _loggerMock.Object;
            var project        = _projectMock.Object;

            // Execute
            var builder   = new Builder.Builder(logger, project);
            var exception = Record.Exception(() => builder.Build(buildArguments));

            Assert.NotNull(exception);
            Assert.IsType <ProjectFileNotFoundException>(exception);
        }
コード例 #15
0
        public int Run(BuildArguments args)
        {
            var inputPath = PathHelper.ResolvePath(args.InputFile);

            var compilation = compilationService.Compile(inputPath);

            if (diagnosticLogger.ErrorCount < 1)
            {
                if (args.OutputToStdOut)
                {
                    writer.ToStdout(compilation);
                }
                else
                {
コード例 #16
0
ファイル: Program.cs プロジェクト: ikemerrix/bicep
        private void Build(IDiagnosticLogger logger, BuildArguments arguments)
        {
            var bicepPaths = arguments.Files.Select(PathHelper.ResolvePath).ToArray();

            if (arguments.OutputToStdOut)
            {
                BuildManyFilesToStdOut(logger, bicepPaths);
                return;
            }

            foreach (string bicepPath in bicepPaths)
            {
                string outputPath = PathHelper.GetDefaultOutputPath(bicepPath);
                BuildSingleFile(logger, bicepPath, outputPath);
            }
        }
コード例 #17
0
ファイル: TestBuildTask.cs プロジェクト: mwasplund/SoupTest
        void LoadTestBuildProperties(
            IBuildState buildState,
            IValueTable testTable,
            BuildArguments arguments)
        {
            if (testTable.TryGetValue("Source", out var sourceValue))
            {
                arguments.SourceFiles = sourceValue.AsList().Select(value => new Path(value.AsString())).ToList();
            }
            else
            {
                throw new InvalidOperationException("No Test Source Files");
            }

            arguments.TargetName = "TestHarness";
            arguments.TargetType = BuildTargetType.Executable;
        }
コード例 #18
0
ファイル: TestBuildTask.cs プロジェクト: mwasplund/SoupTest
        void LoadBuildProperties(
            IValueTable buildTable,
            BuildArguments arguments)
        {
            arguments.SourceRootDirectory = new Path(buildTable["SourceRootDirectory"].AsString());
            arguments.TargetRootDirectory = new Path(buildTable["TargetRootDirectory"].AsString());
            arguments.ObjectDirectory     = new Path(buildTable["ObjectDirectory"].AsString());
            arguments.BinaryDirectory     = new Path(buildTable["BinaryDirectory"].AsString());

            if (buildTable.TryGetValue("LibraryPaths", out var libraryPathsValue))
            {
                arguments.LibraryPaths = libraryPathsValue.AsList().Select(value => new Path(value.AsString())).ToList();
            }

            if (buildTable.TryGetValue("PreprocessorDefinitions", out var preprocessorDefinitionsValue))
            {
                arguments.PreprocessorDefinitions = preprocessorDefinitionsValue.AsList().Select(value => value.AsString()).ToList();
            }

            if (buildTable.TryGetValue("OptimizationLevel", out var optimizationLevelValue))
            {
                arguments.OptimizationLevel = (BuildOptimizationLevel)
                                              optimizationLevelValue.AsInteger();
            }
            else
            {
                arguments.OptimizationLevel = BuildOptimizationLevel.None;
            }

            if (buildTable.TryGetValue("GenerateSourceDebugInfo", out var generateSourceDebugInfoValue))
            {
                arguments.GenerateSourceDebugInfo = generateSourceDebugInfoValue.AsBoolean();
            }
            else
            {
                arguments.GenerateSourceDebugInfo = false;
            }

            // Load the link dependencies
            if (buildTable.TryGetValue("LinkDependencies", out var linkDependenciesValue))
            {
                arguments.LinkDependencies = CombineUnique(
                    arguments.LinkDependencies,
                    linkDependenciesValue.AsList().Select(value => new Path(value.AsString())));
            }
        }
コード例 #19
0
        private static void LoadTestDependencyBuildInput(
            IBuildState buildState,
            IValueTable activeState,
            BuildArguments arguments)
        {
            if (activeState.TryGetValue("Dependencies", out var dependenciesValue))
            {
                var dependenciesTable = dependenciesValue.AsTable();
                if (dependenciesTable.TryGetValue("Test", out var testValue))
                {
                    var testDependenciesTable = testValue.AsTable();
                    foreach (var dependencyName in testDependenciesTable)
                    {
                        // Combine the core dependency build inputs for the core build task
                        buildState.LogTrace(TraceLevel.Information, "Combine Test Dependency: " + dependencyName.Key);
                        var dependencyTable = dependencyName.Value.AsTable();

                        if (dependencyTable.TryGetValue("Build", out var buildValue))
                        {
                            var dependencyBuildTable = buildValue.AsTable();

                            if (dependencyBuildTable.TryGetValue("ModuleDependencies", out var moduleDependenciesValue))
                            {
                                arguments.ModuleDependencies = CombineUnique(
                                    arguments.ModuleDependencies,
                                    moduleDependenciesValue.AsList().Select(value => new Path(value.AsString())));
                            }

                            if (dependencyBuildTable.TryGetValue("RuntimeDependencies", out var runtimeDependenciesValue))
                            {
                                arguments.RuntimeDependencies = CombineUnique(
                                    arguments.RuntimeDependencies,
                                    runtimeDependenciesValue.AsList().Select(value => new Path(value.AsString())));
                            }

                            if (dependencyBuildTable.TryGetValue("LinkDependencies", out var linkDependenciesValue))
                            {
                                arguments.LinkDependencies = CombineUnique(
                                    arguments.LinkDependencies,
                                    linkDependenciesValue.AsList().Select(value => new Path(value.AsString())));
                            }
                        }
                    }
                }
            }
        }
コード例 #20
0
        public void Pass_Execute_NullProjectPath()
        {
            // Setup
            var projectPath = Path.Combine(_workingFolder, $"{Fakes.RandomString()}.dtproj");

            File.Create(projectPath).Close();
            _projectMock.Setup(p => p.Parameters).Returns(() => new Dictionary <string, IParameter>());

            var buildArguments = new BuildArguments(_workingFolder, null, null, null, null, null, Fakes.RandomString(), null, null);
            var logger         = _loggerMock.Object;
            var project        = _projectMock.Object;

            // Execute
            var builder = new Builder.Builder(logger, project);

            builder.Build(buildArguments);
        }
コード例 #21
0
        bool SetBuildArgs(IEnumerable <string> args)
        {
            Cancel();

            try
            {
                _args = BuildCommand.Parse(args, _log);
                _args.Options.Native         = false;
                _args.Options.PrintInternals = true;
                _view.OnProjectChanged(_args.ProjectFile);
                return(true);
            }
            catch (Exception e)
            {
                _log.Error(e.Message);
                return(false);
            }
        }
コード例 #22
0
        public async Task <int> RunAsync(BuildArguments args)
        {
            var inputPath = PathHelper.ResolvePath(args.InputFile);

            if (invocationContext.EmitterSettings.EnableSymbolicNames)
            {
                logger.LogWarning(CliResources.SymbolicNamesDisclaimerMessage);
            }

            var compilation = await compilationService.CompileAsync(inputPath, args.NoRestore);

            if (diagnosticLogger.ErrorCount < 1)
            {
                if (args.OutputToStdOut)
                {
                    writer.ToStdout(compilation);
                }
                else
                {
コード例 #23
0
        public void Pass_Process_AllProperties()
        {
            // Setup
            var projectPath           = Fakes.RandomString();
            var workingFolder         = Fakes.RandomString();
            var protectionLevelString = new[] { nameof(ProtectionLevel.EncryptAllWithPassword), nameof(ProtectionLevel.EncryptSensitiveWithPassword) }[Fakes.RandomInt(0, 200) / 200];
            var configuration         = Fakes.RandomString();
            var password     = Fakes.RandomString();
            var newPassword  = Fakes.RandomString();
            var outputFolder = Fakes.RandomString();
            var releaseNotes = Fakes.RandomString();

            var parametersCount = Fakes.RandomInt(0, 10);
            var parameters      = new Dictionary <string, string>();

            for (var i = 0; i < parametersCount; i++)
            {
                parameters.Add(Fakes.RandomString(), Fakes.RandomString());
            }

            // Execute
            var buildArguments = new BuildArguments(workingFolder, projectPath, outputFolder, protectionLevelString, password, newPassword, configuration, releaseNotes, parameters);

            // Assert
            Assert.Equal(projectPath, buildArguments.ProjectPath);
            Assert.Equal(configuration, buildArguments.Configuration);
            Assert.Equal(protectionLevelString, buildArguments.ProtectionLevel);
            Assert.Equal(newPassword, buildArguments.NewPassword);
            Assert.Equal(password, buildArguments.Password);
            Assert.Equal(outputFolder, buildArguments.OutputFolder);
            Assert.Equal(releaseNotes, buildArguments.ReleaseNotes);
            Assert.Equal(workingFolder, buildArguments.WorkingFolder);

            Assert.NotNull(buildArguments.Parameters);
            Assert.Equal(parametersCount, buildArguments.Parameters.Count);

            foreach (var parameter in parameters)
            {
                Assert.True(buildArguments.Parameters.ContainsKey(parameter.Key));
                Assert.Equal(parameter.Value, buildArguments.Parameters[parameter.Key]);
            }
        }
コード例 #24
0
        public void             Build(BuildArguments _args)
        {
            // Setup arguments
            floatTrackbarControlHeight.Value       = _args.displacementSize_cm;
            floatTrackbarControlPixelDensity.Value = _args.textureSize_cm;

            integerTrackbarControlRaysCount.Value     = _args.raysCount;
            integerTrackbarControlMaxStepsCount.Value = _args.searchRange;
            floatTrackbarControlMaxConeAngle.Value    = _args.coneAngle;

            floatTrackbarControlBilateralRadius.Value    = _args.bilateralRadius;
            floatTrackbarControlBilateralTolerance.Value = _args.bilateralTolerance;

            checkBoxWrap.Checked = _args.tile;

            m_silentMode = true;

            // Create device, shaders and structures
            OnLoad(EventArgs.Empty);

            // Load height map
            System.IO.FileInfo HeightMapFileName = new System.IO.FileInfo(_args.heightMapFileName);
            LoadHeightMap(HeightMapFileName);

            // Load normal map
            if (_args.normalMapFileName != null)
            {
                System.IO.FileInfo NormalMapFileName = new System.IO.FileInfo(_args.normalMapFileName);
                LoadNormalMap(NormalMapFileName);
            }

            // Generate
            Generate();

            // Save results
            m_BitmapResult.Save(new System.IO.FileInfo(_args.AOMapFileName));

            // Dispose
            CancelEventArgs onsenfout = new CancelEventArgs();

            OnClosing((CancelEventArgs)onsenfout);
        }
コード例 #25
0
ファイル: DeployTask.cs プロジェクト: zoroz/Terminals
        public static string[] Deploy(Arguments.IDeployArguments deployArguments, Logging.ILog log = null)
        {
            if (log == null)
            {
                log = new Logging.NoLogging();
            }

            if (System.IO.File.Exists(deployArguments.ArtifactFile))
            {
                string packageFile = deployArguments.ArtifactFile;//System.IO.Path.Combine(deployArguments.ArtifactFolder, PackageTask.PackageFile);
                if (System.IO.File.Exists(packageFile))
                {
                    string tempFolder = System.IO.Path.GetTempPath();
                    string newFolder  = System.Guid.NewGuid().ToString();
                    string ourFolder  = System.IO.Path.Combine(tempFolder, newFolder);
                    System.IO.Directory.CreateDirectory(ourFolder);
                    ICSharpCode.SharpZipLib.Zip.FastZip fz = new FastZip();

                    fz.ExtractZip(packageFile, ourFolder, null);

                    Arguments.BuildArguments ba = new BuildArguments();
                    ba.ConnectionString  = deployArguments.ConnectionString;
                    ba.DbProviderFactory = deployArguments.DbProviderFactory;
                    ba.ScriptProcessor   = deployArguments.ScriptProcessor;
                    ba.VersionParser     = deployArguments.VersionParser;
                    ba.DryRun            = false;
                    ba.BreakOnError      = true;
                    ba.MaximumVersion    = "99999.99999.99999";
                    ba.MinimumVersion    = "0.0.0";
                    ba.Recurse           = true;
                    ba.ScriptPath        = ourFolder;
                    ba.ScriptPattern     = "*.*";
                    ba.Transactional     = true;


                    return(BuildTask.Build(ba, log));
                }
            }

            return(null);
        }
コード例 #26
0
ファイル: Program.cs プロジェクト: yane3628/bicep
        private int Build(ILogger logger, BuildArguments arguments)
        {
            var diagnosticLogger = new BicepDiagnosticLogger(logger);
            var bicepPaths       = arguments.Files.Select(f => PathHelper.ResolvePath(f)).ToArray();

            if (arguments.OutputToStdOut)
            {
                BuildManyFilesToStdOut(diagnosticLogger, bicepPaths);
            }
            else
            {
                foreach (string bicepPath in bicepPaths)
                {
                    string outputPath = PathHelper.GetDefaultOutputPath(bicepPath);
                    BuildSingleFile(diagnosticLogger, bicepPath, outputPath);
                }
            }

            // return non-zero exit code on errors
            return(diagnosticLogger.HasLoggedErrors ? 1 : 0);
        }
コード例 #27
0
 internal ResolvedTool(
     string name,
     DiffTool?tool,
     string exePath,
     BuildArguments arguments,
     bool isMdi,
     bool autoRefresh,
     IReadOnlyList <string> binaryExtensions,
     bool requiresTarget,
     bool supportsText)
 {
     Name             = name;
     Tool             = tool;
     ExePath          = exePath;
     Arguments        = arguments;
     IsMdi            = isMdi;
     AutoRefresh      = autoRefresh;
     BinaryExtensions = binaryExtensions;
     RequiresTarget   = requiresTarget;
     SupportsText     = supportsText;
 }
コード例 #28
0
 public ResolvedTool(
     string name,
     string exePath,
     BuildArguments arguments,
     bool isMdi,
     bool autoRefresh,
     string[] binaryExtensions,
     bool requiresTarget,
     bool supportsText)
 {
     Guard.FileExists(exePath, nameof(exePath));
     Guard.AgainstNullOrEmpty(name, nameof(name));
     Guard.AgainstNull(binaryExtensions, nameof(binaryExtensions));
     Guard.AgainstNull(arguments, nameof(arguments));
     Name             = name;
     ExePath          = exePath;
     Arguments        = arguments;
     IsMdi            = isMdi;
     AutoRefresh      = autoRefresh;
     BinaryExtensions = binaryExtensions;
     RequiresTarget   = requiresTarget;
     SupportsText     = supportsText;
 }
コード例 #29
0
ファイル: TestBuildTask.cs プロジェクト: mwasplund/SoupTest
        public void Execute()
        {
            var activeState = this.buildState.ActiveState;
            var sharedState = this.buildState.SharedState;

            var recipeTable      = activeState["Recipe"].AsTable();
            var activeBuildTable = activeState["Build"].AsTable();
            var parametersTable  = activeState["Parameters"].AsTable();

            if (!recipeTable.ContainsKey("Tests"))
            {
                throw new InvalidOperationException("No Tests Specified");
            }

            var arguments = new BuildArguments();

            arguments.TargetArchitecture = parametersTable["Architecture"].AsString();

            // Load up the common build properties from the original Build table in the active state
            LoadBuildProperties(activeBuildTable, arguments);

            // Load the test properties
            var testTable = recipeTable["Tests"].AsTable();

            LoadTestBuildProperties(buildState, testTable, arguments);

            // Load up the input build parameters from the shared build state as if
            // this is a dependency build
            var sharedBuildTable = sharedState["Build"].AsTable();

            LoadDependencyBuildInput(sharedBuildTable, arguments);

            // Load up the test dependencies build input to add extra test runtime libraries
            LoadTestDependencyBuildInput(buildState, activeState, arguments);

            // Update to place the output in a sub folder
            arguments.ObjectDirectory = arguments.ObjectDirectory + new Path("Test/");
            arguments.BinaryDirectory = arguments.BinaryDirectory + new Path("Test/");

            // Initialize the compiler to use
            var compilerName = parametersTable["Compiler"].AsString();

            if (!this.compilerFactory.TryGetValue(compilerName, out var compileFactory))
            {
                this.buildState.LogTrace(TraceLevel.Error, "Unknown compiler: " + compilerName);
                throw new InvalidOperationException();
            }

            var compiler = compileFactory(activeState);

            var buildEngine = new BuildEngine(compiler);
            var buildResult = buildEngine.Execute(buildState, arguments);

            // Create the operation to run tests during build
            var title             = "Run Tests";
            var program           = new Path("C:/Program Files/dotnet/dotnet.exe");
            var runtimeConfigFile = arguments.BinaryDirectory + new Path($"{arguments.TargetName}.runtimeconfig.json");
            var workingDirectory  = arguments.TargetRootDirectory;
            var runArguments      = buildResult.TargetFile.ToString();

            // Ensure that the executable and all runtime dependencies are in place before running tests
            var inputFiles = new List <Path>(buildResult.RuntimeDependencies);

            inputFiles.Add(program);
            inputFiles.Add(runtimeConfigFile);

            // The test should have no output
            var outputFiles = new List <Path>();

            var runTestsOperation =
                new BuildOperation(
                    title,
                    workingDirectory,
                    program,
                    runArguments,
                    inputFiles,
                    outputFiles);

            // Run the test harness
            buildResult.BuildOperations.Add(runTestsOperation);

            // Register the build operations
            foreach (var operation in buildResult.BuildOperations)
            {
                buildState.CreateOperation(operation);
            }
        }
コード例 #30
0
        public void Execute()
        {
            var activeState = this.buildState.ActiveState;
            var sharedState = this.buildState.SharedState;

            var buildTable      = activeState["Build"].AsTable();
            var parametersTable = activeState["Parameters"].AsTable();

            var arguments = new BuildArguments();

            arguments.TargetArchitecture  = parametersTable["Architecture"].AsString();
            arguments.TargetName          = buildTable["TargetName"].AsString();
            arguments.TargetType          = (BuildTargetType)buildTable["TargetType"].AsInteger();
            arguments.SourceRootDirectory = new Path(buildTable["SourceRootDirectory"].AsString());
            arguments.TargetRootDirectory = new Path(buildTable["TargetRootDirectory"].AsString());
            arguments.ObjectDirectory     = new Path(buildTable["ObjectDirectory"].AsString());
            arguments.BinaryDirectory     = new Path(buildTable["BinaryDirectory"].AsString());

            if (buildTable.TryGetValue("Source", out var sourceValue))
            {
                arguments.SourceFiles = sourceValue.AsList().Select(value => new Path(value.AsString())).ToList();
            }

            if (buildTable.TryGetValue("LibraryPaths", out var libraryPathsValue))
            {
                arguments.LibraryPaths = libraryPathsValue.AsList().Select(value => new Path(value.AsString())).ToList();
            }

            if (buildTable.TryGetValue("PreprocessorDefinitions", out var preprocessorDefinitionsValue))
            {
                arguments.PreprocessorDefinitions = preprocessorDefinitionsValue.AsList().Select(value => value.AsString()).ToList();
            }

            if (buildTable.TryGetValue("OptimizationLevel", out var optimizationLevelValue))
            {
                arguments.OptimizationLevel = (BuildOptimizationLevel)
                                              optimizationLevelValue.AsInteger();
            }
            else
            {
                arguments.OptimizationLevel = BuildOptimizationLevel.None;
            }

            if (buildTable.TryGetValue("GenerateSourceDebugInfo", out var generateSourceDebugInfoValue))
            {
                arguments.GenerateSourceDebugInfo = generateSourceDebugInfoValue.AsBoolean();
            }
            else
            {
                arguments.GenerateSourceDebugInfo = false;
            }

            if (buildTable.TryGetValue("NullableState", out var nullableValue))
            {
                arguments.NullableState = (BuildNullableState)nullableValue.AsInteger();
            }
            else
            {
                arguments.NullableState = BuildNullableState.Enabled;
            }

            // Load the runtime dependencies
            if (buildTable.TryGetValue("RuntimeDependencies", out var runtimeDependenciesValue))
            {
                arguments.RuntimeDependencies = MakeUnique(
                    runtimeDependenciesValue.AsList().Select(value => new Path(value.AsString())));
            }

            // Load the link dependencies
            if (buildTable.TryGetValue("LinkDependencies", out var linkDependenciesValue))
            {
                arguments.LinkDependencies = MakeUnique(
                    linkDependenciesValue.AsList().Select(value => new Path(value.AsString())));
            }

            // Load the list of disabled warnings
            if (buildTable.TryGetValue("EnableWarningsAsErrors", out var enableWarningsAsErrorsValue))
            {
                arguments.EnableWarningsAsErrors = enableWarningsAsErrorsValue.AsBoolean();
            }
            else
            {
                arguments.GenerateSourceDebugInfo = false;
            }

            // Load the list of disabled warnings
            if (buildTable.TryGetValue("DisabledWarnings", out var disabledWarningsValue))
            {
                arguments.DisabledWarnings = disabledWarningsValue.AsList().Select(value => value.AsString()).ToList();
            }

            // Check for any custom compiler flags
            if (buildTable.TryGetValue("CustomCompilerProperties", out var customCompilerPropertiesValue))
            {
                arguments.CustomProperties = customCompilerPropertiesValue.AsList().Select(value => value.AsString()).ToList();
            }

            // Initialize the compiler to use
            var compilerName = parametersTable["Compiler"].AsString();

            if (!this.compilerFactory.TryGetValue(compilerName, out var compileFactory))
            {
                this.buildState.LogTrace(TraceLevel.Error, "Unknown compiler: " + compilerName);
                throw new InvalidOperationException();
            }

            var compiler = compileFactory(activeState);

            var buildEngine = new BuildEngine(compiler);
            var buildResult = buildEngine.Execute(this.buildState, arguments);

            // Pass along internal state for other stages to gain access
            buildTable.EnsureValueList(this.factory, "InternalLinkDependencies").SetAll(this.factory, buildResult.InternalLinkDependencies);

            // Always pass along required input to shared build tasks
            var sharedBuildTable = sharedState.EnsureValueTable(this.factory, "Build");

            sharedBuildTable.EnsureValueList(this.factory, "RuntimeDependencies").SetAll(this.factory, buildResult.RuntimeDependencies);
            sharedBuildTable.EnsureValueList(this.factory, "LinkDependencies").SetAll(this.factory, buildResult.LinkDependencies);

            if (!buildResult.TargetFile.IsEmpty)
            {
                sharedBuildTable["TargetFile"]    = this.factory.Create(buildResult.TargetFile.ToString());
                sharedBuildTable["RunExecutable"] = this.factory.Create("C:/Program Files/dotnet/dotnet.exe");
                sharedBuildTable["RunArguments"]  = this.factory.Create(buildResult.TargetFile.ToString());
            }

            // Register the build operations
            foreach (var operation in buildResult.BuildOperations)
            {
                this.buildState.CreateOperation(operation);
            }

            this.buildState.LogTrace(TraceLevel.Information, "Build Generate Done");
        }
コード例 #31
0
ファイル: GeneratorForm.cs プロジェクト: Patapom/GodComplex
        public void Build( BuildArguments _args )
        {
            // Setup arguments
            floatTrackbarControlHeight.Value = _args.displacementSize_cm;
            floatTrackbarControlPixelDensity.Value = _args.textureSize_cm;

            integerTrackbarControlRaysCount.Value = _args.raysCount;
            integerTrackbarControlMaxStepsCount.Value = _args.searchRange;
            floatTrackbarControlMaxConeAngle.Value = _args.coneAngle;

            floatTrackbarControlBilateralRadius.Value = _args.bilateralRadius;
            floatTrackbarControlBilateralTolerance.Value = _args.bilateralTolerance;

            checkBoxWrap.Checked = _args.tile;

            m_silentMode = true;

            // Create device, shaders and structures
            OnLoad( EventArgs.Empty );

            // Load height map
            System.IO.FileInfo	HeightMapFileName = new System.IO.FileInfo( _args.heightMapFileName );
            LoadHeightMap( HeightMapFileName );

            // Load normal map
            if ( _args.normalMapFileName != null ) {
                System.IO.FileInfo	NormalMapFileName = new System.IO.FileInfo( _args.normalMapFileName );
                LoadNormalMap( NormalMapFileName );
            }

            // Generate
             			Generate();

            // Save results
            m_imageResult.Save( new System.IO.FileInfo( _args.AOMapFileName ) );

            // Dispose
            CancelEventArgs	onsenfout = new CancelEventArgs();
            OnClosing( (CancelEventArgs) onsenfout );
        }