/// <summary> /// <see cref="AddRushProject(SpecEvaluationBuilder, string, string, string, string[], (string, string)[])"/> /// </summary> public static SpecEvaluationBuilder AddRushProject( this SpecEvaluationBuilder builder, string packageName, string packageFolder, string content = null, string[] dependencies = null, (string, string)[] scriptCommands = null)
internal static SpecEvaluationBuilder AddTestFiles(this SpecEvaluationBuilder builder) { return(builder .AddFile(@"src\a.txt", "a") .AddFile(@"src\b.txt", "a") .AddFile(@"src\a.cs", "a") .AddFile(@"src\b.cs", "a") .AddFile(@"src\other", "a") .AddFile(@"src\f1\a.txt", "a") .AddFile(@"src\f1\b.txt", "a") .AddFile(@"src\f1\a.cs", "a") .AddFile(@"src\f1\b.cs", "a") .AddFile(@"src\f1\other", "a") .AddFile(@"src\f2\a.txt", "a") .AddFile(@"src\f2\b.txt", "a") .AddFile(@"src\f2\a.cs", "a") .AddFile(@"src\f2\b.cs", "a") .AddFile(@"src\f3\other", "a") .AddFile(@"src\f4\f5\a.txt", "a") .AddFile(@"src\f4\f5\b.txt", "a") .AddFile(@"src\f4\f5\a.cs", "a") .AddFile(@"src\f4\f5\b.cs", "a") .AddFile(@"src\f4\f5\other", "a") .AddFile(@"src\f4\f6\other", "a") .AddFile(@"src\f4\other", "a") .AddFile(@"src\x.cs\other\f7\a.cs", "a")); }
private ICommandLineConfiguration WriteSpecs(string testRoot, BuildDefinition contents) { SpecEvaluationBuilder specBuilder = contents .Specs .Aggregate( seed: Build().TestRootDirectory(testRoot), func: (acc, specTuple) => acc.AddSpec(specTuple.SpecPath, specTuple.SpecContent)); var config = (CommandLineConfiguration)specBuilder.PersistSpecsAndGetConfiguration(); config.Cache.AllowFetchingCachedGraphFromContentCache = false; return(config); }
private ICommandLineConfiguration WriteSpecs(string testRoot, BuildDefinition contents) { SpecEvaluationBuilder specBuilder = contents .Specs .Aggregate( seed: Build().TestRootDirectory(testRoot), func: (acc, specTuple) => acc.AddSpec(specTuple.SpecPath, specTuple.SpecContent)); var config = (CommandLineConfiguration)specBuilder.PersistSpecsAndGetConfiguration(); config.Cache.AllowFetchingCachedGraphFromContentCache = false; // Make sure to use a different output directory for each test case config.Layout.OutputDirectory = global::BuildXL.Utilities.AbsolutePath.Create(PathTable, Path.Combine(testRoot, "out")); return(config); }
/// <summary> /// Adds modules to the spec builder based on a string-based dependency chain. E.g. "A -> B -> C -> D". No actual projects are added to /// the modules /// </summary> internal static SpecEvaluationBuilder AddModuleDependency(this SpecEvaluationBuilder builder, params string[] dependencyChains) { var moduleChains = dependencyChains.Select( dependencyChain => dependencyChain.Split(new[] { "->" }, StringSplitOptions.RemoveEmptyEntries).Select(name => name.Trim()).ToArray()); // Collect all direct dependencies for each module var dependencies = new MultiValueDictionary <string, string>(); foreach (var modules in moduleChains) { // We expect at least one dependency pair Contract.Assert(modules.Length >= 2); for (var i = 0; i < modules.Length - 1; i++) { dependencies.Add(modules[i], modules[i + 1]); } // We add the last module with no dependencies so the set of modules is complete dependencies.Add(modules[modules.Length - 1]); } // Add one module per module name, with the corresponding allowed dependencies foreach (var moduleWithDependencies in dependencies) { var moduleName = moduleWithDependencies.Key; builder.AddFile( I($"{moduleName}/package.config.dsc"), DsTest.CreatePackageConfig(moduleName, useImplicitReferenceSemantics: true, allowedDependencies: moduleWithDependencies.Value.ToList())); } // We always want to evaluate everything builder.RootSpec(Names.ConfigBc); return(builder); }
public static SpecEvaluationBuilder AddSpecIf(this SpecEvaluationBuilder builder, bool condition, string specName, string specContent) { return(condition ? builder.AddSpec(specName, specContent) : builder); }