Beispiel #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Do the import
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void ExecuteTask()
        {
            base.ExecuteTask();

            // Check to see if any of the underlying IDL files have changed
            // Otherwise, it's not necessary to reimport.
            if (NeedsCompiling())
            {
                Log(Level.Info, "Importing {0}", Path.GetFileName(IdlFile));

                try
                {
                    IDLImporter   importer        = new IDLImporter();
                    List <string> usingNamespaces = new List <string>();
                    foreach (UsingNamespace ns in m_usingNamespaces)
                    {
                        usingNamespaces.Add(ns.Namespace);
                    }

                    bool fOk = importer.Import(usingNamespaces, IdlFile, m_configfile,
                                               OutputFile.FullName, Namespace, m_idhFiles.FileNames,
                                               m_refFiles.FileNames, m_fCreateXmlComments);
                    if (!fOk)
                    {
                        throw new BuildException("Import failed: data has errors", Location);
                    }
                }
                catch (Exception e)
                {
                    throw new BuildException("Import failed.", Location, e);
                }
            }
        }
Beispiel #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Do the import
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override bool Execute()
        {
            try
            {
                IDLImporter importer   = new IDLImporter();
                var         namespaces = new List <string>();
                foreach (var s in GetFilesFrom(UsingNamespaces))
                {
                    Log.LogMessage(MessageImportance.Low, "Using namespace " + s);
                    namespaces.Add(s);
                }


                foreach (var idlFile in Sources)
                {
                    //Log.LogMessage(MessageImportance.Normal, "Creating IDL File " + Path.GetFileName(idlFile.ItemSpec));
                    Log.LogMessage(MessageImportance.Normal, "Processing IDL File " + Path.GetFileName(idlFile.ItemSpec) + " to produce " + Output);
                    foreach (var s in GetFilesFrom(IdhFiles))
                    {
                        Log.LogMessage(MessageImportance.Low, "IDH: " + s);
                    }
                    foreach (var s in GetFilesFrom(ReferenceFiles))
                    {
                        Log.LogMessage(MessageImportance.Low, "references: " + s);
                    }
                    bool fOk = importer.Import(namespaces, idlFile.ItemSpec, null,
                                               Output, Namespace, GetFilesFrom(IdhFiles),
                                               GetFilesFrom(ReferenceFiles), CreateXmlComments);
                    if (!fOk)
                    {
                        Log.LogMessage(MessageImportance.High, "IDL Import failed: data has errors " + Path.GetFileName(idlFile.ItemSpec));
                        return(false);
                    }
                }
            }

            catch (Exception e)
            {
                Log.LogMessage(MessageImportance.High, "IDL Import threw an exception: " + e.Message);
                return(false);
            }
            return(true);
        }