Example #1
0
        /// <summary>
        /// 设置递交组件,作废,由处理ReadMe时读取Coms操作,数据库记录不可靠
        /// </summary>
        private void SetComs()
        {
            ComComms.Clear();
            // 查询出的组件是如下的一段
            // config.ini  [V6.1.4.7]  GJShortMessage.dll  [V6.1.4.1]  HsNoticeSvr.exe  [V6.1.4.6]
            // 需要进行分解,操作如下
            string name, version, line, cs = ComString;

            int i = -1, s = 0, e = 0;

            while ((i = cs.IndexOf("\r\n")) > 0)
            {
                line = cs.Substring(0, i);
                s    = line.IndexOf("[");           // 取第一个版本分隔符号
                name = line.Substring(0, s).Trim(); // 程序名称

                s       = line.LastIndexOf("[");
                e       = line.LastIndexOf("]");            // 取版本分隔符号
                version = line.Substring(s + 1, e - s - 1); // 程序版本
                CommitCom c = new CommitCom(name, version);
                // 添加组件
                ComComms.Add(c);

                // 取剩余递交项
                cs = cs.Substring(i + 2);
            }
        }
Example #2
0
        public virtual Boolean CompileSql(CommitCom c)
        {
            bool   Result = true;
            string path   = string.Empty;
            string u      = string.Empty;

            foreach (string user in c.users)
            {
                if (c.ctype == ComType.Sql)
                {
                    path = Path.Combine(OutDir, c.cname);
                }
                else
                {
                    path = c.sawfile.LocalPath;
                }

                u = GetConnDesc(user);
                if (u == string.Empty)
                {
                    Result = false;
                    log.WriteErrorLog("无法确认用户连接。" + c.cname + " " + user);
                    break;
                }

                Result = CompileSqlOne(u, path);
                if (!Result)
                {
                    break;
                }
            }
            return(Result);
        }
Example #3
0
        public Detail(CommitCom c)
        {
            this.Name = c.cname;
            Pas       = c.cname.Replace("libs_", "").Replace("flow.10.so", "");
            ProcFiles = new ArrayList();
            MiddFiles = new ArrayList();
            Gcc       = "s_" + Pas + "flow.gcc";
            SO        = "libs_" + Pas + "flow.10.so";
            ProcFiles.Add(Gcc);

            ProcFiles.Add("s_" + Pas + "func.h");

            if (c.cname.IndexOf("s_ls_") >= 0)
            {
                ProcFiles.Add("s_" + Pas + "flow.cpp");
                ProcFiles.Add("s_" + Pas + "func.cpp"); // 与原子与逻辑不同
            }
            else if (c.cname.IndexOf("s_as_") >= 0)
            {
                ProcFiles.Add("s_" + Pas + "flow.pc");
                ProcFiles.Add("s_" + Pas + "func.pc");

                MiddFiles.Add("s_" + Pas + "func.cpp");
            }

            MiddFiles.Add("s_" + Pas + "flow.o");
            MiddFiles.Add("s_" + Pas + "func.o");

            Compile = false;
            Show    = true;
        }
Example #4
0
        public virtual bool CompileFront(CommitCom c)
        {
            string Lang;
            int    Ver;

            GetLangVer(c.cname, out Lang, out Ver);

            // 确定工程名称
            string dPro   = Path.Combine(c.sawfile.LocalPath, Path.GetFileNameWithoutExtension(c.cname) + ".dpr");
            bool   Result = CompileDpr(Ver, dPro, OutDir);

            return(Result);
        }
Example #5
0
 public Detail FindByName(CommitCom c)
 {
     if (c.ctype == ComType.SO)
     {
         return(FindBySo(c.cname));
     }
     else if (c.ctype == ComType.Sql)
     {
         return(FindBySql(c.cname));
     }
     else if (c.ctype == ComType.FuncXml)
     {
         return(FindByFuncXml(c.cname));
     }
     else
     {
         return(null);
     }
 }
