/// <summary> /// Create new mutable instance from template /// </summary> /// <remarks> /// This is the only class with CommandLineConfiguration as the configuration entrypoint where the pathRemapper is an argument with default value. /// If the argument was optional everywhere as well there would be no compiler helping us if someone forgot to pass it along. /// This is the main entrypoint so we allow a default value here for convenience /// </remarks> public ConfigurationImpl(IConfiguration template, PathRemapper pathRemapper = null) : base(template, pathRemapper = pathRemapper ?? new PathRemapper()) { Contract.Assume(template != null); Qualifiers = new QualifierConfiguration(template.Qualifiers); Resolvers = new List <IResolverSettings>(template.Resolvers.Select(resolver => ResolverSettings.CreateFromTemplate(resolver, pathRemapper))); AllowedEnvironmentVariables = new List <string>(template.AllowedEnvironmentVariables); Layout = new LayoutConfiguration(template.Layout, pathRemapper); Engine = new EngineConfiguration(template.Engine, pathRemapper); Schedule = new ScheduleConfiguration(template.Schedule, pathRemapper); Sandbox = new SandboxConfiguration(template.Sandbox, pathRemapper); Cache = new CacheConfiguration(template.Cache, pathRemapper); Logging = new LoggingConfiguration(template.Logging, pathRemapper); Export = new ExportConfiguration(template.Export, pathRemapper); Experiment = new ExperimentalConfiguration(template.Experiment); Distribution = new DistributionConfiguration(template.Distribution); Viewer = template.Viewer; Projects = template.Projects?.Select(p => pathRemapper.Remap(p)).ToList(); Packages = template.Packages?.Select(p => pathRemapper.Remap(p)).ToList(); Modules = template.Modules?.Select(m => pathRemapper.Remap(m)).ToList(); DisableDefaultSourceResolver = template.DisableDefaultSourceResolver; FrontEnd = new FrontEndConfiguration(template.FrontEnd, pathRemapper); CommandLineEnabledUnsafeOptions = new List <string>(template.CommandLineEnabledUnsafeOptions); Ide = new IdeConfiguration(template.Ide, pathRemapper); InCloudBuild = template.InCloudBuild; ResolverDefaults = new ResolverDefaults(template.ResolverDefaults); }
/// <nodoc /> public ConfigurationImpl() { Qualifiers = new QualifierConfiguration(); Resolvers = new List <IResolverSettings>(); AllowedEnvironmentVariables = new List <string>(); Layout = new LayoutConfiguration(); Engine = new EngineConfiguration(); Schedule = new ScheduleConfiguration(); Sandbox = new SandboxConfiguration(); Cache = new CacheConfiguration(); Logging = new LoggingConfiguration(); Export = new ExportConfiguration(); Experiment = new ExperimentalConfiguration(); Distribution = new DistributionConfiguration(); Viewer = ViewerMode.Hide; Projects = null; // Deliberate null, here as magic indication that none has been defined. All consumers are aware and deal with it. Packages = null; // Deliberate null, here as magic indication that none has been defined. All consumers are aware and deal with it. Modules = null; // Deliberate null, here as magic indication that none has been defined. All consumers are aware and deal with it. FrontEnd = new FrontEndConfiguration(); CommandLineEnabledUnsafeOptions = new List <string>(); Ide = new IdeConfiguration(); ResolverDefaults = new ResolverDefaults(); }