Beispiel #1
0
 public void Apply()
 {
     foreach (ModuleLink moduleLink in modules)
     {
         ModuleInstaller.Install(moduleLink);
     }
     AssetsUtil.TriggerPostprocessEvent();
 }
        private void ResolveDependency(PluginDependencyType type, string id)
        {
            switch (type)
            {
            case PluginDependencyType.Plugin:
                Install(AssetDatabase.LoadAssetAtPath <PluginInfo>(id));
                break;

            case PluginDependencyType.DefineSymbol:
                DefineSymbols.Add(id, "");
                break;

            case PluginDependencyType.Package:
                string[] package = id.Split(':');
                Util.AddDependencyToPackageManifest(package[0], package[1]);
                break;

            case PluginDependencyType.Module:
                ModuleInstaller.Install(AssetDatabase.LoadAssetAtPath <ModuleInstallInfo>(id).GenerateLink());
                break;
            }
            EditorApplication.delayCall += Refresh;
        }
        public bool IsInstallationValid(out ErrorSummary errors)
        {
            if (errorSummary != null)
            {
                errors = errorSummary;
                return(errors.IsEmpty());
            }

            errors       = new ErrorSummary();
            errorSummary = errors;

            PluginData data = PluginsManifest.Instance.GetPluginData(this);

            if (data.installed == false)
            {
                return(false);
            }

            foreach (var symbol in GetSymbols())
            {
                if (DefineSymbols.Instance.IsEnabled(symbol.symbolName) == false)
                {
                    errors.RegisterInvalidItem($"{symbol.symbolName}", PluginDependencyType.DefineSymbol);
                }
            }

            foreach (ModuleInstallInfo moduleInfo in GetModules())
            {
                if (ModuleInstaller.IsModuleInstallationValid(moduleInfo) == false)
                {
                    errors.RegisterInvalidItem($"{AssetDatabase.GetAssetPath(moduleInfo)}", PluginDependencyType.Module);
                }
            }

            foreach (PackageDependency packageDependency in GetPackages())
            {
                if (Util.HasPackageDependency(packageDependency.packageName, packageDependency.version) == false)
                {
                    errors.RegisterInvalidItem($"{packageDependency.FullName}", PluginDependencyType.Package);
                }
            }

            foreach (PluginInfo dependency in GetDependencies())
            {
                if (dependency == this)
                {
                    Debug.LogWarning($"Circular dependency: {description} depends on itself!");
                    continue;
                }
                if (dependency == null)
                {
                    Debug.LogWarning($"Empty dependency detected on {description}!");
                    continue;
                }
                if (dependency.IsInstallationValid(out var depErrors) == false)
                {
                    errors.RegisterInvalidItem($"{AssetDatabase.GetAssetPath(dependency)}", PluginDependencyType.Plugin);
                }
            }

            return(errors.IsEmpty());
        }
 private static void InstallModule(ModuleInstallInfo moduleInstallInfo)
 {
     ModuleInstaller.Install(moduleInstallInfo.GenerateLink());
 }