Example #6
0
        private bool CompileHDT2(CommitCom c)
        {
            bool Result = true;

            //分解Project
            string t        = c.sawfile.LocalPath;
            string Pdata    = string.Empty;
            string Pproject = string.Empty;
            string Pbiz     = string.Empty;
            string FlagStr  = string.Empty;

            if (c.ctype == ComType.FuncXml && c.cname.IndexOf("functionlist") >= 0)
            {
                Pdata    = Path.Combine(WorkSpace, @"Sources\DevCodes");
                Pproject = name;  // 用项目配置
                Pbiz     = c.cname;
                FlagStr  = "functionlist文件生成完成";
            }
            else
            {
                int i = t.IndexOf("DevCodes");
                Pdata    = t.Substring(0, i + 8); //
                t        = t.Substring(i + 9);
                i        = t.IndexOf("\\");
                Pproject = t.Substring(0, i);
                Pbiz     = t.Substring(i + 1);
                FlagStr  = "生成模块代码总耗时";
            }


            // 开发工具限制,一定要在HDT下调用程序,否则总是会报下JAVA的错误,因此通过批处理编译,批处理中先将目录进行切换。
            Process p = new Process();

            p.StartInfo.FileName  = "cm_back.bat";
            p.StartInfo.Arguments = " " + Pdata + " " + Pproject + " " + Pbiz + " " + OutDir;
            log.WriteLog("[编译命令] " + p.StartInfo.FileName + p.StartInfo.Arguments);
            p.StartInfo.UseShellExecute        = false;
            p.StartInfo.RedirectStandardInput  = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError  = true;
            p.StartInfo.CreateNoWindow         = true;

            p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
            p.ErrorDataReceived  += new DataReceivedEventHandler(p_OutputDataReceived);

            p.Start();    // 启动

            p.BeginOutputReadLine();
            p.BeginErrorReadLine();
            p.WaitForExit();
            p.Close();

            // <提示>经纪业务运营平台V21已经存在 输出在错误流
            if (sBuilder.ToString().IndexOf("Exception") >= 0 || // 异常
                sBuilder.ToString().IndexOf("exception") >= 0 ||  // 异常
                sBuilder.ToString().IndexOf("错误信息") >= 0)    // 文件缺失时,<警告>模块代码已生成,但有错误信息。请参考日志文件:file:/E:/hstrade20/trun

            {
                log.WriteLog("HDT编译过程可能有错误,请检查日志文件确认!", LogLevel.Error);
                Result = false;
            }

            log.WriteLog("编译结束 " + c.cname);
            return(Result);
        }
Example #7
0
        private bool CompileHDT(CommitCom c)
        {
            bool Result = true;

            //分解Project
            string t        = c.sawfile.LocalPath;
            string Pdata    = string.Empty;
            string Pproject = string.Empty;
            string Pbiz     = string.Empty;
            string FlagStr  = string.Empty;

            if (c.ctype == ComType.FuncXml && c.cname.IndexOf("functionlist") >= 0)
            {
                Pdata    = Path.Combine(WorkSpace, @"Sources\DevCodes");
                Pproject = name;  // 用项目配置
                Pbiz     = c.cname;
                FlagStr  = "functionlist文件生成完成";
            }
            else
            {
                int i = t.IndexOf("DevCodes");
                Pdata    = t.Substring(0, i + 8); //
                t        = t.Substring(i + 9);
                i        = t.IndexOf("\\");
                Pproject = t.Substring(0, i);
                Pbiz     = t.Substring(i + 1);
                FlagStr  = "生成模块代码总耗时";
            }


            // 开发工具限制,一定要在HDT下调用程序,否则总是会报下JAVA的错误,因此通过批处理编译,批处理中先将目录进行切换。
            Process p = new Process();

            p.StartInfo.FileName               = "cm_back.bat";
            p.StartInfo.Arguments              = " " + Pdata + " " + Pproject + " " + Pbiz + " " + OutDir;
            p.StartInfo.UseShellExecute        = false;
            p.StartInfo.RedirectStandardInput  = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError  = true;
            p.StartInfo.CreateNoWindow         = true;
            p.Start();

            string strOutput = p.StandardOutput.ReadToEnd();

            log.WriteFileLog("[编译命令] " + p.StartInfo.FileName + p.StartInfo.Arguments);
            log.WriteFileLog("[编译日志]");
            log.WriteFileLog("编译输出:");
            if (strOutput.IndexOf(FlagStr) < 0)
            {
                log.WriteLog(strOutput, LogLevel.Error);
                Result = false;
            }
            else
            {
                log.WriteLog(strOutput);
            }

            log.WriteFileLog("[编译结束]");
            p.WaitForExit();
            p.Close();

            return(Result);
        }
