void ExtractBuiltArtifacts(PartialClassGenerationTaskInternal wrapper)
        {
            foreach (string resource in wrapper.GeneratedResources)
            {
                this.generatedResources.Add(new TaskItem(resource));
            }

            foreach (string code in wrapper.GeneratedCodeFiles)
            {
                this.generatedCodeFiles.Add(new TaskItem(code));
            }

            this.RequiresCompilationPass2 = wrapper.RequiresCompilationPass2 ||
                                            (this.XamlBuildTypeInspectionExtensionNames != null && this.XamlBuildTypeInspectionExtensionNames.Length > 0);
        }
        bool ExecuteInternal(AppDomain appDomain)
        {
            PartialClassGenerationTaskInternal wrapper = (PartialClassGenerationTaskInternal)appDomain.CreateInstanceAndUnwrap(
                Assembly.GetExecutingAssembly().FullName,
                typeof(PartialClassGenerationTaskInternal).FullName);

            PopulateBuildArtifacts(wrapper);

            bool ret = wrapper.Execute();

            if (ret)
            {
                ExtractBuiltArtifacts(wrapper);
            }
            return(ret);
        }
        void PopulateBuildArtifacts(PartialClassGenerationTaskInternal wrapper)
        {
            IList <ITaskItem> applicationMarkup = null;

            if (this.ApplicationMarkup != null)
            {
                applicationMarkup = this.ApplicationMarkup
                                    .Select(i => new DelegatingTaskItem(i) as ITaskItem).ToList();
            }
            wrapper.ApplicationMarkup = applicationMarkup;

            wrapper.BuildLogger = this.Log;

            wrapper.References = this.References
                                 .Select(i => new DelegatingTaskItem(i) as ITaskItem).ToList();

            IList <string> sourceCodeFiles = null;

            if (this.SourceCodeFiles != null)
            {
                sourceCodeFiles = new List <string>(this.SourceCodeFiles.Length);
                foreach (ITaskItem taskItem in this.SourceCodeFiles)
                {
                    sourceCodeFiles.Add(taskItem.ItemSpec);
                }
            }
            wrapper.SourceCodeFiles = sourceCodeFiles;

            wrapper.Language                     = this.Language;
            wrapper.AssemblyName                 = this.AssemblyName;
            wrapper.OutputPath                   = this.OutputPath;
            wrapper.RootNamespace                = this.RootNamespace;
            wrapper.GeneratedSourceExtension     = this.GeneratedSourceExtension;
            wrapper.IsInProcessXamlMarkupCompile = this.IsInProcessXamlMarkupCompile;
            wrapper.MSBuildProjectDirectory      = this.MSBuildProjectDirectory;
            wrapper.XamlBuildTaskTypeGenerationExtensionNames = XamlBuildTaskServices.GetXamlBuildTaskExtensionNames(this.XamlBuildTypeGenerationExtensionNames);
            if (this.XamlBuildTypeInspectionExtensionNames != null && this.XamlBuildTypeInspectionExtensionNames.Length > 0)
            {
                wrapper.MarkupCompilePass2ExtensionsPresent = true;
            }

            wrapper.SupportExtensions = this.supportExtensions;
        }
        void ExtractBuiltArtifacts(PartialClassGenerationTaskInternal wrapper)
        {
            foreach (string resource in wrapper.GeneratedResources)
            {
                this.generatedResources.Add(new TaskItem(resource));
            }

            foreach (string code in wrapper.GeneratedCodeFiles)
            {
                this.generatedCodeFiles.Add(new TaskItem(code));
            }

            this.RequiresCompilationPass2 = wrapper.RequiresCompilationPass2 ||
                (this.XamlBuildTypeInspectionExtensionNames != null && this.XamlBuildTypeInspectionExtensionNames.Length > 0);
        }
        void PopulateBuildArtifacts(PartialClassGenerationTaskInternal wrapper)
        {
            IList<ITaskItem> applicationMarkup = null;
            if (this.ApplicationMarkup != null)
            {
                applicationMarkup = this.ApplicationMarkup
                    .Select(i => new DelegatingTaskItem(i) as ITaskItem).ToList();
            }
            wrapper.ApplicationMarkup = applicationMarkup;

            wrapper.BuildLogger = this.Log;

            wrapper.References = this.References
                .Select(i => new DelegatingTaskItem(i) as ITaskItem).ToList();

            IList<string> sourceCodeFiles = null;
            if (this.SourceCodeFiles != null)
            {
                sourceCodeFiles = new List<string>(this.SourceCodeFiles.Length);
                foreach (ITaskItem taskItem in this.SourceCodeFiles)
                {
                    sourceCodeFiles.Add(taskItem.ItemSpec);
                }
            }
            wrapper.SourceCodeFiles = sourceCodeFiles;

            wrapper.Language = this.Language;
            wrapper.AssemblyName = this.AssemblyName;
            wrapper.OutputPath = this.OutputPath;
            wrapper.RootNamespace = this.RootNamespace;
            wrapper.GeneratedSourceExtension = this.GeneratedSourceExtension;
            wrapper.IsInProcessXamlMarkupCompile = this.IsInProcessXamlMarkupCompile;
            wrapper.MSBuildProjectDirectory = this.MSBuildProjectDirectory;
            wrapper.XamlBuildTaskTypeGenerationExtensionNames = XamlBuildTaskServices.GetXamlBuildTaskExtensionNames(this.XamlBuildTypeGenerationExtensionNames);
            if (this.XamlBuildTypeInspectionExtensionNames != null && this.XamlBuildTypeInspectionExtensionNames.Length > 0)
            {
                wrapper.MarkupCompilePass2ExtensionsPresent = true;
            }

            wrapper.SupportExtensions = this.supportExtensions;
        }