示例#1
0
            public Stitcher Into(Action <DestinationConfig> configuratorCallback)
            {
                var config = new DestinationConfig();

                configuratorCallback(config);
                _stitcher.UsingDestinationConfig(config);
                return(_stitcher);
            }
示例#2
0
        private Stitcher UsingConfig(StitchConfig config)
        {
            if (config.Into == null)
            {
                throw new Exception("Compiler config is required");
            }

            if (string.IsNullOrWhiteSpace(config.Into.Directory))
            {
                throw new Exception("DestinationDirectory is required");
            }

            if (config.From == null)
            {
                throw new Exception("Packager config is required");
            }

            if (string.IsNullOrWhiteSpace(config.From.RootPath))
            {
                throw new Exception("RootPath is required");
            }

            if (((config.From.EntryPoints?.Length ?? 0) == 0) && (config.From.CopyFiles?.Length ?? 0) == 0)
            {
                throw new Exception("EntryPoints or CopyFiles is required");
            }

            _sourceConfig      = config.From;
            _destinationConfig = config.Into;

            if (config.Extendibility != null)
            {
                if (config.Extendibility.DI != null)
                {
                    foreach (var diEntry in config.Extendibility.DI)
                    {
                        Type registerType       = Type.GetType(diEntry.Key, true);
                        Type implementationType = Type.GetType(diEntry.Value, true);
                        _container.Register(registerType, implementationType);
                    }
                }
                if (config.Extendibility.Transformers?.Count > 0)
                {
                    _useDefaultTransformers = false;
                    _transformerTypes.Clear();
                    foreach (var moduleTransformerTypeName in config.Extendibility.Transformers)
                    {
                        Type moduleTransformerType = Type.GetType(moduleTransformerTypeName, true);
                        _transformerTypes.Add(moduleTransformerType);
                    }
                }
            }

            return(this);
        }
示例#3
0
 private Stitcher UsingDestinationConfig(DestinationConfig destinationConfig)
 {
     _destinationConfig = destinationConfig;
     return(this);
 }