Пример #1
0
        void Publish()
        {
            if (PackagesToPublish != null)
            {
                // Make sure the version information is updated before publishing
                VersionMaintainer.UpdateVersionInformation(true);

                int packagesToPublish = 0;
                foreach (var packageView in PackagesToPublish)
                {
                    if (packageView.publish)
                    {
                        packagesToPublish++;
                    }
                }

                if (packagesToPublish == 0)
                {
                    EditorUtility.DisplayDialog("Error", "No packages to publish selected.", "OK");
                    return;
                }



                EditorUtility.DisplayProgressBar("Publishing package", "Publishing packages", 0f);

                string result         = "";
                int    currentPackage = 0;
                bool   failures       = false;
                try
                {
                    foreach (var packageView in PackagesToPublish)
                    {
                        if (packageView.publish)
                        {
                            EditorUtility.DisplayProgressBar("Publishing package", "Publishing packages " + packageView.package.displayName + " to " + packageView.registry, (float)currentPackage / (float)packagesToPublish);

                            if (string.IsNullOrEmpty(packageView.registry))
                            {
                                failures = true;
                                result  += "[Error] No registry set for " + packageView.package.displayName + Environment.NewLine;
                            }
                            else
                            {
                                try
                                {
                                    PublicationController.Publish(packageView.package, packageView.registry);
                                    result += "[Success] Publishing " + packageView.package.displayName + " succeeded." + Environment.NewLine;
                                }
                                catch (System.Exception e)
                                {
                                    failures = true;
                                    result  += "[Error] Publishing " + packageView.package.displayName + " failed with error:" + Environment.NewLine + "\t" + e.Message + Environment.NewLine;
                                }
                            }

                            currentPackage++;
                        }
                    }
                }
                finally
                {
                    EditorUtility.ClearProgressBar();
                }
                string message;
                if (failures)
                {
                    message = "Published with errors." + Environment.NewLine + result;
                }
                else
                {
                    message = "Published all packages. " + Environment.NewLine + result;
                }
                EditorUtility.DisplayDialog("Publishing finished", message, "OK");
            }
        }
Пример #2
0
 private void Pack(PackageManifest package)
 {
     PublicationController.Pack(package);
 }