static PublishProductionExtension()
        {
            if (!Unsupported.IsDeveloperMode())
            {
                return;
            }

            PackageManagerDevelopExtensions.RegisterPublishExtension(new PublishProductionExtension());
        }
Ejemplo n.º 2
0
        public void OnPackageSelectionChange(IPackageVersion packageVersion, VisualElement toolbar)
        {
            if (packageVersion == null || toolbar == null)
            {
                return;
            }

            PackageVersion = packageVersion;
            Toolbar        = toolbar;

            if (PrepareTools == null)
            {
                PrepareTools             = new PrepareTools(packageVersion, PackageTestRunner);
                PrepareTools.OnValidate += OnValidate;
            }
            if (PublishTools == null)
            {
                PublishTools = new PublishTools();
            }
            if (DevelopTools == null)
            {
                DevelopTools = new DevelopTools();
            }

            // Put the publish button right before the edit package manifest button, or at the end if it does not exists
            var rightItems          = toolbar.Q <VisualElement>(RightItemsName);
            var editPackageManifest = rightItems.Q <VisualElement>("editPackageManifest");
            var publishPosition     = editPackageManifest != null?rightItems.IndexOf(editPackageManifest) : rightItems.childCount;

            AddIfNotExists(toolbar.Q <VisualElement>(LeftItemsName), PrepareTools);
            AddIfNotExists(toolbar.Q <VisualElement>(LeftItemsName), DevelopTools);
            AddIfNotExists(rightItems, PublishTools, publishPosition);

            DevelopTools.SetPackage(packageVersion);
            PrepareTools.SetPackage(packageVersion);
            PublishTools.SetPackage(packageVersion);

            var publishTarget = PackageManagerState.Instance.ForPackage(PackageVersion)?.PublishTarget;
            var extension     = PackageManagerDevelopExtensions.GetPublishExtension(publishTarget);
        }
 static LocalPublishExtension()
 {
     PackageManagerDevelopExtensions.RegisterPublishExtension(new LocalPublishExtension());
 }