Beispiel #1
0
        public void DoTransforms(string currentDirectory)
        {
            var explicitTransforms  = GetExplicitTransforms();
            var automaticTransforms = GetAutomaticTransforms();
            var sourceExtensions    = GetSourceExtensions(explicitTransforms);

            var allTransforms = explicitTransforms.Concat(automaticTransforms).ToList();
            var transformDefinitionsApplied   = new List <XmlConfigTransformDefinition>();
            var duplicateTransformDefinitions = new List <XmlConfigTransformDefinition>();
            var transformFilesApplied         = new HashSet <Tuple <string, string> >();
            var diagnosticLoggingEnabled      = variables.GetFlag(KnownVariables.Package.EnableDiagnosticsConfigTransformationLogging);

            if (diagnosticLoggingEnabled)
            {
                log.Verbose($"Recursively searching for transformation files that match {string.Join(" or ", sourceExtensions)} in folder '{currentDirectory}'");
            }
            foreach (var configFile in MatchingFiles(currentDirectory, sourceExtensions))
            {
                if (diagnosticLoggingEnabled)
                {
                    log.Verbose($"Found config file '{configFile}'");
                }
                ApplyTransformations(configFile, allTransforms, transformFilesApplied,
                                     transformDefinitionsApplied, duplicateTransformDefinitions, diagnosticLoggingEnabled, currentDirectory);
            }

            LogFailedTransforms(explicitTransforms, automaticTransforms, transformDefinitionsApplied, duplicateTransformDefinitions, diagnosticLoggingEnabled);
            variables.SetStrings(KnownVariables.AppliedXmlConfigTransforms, transformFilesApplied.Select(t => t.Item1), "|");
        }