Exemple #1
0
        /// <summary>
        /// Loads the cache if it exists
        /// If no cache file exists, default values are loaded
        /// </summary>
        /// <returns>Returns the loaded version cache object</returns>
        public static VersionCache Load()
        {
            if (!File.Exists(savePath))
            {
                return(new VersionCache());
            }
            string       json         = File.ReadAllText(savePath);
            VersionCache versionCache = JsonUtility.FromJson <VersionCache>(json);

            versionCache.wsaVersion = Version.Parse(versionCache.strWsaVersion);
            return(versionCache);
        }
Exemple #2
0
        // restores the versions
        private void RestoreVersions()
        {
            VersionCache cache = VersionCache.Load();

            Debug.Log($"[{GitVersionBuildStep.toolName}] Restoring version config:\n" +
                      $"{PlayerSettings.bundleVersion}->{cache.appVersion}\n" +
                      $"{PlayerSettings.WSA.packageVersion}->{cache.wsaVersion}\n" +
                      $"{PlayerSettings.Android.bundleVersionCode}->{cache.androidVersion}"
                      );
            PlayerSettings.bundleVersion             = cache.appVersion;
            PlayerSettings.WSA.packageVersion        = cache.wsaVersion;
            PlayerSettings.Android.bundleVersionCode = cache.androidVersion;
        }
Exemple #3
0
        // caches the project's original version configuration
        // so that it can be restored after the build
        private void CacheVersionConfig()
        {
            Debug.Log($"[{GitVersionBuildStep.toolName}] Caching version config:\n" +
                      $"{PlayerSettings.bundleVersion}\n" +
                      $"{PlayerSettings.WSA.packageVersion}\n" +
                      $"{PlayerSettings.Android.bundleVersionCode}");
            VersionCache cache = new VersionCache();

            cache.appVersion     = PlayerSettings.bundleVersion;
            cache.wsaVersion     = PlayerSettings.WSA.packageVersion;
            cache.androidVersion = PlayerSettings.Android.bundleVersionCode;

            cache.Save();
            Debug.Log($"[{GitVersionBuildStep.toolName}] Saved temporary cache");
        }
Exemple #4
0
 /// <summary>
 /// Called once the build has finished
 /// Restores version project settings that have been altered by the version tool
 /// </summary>
 /// <param name="report">A report about the build</param>
 public void OnPostprocessBuild(BuildReport report)
 {
     RestoreVersions();
     Debug.Log($"[{GitVersionBuildStep.toolName}] Removing temporary cache");
     VersionCache.Remove();
 }