Example #8
0
 public override bool CompileBackEnd(CommitCom c)
 {
     return(CompileHDT2(c));
 }
Example #9
0
 public override bool CompileFront(CommitCom c)
 {
     return(base.CompileFront(c));
 }
Example #10
0
        public override Detail GetDetail(CommitCom c)
        {
            Detail d = new Detail(c);

            return(d);
        }
Example #11
0
        // 编译Excel文件或者后台Sql
        private bool CompileExcel(CommitCom c)
        {
            // 确定详细设计说明书文件
            MacroType m;
            Detail    d = Dls.FindByName(c);

            if (d == null)
            {
                log.WriteErrorLog("查找不到对应的详细设计说明书模块!");
                return(false);
            }

            // 标定index
            bool Result = true;
            int  index  = Dls.IndexOf(d) + 1;

            // 先把存在的CError删除,以检测是否发生编译错误
            if (File.Exists(Path.Combine(OutDir, "CError.txt")))
            {
                File.Delete(Path.Combine(OutDir, "CError.txt"));
            }

            // 编译Excel 最耗时,对Excel检查是否需要编译,比较PC文件
            bool     bNew = false;
            DateTime t2   = File.GetLastWriteTime(c.sawfile.LocalPath);
            DateTime t1   = t2.AddSeconds(-1);

            if (c.ctype == ComType.SO)
            {
                foreach (string s in d.ProcFiles)
                {
                    t1 = File.GetLastWriteTime(Path.Combine(OutDir, s));
                    if (DateTime.Compare(t1, t2) > 0)
                    {
                        bNew = true;
                        break;
                    }
                }
            }
            else if (c.ctype == ComType.Sql || c.ctype == ComType.FuncXml)
            {
                if (c.ctype == ComType.Sql)
                {
                    t1 = File.GetLastWriteTime(Path.Combine(OutDir, d.SqlFile));
                }
                else
                {
                    t1 = File.GetLastWriteTime(Path.Combine(OutDir, d.XmlFile));
                }

                if (DateTime.Compare(t1, t2) > 0)
                {
                    bNew = true;
                }
            }

            if (bNew)
            {
                log.WriteLog("本地源代码时间晚于Excel文件时间,不需集成处理!" + c.cname + " " + c.ctype);
                return(true);
            }

            if (c.ctype == ComType.SO)
            {
                m = MacroType.ProC;
            }
            else if (c.ctype == ComType.Sql)
            {
                m = MacroType.SQL;
            }
            else if (c.ctype == ComType.FuncXml)
            {
                m = MacroType.FuncXml;
            }
            else
            {
                return(true);
            }

            Result = Exh.ScmRunExcelMacro(m, index, OutDir);

            if (!Result)
            {
                return(false);
            }
            else if (File.Exists(Path.Combine(OutDir, "CError.txt")))
            {
                Result = false;
                log.WriteErrorLog("检测到编译错误文件 CError.txt,请确认!");
            }

            return(Result);
        }
Example #12
0
 public override Detail GetDetail(CommitCom c)
 {
     return(Dls.FindByName(c));
 }
Example #13
0
 public virtual bool CompileBackEnd(CommitCom c)
 {
     return(true);
 }
Example #14
0
 public virtual Detail GetDetail(CommitCom c)
 {
     return(null);
 }