private static List <AssertException> CheckAsserts(string android_sdk_path, string ant_path, Mod mod)
        {
            if (mod == null)
            {
                return(new List <AssertException>());
            }
            XmlNode asserts       = mod.Xml.DocumentElement.SelectSingleNode("assert");
            var     exceptionList = new List <AssertException>();

            if (asserts != null)
            {
                foreach (XmlNode node in asserts.ChildNodes)
                {
                    try{
                        switch (node.Name)
                        {
                        case "android-sdk":
                            CheckAndroidSdk(node, android_sdk_path);
                            break;

                        case "jdk":
                            CheckJdk(node);
                            break;

                        case "ant":
                            CheckAnt(node, ant_path);
                            break;

                        default:
                            Debug.LogWarning("Unknown node: '" + node.Name + "' in assert partment in file: " + mod.path);
                            break;
                        }
                    }
                    catch (AssertException e)
                    {
                        exceptionList.Add(e);
                    }
                }
            }


            foreach (Mod lib in mod.Reference)
            {
                exceptionList.AddRange(BuildTask_AndroidUtility.CheckAsserts(android_sdk_path, ant_path, lib));
            }

            return(exceptionList);
        }
Esempio n. 2
0
        public override void OnPreBuild()
        {
            Process(1, "Detect Paths", "");
            this.startTime = DateTime.Now;
            this.global    = Configuration.Gloable;
            this.local     = Configuration.Local;
            this.global.Repaire();
            this.local.Repaire();
            //var modPath = global["android.conf"];
            // 根据ModName到Mod目录中寻找Mod的路径
            //Debug.LogError("this.modName;"+this.modName);

            /*
             * if (!string.IsNullOrEmpty(this.modName))
             * {
             *  this.mod = new Mod(Path.Combine(this.global.AndroidSrcDir, this.modName));
             *
             *  // add lib Refenrence
             *  //DirectoryInfo lib_dir = new DirectoryInfo(global["android.lib.dir"]);
             *  //DirectoryInfo src_dir = new DirectoryInfo(global["android.src.dir"]);
             *  DirectoryInfo src_dir = new DirectoryInfo(this.mod.subModPath);
             *  var libs = src_dir.GetDirectories("*.eupe", SearchOption.TopDirectoryOnly);
             *  string[] libs_path = (from d in libs
             *                       select d.FullName).ToArray();
             *  foreach (var lib in libs_path)
             *  {
             *      this.mod.AddReference(lib);
             *  }
             * }
             */

            Process(2, "Check asserts", "");
            var exceptionList = BuildTask_AndroidUtility.CheckAsserts(this.local, UseBackup, this.global);

            if (exceptionList.Count > 0)
            {
                string msg   = "Packaging can not start because of the following reasons:\n";
                int    index = 1;
                foreach (AssertException e in exceptionList)
                {
                    msg += "    " + index + "). " + e.Message + "\n";
                    index++;
                }
                throw new Exception(msg);
            }
        }