Exemplo n.º 1
0
        public override bool Execute()
        {
            // System.Diagnostics.Debugger.Launch();

            var referenceCopyLocalPaths = ReferenceCopyLocalFiles.Select(x => x.ItemSpec).ToList();

            var defineConstants = DefineConstants.GetConstants();

            processor = new Processor
            {
                Logger = new BuildLogger
                {
                    BuildEngine = BuildEngine,
                },
                AssemblyFilePath        = AssemblyFile,
                IntermediateDirectory   = IntermediateDirectory,
                KeyFilePath             = KeyOriginatorFile ?? AssemblyOriginatorKeyFile,
                SignAssembly            = SignAssembly,
                ProjectDirectory        = ProjectDirectory,
                DocumentationFilePath   = DocumentationFile,
                References              = References,
                SolutionDirectory       = SolutionDirectoryFinder.Find(SolutionDirectory, NCrunchOriginalSolutionDirectory, ProjectDirectory),
                ReferenceCopyLocalPaths = referenceCopyLocalPaths,
                DefineConstants         = defineConstants,
                NuGetPackageRoot        = NuGetPackageRoot,
                MSBuildDirectory        = MSBuildThisFileDirectory,
                WeaverFilesFromProps    = GetWeaverFilesFromProps(),
                DebugSymbols            = GetDebugSymbolsType()
            };
            var success = processor.Execute();

            if (success)
            {
                var weavers = processor.Weavers.Select(x => x.AssemblyName);
                ExecutedWeavers = string.Join(";", weavers) + ";";

                File.WriteAllLines(IntermediateCopyLocalFilesCache, processor.ReferenceCopyLocalPaths);
            }
            else
            {
                if (File.Exists(IntermediateCopyLocalFilesCache))
                {
                    File.Delete(IntermediateCopyLocalFilesCache);
                }
            }

            return(success);
        }
Exemplo n.º 2
0
        public override bool Execute()
        {
            var defineConstants = DefineConstants.GetConstants();
            var verifier        = new Verifier
            {
                Logger = new BuildLogger
                {
                    BuildEngine = BuildEngine,
                },
                SolutionDirectory = SolutionDirectoryFinder.Find(SolutionDirectory, NCrunchOriginalSolutionDirectory, ProjectDirectory),
                ProjectDirectory  = ProjectDirectory,
                DefineConstants   = defineConstants,
                TargetPath        = TargetPath,
            };

            return(verifier.Verify());
        }
Exemplo n.º 3
0
        public override bool Execute()
        {
            var referenceCopyLocalPaths = ReferenceCopyLocalFiles.Select(x => x.ItemSpec).ToList();

            var defineConstants = DefineConstants.GetConstants();
            var buildLogger     = new BuildLogger
            {
                BuildEngine = BuildEngine,
            };

            processor = new Processor
            {
                Logger                  = buildLogger,
                AssemblyFilePath        = AssemblyFile,
                IntermediateDirectory   = IntermediateDirectory,
                KeyFilePath             = KeyOriginatorFile ?? AssemblyOriginatorKeyFile,
                SignAssembly            = SignAssembly,
                ProjectDirectory        = ProjectDirectory,
                DocumentationFilePath   = DocumentationFile,
                References              = References,
                SolutionDirectory       = SolutionDirectoryFinder.Find(SolutionDirectory, NCrunchOriginalSolutionDirectory, ProjectDirectory),
                ReferenceCopyLocalPaths = referenceCopyLocalPaths,
                DefineConstants         = defineConstants,
                NuGetPackageRoot        = NuGetPackageRoot,
                MSBuildDirectory        = MSBuildThisFileDirectory,
                WeaverFilesFromProps    = GetWeaverFilesFromProps(),
                DebugSymbols            = GetDebugSymbolsType(),
                GenerateXsd             = GenerateXsd
            };
            var success = processor.Execute();

            if (success)
            {
                var weavers = processor.Weavers.Select(x => x.AssemblyName);
                ExecutedWeavers = string.Join(";", weavers) + ";";

                try
                {
                    File.WriteAllLines(IntermediateCopyLocalFilesCache, processor.ReferenceCopyLocalPaths);
                }
                catch (Exception ex)
                {
                    buildLogger.LogInfo("ProjectDirectory: " + ProjectDirectory);
                    buildLogger.LogInfo("IntermediateDirectory: " + IntermediateDirectory);
                    buildLogger.LogInfo("CurrentDirectory: " + Directory.GetCurrentDirectory());
                    buildLogger.LogInfo("AssemblyFile: " + AssemblyFile);
                    buildLogger.LogInfo("IntermediateCopyLocalFilesCache: " + IntermediateCopyLocalFilesCache);
                    buildLogger.LogError("Error writing IntermediateCopyLocalFilesCache: " + ex.Message);
                    return(false);
                }
            }
            else
            {
                if (File.Exists(IntermediateCopyLocalFilesCache))
                {
                    File.Delete(IntermediateCopyLocalFilesCache);
                }
            }

            return(success);
        }
 public Task Find() =>
 Verify(SolutionDirectoryFinder.Find(SourceFile));
Exemplo n.º 5
0
    public void ReturnNCrunchSolutionWhenPresent()
    {
        var result = SolutionDirectoryFinder.Find("Foo", "Baz", "Bar");

        Assert.Equal("Baz", result);
    }
Exemplo n.º 6
0
    public void IgnoreUndefinedSolution()
    {
        var result = SolutionDirectoryFinder.Find("*Undefined*", null, Environment.CurrentDirectory);

        Assert.Equal(Path.GetDirectoryName(Environment.CurrentDirectory), result);
    }
Exemplo n.º 7
0
    public void ReturnProjectParentWhenSolutionIsEmpty()
    {
        var result = SolutionDirectoryFinder.Find(null, null, Environment.CurrentDirectory);

        Assert.Equal(Path.GetDirectoryName(Environment.CurrentDirectory), result);
    }
 public Task Find()
 {
     return(Verifier.Verify(SolutionDirectoryFinder.Find(SourceFile)));
 }