コード例 #1
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);
            }
        }
コード例 #2
0
        public static List <AssertException> CheckAsserts(Mod mod, Conf_Local local, bool useBackUp, Conf_Gloable global)
        {
            // check asset
            //var exceptionList = BuildTask_AndroidUtility.CheckAsserts(local["android.sdk"], local["ant.sdk"], mod);
            var exceptionList = new List <AssertException>();

            // check Java Home

            /*
             *          if(OSUtil.Platform == Platform.Windows){
             *                  string java_home = Environment.GetEnvironmentVariable("JAVA_HOME");
             *                  Debug.Log("java_home:" + java_home);
             *                  if(java_home == null){
             *                          exceptionList.Add(new AssertException("'JAVA_HOME' is not found."));
             *                  }
             *          }
             *
             *          // check Platform
             *          if(EditorUserBuildSettings.activeBuildTarget != BuildTarget.Android)
             *          {
             *                  exceptionList.Add(new AssertException("Current platform is not Android. (now is " + EditorUserBuildSettings.activeBuildTarget + ")"));
             *          }
             */

            // check backup
            if (useBackUp)
            {
                var di = new DirectoryInfo(global["temp.dir"] + "/android/eclipse_project_backup");
                if (!di.Exists)
                {
                    exceptionList.Add(new AssertException("Eclipse project backup not exsits. retry with setting 'Build Option' to 'Rebuild' in NativeBuilder Android Build pannel. (Once Eclipse project be rebuilt, NativeBuilder will backup it)\npath:" + di.FullName));
                }
            }

            return(exceptionList);
        }