Exemple #1
0
        /// <summary>
        /// Generate bundle number of build for Android and iOS.<br/>
        /// Format: <![CDATA[<revision><branchId><targetId>]]><br/>
        /// Where <i>revision</i> - parsed number from <see cref="GitRequest.Revision"/>;
        /// <i>branchId</i> - 0 if current branch is equal to <see cref="RELEASE_BRANCH"/>, otherwise 1.<br/>
        /// Example return: "23401" - revision is 234, release branch, targetId is 1.
        /// </summary>
        /// <param name="targetId">Default is 0. Target id for distinguish between builds for different
        /// targets on one platform (e.g. ARMv7 and x86 on Android).</param>
        /// <returns>Generated bundle number</returns>
        public static int GenBundleNumber(int targetId = 0)
        {
            var rev      = GitRequest.Revision(true);
            int branchId = GitRequest.CurrentBranch() == RELEASE_BRANCH ? 0 : 1;

            return(int.Parse(string.Format("{0}{1}{2}", rev, branchId, targetId)));
        }
Exemple #2
0
     private void OnGUI()
     {
         EditorGUILayout.LabelField(string.Format(
                                        @"Type the last part of version: e.g. 
 if full version is '2.1.234' - type '234';
 if '2.1.{0}1685c5a' - type '{0}1685c5a'."
                                        , BuildHelperStrings.PREFIX_DEVELOP), EditorStyles.helpBox);
         _txtVersion = EditorGUILayout.TextField("Generated version", _txtVersion);
         _count      = EditorGUILayout.IntSlider("Log length", _count, 1, 100);
         if (GUILayout.Button("Search"))
         {
             string branch;
             string rev = _txtVersion;
             if (rev.StartsWith(BuildHelperStrings.PREFIX_DEVELOP))
             {
                 rev    = rev.Substring(BuildHelperStrings.PREFIX_DEVELOP.Length);
                 branch = null;
             }
             else
             {
                 branch = BuildHelperStrings.RELEASE_BRANCH;
             }
             var found = GitRequest.FindRevision(rev, _count, branch);
             if (found.Length == 0)
             {
                 found = " not found";
             }
             Debug.LogFormat("Version {0}:\n{1}", _txtVersion, found);
         }
     }
Exemple #3
0
        /// <summary>
        /// Generate version of build for current git repository state.<br/>
        /// Format: <![CDATA[<major>.<minor>]]><br/>
        /// There is two type of minor versions:
        /// <list type="bullet">
        ///     <item>
        ///         <description>Minor version is pretty number, e.g. "2.1.234".
        ///         Returned if current branch is equal to <see cref="RELEASE_BRANCH"/></description>
        ///     </item>
        ///     <item>
        ///         <description>Minor version is revision id, e.g. "2.1.d-1685c5a".
        ///         Returned if current branch is <b>not</b> equal to <see cref="RELEASE_BRANCH"/></description>
        ///     </item>
        /// </list>
        /// Major version is a Version in Unity Player Settings (<see cref="PlayerSettings.bundleVersion"/>).
        /// </summary>
        /// <seealso cref="GitRequest.Revision"/>
        /// <returns>Ganerated version</returns>
        public static string GetBuildVersion()
        {
            var    branch = GitRequest.CurrentBranch();
            string version;

            if (branch == RELEASE_BRANCH)
            {
                version = GitRequest.Revision(true);
            }
            else
            {
                Debug.LogWarningFormat("Build development version from '{0}'", branch);
                version = PREFIX_DEVELOP + GitRequest.Revision(false);
            }
            return(PlayerSettings.bundleVersion + "." + version);
        }