Пример #1
0
        /// <include file='Funq.Build.xdoc' path='docs/doc[@for="GenerateFunqlet.Execute"]/*'/>
        public override bool Execute()
        {
            // The filter by copylocal should be done in the .targets
            var exportedTypes = this.Assemblies
                                .Where(item => item.GetMetadata("CopyLocal") == "true")
                                .Select(item => Assembly.LoadFrom(item.GetMetadata("FullPath")))
                                .SelectMany(asm => asm.GetTypes())
                                .Where(type =>
                                       type.HasCustomAttribute <ExportAttribute>(false) ||
                                       type.HasCustomAttribute <InheritedExportAttribute>(true));

            var template = new FunqletTemplate
            {
                Exports         = BuildExports(exportedTypes),
                TargetNamespace = TargetNamespace,
            };

            var fileName = Path.Combine(this.OutputPath, this.TargetNamespace + ".Funqlet.cs");

            File.WriteAllText(fileName, template.TransformText(), Encoding.UTF8);

            this.Funqlet = new TaskItem(fileName);

            this.Log.LogMessage(Resources.GenerateSuccessfull, fileName);

            return(true);
        }
Пример #2
0
        /// <include file='Funq.Build.xdoc' path='docs/doc[@for="GenerateFunqlet.Execute"]/*'/>
        public override bool Execute()
        {
            // The filter by copylocal should be done in the .targets
            var exportedTypes = this.Assemblies
                .Where(item => item.GetMetadata("CopyLocal") == "true")
                .Select(item => Assembly.LoadFrom(item.GetMetadata("FullPath")))
                .SelectMany(asm => asm.GetTypes())
                .Where(type =>
                    type.HasCustomAttribute<ExportAttribute>(false) ||
                    type.HasCustomAttribute<InheritedExportAttribute>(true));

            var template = new FunqletTemplate
            {
                Exports = BuildExports(exportedTypes),
                TargetNamespace = TargetNamespace,
            };

            var fileName = Path.Combine(this.OutputPath, this.TargetNamespace + ".Funqlet.cs");

            File.WriteAllText(fileName, template.TransformText(), Encoding.UTF8);

            this.Funqlet = new TaskItem(fileName);

            this.Log.LogMessage(Resources.GenerateSuccessfull, fileName);

            return true;
        }