Пример #1
0
        private async void ButtonOk(object sender, RoutedEventArgs e)
        {
            if (!SelectedPlatforms.Any())
            {
                await services.Get <IDialogService>().MessageBox(Tr._p("Message", "You must select at least one platform."), MessageBoxButton.OK, MessageBoxImage.Information);

                return;
            }

            if (AvailablePlatforms.Any(x => x.MarkedToRemove))
            {
                var buttons = DialogHelper.CreateButtons(new[]
                {
                    Tr._p("Button", "Remove"),
                    Tr._p("Button", "Cancel")
                }, 1, 2);
                var msg    = string.Format(Tr._p("Message", "Are you sure you want to remove these {0} platform(s) from the package?"), AvailablePlatforms.Count(x => x.MarkedToRemove));
                var result = await services.Get <IDialogService>().MessageBox(msg, buttons, MessageBoxImage.Question);

                if (result != 1)
                {
                    return;
                }

                Result = Stride.Core.Presentation.Services.DialogResult.Ok;
                Close();
                return;
            }

            Result = Stride.Core.Presentation.Services.DialogResult.Ok;
            Close();
        }
Пример #2
0
        // Initialize application library
        public AssetProcessorLibGCC()
        {
            AvailablePlatforms.Add(BuildPlatform.LINUX);
            AvailablePlatforms.Add(BuildPlatform.ANDROID);
            AvailablePlatforms.Add(BuildPlatform.IOS);

            stm_OptionMap.Add("libpath", "-L=");
            stm_OptionMap.Add("lib", "-l");
        }
        /// <summary>
        /// Exports the project info into a solution file, and the CSProject files.
        /// </summary>
        /// <param name="solutionTemplateText">The solution file template text.</param>
        /// <param name="projectFileTemplateText">The project file template text.</param>
        /// <param name="generatedProjectPath">The output folder of the platform props.</param>
        public void ExportSolution(string solutionTemplateText, string projectFileTemplateText, string generatedProjectPath)
        {
            string solutionFilePath = Path.Combine(generatedProjectPath, $"{UnityProjectName}.sln");

            if (File.Exists(solutionFilePath))
            {
                File.Delete(solutionFilePath);
            }

            if (Utilities.TryGetTextTemplate(solutionTemplateText, "PROJECT", out string projectEntryTemplate, out string projectEntryTemplateBody) &&
                Utilities.TryGetTextTemplate(solutionTemplateText, "CONFIGURATION_PLATFORM", out string configurationPlatformEntry, out string configurationPlatformEntryBody) &&
                Utilities.TryGetTextTemplate(solutionTemplateText, "CONFIGURATION_PLATFORM_MAPPING", out string configurationPlatformMappingTemplate, out string configurationPlatformMappingTemplateBody) &&
                Utilities.TryGetTextTemplate(solutionTemplateText, "CONFIGURATION_PLATFORM_ENABLED", out string configurationPlatformEnabledTemplate, out string configurationPlatformEnabledTemplateBody))
            {
                CSProjectInfo[]      unorderedProjects = CSProjects.Select(t => t.Value).ToArray();
                List <CSProjectInfo> orderedProjects   = new List <CSProjectInfo>();

                while (orderedProjects.Count < unorderedProjects.Length)
                {
                    bool oneRemoved = false;
                    for (int i = 0; i < unorderedProjects.Length; i++)
                    {
                        if (unorderedProjects[i] == null)
                        {
                            continue;
                        }

                        if (unorderedProjects[i].ProjectDependencies.Count == 0 || unorderedProjects[i].ProjectDependencies.All(t => orderedProjects.Contains(t.Dependency)))
                        {
                            orderedProjects.Add(unorderedProjects[i]);

                            unorderedProjects[i] = null;
                            oneRemoved           = true;
                        }
                    }

                    if (!oneRemoved)
                    {
                        Debug.LogError($"Possible circular dependency.");
                        break;
                    }
                }

                IEnumerable <string> projectEntries = orderedProjects.Select(t => GetProjectEntry(t, projectEntryTemplateBody));

                string[] twoConfigs = new string[] {
                    configurationPlatformEntryBody.Replace("<Configuration>", "InEditor"),
                    configurationPlatformEntryBody.Replace("<Configuration>", "Player")
                };

                IEnumerable <string> configPlatforms = twoConfigs
                                                       .SelectMany(t => AvailablePlatforms.Select(p => t.Replace("<Platform>", p.Name.ToString())));

                List <string> configurationMappings = new List <string>();
                List <string> disabled = new List <string>();

                foreach (CSProjectInfo project in orderedProjects.Select(t => t))
                {
                    string ConfigurationTemplateReplace(string template, string guid, string configuration, string platform)
                    {
                        return(Utilities.ReplaceTokens(template, new Dictionary <string, string>()
                        {
                            { "<PROJECT_GUID_TOKEN>", guid.ToString().ToUpper() },
                            { "<PROJECT_CONFIGURATION_TOKEN>", configuration },
                            { "<PROJECT_PLATFORM_TOKEN>", platform },
                            { "<SOLUTION_CONFIGURATION_TOKEN>", configuration },
                            { "<SOLUTION_PLATFORM_TOKEN>", platform },
                        }));
                    }

                    void ProcessMappings(Guid guid, string configuration, IReadOnlyDictionary <BuildTarget, CompilationPlatformInfo> platforms)
                    {
                        foreach (CompilationPlatformInfo platform in AvailablePlatforms)
                        {
                            configurationMappings.Add(ConfigurationTemplateReplace(configurationPlatformMappingTemplateBody, guid.ToString(), configuration, platform.Name));

                            if (platforms.ContainsKey(platform.BuildTarget))
                            {
                                configurationMappings.Add(ConfigurationTemplateReplace(configurationPlatformEnabledTemplateBody, guid.ToString(), configuration, platform.Name));
                            }
                        }
                    }

                    ProcessMappings(project.Guid, "InEditor", project.InEditorPlatforms);
                    ProcessMappings(project.Guid, "Player", project.PlayerPlatforms);
                }

                solutionTemplateText = Utilities.ReplaceTokens(solutionTemplateText, new Dictionary <string, string>()
                {
                    { projectEntryTemplate, string.Join(Environment.NewLine, projectEntries) },
                    { configurationPlatformEntry, string.Join(Environment.NewLine, configPlatforms) },
                    { configurationPlatformMappingTemplate, string.Join(Environment.NewLine, configurationMappings) },
                    { configurationPlatformEnabledTemplate, string.Join(Environment.NewLine, disabled) }
                });
            }
Пример #4
0
 // Initialize application library
 public AssetProcessorLibVC()
 {
     AvailablePlatforms.Add(BuildPlatform.WIN64);
 }
Пример #5
0
 // Initialize application library
 public AssetProcessorExeWin()
 {
     AvailablePlatforms.Add(BuildPlatform.WIN64);
 }
Пример #6
0
 // Initialize application library
 public AssetProcessorCPPGCC()
 {
     AvailablePlatforms.Add(BuildPlatform.LINUX);
     AvailablePlatforms.Add(BuildPlatform.ANDROID);
     AvailablePlatforms.Add(BuildPlatform.IOS);
 }