Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
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;
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 编译顺序为:表结构、存储过程、公用原子、其他原子、周边原子、外围原子、公用业务逻辑、同步业务逻辑、其他业务逻辑、周边业务逻辑、外围业务逻辑、
        /// 适配器业务逻辑(有些产品因为模块依赖关系,顺序需要调整,如消费支付的消费支付通知要在公用之后,其他之前编译)、DLL;
        /// 此处,编译SO前要比对SRC
        /// </summary>
        /// <param name="ap"></param>
        /// <returns></returns>
        private bool InsertCom(AmendPack ap, CommitCom c)
        {
            // 只要TablePatch在Patch和过程之前就可以了 根据 ComType的枚举顺序确定
            int i = 0;
            while (i < ap.ComComms.Count && (ap.ComComms[i] as CommitCom).ctype <= c.ctype)
            {
                i++;
            }
            ap.ComComms.Insert(i, c);

            return true;
        }
Ejemplo n.º 4
0
        public bool ProcessComs(AmendPack ap)
        {
            bool Result = true;
            // 清除掉组件列表,重新添加
            ap.ComComms.Clear();
            // 读取readme,重新集成,由于小球上查询的数据库记录的信息冗余,
            try
            {
                // Create an instance of StreamReader to read from a file.
                // The using statement also closes the StreamReader.
                using (StreamReader sr = new StreamReader(ap.SCMAmendDir + "/" + ap.Readme,
                    Encoding.GetEncoding("gb2312")))
                {
                    string line, name, version;
                    int index, index1;

                    // 读到时停止
                    while ((line = sr.ReadLine()) != null && line.IndexOf("涉及的程序及文件: ") < 0)
                        ;

                    sr.ReadLine(); // 跳过"涉及的程序及文件 ..."这行字

                    // 处理递交的组件
                    while ((line = sr.ReadLine()) != null && line.IndexOf("存放路径: ") < 0)
                    {
                        // 跳过空行
                        if (line.Trim() == string.Empty)
                            continue;

                        // 跳过 src 行
                        // 20131107 src-V -> 改为 SRC 判断,以支持账户系统集成
                        if (line.Trim().ToUpper().IndexOf("SRC") >= 0)
                            continue;

                        // 连续读取两行,一行文件说明和版本,一行存放路径
                        // 读取源代码路径,小包下面没有路径,不用读取
                        index = line.IndexOf("[");
                        name = line.Substring(0, index).Trim();
                        index = line.LastIndexOf("["); // 希望读第一个 "[" 和最后一个 "]" 能够处理掉
                        index1 = line.LastIndexOf("]");
                        version = line.Substring(index + 1, index1 - index - 1);

                        // 判断是否是临时包
                        if (int.Parse(version.Substring(version.LastIndexOf(".") + 1)) > 500)
                        {
                            ap.TempModiFlag = true;
                            break;
                        }

                        // 生成组件信息
                        CommitCom c = new CommitCom(name, version);

                        if (c.ctype != ComType.Ssql)
                        {
                            line = sr.ReadLine().Trim();
                            if (line == string.Empty)
                            {
                                log.WriteErrorLog("无法取到文件路径信息,请检查!组件名:" + name);
                                return false;
                            }
                            c.path = line.Substring(1, line.Length - 2); // 去除头部和尾部的 []
                        }
                        else
                        {
                            c.path = "";
                        }

                        if (c.ctype == ComType.Xml && (c.path.IndexOf(".xls") >= 0    // Path.GetExtension 对于箭头字符会判断非法,换成 stirng.index
                            || c.cname.IndexOf("s_ls_") >= 0 || c.cname.IndexOf("s_as_") >= 0  // CRESxml定义
                            || c.cname.IndexOf("functionlist") >= 0))  // cres 有 funclist.xml 需要特别处理
                        {
                            c.ctype = ComType.FuncXml;
                        }

                        if (c.ctype == ComType.Nothing)
                        {
                            log.WriteErrorLog("无法确定的递交组件类型!" + c.cname);
                            return false;
                        }

                        InsertCom(ap, c);
                    }
                }
            }
            catch (Exception ex)
            {
                log.WriteErrorLog("ProcessComs异常 ReadMe:" + ap.Readme + " " + ex.Message);
                return false;
            }

            if (ap.TempModiFlag)
            {
                string message = "该修改单中存在递交项>500,应该是临时包,确认继续处理?";
                string caption = "测试";

                DialogResult dRes = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (dRes == System.Windows.Forms.DialogResult.No)
                {
                    Result = false;
                }
            }

            // 输出下处理结果
            //log.WriteInfoLog("ProcessComs...");
            /*
            log.WriteInfoLog(System.Reflection.MethodBase.GetCurrentMethod().Name);
            foreach (CommitCom c in ap.ComComms)
            {
                log.WriteInfoLog(c.cname + " " + Enum.GetName(typeof(ComStatus), c.cstatus)
                    + " " + Enum.GetName(typeof(ComType), c.ctype) + " " + c.cver + " " + c.path);
            }
             * */
            return Result;
        }
Ejemplo n.º 5
0
 public override bool CompileFront(CommitCom c)
 {
     return base.CompileFront(c);
 }
Ejemplo n.º 6
0
 public override Detail GetDetail(CommitCom c)
 {
     return Dls.FindByName(c);
 }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
0
 public override bool CompileBackEnd(CommitCom c)
 {
     return CompileExcel(c);
 }
Ejemplo n.º 9
0
 public override Detail GetDetail(CommitCom c)
 {
     Detail d = new Detail(c);
     return d;
 }
Ejemplo n.º 10
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;
        }
Ejemplo n.º 11
0
 public virtual Detail GetDetail(CommitCom c)
 {
     return null;
 }
Ejemplo n.º 12
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;
        }
Ejemplo n.º 13
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;
        }
Ejemplo n.º 14
0
 public virtual bool CompileBackEnd(CommitCom c)
 {
     return true;
 }
Ejemplo n.º 15
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;
        }