/**
         * Makes a list of {@link BuildAndCacheApplicationLayerStep} for dependencies, resources, and
         * classes layers. Optionally adds an extra layer if configured to do so.
         */
        public static IAsyncStep <IReadOnlyList <ICachedLayer> > MakeList(
            IBuildConfiguration buildConfiguration,
            ProgressEventDispatcher.Factory progressEventDispatcherFactory)
        {
            buildConfiguration = buildConfiguration ?? throw new ArgumentNullException(nameof(buildConfiguration));
            int layerCount = buildConfiguration.GetLayerConfigurations().Length;

            using (ProgressEventDispatcher progressEventDispatcher =
                       progressEventDispatcherFactory.Create(
                           "setting up to build application layers", layerCount))
                using (TimerEventDispatcher ignored =
                           new TimerEventDispatcher(buildConfiguration.GetEventHandlers(), Description))

                {
                    List <Task <ICachedLayer> > buildAndCacheApplicationLayerSteps = new List <Task <ICachedLayer> >();
                    foreach (LayerConfiguration layerConfiguration in buildConfiguration.GetLayerConfigurations())
                    {
                        // Skips the layer if empty.
                        if (layerConfiguration.LayerEntries.Length == 0)
                        {
                            continue;
                        }

                        buildAndCacheApplicationLayerSteps.Add(
                            new BuildAndCacheApplicationLayerStep(
                                buildConfiguration,
                                progressEventDispatcher.NewChildProducer(),
                                layerConfiguration.Name,
                                layerConfiguration).GetFuture());
                    }
                    return(AsyncSteps.FromTasks(buildAndCacheApplicationLayerSteps));
                }
        }