public override bool Execute()
        {
            logger = new BuildLogger(BuildEngine);
            logger.LogInfo($"SqlPersistenceScriptBuilderTask (version {assemblyVersion}) Executing");

            var stopwatch = Stopwatch.StartNew();

            try
            {
                ValidateInputs();
                var innerTask = new InnerTask(AssemblyPath, IntermediateDirectory, ProjectDirectory, SolutionDirectory,
                                              logError: (error, file) =>
                {
                    logger.LogError(error, file);
                });
                innerTask.Execute();
            }
            catch (ErrorsException exception)
            {
                logger.LogError(exception.Message, exception.FileName);
            }
            catch (Exception exception)
            {
                logger.LogError(exception.ToFriendlyString());
            }
            finally
            {
                logger.LogInfo($"  Finished SqlPersistenceScriptBuilderTask {stopwatch.ElapsedMilliseconds}ms.");
            }
            return(!logger.ErrorOccurred);
        }
Beispiel #2
0
    public void IntegrationTest()
    {
        var testDirectory = TestContext.CurrentContext.TestDirectory;
        var temp          = Path.Combine(testDirectory, "InnerTaskTemp");

        DirectoryExtensions.Delete(temp);
        var assemblyPath     = Path.Combine(testDirectory, "ScriptBuilderTask.Tests.Target.dll");
        var intermediatePath = Path.Combine(temp, "IntermediatePath");
        var promotePath      = Path.Combine(temp, "PromotePath");

        Directory.CreateDirectory(temp);
        Directory.CreateDirectory(intermediatePath);

        Action <string, string> logError = (error, s1) =>
        {
            throw new Exception(error);
        };
        var innerTask = new InnerTask(assemblyPath, intermediatePath, "TheProjectDir", promotePath, logError);

        innerTask.Execute();
        var files = Directory.EnumerateFiles(temp, "*.*", SearchOption.AllDirectories).Select(s => s.Replace(temp, "temp")).ToList();

        ObjectApprover.VerifyWithJson(files);
    }
Beispiel #3
0
 public override bool Execute()
 {
     var innerTask = new InnerTask
         {
             Overwrite = Overwrite,
             IncludeDebugSymbols = IncludeDebugSymbols,
             DeleteReferences = DeleteReferences,
             CreateTemporaryAssemblies = CreateTemporaryAssemblies,
             TargetPath = TargetPath,
             KeyFilePath = KeyFilePath,
             MessageImportance = MessageImportance,
             References = References,
             ReferenceCopyLocalPaths = ReferenceCopyLocalPaths,
             BuildEngine = BuildEngine
         };
     return innerTask.Execute();
 }