private static void BuildAB(BuildParams param, bool onlyBuildAB)
        {
            var abDir  = BuildHelper.GetABDir(param.target);
            var abPath = BuildHelper.GetABDirPath(param.target);
            var option = BuildAssetBundleOptions.None;

            option |= BuildAssetBundleOptions.ChunkBasedCompression;
            BuildHelper.CreateDir(abPath);
            BuildPipeline.BuildAssetBundles(abDir, option, param.target);
            BuildLog.Log("BuildAB DONE!");
        }
 public int GetVersionCode()
 {
     if (string.IsNullOrEmpty(bundleVersionCode))
     {
         return(BuildHelper.ParseVersionCode(version));
     }
     else
     {
         return(int.Parse(bundleVersionCode));
     }
 }
 private static void InitBuildParams(BuildTarget target)
 {
     if (s_Param == null)
     {
         s_Param = BuildHelper.GetBuildParamsFromCommandLine(target);
         BuildLog.Log("BuildParams:" + s_Param);
     }
     else
     {
         s_Param.target = target;
     }
 }
        private static bool BuildPlayer(BuildParams param)
        {
            var sourAbPath = BuildHelper.GetABDirPath(param.target);
            var destAbPath = Application.streamingAssetsPath;

            if (!Directory.Exists(sourAbPath))
            {
                BuildLog.LogError("ab path not exists:" + sourAbPath);
                return(false);
            }
            BuildHelper.ClearDir(destAbPath);
            BuildHelper.CopyDir(sourAbPath, destAbPath, ".manifest|.meta");

            PlayerSettings.productName                     = param.productName;
            PlayerSettings.companyName                     = param.companyName;
            PlayerSettings.applicationIdentifier           = param.applicationIdentifier;
            PlayerSettings.bundleVersion                   = param.version;
            PlayerSettings.Android.bundleVersionCode       = param.GetVersionCode();
            PlayerSettings.iOS.buildNumber                 = param.GetVersionCode().ToString();
            PlayerSettings.iOS.appleEnableAutomaticSigning = true;
            PlayerSettings.iOS.appleDeveloperTeamID        = param.appleDeveloperTeamID;
            BuildPlayerOptions op = new BuildPlayerOptions();

            op.scenes           = new[] { param.startScene };
            op.locationPathName = param.GetLocationPathName();
            op.target           = param.target;
            op.options          = param.isDebug ?
                                  (BuildOptions.Development | BuildOptions.AllowDebugging | BuildOptions.ConnectWithProfiler) :
                                  BuildOptions.None;

            var result  = BuildPipeline.BuildPlayer(op);
            var summary = result.summary;

            if (summary.result == BuildResult.Succeeded)
            {
            }
            if (summary.result == BuildResult.Failed)
            {
                return(false);
            }
            return(true);
        }
 public string GetFileName()
 {
     if (!string.IsNullOrEmpty(fileNameFormatter))
     {
         var fileName = fileNameFormatter;
         if (fileName.IndexOf("{time}") >= 0)
         {
             fileName = fileName.Replace("{time}", BuildHelper.GetTimeString());
         }
         if (fileName.IndexOf("{version}") >= 0)
         {
             fileName = fileName.Replace("{version}", version);
         }
         if (fileName.IndexOf("{branch}") >= 0)
         {
             fileName = fileName.Replace("{branch}", branch);
         }
         return(fileName + BuildHelper.GetPackageFileNameExtention(target));
     }
     return(productName + BuildHelper.GetPackageFileNameExtention(target));
 }