// Internal for testing internal void AddRecipePackageAndSetTheme() { if (Recipe == null && !string.IsNullOrEmpty(RecipeName)) { KnownRecipe knownRecipe; if (KnownRecipe.Values.TryGetValue(RecipeName, out knownRecipe)) { Trace.Verbose($"Recipe {RecipeName} was in the lookup of known recipes"); // Make sure we're not ignoring packages if (!IgnoreKnownRecipePackages) { // Add the package, but only if it wasn't added manually if (!string.IsNullOrEmpty(knownRecipe.PackageId) && !PackageInstaller.ContainsPackage(knownRecipe.PackageId)) { PackageInstaller.AddPackage(knownRecipe.PackageId); } } else { Trace.Verbose("Ignoring known recipe packages"); } // Set the theme if we don't already have one if (string.IsNullOrEmpty(Theme)) { Theme = knownRecipe.DefaultTheme; } } else { Trace.Verbose($"Recipe {RecipeName} is not in the lookup of known recipes"); } } }
// Internal for testing internal void AddThemePackagesAndPath() { string inputPath = Theme; if (!string.IsNullOrEmpty(Theme)) { KnownTheme knownTheme; if (KnownTheme.Values.TryGetValue(Theme, out knownTheme)) { Trace.Verbose($"Theme {Theme} was in the lookup of known themes"); inputPath = knownTheme.InputPath; // Do a sanity check against the recipe (but only if we didn't explicitly specify one) if (Recipe == null && !string.IsNullOrEmpty(RecipeName) && !string.IsNullOrEmpty(knownTheme.Recipe) && !string.Equals(RecipeName, knownTheme.Recipe, StringComparison.OrdinalIgnoreCase)) { Trace.Warning($"Theme {Theme} is designed for recipe {knownTheme.Recipe} but is being used with recipe {RecipeName}, results may be unexpected"); } // Make sure we're not ignoring theme packages if (!IgnoreKnownThemePackages) { // Add any packages needed for the theme if (knownTheme.PackageIds != null) { foreach (string themePackageId in knownTheme.PackageIds.Where(x => !PackageInstaller.ContainsPackage(x))) { PackageInstaller.AddPackage(themePackageId, allowPrereleaseVersions: true); } } } else { Trace.Verbose("Ignoring known theme packages"); } } else { Trace.Verbose($"Theme {Theme} is not in the lookup of known themes, assuming it's an input path"); } } // Insert the theme path if (!string.IsNullOrEmpty(inputPath)) { _engine.FileSystem.InputPaths.Insert(0, new DirectoryPath(inputPath)); } }