private AntlrClassGenerationTaskInternal CreateBuildTaskWrapper()
        {
            var wrapper = new AntlrClassGenerationTaskInternal();

            IList <string> sourceCodeFiles = null;

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

            if (this.TokensFiles != null && this.TokensFiles.Length > 0)
            {
                Directory.CreateDirectory(OutputPath);

                HashSet <string> copied = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                foreach (ITaskItem taskItem in TokensFiles)
                {
                    string fileName = taskItem.ItemSpec;
                    if (!File.Exists(fileName))
                    {
                        Log.LogError("The tokens file '{0}' does not exist.", fileName);
                        continue;
                    }

                    string vocabName = Path.GetFileNameWithoutExtension(fileName);
                    if (!copied.Add(vocabName))
                    {
                        Log.LogWarning("The tokens file '{0}' conflicts with another tokens file in the same project.", fileName);
                        continue;
                    }

                    string target = Path.Combine(OutputPath, Path.GetFileName(fileName));
                    if (!Path.GetExtension(target).Equals(".tokens", StringComparison.OrdinalIgnoreCase))
                    {
                        Log.LogError("The destination for the tokens file '{0}' did not have the correct extension '.tokens'.", target);
                        continue;
                    }

                    File.Copy(fileName, target, true);
                    File.SetAttributes(target, File.GetAttributes(target) & ~FileAttributes.ReadOnly);
                }
            }

            wrapper.AntlrToolPath            = AntlrToolPath;
            wrapper.SourceCodeFiles          = sourceCodeFiles;
            wrapper.TargetLanguage           = TargetLanguage;
            wrapper.OutputPath               = OutputPath;
            wrapper.RootNamespace            = RootNamespace;
            wrapper.GeneratedSourceExtension = GeneratedSourceExtension;
            wrapper.LanguageSourceExtensions = LanguageSourceExtensions;
            wrapper.DebugGrammar             = DebugGrammar;
            wrapper.ProfileGrammar           = ProfileGrammar;
            return(wrapper);
        }
        private AntlrClassGenerationTaskInternal CreateBuildTaskWrapper(AppDomain domain)
        {
            AntlrClassGenerationTaskInternal wrapper = (AntlrClassGenerationTaskInternal)domain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, typeof(AntlrClassGenerationTaskInternal).FullName);

            IList <string> sourceCodeFiles = null;

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

            if (this.TokensFiles != null && this.TokensFiles.Length > 0)
            {
                HashSet <string> copied = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                foreach (ITaskItem taskItem in TokensFiles)
                {
                    string fileName = taskItem.ItemSpec;
                    if (!File.Exists(fileName))
                    {
                        Log.LogError("The tokens file '{0}' does not exist.", fileName);
                        continue;
                    }

                    string vocabName = Path.GetFileNameWithoutExtension(fileName);
                    if (!copied.Add(vocabName))
                    {
                        Log.LogWarning("The tokens file '{0}' conflicts with another tokens file in the same project.", fileName);
                        continue;
                    }

                    string target = Path.Combine(OutputPath, Path.GetFileName(fileName));
                    if (!Path.GetExtension(target).Equals(".tokens", StringComparison.OrdinalIgnoreCase))
                    {
                        Log.LogError("The destination for the tokens file '{0}' did not have the correct extension '.tokens'.", target);
                        continue;
                    }

                    File.Copy(fileName, target, true);
                    File.SetAttributes(target, File.GetAttributes(target) & ~FileAttributes.ReadOnly);
                }
            }

            wrapper.AntlrToolPath            = AntlrToolPath;
            wrapper.SourceCodeFiles          = sourceCodeFiles;
            wrapper.LibPaths                 = LibPaths;
            wrapper.Language                 = Language;
            wrapper.OutputPath               = OutputPath;
            wrapper.RootNamespace            = RootNamespace;
            wrapper.GeneratedSourceExtension = GeneratedSourceExtension;
            return(wrapper);
        }
        private AntlrClassGenerationTaskInternal CreateBuildTaskWrapper()
        {
            AntlrClassGenerationTaskInternal wrapper = new AntlrClassGenerationTaskInternal();

            IList <string> sourceCodeFiles = null;

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

            if (this.TokensFiles != null && this.TokensFiles.Length > 0)
            {
                Directory.CreateDirectory(OutputPath);

                HashSet <string> copied = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                foreach (ITaskItem taskItem in TokensFiles)
                {
                    string fileName = taskItem.ItemSpec;
                    if (!File.Exists(fileName))
                    {
                        Log.LogError("The tokens file '{0}' does not exist.", fileName);
                        continue;
                    }

                    string vocabName = Path.GetFileNameWithoutExtension(fileName);
                    if (!copied.Add(vocabName))
                    {
                        Log.LogWarning("The tokens file '{0}' conflicts with another tokens file in the same project.", fileName);
                        continue;
                    }

                    string target = Path.Combine(OutputPath, Path.GetFileName(fileName));
                    if (!Path.GetExtension(target).Equals(".tokens", StringComparison.OrdinalIgnoreCase))
                    {
                        Log.LogError("The destination for the tokens file '{0}' did not have the correct extension '.tokens'.", target);
                        continue;
                    }

                    File.Copy(fileName, target, true);
                    File.SetAttributes(target, File.GetAttributes(target) & ~FileAttributes.ReadOnly);
                }
            }

            wrapper.ToolPath                            = ToolPath;
            wrapper.SourceCodeFiles                     = sourceCodeFiles;
            wrapper.TargetLanguage                      = TargetLanguage;
            wrapper.TargetFrameworkVersion              = TargetFrameworkVersion;
            wrapper.OutputPath                          = OutputPath;
            wrapper.Encoding                            = Encoding;
            wrapper.LanguageSourceExtensions            = LanguageSourceExtensions;
            wrapper.TargetNamespace                     = TargetNamespace;
            wrapper.GenerateListener                    = GenerateListener;
            wrapper.GenerateVisitor                     = GenerateVisitor;
            wrapper.ForceAtn                            = ForceAtn;
            wrapper.AbstractGrammar                     = AbstractGrammar;
            wrapper.JavaVendor                          = JavaVendor;
            wrapper.JavaInstallation                    = JavaInstallation;
            wrapper.JavaExecutable                      = JavaExecutable;
            wrapper.UseCSharpGenerator                  = UseCSharpGenerator;
            wrapper.IncludeDebuggerNonUserCodeAttribute = IncludeDebuggerNonUserCodeAttribute;
            return(wrapper);
        }